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