eal: fix IOVA mode selection as VA for PCI drivers
[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_process.c
17 SRCS-y += ipsec-secgw.c
18
19 CFLAGS += -gdwarf-2
20
21 # Build using pkg-config variables if possible
22 ifeq ($(shell pkg-config --exists libdpdk && echo 0),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 PKGCONF=pkg-config --define-prefix
32
33 PC_FILE := $(shell $(PKGCONF) --path libdpdk)
34 CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
35 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
36 LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
37
38 CFLAGS += -DALLOW_EXPERIMENTAL_API
39
40 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
41         $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
42
43 build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
44         $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
45
46 build:
47         @mkdir -p $@
48
49 .PHONY: clean
50 clean:
51         rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
52         test -d build && rmdir -p build || true
53
54 else
55
56 ifeq ($(RTE_SDK),)
57 $(error "Please define RTE_SDK environment variable")
58 endif
59
60 # Default target, detect a build directory, by looking for a path with a .config
61 RTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.config)))))
62
63 include $(RTE_SDK)/mk/rte.vars.mk
64
65 ifneq ($(MAKECMDGOALS),clean)
66 ifneq ($(CONFIG_RTE_LIBRTE_IPSEC),y)
67 $(error "RTE_LIBRTE_IPSEC is required to build ipsec-secgw")
68 endif
69 endif
70
71 CFLAGS += -DALLOW_EXPERIMENTAL_API
72 CFLAGS += -O3 -gdwarf-2
73 CFLAGS += $(WERROR_FLAGS)
74 ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
75 CFLAGS_sa.o += -diag-disable=vec
76 endif
77
78 ifeq ($(DEBUG),1)
79 CFLAGS += -DIPSEC_DEBUG -fstack-protector-all -O0
80 endif
81
82 include $(RTE_SDK)/mk/rte.extapp.mk
83
84 endif