]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
1 | # SPDX-License-Identifier: BSD-3-Clause |
2 | # Copyright(c) 2016 Intel Corporation | |
3 | ||
4 | APP = ipsec-secgw | |
5 | ||
7c673cae | 6 | # |
9f95a23c | 7 | # all source are stored in SRCS-y |
7c673cae | 8 | # |
9f95a23c TL |
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 | $(shell pkg-config --exists libdpdk) | |
23 | ifeq ($(.SHELLSTATUS),0) | |
24 | ||
25 | all: shared | |
26 | .PHONY: shared static | |
27 | shared: build/$(APP)-shared | |
28 | ln -sf $(APP)-shared build/$(APP) | |
29 | static: build/$(APP)-static | |
30 | ln -sf $(APP)-static build/$(APP) | |
31 | ||
32 | PC_FILE := $(shell pkg-config --path libdpdk) | |
33 | CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) | |
34 | LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) | |
35 | LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) | |
36 | ||
37 | CFLAGS += -DALLOW_EXPERIMENTAL_API | |
38 | ||
39 | build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build | |
40 | $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) | |
41 | ||
42 | build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build | |
43 | $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) | |
44 | ||
45 | build: | |
46 | @mkdir -p $@ | |
47 | ||
48 | .PHONY: clean | |
49 | clean: | |
50 | rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared | |
51 | rmdir --ignore-fail-on-non-empty build | |
52 | ||
53 | else | |
7c673cae FG |
54 | |
55 | ifeq ($(RTE_SDK),) | |
9f95a23c | 56 | $(error "Please define RTE_SDK environment variable") |
7c673cae FG |
57 | endif |
58 | ||
9f95a23c TL |
59 | # Default target, detect a build directory, by looking for a path with a .config |
60 | RTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.config))))) | |
7c673cae FG |
61 | |
62 | include $(RTE_SDK)/mk/rte.vars.mk | |
63 | ||
9f95a23c TL |
64 | ifneq ($(MAKECMDGOALS),clean) |
65 | ifneq ($(CONFIG_RTE_LIBRTE_IPSEC),y) | |
66 | $(error "RTE_LIBRTE_IPSEC is required to build ipsec-secgw") | |
67 | endif | |
68 | endif | |
7c673cae | 69 | |
9f95a23c | 70 | CFLAGS += -DALLOW_EXPERIMENTAL_API |
7c673cae FG |
71 | CFLAGS += -O3 -gdwarf-2 |
72 | CFLAGS += $(WERROR_FLAGS) | |
73 | ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y) | |
74 | CFLAGS_sa.o += -diag-disable=vec | |
75 | endif | |
76 | ||
77 | ifeq ($(DEBUG),1) | |
78 | CFLAGS += -DIPSEC_DEBUG -fstack-protector-all -O0 | |
79 | endif | |
80 | ||
7c673cae | 81 | include $(RTE_SDK)/mk/rte.extapp.mk |
9f95a23c TL |
82 | |
83 | endif |