1# SPDX-License-Identifier: GPL-2.0 2# Copyright (C) 2020 ARM Limited 3 4# preserve CC value from top level Makefile 5ifeq ($(CC),cc) 6CC := $(CROSS_COMPILE)gcc 7endif 8 9CFLAGS += -std=gnu99 -I. -pthread 10LDFLAGS += -pthread 11SRCS := $(filter-out mte_common_util.c,$(wildcard *.c)) 12PROGS := $(patsubst %.c,%,$(SRCS)) 13 14#check if the compiler works well 15mte_cc_support := $(shell if ($(CC) $(CFLAGS) -march=armv8.5-a+memtag -E -x c /dev/null -o /dev/null 2>&1) then echo "1"; fi) 16 17ifeq ($(mte_cc_support),1) 18# Generated binaries to be installed by top KSFT script 19TEST_GEN_PROGS := $(PROGS) 20 21# Get Kernel headers installed and use them. 22else 23 $(warning compiler "$(CC)" does not support the ARMv8.5 MTE extension.) 24 $(warning test program "mte" will not be created.) 25endif 26 27# Include KSFT lib.mk. 28include ../../lib.mk 29 30ifeq ($(mte_cc_support),1) 31$(TEST_GEN_PROGS): mte_common_util.c mte_helper.S 32endif 33