xref: /linux/tools/testing/selftests/arm64/mte/Makefile (revision 55c8a987dd73a7ef9e53119f3329620768d4a655)
1e9b60476SAmit Daniel Kachhap# SPDX-License-Identifier: GPL-2.0
2e9b60476SAmit Daniel Kachhap# Copyright (C) 2020 ARM Limited
3e9b60476SAmit Daniel Kachhap
45238c2cdSAndre Przywara# preserve CC value from top level Makefile
55238c2cdSAndre Przywaraifeq ($(CC),cc)
65238c2cdSAndre PrzywaraCC := $(CROSS_COMPILE)gcc
75238c2cdSAndre Przywaraendif
85238c2cdSAndre Przywara
9e5decefdSAndre PrzywaraCFLAGS += -std=gnu99 -I. -pthread
10e5decefdSAndre PrzywaraLDFLAGS += -pthread
11e9b60476SAmit Daniel KachhapSRCS := $(filter-out mte_common_util.c,$(wildcard *.c))
12e9b60476SAmit Daniel KachhapPROGS := $(patsubst %.c,%,$(SRCS))
13e9b60476SAmit Daniel Kachhap
14e9b60476SAmit Daniel Kachhap#check if the compiler works well
15*55c8a987SMark Brownmte_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)
16e9b60476SAmit Daniel Kachhap
17e9b60476SAmit Daniel Kachhapifeq ($(mte_cc_support),1)
18e9b60476SAmit Daniel Kachhap# Generated binaries to be installed by top KSFT script
19e9b60476SAmit Daniel KachhapTEST_GEN_PROGS := $(PROGS)
20e9b60476SAmit Daniel Kachhap
21e9b60476SAmit Daniel Kachhap# Get Kernel headers installed and use them.
228bbb58a3SAndre Przywaraelse
238bbb58a3SAndre Przywara    $(warning compiler "$(CC)" does not support the ARMv8.5 MTE extension.)
248bbb58a3SAndre Przywara    $(warning test program "mte" will not be created.)
25e9b60476SAmit Daniel Kachhapendif
26e9b60476SAmit Daniel Kachhap
27e9b60476SAmit Daniel Kachhap# Include KSFT lib.mk.
28e9b60476SAmit Daniel Kachhapinclude ../../lib.mk
29e9b60476SAmit Daniel Kachhap
30e9b60476SAmit Daniel Kachhapifeq ($(mte_cc_support),1)
319466ecacSAndre Przywara$(TEST_GEN_PROGS): mte_common_util.c mte_helper.S
32e9b60476SAmit Daniel Kachhapendif
33