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