-
Notifications
You must be signed in to change notification settings - Fork 528
/
Makefile
71 lines (51 loc) · 1.93 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
APP=dperf
SRCS-y := src/main.c src/socket.c src/config.c src/client.c src/mbuf_cache.c src/udp.c \
src/port.c src/mbuf.c src/arp.c src/icmp.c src/tcp.c src/tick.c src/http.c \
src/net_stats.c src/flow.c src/work_space.c src/cpuload.c src/config_keyword.c\
src/socket_timer.c src/ip.c src/eth.c src/server.c src/dpdk.c src/ctl.c \
src/icmp6.c src/neigh.c src/vxlan.c src/csum.c src/bond.c src/lldp.c\
src/rss.c src/ip_list.c src/http_parse.c src/trace.c
GCC_VERSION := $(shell gcc -dumpversion | cut -f1 -d.)
CFLAGS_OPT :=
ifeq ($(shell [ $(GCC_VERSION) -ge 9 ] && echo yes),yes)
CFLAGS_OPT += -Wno-address-of-packed-member
endif
#dpdk 17.11, 18.11, 19.11
ifdef RTE_SDK
SRCS-y += src/kni.c
RTE_TARGET ?= x86_64-native-linuxapp-gcc
include $(RTE_SDK)/mk/rte.vars.mk
CFLAGS += -O3 -g -I./src -Wall
CFLAGS += -DHTTP_PARSE
CFLAGS += $(WERROR_FLAGS) $(CFLAGS_OPT)
ifdef DPERF_DEBUG
CFLAGS += -DDPERF_DEBUG
endif
LDLIBS += -lrte_pmd_bond
include $(RTE_SDK)/mk/rte.extapp.mk
#dpdk 20.11
else
SRCS-y += src/virtio-user.c
PKGCONF = pkg-config
ifneq ($(shell $(PKGCONF) --exists libdpdk && echo 0),0)
$(error "no installation of DPDK found")
endif
CFLAGS := -O3 -g $(CFLAGS) -I./src -Wall
ifdef DPERF_DEBUG
CFLAGS += -DDPERF_DEBUG
endif
CFLAGS += -DHTTP_PARSE
CFLAGS += $(CFLGAS_OPT) -DALLOW_EXPERIMENTAL_API
CFLAGS += $(shell $(PKGCONF) --cflags libdpdk)
CFLAGS += $(CFLAGS_OPT)
#fix lower version pkg-config
LDFLAGS0 = $(shell $(PKGCONF) --static --libs libdpdk) -lpthread -lrte_net_bond -lrte_bus_pci -lrte_bus_vdev
LDFLAGS1 = $(shell echo $(LDFLAGS0) | sed 's/-Wl,--whole-archive -Wl,--no-whole-archive -Wl,--export-dynamic/-Wl,--whole-archive/')
LDFLAGS2 = $(shell echo $(LDFLAGS1) | sed 's/.a -latomic/.a -Wl,--no-whole-archive -Wl,--export-dynamic -latomic/')
LDFLAGS += $(LDFLAGS2)
build/$(APP): $(SRCS-y)
mkdir -p build
gcc $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
clean:
rm -rf build/
endif