xref: /linux/tools/testing/selftests/net/tcp_ao/Makefile (revision 170aafe35cb98e0f3fbacb446ea86389fbce22ea)
1# SPDX-License-Identifier: GPL-2.0
2TEST_BOTH_AF := bench-lookups
3TEST_BOTH_AF += connect
4TEST_BOTH_AF += connect-deny
5TEST_BOTH_AF += icmps-accept icmps-discard
6TEST_BOTH_AF += key-management
7TEST_BOTH_AF += restore
8TEST_BOTH_AF += rst
9TEST_BOTH_AF += self-connect
10TEST_BOTH_AF += seq-ext
11TEST_BOTH_AF += setsockopt-closed
12TEST_BOTH_AF += unsigned-md5
13
14TEST_IPV4_PROGS := $(TEST_BOTH_AF:%=%_ipv4)
15TEST_IPV6_PROGS := $(TEST_BOTH_AF:%=%_ipv6)
16
17TEST_GEN_PROGS := $(TEST_IPV4_PROGS) $(TEST_IPV6_PROGS)
18
19top_srcdir	  := ../../../../..
20include ../../lib.mk
21
22HOSTAR ?= ar
23
24LIBDIR	:= $(OUTPUT)/lib
25LIB	:= $(LIBDIR)/libaotst.a
26LDLIBS	+= $(LIB) -pthread
27LIBDEPS	:= lib/aolib.h Makefile
28
29CFLAGS	+= -Wall -O2 -g -fno-strict-aliasing
30CFLAGS	+= $(KHDR_INCLUDES)
31CFLAGS	+= -iquote ./lib/ -I ../../../../include/
32
33# Library
34LIBSRC	:= ftrace.c ftrace-tcp.c kconfig.c netlink.c
35LIBSRC	+= proc.c repair.c setup.c sock.c utils.c
36LIBOBJ	:= $(LIBSRC:%.c=$(LIBDIR)/%.o)
37EXTRA_CLEAN += $(LIBOBJ) $(LIB)
38
39$(LIB): $(LIBOBJ)
40	$(HOSTAR) rcs $@ $^
41
42$(LIBDIR)/%.o: ./lib/%.c $(LIBDEPS)
43	mkdir -p $(LIBDIR)
44	$(CC) $< $(CFLAGS) $(CPPFLAGS) -o $@ -c
45
46$(TEST_GEN_PROGS): $(LIB)
47
48$(OUTPUT)/%_ipv4: %.c
49	$(LINK.c) $^ $(LDLIBS) -o $@
50
51$(OUTPUT)/%_ipv6: %.c
52	$(LINK.c) -DIPV6_TEST $^ $(LDLIBS) -o $@
53
54$(OUTPUT)/icmps-accept_ipv4: CFLAGS+= -DTEST_ICMPS_ACCEPT
55$(OUTPUT)/icmps-accept_ipv6: CFLAGS+= -DTEST_ICMPS_ACCEPT
56$(OUTPUT)/bench-lookups_ipv4: LDLIBS+= -lm
57$(OUTPUT)/bench-lookups_ipv6: LDLIBS+= -lm
58