Makefile (58c185b85d0c1753b0b6a9390294bd883faf4d77) Makefile (9f7fa225894c7fcb014f3699a402fcc4d896cb1c)
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 ../../..)

--- 66 unchanged lines hidden (view full) ---

75 with_tunnels.sh \
76 tcp_client.py \
77 tcp_server.py \
78 test_xdp_vlan.sh
79
80# Compile but not part of 'make run_tests'
81TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \
82 flow_dissector_load test_flow_dissector test_tcp_check_syncookie_user \
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 ../../..)

--- 66 unchanged lines hidden (view full) ---

75 with_tunnels.sh \
76 tcp_client.py \
77 tcp_server.py \
78 test_xdp_vlan.sh
79
80# Compile but not part of 'make run_tests'
81TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \
82 flow_dissector_load test_flow_dissector test_tcp_check_syncookie_user \
83 test_lirc_mode2_user xdping test_cpp runqslower bench
83 test_lirc_mode2_user xdping test_cpp runqslower bench bpf_testmod.ko
84
85TEST_CUSTOM_PROGS = urandom_read
86
87# Emit succinct information message describing current building step
88# $1 - generic step name (e.g., CC, LINK, etc);
89# $2 - optional "flavor" specifier; if provided, will be emitted as [flavor];
90# $3 - target (assumed to be file); only file name will be emitted;
91# $4 - optional extra arg, emitted as-is, if provided.

--- 7 unchanged lines hidden (view full) ---

99submake_extras := feature_display=0
100endif
101
102# override lib.mk's default rules
103OVERRIDE_TARGETS := 1
104override define CLEAN
105 $(call msg,CLEAN)
106 $(Q)$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
84
85TEST_CUSTOM_PROGS = urandom_read
86
87# Emit succinct information message describing current building step
88# $1 - generic step name (e.g., CC, LINK, etc);
89# $2 - optional "flavor" specifier; if provided, will be emitted as [flavor];
90# $3 - target (assumed to be file); only file name will be emitted;
91# $4 - optional extra arg, emitted as-is, if provided.

--- 7 unchanged lines hidden (view full) ---

99submake_extras := feature_display=0
100endif
101
102# override lib.mk's default rules
103OVERRIDE_TARGETS := 1
104override define CLEAN
105 $(call msg,CLEAN)
106 $(Q)$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
107 $(Q)$(MAKE) -C bpf_testmod clean
107endef
108
109include ../lib.mk
110
111SCRATCH_DIR := $(OUTPUT)/tools
112BUILD_DIR := $(SCRATCH_DIR)/build
113INCLUDE_DIR := $(SCRATCH_DIR)/include
114BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a

--- 16 unchanged lines hidden (view full) ---

131$(OUTPUT)/%:%.c
132 $(call msg,BINARY,,$@)
133 $(Q)$(LINK.c) $^ $(LDLIBS) -o $@
134
135$(OUTPUT)/urandom_read: urandom_read.c
136 $(call msg,BINARY,,$@)
137 $(Q)$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) -Wl,--build-id=sha1
138
108endef
109
110include ../lib.mk
111
112SCRATCH_DIR := $(OUTPUT)/tools
113BUILD_DIR := $(SCRATCH_DIR)/build
114INCLUDE_DIR := $(SCRATCH_DIR)/include
115BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a

--- 16 unchanged lines hidden (view full) ---

132$(OUTPUT)/%:%.c
133 $(call msg,BINARY,,$@)
134 $(Q)$(LINK.c) $^ $(LDLIBS) -o $@
135
136$(OUTPUT)/urandom_read: urandom_read.c
137 $(call msg,BINARY,,$@)
138 $(Q)$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) -Wl,--build-id=sha1
139
140$(OUTPUT)/bpf_testmod.ko: $(VMLINUX_BTF) $(wildcard bpf_testmod/Makefile bpf_testmod/*.[ch])
141 $(call msg,MOD,,$@)
142 $(Q)$(MAKE) $(submake_extras) -C bpf_testmod
143 $(Q)cp bpf_testmod/bpf_testmod.ko $@
144
139$(OUTPUT)/test_stub.o: test_stub.c $(BPFOBJ)
140 $(call msg,CC,,$@)
141 $(Q)$(CC) -c $(CFLAGS) -o $@ $<
142
143VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux) \
144 $(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux) \
145 ../../../../vmlinux \
146 /sys/kernel/btf/vmlinux \

--- 236 unchanged lines hidden (view full) ---

383endef
384
385# Define test_progs test runner.
386TRUNNER_TESTS_DIR := prog_tests
387TRUNNER_BPF_PROGS_DIR := progs
388TRUNNER_EXTRA_SOURCES := test_progs.c cgroup_helpers.c trace_helpers.c \
389 network_helpers.c testing_helpers.c \
390 btf_helpers.c flow_dissector_load.h
145$(OUTPUT)/test_stub.o: test_stub.c $(BPFOBJ)
146 $(call msg,CC,,$@)
147 $(Q)$(CC) -c $(CFLAGS) -o $@ $<
148
149VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux) \
150 $(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux) \
151 ../../../../vmlinux \
152 /sys/kernel/btf/vmlinux \

--- 236 unchanged lines hidden (view full) ---

389endef
390
391# Define test_progs test runner.
392TRUNNER_TESTS_DIR := prog_tests
393TRUNNER_BPF_PROGS_DIR := progs
394TRUNNER_EXTRA_SOURCES := test_progs.c cgroup_helpers.c trace_helpers.c \
395 network_helpers.c testing_helpers.c \
396 btf_helpers.c flow_dissector_load.h
391TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read \
397TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read $(OUTPUT)/bpf_testmod.ko \
392 ima_setup.sh \
393 $(wildcard progs/btf_dump_test_case_*.c)
394TRUNNER_BPF_BUILD_RULE := CLANG_BPF_BUILD_RULE
395TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(CLANG_CFLAGS)
396TRUNNER_BPF_LDFLAGS := -mattr=+alu32
397$(eval $(call DEFINE_TEST_RUNNER,test_progs))
398
399# Define test_progs-no_alu32 test runner.

--- 55 unchanged lines hidden (view full) ---

455 $(OUTPUT)/bench_trigger.o \
456 $(OUTPUT)/bench_ringbufs.o
457 $(call msg,BINARY,,$@)
458 $(Q)$(CC) $(LDFLAGS) -o $@ $(filter %.a %.o,$^) $(LDLIBS)
459
460EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) \
461 prog_tests/tests.h map_tests/tests.h verifier/tests.h \
462 feature \
398 ima_setup.sh \
399 $(wildcard progs/btf_dump_test_case_*.c)
400TRUNNER_BPF_BUILD_RULE := CLANG_BPF_BUILD_RULE
401TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(CLANG_CFLAGS)
402TRUNNER_BPF_LDFLAGS := -mattr=+alu32
403$(eval $(call DEFINE_TEST_RUNNER,test_progs))
404
405# Define test_progs-no_alu32 test runner.

--- 55 unchanged lines hidden (view full) ---

461 $(OUTPUT)/bench_trigger.o \
462 $(OUTPUT)/bench_ringbufs.o
463 $(call msg,BINARY,,$@)
464 $(Q)$(CC) $(LDFLAGS) -o $@ $(filter %.a %.o,$^) $(LDLIBS)
465
466EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) \
467 prog_tests/tests.h map_tests/tests.h verifier/tests.h \
468 feature \
463 $(addprefix $(OUTPUT)/,*.o *.skel.h no_alu32 bpf_gcc)
469 $(addprefix $(OUTPUT)/,*.o *.skel.h no_alu32 bpf_gcc bpf_testmod.ko)