Makefile (2491b544ff3aa9717d427033206fa793be53429d) Makefile (ba0c0cc05dda2c56e23c88e4610ce2ac65ff86ec)
1# SPDX-License-Identifier: GPL-2.0
2
3LIBDIR := ../../../lib
4BPFDIR := $(LIBDIR)/bpf
5APIDIR := ../../../include/uapi
6GENDIR := ../../../../include/generated
7GENHDR := $(GENDIR)/autoconf.h
8
9ifneq ($(wildcard $(GENHDR)),)
10 GENFLAGS := -DHAVE_GENHDR
11endif
12
13CLANG ?= clang
14LLC ?= llc
15LLVM_OBJCOPY ?= llvm-objcopy
16LLVM_READELF ?= llvm-readelf
17BTF_PAHOLE ?= pahole
1# SPDX-License-Identifier: GPL-2.0
2
3LIBDIR := ../../../lib
4BPFDIR := $(LIBDIR)/bpf
5APIDIR := ../../../include/uapi
6GENDIR := ../../../../include/generated
7GENHDR := $(GENDIR)/autoconf.h
8
9ifneq ($(wildcard $(GENHDR)),)
10 GENFLAGS := -DHAVE_GENHDR
11endif
12
13CLANG ?= clang
14LLC ?= llc
15LLVM_OBJCOPY ?= llvm-objcopy
16LLVM_READELF ?= llvm-readelf
17BTF_PAHOLE ?= pahole
18CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(BPFDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
18CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(BPFDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include \
19 -Dbpf_prog_load=bpf_prog_test_load \
20 -Dbpf_load_program=bpf_test_load_program
19LDLIBS += -lcap -lelf -lrt -lpthread
20
21# Order correspond to 'make run_tests' order
22TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \
23 test_align test_verifier_log test_dev_cgroup test_tcpbpf_user \
24 test_sock test_btf test_sockmap test_lirc_mode2_user get_cgroup_id_user \
25 test_socket_cookie test_cgroup_storage test_select_reuseport test_section_names \
21LDLIBS += -lcap -lelf -lrt -lpthread
22
23# Order correspond to 'make run_tests' order
24TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \
25 test_align test_verifier_log test_dev_cgroup test_tcpbpf_user \
26 test_sock test_btf test_sockmap test_lirc_mode2_user get_cgroup_id_user \
27 test_socket_cookie test_cgroup_storage test_select_reuseport test_section_names \
26 test_netcnt test_tcpnotify_user test_sock_fields test_sysctl
28 test_netcnt test_tcpnotify_user test_sock_fields test_sysctl test_hashmap \
29 test_btf_dump test_cgroup_attach
27
28BPF_OBJ_FILES = $(patsubst %.c,%.o, $(notdir $(wildcard progs/*.c)))
29TEST_GEN_FILES = $(BPF_OBJ_FILES)
30
31# Also test sub-register code-gen if LLVM has eBPF v3 processor support which
32# contains both ALU32 and JMP32 instructions.
33SUBREG_CODEGEN := $(shell echo "int cal(int a) { return a > 0; }" | \
34 $(CLANG) -target bpf -O2 -emit-llvm -S -x c - -o - | \

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

73
74$(OUTPUT)/urandom_read: $(OUTPUT)/%: %.c
75 $(CC) -o $@ $< -Wl,--build-id
76
77$(OUTPUT)/test_maps: map_tests/*.c
78
79BPFOBJ := $(OUTPUT)/libbpf.a
80
30
31BPF_OBJ_FILES = $(patsubst %.c,%.o, $(notdir $(wildcard progs/*.c)))
32TEST_GEN_FILES = $(BPF_OBJ_FILES)
33
34# Also test sub-register code-gen if LLVM has eBPF v3 processor support which
35# contains both ALU32 and JMP32 instructions.
36SUBREG_CODEGEN := $(shell echo "int cal(int a) { return a > 0; }" | \
37 $(CLANG) -target bpf -O2 -emit-llvm -S -x c - -o - | \

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

76
77$(OUTPUT)/urandom_read: $(OUTPUT)/%: %.c
78 $(CC) -o $@ $< -Wl,--build-id
79
80$(OUTPUT)/test_maps: map_tests/*.c
81
82BPFOBJ := $(OUTPUT)/libbpf.a
83
81$(TEST_GEN_PROGS): $(BPFOBJ)
84$(TEST_GEN_PROGS): test_stub.o $(BPFOBJ)
82
85
83$(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/libbpf.a
86$(TEST_GEN_PROGS_EXTENDED): test_stub.o $(OUTPUT)/libbpf.a
84
85$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c
86$(OUTPUT)/test_skb_cgroup_id_user: cgroup_helpers.c
87$(OUTPUT)/test_sock: cgroup_helpers.c
88$(OUTPUT)/test_sock_addr: cgroup_helpers.c
89$(OUTPUT)/test_socket_cookie: cgroup_helpers.c
90$(OUTPUT)/test_sockmap: cgroup_helpers.c
91$(OUTPUT)/test_tcpbpf_user: cgroup_helpers.c
92$(OUTPUT)/test_tcpnotify_user: cgroup_helpers.c trace_helpers.c
93$(OUTPUT)/test_progs: trace_helpers.c
94$(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c
95$(OUTPUT)/test_cgroup_storage: cgroup_helpers.c
96$(OUTPUT)/test_netcnt: cgroup_helpers.c
97$(OUTPUT)/test_sock_fields: cgroup_helpers.c
98$(OUTPUT)/test_sysctl: cgroup_helpers.c
87
88$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c
89$(OUTPUT)/test_skb_cgroup_id_user: cgroup_helpers.c
90$(OUTPUT)/test_sock: cgroup_helpers.c
91$(OUTPUT)/test_sock_addr: cgroup_helpers.c
92$(OUTPUT)/test_socket_cookie: cgroup_helpers.c
93$(OUTPUT)/test_sockmap: cgroup_helpers.c
94$(OUTPUT)/test_tcpbpf_user: cgroup_helpers.c
95$(OUTPUT)/test_tcpnotify_user: cgroup_helpers.c trace_helpers.c
96$(OUTPUT)/test_progs: trace_helpers.c
97$(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c
98$(OUTPUT)/test_cgroup_storage: cgroup_helpers.c
99$(OUTPUT)/test_netcnt: cgroup_helpers.c
100$(OUTPUT)/test_sock_fields: cgroup_helpers.c
101$(OUTPUT)/test_sysctl: cgroup_helpers.c
102$(OUTPUT)/test_cgroup_attach: cgroup_helpers.c
99
100.PHONY: force
101
102# force a rebuild of BPFOBJ when its dependencies are updated
103force:
104
105$(BPFOBJ): force
106 $(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/

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

171$(ALU32_BUILD_DIR)/urandom_read: $(OUTPUT)/urandom_read
172 cp $< $@
173
174$(ALU32_BUILD_DIR)/test_progs_32: test_progs.c $(OUTPUT)/libbpf.a\
175 $(ALU32_BUILD_DIR) \
176 $(ALU32_BUILD_DIR)/urandom_read
177 $(CC) $(TEST_PROGS_CFLAGS) $(CFLAGS) \
178 -o $(ALU32_BUILD_DIR)/test_progs_32 \
103
104.PHONY: force
105
106# force a rebuild of BPFOBJ when its dependencies are updated
107force:
108
109$(BPFOBJ): force
110 $(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/

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

175$(ALU32_BUILD_DIR)/urandom_read: $(OUTPUT)/urandom_read
176 cp $< $@
177
178$(ALU32_BUILD_DIR)/test_progs_32: test_progs.c $(OUTPUT)/libbpf.a\
179 $(ALU32_BUILD_DIR) \
180 $(ALU32_BUILD_DIR)/urandom_read
181 $(CC) $(TEST_PROGS_CFLAGS) $(CFLAGS) \
182 -o $(ALU32_BUILD_DIR)/test_progs_32 \
179 test_progs.c trace_helpers.c prog_tests/*.c \
183 test_progs.c test_stub.c trace_helpers.c prog_tests/*.c \
180 $(OUTPUT)/libbpf.a $(LDLIBS)
181
182$(ALU32_BUILD_DIR)/test_progs_32: $(PROG_TESTS_H)
183$(ALU32_BUILD_DIR)/test_progs_32: prog_tests/*.c
184
185$(ALU32_BUILD_DIR)/%.o: progs/%.c $(ALU32_BUILD_DIR) \
186 $(ALU32_BUILD_DIR)/test_progs_32
187 $(CLANG) $(CLANG_FLAGS) \

--- 90 unchanged lines hidden ---
184 $(OUTPUT)/libbpf.a $(LDLIBS)
185
186$(ALU32_BUILD_DIR)/test_progs_32: $(PROG_TESTS_H)
187$(ALU32_BUILD_DIR)/test_progs_32: prog_tests/*.c
188
189$(ALU32_BUILD_DIR)/%.o: progs/%.c $(ALU32_BUILD_DIR) \
190 $(ALU32_BUILD_DIR)/test_progs_32
191 $(CLANG) $(CLANG_FLAGS) \

--- 90 unchanged lines hidden ---