• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# SPDX-License-Identifier: GPL-2.0
2
3APIDIR := ../../../../include/uapi
4TEST_GEN_FILES = action.o
5
6top_srcdir = ../../../../..
7KSFT_KHDR_INSTALL := 1
8include ../../lib.mk
9
10CLANG ?= clang
11LLC   ?= llc
12PROBE := $(shell $(LLC) -march=bpf -mcpu=probe -filetype=null /dev/null 2>&1)
13
14ifeq ($(PROBE),)
15  CPU ?= probe
16else
17  CPU ?= generic
18endif
19
20CLANG_SYS_INCLUDES := $(shell $(CLANG) -v -E - </dev/null 2>&1 \
21	| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }')
22
23CLANG_FLAGS = -I. -I$(APIDIR) \
24	      $(CLANG_SYS_INCLUDES) \
25	      -Wno-compare-distinct-pointer-types
26
27$(OUTPUT)/%.o: %.c
28	$(CLANG) $(CLANG_FLAGS) \
29		 -O2 -target bpf -emit-llvm -c $< -o - |      \
30	$(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
31