test/table: fix memory leak
[dpdk.git] / examples / ipsec-secgw / Makefile
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2016 Intel Corporation
3
4 APP = ipsec-secgw
5
6 #
7 # all source are stored in SRCS-y
8 #
9 SRCS-y += parser.c
10 SRCS-y += ipsec.c
11 SRCS-y += esp.c
12 SRCS-y += sp4.c
13 SRCS-y += sp6.c
14 SRCS-y += sa.c
15 SRCS-y += rt.c
16 SRCS-y += ipsec-secgw.c
17
18 CFLAGS += -gdwarf-2
19
20 # Build using pkg-config variables if possible
21 $(shell pkg-config --exists libdpdk)
22 ifeq ($(.SHELLSTATUS),0)
23
24 all: shared
25 .PHONY: shared static
26 shared: build/$(APP)-shared
27         ln -sf $(APP)-shared build/$(APP)
28 static: build/$(APP)-static
29         ln -sf $(APP)-static build/$(APP)
30
31 PC_FILE := $(shell pkg-config --path libdpdk)
32 CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
33 LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
34 LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
35
36 CFLAGS += -DALLOW_EXPERIMENTAL_API
37
38 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
39         $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
40
41 build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
42         $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
43
44 build:
45         @mkdir -p $@
46
47 .PHONY: clean
48 clean:
49         rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
50         rmdir --ignore-fail-on-non-empty build
51
52 else
53
54 ifeq ($(RTE_SDK),)
55         $(error "Please define RTE_SDK environment variable")
56 endif
57
58 # Default target, can be overridden by command line or environment
59 RTE_TARGET ?= x86_64-native-linuxapp-gcc
60
61 include $(RTE_SDK)/mk/rte.vars.mk
62
63 ifneq ($(MAKECMDGOALS),clean)
64 ifneq ($(CONFIG_RTE_LIBRTE_SECURITY),y)
65 $(error "RTE_LIBRTE_SECURITY is required to build ipsec-secgw")
66 endif
67 endif
68
69 CFLAGS += -DALLOW_EXPERIMENTAL_API
70 CFLAGS += -O3 -gdwarf-2
71 CFLAGS += $(WERROR_FLAGS)
72 ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
73 CFLAGS_sa.o += -diag-disable=vec
74 endif
75
76 ifeq ($(DEBUG),1)
77 CFLAGS += -DIPSEC_DEBUG -fstack-protector-all -O0
78 endif
79
80 include $(RTE_SDK)/mk/rte.extapp.mk
81
82 endif