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