Debian Codegraph @

tools/testing/selftests/arm64/mte/Makefile

raw
1 # SPDX-License-Identifier: GPL-2.0
2 # Copyright (C) 2020 ARM Limited
3
4 CFLAGS += -std=gnu99 -I. -pthread
5 LDFLAGS += -pthread
6 SRCS := $(filter-out mte_common_util.c,$(wildcard *.c))
7 PROGS := $(patsubst %.c,%,$(SRCS))
8
9 ifeq ($(LLVM),)
10 # For GCC check that the toolchain has MTE support.
11
12 # preserve CC value from top level Makefile
13 ifeq ($(CC),cc)
14 CC := $(CROSS_COMPILE)gcc
15 endif
16
17 #check if the compiler works well
18 mte_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)
19
20 else
21
22 # All supported clang versions also support MTE.
23 mte_cc_support := 1
24
25 endif
26
27 ifeq ($(mte_cc_support),1)
28 # Generated binaries to be installed by top KSFT script
29 TEST_GEN_PROGS := $(PROGS)
30
31 else
32 $(warning compiler "$(CC)" does not support the ARMv8.5 MTE extension.)
33 $(warning test program "mte" will not be created.)
34 endif
35
36 # Include KSFT lib.mk.
37 include ../../lib.mk
38
39 ifeq ($(mte_cc_support),1)
40 $(TEST_GEN_PROGS): mte_common_util.c mte_helper.S
41 endif