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#Add mte compiler option 15CFLAGS += -march=armv8.5-a+memtag 16 17#check if the compiler works well 18mte_cc_support := $(shell if ($(CC) $(CFLAGS) -E -x c /dev/null -o /dev/null 2>&1) then echo "1"; fi) 19 20ifeq ($(mte_cc_support),1) 21# Generated binaries to be installed by top KSFT script 22TEST_GEN_PROGS := $(PROGS) 23 24# Get Kernel headers installed and use them. 25else 26 $(warning compiler "$(CC)" does not support the ARMv8.5 MTE extension.) 27 $(warning test program "mte" will not be created.) 28endif 29 30# Include KSFT lib.mk. 31include ../../lib.mk 32 33ifeq ($(mte_cc_support),1) 34$(TEST_GEN_PROGS): mte_common_util.c mte_helper.S 35endif 36