1
1
-include Makefile.local
2
2
3
+ # #############################################################################
4
+ # Compile, link, and install flags
5
+
6
+ CPPFLAGS += -Iinclude/
7
+ CPPFLAGS += $(EXTRA_CPPFLAGS )
8
+ CFLAGS += -std=gnu99 -O3 -g -Wall -Werror -march=native -fno-omit-frame-pointer
9
+ CFLAGS += $(EXTRA_CFLAGS )
10
+ CFLAGS_SHARED += $(CFLAGS ) -fPIC
11
+ LDFLAGS += -pthread -g
12
+ LDFLAGS += $(EXTRA_LDFLAGS )
13
+ LDLIBS += -lm -lpthread -lrt -ldl
14
+ LDLIBS += $(EXTRA_LDLIBS )
15
+
3
16
PREFIX ?= /usr/local
4
17
SBINDIR ?= $(PREFIX ) /sbin
5
18
LIBDIR ?= $(PREFIX ) /lib
6
19
INCDIR ?= $(PREFIX ) /include
7
20
8
- RTE_SDK ?= /usr/
9
21
10
- CFLAGS += -std=gnu99 -O3 -g -Wall -Werror -I. -Iinclude/ -march=native -fno-omit-frame-pointer
11
- LDFLAGS += -pthread -g
22
+ # #############################################################################
23
+ # DPDK configuration
12
24
13
- RTE_SDK ?= $(HOME ) /dpdk/x86_64-native-linuxapp-gcc
25
+ # Prefix for dpdk
26
+ RTE_SDK ?= /usr/
27
+ # mpdts to compile
14
28
DPDK_PMDS ?= ixgbe i40e tap virtio
15
29
16
- CFLAGS+ = -I$(RTE_SDK ) /include -I$(RTE_SDK ) /include/dpdk
17
- CFLAGS+ = -I$(RTE_SDK ) /include/x86_64-linux-gnu/dpdk/
18
- LDFLAGS+ = -L$(RTE_SDK ) /lib/
30
+ DPDK_CPPFLAGS += -I$(RTE_SDK ) /include -I$(RTE_SDK ) /include/dpdk \
31
+ -I$(RTE_SDK ) /include/x86_64-linux-gnu/dpdk/
32
+ DPDK_LDFLAGS+ = -L$(RTE_SDK ) /lib/
33
+ DPDK_LDLIBS+ = \
34
+ -Wl,--whole-archive \
35
+ $(addprefix -lrte_pmd_,$(DPDK_PMDS ) ) \
36
+ -lrte_eal \
37
+ -lrte_mempool \
38
+ -lrte_mempool_ring \
39
+ -lrte_hash \
40
+ -lrte_ring \
41
+ -lrte_kvargs \
42
+ -lrte_ethdev \
43
+ -lrte_mbuf \
44
+ -lnuma \
45
+ -lrte_bus_pci \
46
+ -lrte_pci \
47
+ -lrte_cmdline \
48
+ -lrte_timer \
49
+ -lrte_net \
50
+ -lrte_kni \
51
+ -lrte_bus_vdev \
52
+ -lrte_gso \
53
+ -Wl,--no-whole-archive \
54
+ -ldl \
55
+ $(EXTRA_LIBS_DPDK )
19
56
20
- LIBS_DPDK = -Wl,--whole-archive
21
- LIBS_DPDK+ = $(addprefix -lrte_pmd_,$(DPDK_PMDS ) )
22
- LIBS_DPDK+ = -lrte_eal -lrte_mempool -lrte_mempool_ring \
23
- -lrte_hash -lrte_ring -lrte_kvargs -lrte_ethdev \
24
- -lrte_mbuf -lnuma -lrte_bus_pci -lrte_pci \
25
- -lrte_cmdline -lrte_timer -lrte_net -lrte_kni \
26
- -lrte_bus_vdev -lrte_gso \
27
- -Wl,--no-whole-archive -ldl $(EXTRA_LIBS_DPDK )
28
57
29
- LDLIBS += -lm -lpthread -lrt -ldl
58
+ # #############################################################################
59
+
60
+ include mk/recipes.mk
61
+
62
+ DEPS :=
63
+ CLEAN :=
64
+ TARGETS :=
30
65
31
- UTILS_OBJS = $(addprefix lib/utils/,utils.o rng.o timeout.o)
32
- TASCOMMON_OBJS = $(addprefix tas/,tas.o config.o shm.o)
33
- SLOWPATH_OBJS = $(addprefix tas/slow/,kernel.o packetmem.o appif.o appif_ctx.o \
34
- nicif.o cc.o tcp.o arp.o routing.o kni.o)
35
- FASTPATH_OBJS = $(addprefix tas/fast/,fastemu.o network.o \
36
- qman.o trace.o fast_kernel.o fast_appctx.o fast_flows.o)
37
- STACK_OBJS = $(addprefix lib/tas/,init.o kernel.o conn.o connect.o)
38
- SOCKETS_OBJS = $(addprefix lib/sockets/,control.o transfer.o context.o manage_fd.o \
39
- epoll.o libc.o)
40
- INTERPOSE_OBJS = $(addprefix lib/sockets/,interpose.o)
41
- CFLAGS += -I. -Ilib/tas/include -Ilib/sockets/include
42
-
43
- shared_objs = $(patsubst % .o,% .shared.o,$(1 ) )
44
-
45
- TESTS_AUTO = \
46
- tests/libtas/tas_ll \
47
- tests/libtas/tas_sockets \
48
- tests/tas_unit/fastpath \
49
-
50
- TESTS_AUTO_FULL = \
51
- tests/full/tas_linux \
52
-
53
- TESTS = \
54
- tests/lowlevel \
55
- tests/lowlevel_echo \
56
- tests/usocket_accept \
57
- tests/usocket_connect \
58
- tests/usocket_accrx \
59
- tests/usocket_conntx \
60
- tests/usocket_conntx_large \
61
- tests/usocket_move \
62
- tests/usocket_epoll_eof \
63
- tests/usocket_shutdown \
64
- tests/bench_ll_echo \
65
- $(TESTS_AUTO ) \
66
- $(TESTS_AUTO_FULL )
67
-
68
-
69
- all : lib/libtas_sockets.so lib/libtas_interpose.so \
70
- lib/libtas.so \
71
- tools/tracetool tools/statetool tools/scaletool \
72
- tas/tas
73
-
74
- tests : $(TESTS )
75
-
76
- # run all simple testcases
77
- run-tests : $(TESTS_AUTO )
78
- tests/libtas/tas_ll
79
- tests/libtas/tas_sockets
80
- tests/tas_unit/fastpath
81
-
82
- # run full tests that run full TAS
83
- run-tests-full : $(TESTS_AUTO_FULL ) tas/tas
84
- tests/full/tas_linux
85
-
86
- docs :
87
- cd doc && doxygen
88
-
89
- tas/% .o : CFLAGS+=-Itas/include
90
- tas/tas : LDLIBS+=$(LIBS_DPDK )
91
- tas/tas : $(TASCOMMON_OBJS ) $(FASTPATH_OBJS ) $(SLOWPATH_OBJS ) $(UTILS_OBJS )
92
-
93
- flexnic/tests/tcp_common : flexnic/tests/tcp_common.o
94
-
95
- tests/lowlevel : tests/lowlevel.o lib/libtas.so
96
- tests/lowlevel_echo : tests/lowlevel_echo.o lib/libtas.so
97
-
98
- tests/usocket_accept : tests/usocket_accept.o lib/libtas_sockets.so
99
- tests/usocket_connect : tests/usocket_connect.o lib/libtas_sockets.so
100
- tests/usocket_accrx : tests/usocket_accrx.o lib/libtas_sockets.so
101
- tests/usocket_conntx : tests/usocket_conntx.o lib/libtas_sockets.so
102
- tests/usocket_conntx_large : tests/usocket_conntx_large.o \
103
- lib/libtas_sockets.so
104
- tests/usocket_move : tests/usocket_move.o lib/libtas_sockets.so
105
- tests/usocket_epoll_eof : tests/usocket_epoll_eof.o
106
- tests/usocket_shutdown : tests/usocket_shutdown.o
107
- tests/bench_ll_echo : tests/bench_ll_echo.o lib/libtas.so
108
-
109
- tests/libtas/tas_ll : tests/libtas/tas_ll.o tests/libtas/harness.o \
110
- tests/libtas/harness.o tests/testutils.o lib/libtas.so
111
- tests/libtas/tas_sockets : tests/libtas/tas_sockets.o tests/libtas/harness.o \
112
- tests/libtas/harness.o tests/testutils.o lib/libtas_sockets.so
113
-
114
- tests/tas_unit/% .o : CFLAGS+=-Itas/include
115
- tests/tas_unit/fastpath : LDLIBS+=-lrte_eal
116
- tests/tas_unit/fastpath : tests/tas_unit/fastpath.o tests/testutils.o \
117
- tas/fast/fast_flows.o
118
-
119
- tests/full/% .o : CFLAGS+=-Itas/include
120
- tests/full/tas_linux : tests/full/tas_linux.o tests/full/fulltest.o lib/libtas.so
121
-
122
- tools/tracetool : tools/tracetool.o
123
- tools/statetool : tools/statetool.o lib/libtas.so
124
- tools/scaletool : tools/scaletool.o lib/libtas.so
125
-
126
- lib/libtas_sockets.so : $(call shared_objs, \
127
- $(SOCKETS_OBJS ) $(STACK_OBJS ) $(UTILS_OBJS ) )
128
-
129
- lib/libtas_interpose.so : $(call shared_objs, \
130
- $(INTERPOSE_OBJS ) $(SOCKETS_OBJS ) $(STACK_OBJS ) $(UTILS_OBJS ) )
131
-
132
- lib/libtas.so : $(call shared_objs, $(UTILS_OBJS ) $(STACK_OBJS ) )
133
-
134
- % .shared.o : % .c
135
- $(CC ) $(CFLAGS ) -fPIC -c -o $@ $<
136
-
137
- % .so :
138
- $(CC ) $(LDFLAGS ) -shared $^ $(LOADLIBES ) $(LDLIBS ) -o $@
66
+ # Subdirectories
139
67
68
+ dir := lib
69
+ include $(dir ) /rules.mk
70
+
71
+ dir := tas
72
+ include $(dir ) /rules.mk
73
+
74
+ dir := tools
75
+ include $(dir ) /rules.mk
76
+
77
+ dir := tests
78
+ include $(dir ) /rules.mk
79
+
80
+ dir := doc
81
+ include $(dir ) /rules.mk
82
+
83
+
84
+ # #############################################################################
85
+ # Top level targets
86
+
87
+ all : $(TARGETS )
140
88
141
89
clean :
142
- rm -f * .o tas/* .o tas/fast/* .o tas/slow/* .o lib/utils/* .o \
143
- lib/tas/* .o lib/sockets/* .o tests/* .o tests/* /* .o tools/* .o \
144
- lib/libtas_sockets.so lib/libtas_interpose.so \
145
- lib/libtas.so \
146
- $(TESTS ) \
147
- tools/tracetool tools/statetool tools/scaletool \
148
- tas/tas
90
+ rm -rf $(CLEAN ) $(DEPS )
149
91
150
92
install : tas/tas lib/libtas_sockets.so lib/libtas_interpose.so \
151
93
lib/libtas.so tools/statetool
@@ -164,4 +106,9 @@ uninstall:
164
106
rm -f $(DESTDIR )$(LIBDIR ) /libtas_sockets.so
165
107
rm -f $(DESTDIR )$(LIBDIR ) /libtas.so
166
108
167
- .PHONY : all tests clean docs install uninstall run-tests
109
+
110
+ .DEFAULT_GOAL := all
111
+ .PHONY : all clean
112
+
113
+ # Include dependencies
114
+ -include $(DEPS )
0 commit comments