1# SPDX-License-Identifier: GPL-2.0
2include ../../../../scripts/Kbuild.include
3include ../../../scripts/Makefile.arch
4
5CXX ?= $(CROSS_COMPILE)g++
6
7CURDIR := $(abspath .)
8TOOLSDIR := $(abspath ../../..)
9LIBDIR := $(TOOLSDIR)/lib
10BPFDIR := $(LIBDIR)/bpf
11TOOLSINCDIR := $(TOOLSDIR)/include
12BPFTOOLDIR := $(TOOLSDIR)/bpf/bpftool
13APIDIR := $(TOOLSINCDIR)/uapi
14GENDIR := $(abspath ../../../../include/generated)
15GENHDR := $(GENDIR)/autoconf.h
16
17ifneq ($(wildcard $(GENHDR)),)
18  GENFLAGS := -DHAVE_GENHDR
19endif
20
21CLANG		?= clang
22LLC		?= llc
23LLVM_OBJCOPY	?= llvm-objcopy
24BPF_GCC		?= $(shell command -v bpf-gcc;)
25SAN_CFLAGS	?=
26CFLAGS += -g -rdynamic -Wall -O2 $(GENFLAGS) $(SAN_CFLAGS)		\
27	  -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)		\
28	  -I$(TOOLSINCDIR) -I$(APIDIR)					\
29	  -Dbpf_prog_load=bpf_prog_test_load				\
30	  -Dbpf_load_program=bpf_test_load_program
31LDLIBS += -lcap -lelf -lz -lrt -lpthread
32
33# Order correspond to 'make run_tests' order
34TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \
35	test_align test_verifier_log test_dev_cgroup test_tcpbpf_user \
36	test_sock test_btf test_sockmap get_cgroup_id_user test_socket_cookie \
37	test_cgroup_storage \
38	test_netcnt test_tcpnotify_user test_sock_fields test_sysctl \
39	test_progs-no_alu32 \
40	test_current_pid_tgid_new_ns
41
42# Also test bpf-gcc, if present
43ifneq ($(BPF_GCC),)
44TEST_GEN_PROGS += test_progs-bpf_gcc
45endif
46
47TEST_GEN_FILES =
48TEST_FILES = test_lwt_ip_encap.o \
49	test_tc_edt.o
50
51# Order correspond to 'make run_tests' order
52TEST_PROGS := test_kmod.sh \
53	test_xdp_redirect.sh \
54	test_xdp_meta.sh \
55	test_xdp_veth.sh \
56	test_offload.py \
57	test_sock_addr.sh \
58	test_tunnel.sh \
59	test_lwt_seg6local.sh \
60	test_lirc_mode2.sh \
61	test_skb_cgroup_id.sh \
62	test_flow_dissector.sh \
63	test_xdp_vlan_mode_generic.sh \
64	test_xdp_vlan_mode_native.sh \
65	test_lwt_ip_encap.sh \
66	test_tcp_check_syncookie.sh \
67	test_tc_tunnel.sh \
68	test_tc_edt.sh \
69	test_xdping.sh \
70	test_bpftool_build.sh \
71	test_bpftool.sh
72
73TEST_PROGS_EXTENDED := with_addr.sh \
74	with_tunnels.sh \
75	tcp_client.py \
76	tcp_server.py \
77	test_xdp_vlan.sh
78
79# Compile but not part of 'make run_tests'
80TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \
81	flow_dissector_load test_flow_dissector test_tcp_check_syncookie_user \
82	test_lirc_mode2_user xdping test_cpp runqslower bench
83
84TEST_CUSTOM_PROGS = urandom_read
85
86# Emit succinct information message describing current building step
87# $1 - generic step name (e.g., CC, LINK, etc);
88# $2 - optional "flavor" specifier; if provided, will be emitted as [flavor];
89# $3 - target (assumed to be file); only file name will be emitted;
90# $4 - optional extra arg, emitted as-is, if provided.
91ifeq ($(V),1)
92Q =
93msg =
94else
95Q = @
96msg = @printf '  %-8s%s %s%s\n' "$(1)" "$(if $(2), [$(2)])" "$(notdir $(3))" "$(if $(4), $(4))";
97MAKEFLAGS += --no-print-directory
98submake_extras := feature_display=0
99endif
100
101# override lib.mk's default rules
102OVERRIDE_TARGETS := 1
103override define CLEAN
104	$(call msg,CLEAN)
105	$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
106endef
107
108include ../lib.mk
109
110SCRATCH_DIR := $(OUTPUT)/tools
111BUILD_DIR := $(SCRATCH_DIR)/build
112INCLUDE_DIR := $(SCRATCH_DIR)/include
113BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a
114
115# Define simple and short `make test_progs`, `make test_sysctl`, etc targets
116# to build individual tests.
117# NOTE: Semicolon at the end is critical to override lib.mk's default static
118# rule for binaries.
119$(notdir $(TEST_GEN_PROGS)						\
120	 $(TEST_PROGS)							\
121	 $(TEST_PROGS_EXTENDED)						\
122	 $(TEST_GEN_PROGS_EXTENDED)					\
123	 $(TEST_CUSTOM_PROGS)): %: $(OUTPUT)/% ;
124
125$(OUTPUT)/%:%.c
126	$(call msg,BINARY,,$@)
127	$(LINK.c) $^ $(LDLIBS) -o $@
128
129$(OUTPUT)/urandom_read: urandom_read.c
130	$(call msg,BINARY,,$@)
131	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) -Wl,--build-id
132
133$(OUTPUT)/test_stub.o: test_stub.c $(BPFOBJ)
134	$(call msg,CC,,$@)
135	$(CC) -c $(CFLAGS) -o $@ $<
136
137VMLINUX_BTF_PATHS := $(if $(O),$(O)/vmlinux)				\
138		     $(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux)	\
139		     ../../../../vmlinux				\
140		     /sys/kernel/btf/vmlinux				\
141		     /boot/vmlinux-$(shell uname -r)
142VMLINUX_BTF := $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS))))
143
144$(OUTPUT)/runqslower: $(BPFOBJ)
145	$(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower	\
146		    OUTPUT=$(SCRATCH_DIR)/ VMLINUX_BTF=$(VMLINUX_BTF)   \
147		    BPFOBJ=$(BPFOBJ) BPF_INCLUDE=$(INCLUDE_DIR) &&	\
148		    cp $(SCRATCH_DIR)/runqslower $@
149
150$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ)
151
152$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c
153$(OUTPUT)/test_skb_cgroup_id_user: cgroup_helpers.c
154$(OUTPUT)/test_sock: cgroup_helpers.c
155$(OUTPUT)/test_sock_addr: cgroup_helpers.c
156$(OUTPUT)/test_socket_cookie: cgroup_helpers.c
157$(OUTPUT)/test_sockmap: cgroup_helpers.c
158$(OUTPUT)/test_tcpbpf_user: cgroup_helpers.c
159$(OUTPUT)/test_tcpnotify_user: cgroup_helpers.c trace_helpers.c
160$(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c
161$(OUTPUT)/test_cgroup_storage: cgroup_helpers.c
162$(OUTPUT)/test_netcnt: cgroup_helpers.c
163$(OUTPUT)/test_sock_fields: cgroup_helpers.c
164$(OUTPUT)/test_sysctl: cgroup_helpers.c
165
166DEFAULT_BPFTOOL := $(SCRATCH_DIR)/sbin/bpftool
167BPFTOOL ?= $(DEFAULT_BPFTOOL)
168$(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile)    \
169		    $(BPFOBJ) | $(BUILD_DIR)/bpftool
170	$(Q)$(MAKE) $(submake_extras)  -C $(BPFTOOLDIR)			       \
171		    OUTPUT=$(BUILD_DIR)/bpftool/			       \
172		    prefix= DESTDIR=$(SCRATCH_DIR)/ install
173
174$(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile)		       \
175	   ../../../include/uapi/linux/bpf.h                                   \
176	   | $(INCLUDE_DIR) $(BUILD_DIR)/libbpf
177	$(Q)$(MAKE) $(submake_extras) -C $(BPFDIR) OUTPUT=$(BUILD_DIR)/libbpf/ \
178		    DESTDIR=$(SCRATCH_DIR) prefix= all install_headers
179
180$(BUILD_DIR)/libbpf $(BUILD_DIR)/bpftool $(INCLUDE_DIR):
181	$(call msg,MKDIR,,$@)
182	mkdir -p $@
183
184$(INCLUDE_DIR)/vmlinux.h: $(VMLINUX_BTF) | $(BPFTOOL) $(INCLUDE_DIR)
185	$(call msg,GEN,,$@)
186	$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@
187
188# Get Clang's default includes on this system, as opposed to those seen by
189# '-target bpf'. This fixes "missing" files on some architectures/distros,
190# such as asm/byteorder.h, asm/socket.h, asm/sockios.h, sys/cdefs.h etc.
191#
192# Use '-idirafter': Don't interfere with include mechanics except where the
193# build would have failed anyways.
194define get_sys_includes
195$(shell $(1) -v -E - </dev/null 2>&1 \
196	| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }')
197endef
198
199# Determine target endianness.
200IS_LITTLE_ENDIAN = $(shell $(CC) -dM -E - </dev/null | \
201			grep 'define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__')
202MENDIAN=$(if $(IS_LITTLE_ENDIAN),-mlittle-endian,-mbig-endian)
203
204CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG))
205BPF_CFLAGS = -g -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) 			\
206	     -I$(INCLUDE_DIR) -I$(CURDIR) -I$(APIDIR)			\
207	     -I$(abspath $(OUTPUT)/../usr/include)
208
209CLANG_CFLAGS = $(CLANG_SYS_INCLUDES) \
210	       -Wno-compare-distinct-pointer-types
211
212$(OUTPUT)/test_l4lb_noinline.o: BPF_CFLAGS += -fno-inline
213$(OUTPUT)/test_xdp_noinline.o: BPF_CFLAGS += -fno-inline
214
215$(OUTPUT)/flow_dissector_load.o: flow_dissector_load.h
216
217# Build BPF object using Clang
218# $1 - input .c file
219# $2 - output .o file
220# $3 - CFLAGS
221# $4 - LDFLAGS
222define CLANG_BPF_BUILD_RULE
223	$(call msg,CLNG-LLC,$(TRUNNER_BINARY),$2)
224	($(CLANG) $3 -O2 -target bpf -emit-llvm				\
225		-c $1 -o - || echo "BPF obj compilation failed") | 	\
226	$(LLC) -mattr=dwarfris -march=bpf -mcpu=v3 $4 -filetype=obj -o $2
227endef
228# Similar to CLANG_BPF_BUILD_RULE, but with disabled alu32
229define CLANG_NOALU32_BPF_BUILD_RULE
230	$(call msg,CLNG-LLC,$(TRUNNER_BINARY),$2)
231	($(CLANG) $3 -O2 -target bpf -emit-llvm				\
232		-c $1 -o - || echo "BPF obj compilation failed") | 	\
233	$(LLC) -march=bpf -mcpu=v2 $4 -filetype=obj -o $2
234endef
235# Similar to CLANG_BPF_BUILD_RULE, but using native Clang and bpf LLC
236define CLANG_NATIVE_BPF_BUILD_RULE
237	$(call msg,CLNG-BPF,$(TRUNNER_BINARY),$2)
238	($(CLANG) $3 -O2 -emit-llvm					\
239		-c $1 -o - || echo "BPF obj compilation failed") | 	\
240	$(LLC) -march=bpf -mcpu=v3 $4 -filetype=obj -o $2
241endef
242# Build BPF object using GCC
243define GCC_BPF_BUILD_RULE
244	$(call msg,GCC-BPF,$(TRUNNER_BINARY),$2)
245	$(BPF_GCC) $3 $4 -O2 -c $1 -o $2
246endef
247
248SKEL_BLACKLIST := btf__% test_pinning_invalid.c test_sk_assign.c
249
250# Set up extra TRUNNER_XXX "temporary" variables in the environment (relies on
251# $eval()) and pass control to DEFINE_TEST_RUNNER_RULES.
252# Parameters:
253# $1 - test runner base binary name (e.g., test_progs)
254# $2 - test runner extra "flavor" (e.g., no_alu32, gcc-bpf, etc)
255define DEFINE_TEST_RUNNER
256
257TRUNNER_OUTPUT := $(OUTPUT)$(if $2,/)$2
258TRUNNER_BINARY := $1$(if $2,-)$2
259TRUNNER_TEST_OBJS := $$(patsubst %.c,$$(TRUNNER_OUTPUT)/%.test.o,	\
260				 $$(notdir $$(wildcard $(TRUNNER_TESTS_DIR)/*.c)))
261TRUNNER_EXTRA_OBJS := $$(patsubst %.c,$$(TRUNNER_OUTPUT)/%.o,		\
262				 $$(filter %.c,$(TRUNNER_EXTRA_SOURCES)))
263TRUNNER_EXTRA_HDRS := $$(filter %.h,$(TRUNNER_EXTRA_SOURCES))
264TRUNNER_TESTS_HDR := $(TRUNNER_TESTS_DIR)/tests.h
265TRUNNER_BPF_SRCS := $$(notdir $$(wildcard $(TRUNNER_BPF_PROGS_DIR)/*.c))
266TRUNNER_BPF_OBJS := $$(patsubst %.c,$$(TRUNNER_OUTPUT)/%.o, $$(TRUNNER_BPF_SRCS))
267TRUNNER_BPF_SKELS := $$(patsubst %.c,$$(TRUNNER_OUTPUT)/%.skel.h,	\
268				 $$(filter-out $(SKEL_BLACKLIST),	\
269					       $$(TRUNNER_BPF_SRCS)))
270TEST_GEN_FILES += $$(TRUNNER_BPF_OBJS)
271
272# Evaluate rules now with extra TRUNNER_XXX variables above already defined
273$$(eval $$(call DEFINE_TEST_RUNNER_RULES,$1,$2))
274
275endef
276
277# Using TRUNNER_XXX variables, provided by callers of DEFINE_TEST_RUNNER and
278# set up by DEFINE_TEST_RUNNER itself, create test runner build rules with:
279# $1 - test runner base binary name (e.g., test_progs)
280# $2 - test runner extra "flavor" (e.g., no_alu32, gcc-bpf, etc)
281define DEFINE_TEST_RUNNER_RULES
282
283ifeq ($($(TRUNNER_OUTPUT)-dir),)
284$(TRUNNER_OUTPUT)-dir := y
285$(TRUNNER_OUTPUT):
286	$$(call msg,MKDIR,,$$@)
287	mkdir -p $$@
288endif
289
290# ensure we set up BPF objects generation rule just once for a given
291# input/output directory combination
292ifeq ($($(TRUNNER_BPF_PROGS_DIR)$(if $2,-)$2-bpfobjs),)
293$(TRUNNER_BPF_PROGS_DIR)$(if $2,-)$2-bpfobjs := y
294$(TRUNNER_BPF_OBJS): $(TRUNNER_OUTPUT)/%.o:				\
295		     $(TRUNNER_BPF_PROGS_DIR)/%.c			\
296		     $(TRUNNER_BPF_PROGS_DIR)/*.h			\
297		     $$(INCLUDE_DIR)/vmlinux.h				\
298		     $$(BPFOBJ) | $(TRUNNER_OUTPUT)
299	$$(call $(TRUNNER_BPF_BUILD_RULE),$$<,$$@,			\
300					  $(TRUNNER_BPF_CFLAGS),	\
301					  $(TRUNNER_BPF_LDFLAGS))
302
303$(TRUNNER_BPF_SKELS): $(TRUNNER_OUTPUT)/%.skel.h:			\
304		      $(TRUNNER_OUTPUT)/%.o				\
305		      | $(BPFTOOL) $(TRUNNER_OUTPUT)
306	$$(call msg,GEN-SKEL,$(TRUNNER_BINARY),$$@)
307	$$(BPFTOOL) gen skeleton $$< > $$@
308endif
309
310# ensure we set up tests.h header generation rule just once
311ifeq ($($(TRUNNER_TESTS_DIR)-tests-hdr),)
312$(TRUNNER_TESTS_DIR)-tests-hdr := y
313$(TRUNNER_TESTS_HDR): $(TRUNNER_TESTS_DIR)/*.c
314	$$(call msg,TEST-HDR,$(TRUNNER_BINARY),$$@)
315	$$(shell ( cd $(TRUNNER_TESTS_DIR);				\
316		  echo '/* Generated header, do not edit */';		\
317		  ls *.c 2> /dev/null |					\
318			sed -e 's@\([^\.]*\)\.c@DEFINE_TEST(\1)@';	\
319		 ) > $$@)
320endif
321
322# compile individual test files
323# Note: we cd into output directory to ensure embedded BPF object is found
324$(TRUNNER_TEST_OBJS): $(TRUNNER_OUTPUT)/%.test.o:			\
325		      $(TRUNNER_TESTS_DIR)/%.c				\
326		      $(TRUNNER_EXTRA_HDRS)				\
327		      $(TRUNNER_BPF_OBJS)				\
328		      $(TRUNNER_BPF_SKELS)				\
329		      $$(BPFOBJ) | $(TRUNNER_OUTPUT)
330	$$(call msg,TEST-OBJ,$(TRUNNER_BINARY),$$@)
331	cd $$(@D) && $$(CC) -I. $$(CFLAGS) -c $(CURDIR)/$$< $$(LDLIBS) -o $$(@F)
332
333$(TRUNNER_EXTRA_OBJS): $(TRUNNER_OUTPUT)/%.o:				\
334		       %.c						\
335		       $(TRUNNER_EXTRA_HDRS)				\
336		       $(TRUNNER_TESTS_HDR)				\
337		       $$(BPFOBJ) | $(TRUNNER_OUTPUT)
338	$$(call msg,EXT-OBJ,$(TRUNNER_BINARY),$$@)
339	$$(CC) $$(CFLAGS) -c $$< $$(LDLIBS) -o $$@
340
341# only copy extra resources if in flavored build
342$(TRUNNER_BINARY)-extras: $(TRUNNER_EXTRA_FILES) | $(TRUNNER_OUTPUT)
343ifneq ($2,)
344	$$(call msg,EXT-COPY,$(TRUNNER_BINARY),$(TRUNNER_EXTRA_FILES))
345	cp -a $$^ $(TRUNNER_OUTPUT)/
346endif
347
348$(OUTPUT)/$(TRUNNER_BINARY): $(TRUNNER_TEST_OBJS)			\
349			     $(TRUNNER_EXTRA_OBJS) $$(BPFOBJ)		\
350			     | $(TRUNNER_BINARY)-extras
351	$$(call msg,BINARY,,$$@)
352	$$(CC) $$(CFLAGS) $$(filter %.a %.o,$$^) $$(LDLIBS) -o $$@
353
354endef
355
356# Define test_progs test runner.
357TRUNNER_TESTS_DIR := prog_tests
358TRUNNER_BPF_PROGS_DIR := progs
359TRUNNER_EXTRA_SOURCES := test_progs.c cgroup_helpers.c trace_helpers.c	\
360			 network_helpers.c testing_helpers.c		\
361			 flow_dissector_load.h
362TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read				\
363		       $(wildcard progs/btf_dump_test_case_*.c)
364TRUNNER_BPF_BUILD_RULE := CLANG_BPF_BUILD_RULE
365TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(CLANG_CFLAGS)
366TRUNNER_BPF_LDFLAGS := -mattr=+alu32
367$(eval $(call DEFINE_TEST_RUNNER,test_progs))
368
369# Define test_progs-no_alu32 test runner.
370TRUNNER_BPF_BUILD_RULE := CLANG_NOALU32_BPF_BUILD_RULE
371TRUNNER_BPF_LDFLAGS :=
372$(eval $(call DEFINE_TEST_RUNNER,test_progs,no_alu32))
373
374# Define test_progs BPF-GCC-flavored test runner.
375ifneq ($(BPF_GCC),)
376TRUNNER_BPF_BUILD_RULE := GCC_BPF_BUILD_RULE
377TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(call get_sys_includes,gcc)
378TRUNNER_BPF_LDFLAGS :=
379$(eval $(call DEFINE_TEST_RUNNER,test_progs,bpf_gcc))
380endif
381
382# Define test_maps test runner.
383TRUNNER_TESTS_DIR := map_tests
384TRUNNER_BPF_PROGS_DIR := progs
385TRUNNER_EXTRA_SOURCES := test_maps.c
386TRUNNER_EXTRA_FILES :=
387TRUNNER_BPF_BUILD_RULE := $$(error no BPF objects should be built)
388TRUNNER_BPF_CFLAGS :=
389TRUNNER_BPF_LDFLAGS :=
390$(eval $(call DEFINE_TEST_RUNNER,test_maps))
391
392# Define test_verifier test runner.
393# It is much simpler than test_maps/test_progs and sufficiently different from
394# them (e.g., test.h is using completely pattern), that it's worth just
395# explicitly defining all the rules explicitly.
396verifier/tests.h: verifier/*.c
397	$(shell ( cd verifier/; \
398		  echo '/* Generated header, do not edit */'; \
399		  echo '#ifdef FILL_ARRAY'; \
400		  ls *.c 2> /dev/null | sed -e 's@\(.*\)@#include \"\1\"@'; \
401		  echo '#endif' \
402		) > verifier/tests.h)
403$(OUTPUT)/test_verifier: test_verifier.c verifier/tests.h $(BPFOBJ) | $(OUTPUT)
404	$(call msg,BINARY,,$@)
405	$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@
406
407# Make sure we are able to include and link libbpf against c++.
408$(OUTPUT)/test_cpp: test_cpp.cpp $(OUTPUT)/test_core_extern.skel.h $(BPFOBJ)
409	$(call msg,CXX,,$@)
410	$(CXX) $(CFLAGS) $^ $(LDLIBS) -o $@
411
412# Benchmark runner
413$(OUTPUT)/bench_%.o: benchs/bench_%.c bench.h
414	$(call msg,CC,,$@)
415	$(CC) $(CFLAGS) -c $(filter %.c,$^) $(LDLIBS) -o $@
416$(OUTPUT)/bench_rename.o: $(OUTPUT)/test_overhead.skel.h
417$(OUTPUT)/bench_trigger.o: $(OUTPUT)/trigger_bench.skel.h
418$(OUTPUT)/bench_ringbufs.o: $(OUTPUT)/ringbuf_bench.skel.h \
419			    $(OUTPUT)/perfbuf_bench.skel.h
420$(OUTPUT)/bench.o: bench.h testing_helpers.h
421$(OUTPUT)/bench: LDLIBS += -lm
422$(OUTPUT)/bench: $(OUTPUT)/bench.o $(OUTPUT)/testing_helpers.o \
423		 $(OUTPUT)/bench_count.o \
424		 $(OUTPUT)/bench_rename.o \
425		 $(OUTPUT)/bench_trigger.o \
426		 $(OUTPUT)/bench_ringbufs.o
427	$(call msg,BINARY,,$@)
428	$(CC) $(LDFLAGS) -o $@ $(filter %.a %.o,$^) $(LDLIBS)
429
430EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR)			\
431	prog_tests/tests.h map_tests/tests.h verifier/tests.h		\
432	feature								\
433	$(addprefix $(OUTPUT)/,*.o *.skel.h no_alu32 bpf_gcc)
434