1e9b60476SAmit Daniel Kachhap# SPDX-License-Identifier: GPL-2.0
2e9b60476SAmit Daniel Kachhap# Copyright (C) 2020 ARM Limited
3e9b60476SAmit Daniel Kachhap
4*5238c2cdSAndre Przywara# preserve CC value from top level Makefile
5*5238c2cdSAndre Przywaraifeq ($(CC),cc)
6*5238c2cdSAndre PrzywaraCC := $(CROSS_COMPILE)gcc
7*5238c2cdSAndre Przywaraendif
8*5238c2cdSAndre 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#Add mte compiler option
15e9b60476SAmit Daniel KachhapCFLAGS += -march=armv8.5-a+memtag
16e9b60476SAmit Daniel Kachhap
17e9b60476SAmit Daniel Kachhap#check if the compiler works well
18e9b60476SAmit Daniel Kachhapmte_cc_support := $(shell if ($(CC) $(CFLAGS) -E -x c /dev/null -o /dev/null 2>&1) then echo "1"; fi)
19e9b60476SAmit Daniel Kachhap
20e9b60476SAmit Daniel Kachhapifeq ($(mte_cc_support),1)
21e9b60476SAmit Daniel Kachhap# Generated binaries to be installed by top KSFT script
22e9b60476SAmit Daniel KachhapTEST_GEN_PROGS := $(PROGS)
23e9b60476SAmit Daniel Kachhap
24e9b60476SAmit Daniel Kachhap# Get Kernel headers installed and use them.
25e9b60476SAmit Daniel KachhapKSFT_KHDR_INSTALL := 1
26e9b60476SAmit Daniel Kachhapendif
27e9b60476SAmit Daniel Kachhap
28e9b60476SAmit Daniel Kachhap# Include KSFT lib.mk.
29e9b60476SAmit Daniel Kachhapinclude ../../lib.mk
30e9b60476SAmit Daniel Kachhap
31e9b60476SAmit Daniel Kachhapifeq ($(mte_cc_support),1)
32e9b60476SAmit Daniel Kachhap$(TEST_GEN_PROGS): mte_common_util.c mte_common_util.h mte_helper.S
33e9b60476SAmit Daniel Kachhapendif
34