13998e2a0SBruce Richardson# SPDX-License-Identifier: BSD-3-Clause 23998e2a0SBruce Richardson# Copyright(c) 2016 Intel Corporation 3d299106eSSergio Gonzalez Monroy 40eba4adeSBruce RichardsonAPP = ipsec-secgw 50eba4adeSBruce Richardson 60eba4adeSBruce Richardson# 70eba4adeSBruce Richardson# all source are stored in SRCS-y 80eba4adeSBruce Richardson# 90eba4adeSBruce RichardsonSRCS-y += parser.c 100eba4adeSBruce RichardsonSRCS-y += ipsec.c 110eba4adeSBruce RichardsonSRCS-y += esp.c 120eba4adeSBruce RichardsonSRCS-y += sp4.c 130eba4adeSBruce RichardsonSRCS-y += sp6.c 140eba4adeSBruce RichardsonSRCS-y += sa.c 15df3e1d94SVladimir MedvedkinSRCS-y += sad.c 160eba4adeSBruce RichardsonSRCS-y += rt.c 173e5f4625SKonstantin AnanyevSRCS-y += ipsec_process.c 180eba4adeSBruce RichardsonSRCS-y += ipsec-secgw.c 194965dda0SLukasz BartosikSRCS-y += ipsec_worker.c 20e0b0e55cSAnoob JosephSRCS-y += event_helper.c 218e693616SAnoob JosephSRCS-y += flow.c 220eba4adeSBruce Richardson 2322119c45SBruce RichardsonCFLAGS += -gdwarf-2 2422119c45SBruce Richardson 2522119c45SBruce Richardson# Build using pkg-config variables if possible 26fda34680SCiara Powerifneq ($(shell pkg-config --exists libdpdk && echo 0),0) 27fda34680SCiara Power$(error "no installation of DPDK found") 28fda34680SCiara Powerendif 2922119c45SBruce Richardson 301842d194SBruce Richardsonall: shared 311842d194SBruce Richardson.PHONY: shared static 321842d194SBruce Richardsonshared: build/$(APP)-shared 331842d194SBruce Richardson ln -sf $(APP)-shared build/$(APP) 341842d194SBruce Richardsonstatic: build/$(APP)-static 351842d194SBruce Richardson ln -sf $(APP)-static build/$(APP) 361842d194SBruce Richardson 3712a652a0SBruce RichardsonPKGCONF ?= pkg-config 38ca926852SBruce Richardson 3969b1bb49SBruce RichardsonPC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) 40ca926852SBruce RichardsonCFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) 41ca926852SBruce RichardsonLDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) 428549295dSBruce RichardsonLDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) 4322119c45SBruce Richardson 44*5a196330SBruce Richardsonifeq ($(MAKECMDGOALS),static) 45*5a196330SBruce Richardson# check for broken pkg-config 46*5a196330SBruce Richardsonifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),) 47*5a196330SBruce Richardson$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.") 48*5a196330SBruce Richardson$(error "Cannot generate statically-linked binaries with this version of pkg-config") 49*5a196330SBruce Richardsonendif 50*5a196330SBruce Richardsonendif 51*5a196330SBruce Richardson 5222119c45SBruce RichardsonCFLAGS += -DALLOW_EXPERIMENTAL_API 5313db2494SDavid MarchandCFLAGS += -Wno-address-of-packed-member 5422119c45SBruce Richardson 551842d194SBruce Richardsonbuild/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build 561842d194SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 571842d194SBruce Richardson 581842d194SBruce Richardsonbuild/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build 591842d194SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 6022119c45SBruce Richardson 6122119c45SBruce Richardsonbuild: 6222119c45SBruce Richardson @mkdir -p $@ 6322119c45SBruce Richardson 6422119c45SBruce Richardson.PHONY: clean 6522119c45SBruce Richardsonclean: 661842d194SBruce Richardson rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared 677e9562a1SBruce Richardson test -d build && rmdir -p build || true 68