-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (57 loc) · 2.48 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
-include Makefile.local
PREFIX ?= /usr/local
SBINDIR ?= $(PREFIX)/sbin
LIBDIR ?= $(PREFIX)/lib
INCDIR ?= $(PREFIX)/include
CFLAGS += -std=gnu99 -O3 -g -Wall -Isrc/ -Isrc/include/ -march=native -fno-omit-frame-pointer -fno-common -mno-avx512f -U_FORTIFY_SOURCE #-Werror
LDFLAGS += -pthread -g
RTE_SDK ?= ${HOME}/dpdk/build
DPDK_PMDS = mlx5
EXTRA_LIBS_DPDK = -libverbs -lmlx5 -lmnl
CFLAGS+= -I$(RTE_SDK)/include -I$(RTE_SDK)/include/dpdk
CFLAGS+= -I$(RTE_SDK)/include/x86_64-linux-gnu/dpdk/
LDFLAGS+= -L$(RTE_SDK)/lib/
LIBS_DPDK= -Wl,--whole-archive -Wl,-rpath=$(abspath $(RTE_SDK)/lib)
LIBS_DPDK+= $(addprefix -lrte_pmd_,$(DPDK_PMDS))
LIBS_DPDK+= -lrte_eal -lrte_mempool -lrte_mempool_ring \
-lrte_hash -lrte_ring -lrte_kvargs -lrte_ethdev \
-lrte_mbuf -lnuma -lrte_bus_pci -lrte_pci \
-lrte_cmdline -lrte_timer -lrte_net \
-lrte_bus_vdev -lrte_gso -lrte_kni \
-Wl,--no-whole-archive -ldl $(EXTRA_LIBS_DPDK)
#-lrte_telemetry\
LDLIBS += -lm -lpthread -lrt -ldl
UTILS_OBJS = $(addprefix src/utils/,utils.o rng.o timeout.o)
SOCKETS_OBJS = $(addprefix src/,control.o transfer.o context.o manage_fd.o \
epoll.o)
INTERPOSE_OBJS = $(addprefix src/,interpose.o)
COPY_INTERPOSE_OBJS = $(addprefix src/,copy_interpose.o)
COPY_INTERPOSE_MANUAL_OBJS = $(addprefix src/,copy_interpose_manual.o)
PAGE_FAULT_OBJS = $(addprefix src/,page_fault_test.o)
TAS_COPY_INTERPOSE_OBJS = $(addprefix src/,tas_copy_interpose.o)
ZIO_INTERPOSE_OBJS = $(addprefix src/,zio_interpose.o)
MEM_COUNTER_OBJS = $(addprefix src/,mem_counter.o)
CFLAGS += -I. -Isrc/sockets/include
shared_objs = $(patsubst %.o,%.shared.o,$(1))
linux: copy_interpose.so copy_interpose_manual.so
all: copy_interpose_manual.so copy_interpose.so page_fault_test.so
copy_interpose.so: $(call shared_objs, \
$(COPY_INTERPOSE_OBJS) $(UTILS_OBJS))
copy_interpose_manual.so: $(call shared_objs, \
$(COPY_INTERPOSE_MANUAL_OBJS) $(UTILS_OBJS))
page_fault_test.so: $(call shared_objs, \
$(PAGE_FAULT_OBJS) $(UTILS_OBJS))
tas_copy_interpose.so: $(call shared_objs, \
$(TAS_COPY_INTERPOSE_OBJS) $(SOCKETS_OBJS) $(UTILS_OBJS))
zio_interpose.so: $(call shared_objs, \
$(ZIO_INTERPOSE_OBJS) $(SOCKETS_OBJS) $(UTILS_OBJS))
libmem_counter.so: $(call shared_objs, \
$(MEM_COUNTER_OBJS) $(SOCKETS_OBJS) $(UTILS_OBJS))
%.shared.o: %.c
g++ $(CFLAGS) -fPIC -c -o $@ $<
%.so:
g++ $(CFLAGS) $(LDFLAGS) -shared $^ $(LOADLIBES) $(LDLIBS) -o $@
clean:
rm -f *.o src.o \
copy_interpose.so tas_copy_interpose.so \
page_fault_test.so mem_counter.so src/*.o