Makefile (cdd5b5a9761fd66d17586e4f4ba6588c70e640ea) Makefile (2258b666482d3326aec8b72ec3e009a2aad9582c)
1# SPDX-License-Identifier: GPL-2.0
2# Makefile for net selftests
3
4CFLAGS = -Wall -Wl,--no-as-needed -O2 -g
5CFLAGS += -I../../../../usr/include/ $(KHDR_INCLUDES)
1# SPDX-License-Identifier: GPL-2.0
2# Makefile for net selftests
3
4CFLAGS = -Wall -Wl,--no-as-needed -O2 -g
5CFLAGS += -I../../../../usr/include/ $(KHDR_INCLUDES)
6# Additional include paths needed by kselftest.h
7CFLAGS += -I../
6
7TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh \
8 rtnetlink.sh xfrm_policy.sh test_blackhole_dev.sh
9TEST_PROGS += fib_tests.sh fib-onlink-tests.sh pmtu.sh udpgso.sh ip_defrag.sh
10TEST_PROGS += udpgso_bench.sh fib_rule_tests.sh msg_zerocopy.sh psock_snd.sh
11TEST_PROGS += udpgro_bench.sh udpgro.sh test_vxlan_under_vrf.sh reuseport_addr_any.sh
12TEST_PROGS += test_vxlan_fdb_changelink.sh so_txtime.sh ipv6_flowlabel.sh
13TEST_PROGS += tcp_fastopen_backup_key.sh fcnal-test.sh l2tp.sh traceroute.sh

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

27TEST_PROGS += udpgro_fwd.sh
28TEST_PROGS += udpgro_frglist.sh
29TEST_PROGS += veth.sh
30TEST_PROGS += ioam6.sh
31TEST_PROGS += gro.sh
32TEST_PROGS += gre_gso.sh
33TEST_PROGS += cmsg_so_mark.sh
34TEST_PROGS += cmsg_time.sh cmsg_ipv6.sh
8
9TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh \
10 rtnetlink.sh xfrm_policy.sh test_blackhole_dev.sh
11TEST_PROGS += fib_tests.sh fib-onlink-tests.sh pmtu.sh udpgso.sh ip_defrag.sh
12TEST_PROGS += udpgso_bench.sh fib_rule_tests.sh msg_zerocopy.sh psock_snd.sh
13TEST_PROGS += udpgro_bench.sh udpgro.sh test_vxlan_under_vrf.sh reuseport_addr_any.sh
14TEST_PROGS += test_vxlan_fdb_changelink.sh so_txtime.sh ipv6_flowlabel.sh
15TEST_PROGS += tcp_fastopen_backup_key.sh fcnal-test.sh l2tp.sh traceroute.sh

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

29TEST_PROGS += udpgro_fwd.sh
30TEST_PROGS += udpgro_frglist.sh
31TEST_PROGS += veth.sh
32TEST_PROGS += ioam6.sh
33TEST_PROGS += gro.sh
34TEST_PROGS += gre_gso.sh
35TEST_PROGS += cmsg_so_mark.sh
36TEST_PROGS += cmsg_time.sh cmsg_ipv6.sh
37TEST_PROGS += netns-name.sh
35TEST_PROGS += srv6_end_dt46_l3vpn_test.sh
36TEST_PROGS += srv6_end_dt4_l3vpn_test.sh
37TEST_PROGS += srv6_end_dt6_l3vpn_test.sh
38TEST_PROGS += srv6_hencap_red_l3vpn_test.sh
39TEST_PROGS += srv6_hl2encap_red_l2vpn_test.sh
40TEST_PROGS += srv6_end_next_csid_l3vpn_test.sh
38TEST_PROGS += srv6_end_dt46_l3vpn_test.sh
39TEST_PROGS += srv6_end_dt4_l3vpn_test.sh
40TEST_PROGS += srv6_end_dt6_l3vpn_test.sh
41TEST_PROGS += srv6_hencap_red_l3vpn_test.sh
42TEST_PROGS += srv6_hl2encap_red_l2vpn_test.sh
43TEST_PROGS += srv6_end_next_csid_l3vpn_test.sh
44TEST_PROGS += srv6_end_x_next_csid_l3vpn_test.sh
41TEST_PROGS += srv6_end_flavors_test.sh
42TEST_PROGS += vrf_strict_mode_test.sh
43TEST_PROGS += arp_ndisc_evict_nocarrier.sh
44TEST_PROGS += ndisc_unsolicited_na_test.sh
45TEST_PROGS += arp_ndisc_untracked_subnets.sh
46TEST_PROGS += stress_reuseport_listen.sh
47TEST_PROGS += l2_tos_ttl_inherit.sh
48TEST_PROGS += bind_bhash.sh

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

80TEST_GEN_FILES += sctp_hello
81TEST_GEN_FILES += csum
82TEST_GEN_FILES += nat6to4.o
83TEST_GEN_FILES += ip_local_port_range
84TEST_GEN_FILES += bind_wildcard
85TEST_PROGS += test_vxlan_mdb.sh
86TEST_PROGS += test_bridge_neigh_suppress.sh
87TEST_PROGS += test_vxlan_nolocalbypass.sh
45TEST_PROGS += srv6_end_flavors_test.sh
46TEST_PROGS += vrf_strict_mode_test.sh
47TEST_PROGS += arp_ndisc_evict_nocarrier.sh
48TEST_PROGS += ndisc_unsolicited_na_test.sh
49TEST_PROGS += arp_ndisc_untracked_subnets.sh
50TEST_PROGS += stress_reuseport_listen.sh
51TEST_PROGS += l2_tos_ttl_inherit.sh
52TEST_PROGS += bind_bhash.sh

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

84TEST_GEN_FILES += sctp_hello
85TEST_GEN_FILES += csum
86TEST_GEN_FILES += nat6to4.o
87TEST_GEN_FILES += ip_local_port_range
88TEST_GEN_FILES += bind_wildcard
89TEST_PROGS += test_vxlan_mdb.sh
90TEST_PROGS += test_bridge_neigh_suppress.sh
91TEST_PROGS += test_vxlan_nolocalbypass.sh
92TEST_PROGS += test_bridge_backup_port.sh
93TEST_PROGS += fdb_flush.sh
94TEST_PROGS += vlan_hw_filter.sh
88
89TEST_FILES := settings
90
91include ../lib.mk
92
93$(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma
94$(OUTPUT)/tcp_mmap: LDLIBS += -lpthread -lcrypto
95$(OUTPUT)/tcp_inq: LDLIBS += -lpthread
96$(OUTPUT)/bind_bhash: LDLIBS += -lpthread
95
96TEST_FILES := settings
97
98include ../lib.mk
99
100$(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma
101$(OUTPUT)/tcp_mmap: LDLIBS += -lpthread -lcrypto
102$(OUTPUT)/tcp_inq: LDLIBS += -lpthread
103$(OUTPUT)/bind_bhash: LDLIBS += -lpthread
104$(OUTPUT)/io_uring_zerocopy_tx: CFLAGS += -I../../../include/
97
98# Rules to generate bpf obj nat6to4.o
99CLANG ?= clang
100SCRATCH_DIR := $(OUTPUT)/tools
101BUILD_DIR := $(SCRATCH_DIR)/build
102BPFDIR := $(abspath ../../../lib/bpf)
103APIDIR := $(abspath ../../../include/uapi)
104
105CCINCLUDE += -I../bpf
106CCINCLUDE += -I../../../../usr/include/
107CCINCLUDE += -I$(SCRATCH_DIR)/include
108
109BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a
110
111MAKE_DIRS := $(BUILD_DIR)/libbpf
112$(MAKE_DIRS):
113 mkdir -p $@
114
115# Get Clang's default includes on this system, as opposed to those seen by
105
106# Rules to generate bpf obj nat6to4.o
107CLANG ?= clang
108SCRATCH_DIR := $(OUTPUT)/tools
109BUILD_DIR := $(SCRATCH_DIR)/build
110BPFDIR := $(abspath ../../../lib/bpf)
111APIDIR := $(abspath ../../../include/uapi)
112
113CCINCLUDE += -I../bpf
114CCINCLUDE += -I../../../../usr/include/
115CCINCLUDE += -I$(SCRATCH_DIR)/include
116
117BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a
118
119MAKE_DIRS := $(BUILD_DIR)/libbpf
120$(MAKE_DIRS):
121 mkdir -p $@
122
123# Get Clang's default includes on this system, as opposed to those seen by
116# '-target bpf'. This fixes "missing" files on some architectures/distros,
124# '--target=bpf'. This fixes "missing" files on some architectures/distros,
117# such as asm/byteorder.h, asm/socket.h, asm/sockios.h, sys/cdefs.h etc.
118#
119# Use '-idirafter': Don't interfere with include mechanics except where the
120# build would have failed anyways.
121define get_sys_includes
122$(shell $(1) $(2) -v -E - </dev/null 2>&1 \
123 | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \
124$(shell $(1) $(2) -dM -E - </dev/null | grep '__riscv_xlen ' | awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}')
125endef
126
127ifneq ($(CROSS_COMPILE),)
128CLANG_TARGET_ARCH = --target=$(notdir $(CROSS_COMPILE:%-=%))
129endif
130
131CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
132
133$(OUTPUT)/nat6to4.o: nat6to4.c $(BPFOBJ) | $(MAKE_DIRS)
125# such as asm/byteorder.h, asm/socket.h, asm/sockios.h, sys/cdefs.h etc.
126#
127# Use '-idirafter': Don't interfere with include mechanics except where the
128# build would have failed anyways.
129define get_sys_includes
130$(shell $(1) $(2) -v -E - </dev/null 2>&1 \
131 | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \
132$(shell $(1) $(2) -dM -E - </dev/null | grep '__riscv_xlen ' | awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}')
133endef
134
135ifneq ($(CROSS_COMPILE),)
136CLANG_TARGET_ARCH = --target=$(notdir $(CROSS_COMPILE:%-=%))
137endif
138
139CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
140
141$(OUTPUT)/nat6to4.o: nat6to4.c $(BPFOBJ) | $(MAKE_DIRS)
134 $(CLANG) -O2 -target bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@
142 $(CLANG) -O2 --target=bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@
135
136$(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \
137 $(APIDIR)/linux/bpf.h \
138 | $(BUILD_DIR)/libbpf
139 $(MAKE) $(submake_extras) -C $(BPFDIR) OUTPUT=$(BUILD_DIR)/libbpf/ \
140 EXTRA_CFLAGS='-g -O0' \
141 DESTDIR=$(SCRATCH_DIR) prefix= all install_headers
142
143EXTRA_CLEAN := $(SCRATCH_DIR)
143
144$(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \
145 $(APIDIR)/linux/bpf.h \
146 | $(BUILD_DIR)/libbpf
147 $(MAKE) $(submake_extras) -C $(BPFDIR) OUTPUT=$(BUILD_DIR)/libbpf/ \
148 EXTRA_CFLAGS='-g -O0' \
149 DESTDIR=$(SCRATCH_DIR) prefix= all install_headers
150
151EXTRA_CLEAN := $(SCRATCH_DIR)