xref: /linux/tools/testing/selftests/arm64/mte/Makefile (revision 6dcb8bf9a1d7f6d137a17b76177cd67e9b8e023d)
1# SPDX-License-Identifier: GPL-2.0
2# Copyright (C) 2020 ARM Limited
3
4CFLAGS += -std=gnu99 -I. -lpthread
5SRCS := $(filter-out mte_common_util.c,$(wildcard *.c))
6PROGS := $(patsubst %.c,%,$(SRCS))
7
8#Add mte compiler option
9ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep gcc),)
10CFLAGS += -march=armv8.5-a+memtag
11endif
12
13#check if the compiler works well
14mte_cc_support := $(shell if ($(CC) $(CFLAGS) -E -x c /dev/null -o /dev/null 2>&1) then echo "1"; fi)
15
16ifeq ($(mte_cc_support),1)
17# Generated binaries to be installed by top KSFT script
18TEST_GEN_PROGS := $(PROGS)
19
20# Get Kernel headers installed and use them.
21KSFT_KHDR_INSTALL := 1
22endif
23
24# Include KSFT lib.mk.
25include ../../lib.mk
26
27ifeq ($(mte_cc_support),1)
28$(TEST_GEN_PROGS): mte_common_util.c mte_common_util.h mte_helper.S
29endif
30