Rework handle_esp.c (proto, DPDK<17.08, cleanup)
[samplevnf.git] / VNFs / DPPD-PROX / Makefile
1 ##
2 ## Copyright (c) 2010-2017 Intel Corporation
3 ##
4 ## Licensed under the Apache License, Version 2.0 (the "License");
5 ## you may not use this file except in compliance with the License.
6 ## You may obtain a copy of the License at
7 ##
8 ##     http://www.apache.org/licenses/LICENSE-2.0
9 ##
10 ## Unless required by applicable law or agreed to in writing, software
11 ## distributed under the License is distributed on an "AS IS" BASIS,
12 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ## See the License for the specific language governing permissions and
14 ## limitations under the License.
15 ##
16
17 ifeq ($(RTE_SDK),)
18 $(error "Please define RTE_SDK environment variable")
19 endif
20
21 # Default target, can be overriden by command line or environment
22 RTE_TARGET ?= x86_64-native-linuxapp-gcc
23
24 rte_version_h := $(RTE_SDK)/$(RTE_TARGET)/include/rte_version.h
25 rte_ver_part = $(shell sed -n -e 's/^\#define\s*$1\s*\(.*\)$$/\1/p' $(rte_version_h))
26 rte_ver_eval = $(shell printf '%u' $$(printf '0x%02x%02x%02x%02x' $1 $2 $3 $4))
27 rte_ver_MMLR = $(call rte_ver_eval,$(call \
28         rte_ver_part,RTE_VER_MAJOR),$(call \
29         rte_ver_part,RTE_VER_MINOR),$(call \
30         rte_ver_part,RTE_VER_PATCH_LEVEL),$(call \
31         rte_ver_part,RTE_VER_PATCH_RELEASE))
32 rte_ver_YMMR = $(call rte_ver_eval,$(call \
33         rte_ver_part,RTE_VER_YEAR),$(call \
34         rte_ver_part,RTE_VER_MONTH),$(call \
35         rte_ver_part,RTE_VER_MINOR),$(call \
36         rte_ver_part,RTE_VER_RELEASE))
37 rte_ver_dpdk := $(if $(call rte_ver_part,RTE_VER_MAJOR),$(rte_ver_MMLR),$(rte_ver_YMMR))
38 rte_ver_comp = $(shell test $(rte_ver_dpdk) $5 $(call rte_ver_eval,$1,$2,$3,$4) && echo 'y')
39 rte_ver_EQ = $(call rte_ver_comp,$1,$2,$3,$4,-eq)
40 rte_ver_NE = $(call rte_ver_comp,$1,$2,$3,$4,-ne)
41 rte_ver_GT = $(call rte_ver_comp,$1,$2,$3,$4,-gt)
42 rte_ver_LT = $(call rte_ver_comp,$1,$2,$3,$4,-lt)
43 rte_ver_GE = $(call rte_ver_comp,$1,$2,$3,$4,-ge)
44 rte_ver_LE = $(call rte_ver_comp,$1,$2,$3,$4,-le)
45
46 include $(RTE_SDK)/mk/rte.vars.mk
47
48 # binary name
49 APP = prox
50 CFLAGS += -DPROGRAM_NAME=\"$(APP)\"
51
52 CFLAGS += -O2 -g
53 CFLAGS += -fno-stack-protector -Wno-deprecated-declarations
54
55 ifeq ($(BNG_QINQ),)
56 CFLAGS += -DUSE_QINQ
57 else ifeq ($(BNG_QINQ),y)
58 CFLAGS += -DUSE_QINQ
59 endif
60
61 ifeq ($(MPLS_ROUTING),)
62 CFLAGS += -DMPLS_ROUTING
63 else ifeq ($(MPLS_ROUTING),y)
64 CFLAGS += -DMPLS_ROUTING
65 endif
66
67 LD_LUA  = $(shell pkg-config --silence-errors --libs-only-l lua)
68 CFLAGS += $(shell pkg-config --silence-errors --cflags lua)
69 ifeq ($(LD_LUA),)
70 LD_LUA  = $(shell pkg-config --silence-errors --libs-only-l lua5.2)
71 CFLAGS += $(shell pkg-config --silence-errors --cflags lua5.2)
72 ifeq ($(LD_LUA),)
73 LD_LUA  = $(shell pkg-config --silence-errors --libs-only-l lua5.3)
74 CFLAGS += $(shell pkg-config --silence-errors --cflags lua5.3)
75 ifeq ($(LD_LUA),)
76 LD_LUA =-llua
77 endif
78 endif
79 endif
80
81 LD_TINFO = $(shell pkg-config --silence-errors --libs-only-l tinfo)
82 LDFLAGS += -lpcap $(LD_TINFO) $(LD_LUA)
83 LDFLAGS += -lncurses -lncursesw -ledit
84
85 PROX_STATS ?= y
86 ifeq ($(PROX_STATS),y)
87 CFLAGS += -DPROX_STATS
88 endif
89
90 ifeq ($(DPI_STATS),y)
91 CFLAGS += -DDPI_STATS
92 endif
93
94 ifeq ($(HW_DIRECT_STATS),y)
95 CFLAGS += -DPROX_HW_DIRECT_STATS
96 endif
97
98 ifeq ($(dbg),y)
99 EXTRA_CFLAGS += -ggdb
100 endif
101
102 ifeq ($(log),)
103 CFLAGS += -DPROX_MAX_LOG_LVL=2
104 else
105 CFLAGS += -DPROX_MAX_LOG_LVL=$(log)
106 endif
107
108 # override any use-case/enviroment specific choices regarding crc and
109 # always use the sw implementation
110 ifeq ($(crc),soft)
111 CFLAGS += -DSOFT_CRC
112 endif
113
114 CFLAGS += -DPROX_PREFETCH_OFFSET=2
115 #CFLAGS += -DBRAS_RX_BULK
116 #CFLAGS += -DASSERT
117 #CFLAGS += -DENABLE_EXTRA_USER_STATISTICS
118 CFLAGS += -DLATENCY_PER_PACKET
119 CFLAGS += -DLATENCY_DETAILS
120 CFLAGS += -DGRE_TP
121 CFLAGS += -std=gnu99
122 CFLAGS += -D_GNU_SOURCE                # for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
123 CFLAGS += $(WERROR_FLAGS)
124 CFLAGS += -Wno-unused
125 CFLAGS += -Wno-unused-parameter
126 CFLAGS += -Wno-unused-result
127
128 # all source are stored in SRCS-y
129
130 SRCS-y := task_init.c
131
132 SRCS-y += handle_aggregator.c
133 SRCS-y += handle_nop.c
134 SRCS-y += handle_irq.c
135 SRCS-y += handle_arp.c
136 SRCS-y += handle_impair.c
137 SRCS-y += handle_lat.c
138 SRCS-y += handle_qos.c
139 SRCS-y += handle_qinq_decap4.c
140 SRCS-y += handle_routing.c
141 SRCS-y += handle_untag.c
142 SRCS-y += handle_mplstag.c
143 SRCS-y += handle_qinq_decap6.c
144
145 # support for GRE encap/decap dropped in latest DPDK versions
146 SRCS-$(call rte_ver_LT,2,1,0,0) += handle_gre_decap_encap.c
147
148 SRCS-y += rw_reg.c
149 SRCS-y += handle_lb_qinq.c
150 SRCS-y += handle_lb_pos.c
151 SRCS-y += handle_lb_net.c
152 SRCS-y += handle_qinq_encap4.c
153 SRCS-y += handle_qinq_encap6.c
154 SRCS-y += handle_classify.c
155 SRCS-y += handle_l2fwd.c
156 SRCS-y += handle_swap.c
157 SRCS-y += handle_police.c
158 SRCS-y += handle_acl.c
159 SRCS-y += handle_gen.c
160 SRCS-y += handle_mirror.c
161 SRCS-y += handle_genl4.c
162 SRCS-y += handle_ipv6_tunnel.c
163 SRCS-y += handle_read.c
164 ifeq ($(call rte_ver_LT,17,8,0,0),y)
165 SRCS-$(call rte_ver_GE,17,2,0,16) += handle_esp.c
166 endif
167 SRCS-y += handle_cgnat.c
168 SRCS-y += handle_nat.c
169 SRCS-y += handle_dump.c
170 SRCS-y += handle_tsc.c
171 SRCS-y += handle_fm.c
172 SRCS-$(call rte_ver_GE,1,8,0,16) += handle_nsh.c
173 SRCS-y += handle_lb_5tuple.c
174 SRCS-y += handle_blockudp.c
175 SRCS-y += toeplitz.c
176 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += handle_pf_acl.c
177
178 SRCS-y += thread_nop.c
179 SRCS-y += thread_generic.c
180 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += thread_pipeline.c
181
182 SRCS-y += prox_args.c prox_cfg.c prox_cksum.c prox_port_cfg.c
183
184 SRCS-y += cfgfile.c clock.c commands.c cqm.c msr.c defaults.c
185 SRCS-y += display.c display_latency.c display_mempools.c
186 SRCS-y += display_ports.c display_rings.c display_priority.c display_pkt_len.c display_l4gen.c display_tasks.c
187 SRCS-y += log.c hash_utils.c main.c parse_utils.c file_utils.c
188 SRCS-y += run.c input_conn.c input_curses.c
189 SRCS-y += rx_pkt.c lconf.c tx_pkt.c expire_cpe.c ip_subnet.c
190 SRCS-y += stats_port.c stats_mempool.c stats_ring.c stats_l4gen.c
191 SRCS-y += stats_latency.c stats_global.c stats_core.c stats_task.c stats_prio.c
192 SRCS-y += cmd_parser.c input.c prox_shared.c prox_lua_types.c
193 SRCS-y += genl4_bundle.c heap.c genl4_stream_tcp.c genl4_stream_udp.c cdf.c
194 SRCS-y += stats.c stats_cons_log.c stats_cons_cli.c stats_parser.c hash_set.c prox_lua.c prox_malloc.c
195
196 ifeq ($(FIRST_PROX_MAKE),)
197 MAKEFLAGS += --no-print-directory
198 FIRST_PROX_MAKE = 1
199 export FIRST_PROX_MAKE
200 all:
201         @./helper-scripts/trailing.sh
202         @$(MAKE) $@
203 %::
204         @$(MAKE) $@
205 else
206 include $(RTE_SDK)/mk/rte.extapp.mk
207 endif