xref: /OK3568_Linux_fs/kernel/tools/testing/selftests/tc-testing/Makefile (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyuntop_srcdir = $(abspath ../../../..)
4*4882a593SmuzhiyunAPIDIR := $(top_scrdir)/include/uapi
5*4882a593SmuzhiyunTEST_GEN_FILES = action.o
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunKSFT_KHDR_INSTALL := 1
8*4882a593Smuzhiyuninclude ../lib.mk
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunCLANG ?= clang
11*4882a593SmuzhiyunLLC   ?= llc
12*4882a593SmuzhiyunPROBE := $(shell $(LLC) -march=bpf -mcpu=probe -filetype=null /dev/null 2>&1)
13*4882a593Smuzhiyun
14*4882a593Smuzhiyunifeq ($(PROBE),)
15*4882a593Smuzhiyun  CPU ?= probe
16*4882a593Smuzhiyunelse
17*4882a593Smuzhiyun  CPU ?= generic
18*4882a593Smuzhiyunendif
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunCLANG_SYS_INCLUDES := $(shell $(CLANG) -v -E - </dev/null 2>&1 \
21*4882a593Smuzhiyun	| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }')
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunCLANG_FLAGS = -I. -I$(APIDIR) \
24*4882a593Smuzhiyun	      $(CLANG_SYS_INCLUDES) \
25*4882a593Smuzhiyun	      -Wno-compare-distinct-pointer-types
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun$(OUTPUT)/%.o: %.c
28*4882a593Smuzhiyun	$(CLANG) $(CLANG_FLAGS) \
29*4882a593Smuzhiyun		 -O2 -target bpf -emit-llvm -c $< -o - |      \
30*4882a593Smuzhiyun	$(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunTEST_PROGS += ./tdc.sh
33*4882a593SmuzhiyunTEST_FILES := tdc*.py Tdc*.py plugins plugin-lib tc-tests
34