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 25*11e02702SJerin JacobPKGCONF ?= pkg-config 26*11e02702SJerin Jacob 2722119c45SBruce Richardson# Build using pkg-config variables if possible 28*11e02702SJerin Jacobifneq ($(shell $(PKGCONF) --exists libdpdk && echo 0),0) 29fda34680SCiara Power$(error "no installation of DPDK found") 30fda34680SCiara Powerendif 3122119c45SBruce Richardson 321842d194SBruce Richardsonall: shared 331842d194SBruce Richardson.PHONY: shared static 341842d194SBruce Richardsonshared: build/$(APP)-shared 351842d194SBruce Richardson ln -sf $(APP)-shared build/$(APP) 361842d194SBruce Richardsonstatic: build/$(APP)-static 371842d194SBruce Richardson ln -sf $(APP)-static build/$(APP) 381842d194SBruce 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 445a196330SBruce Richardsonifeq ($(MAKECMDGOALS),static) 455a196330SBruce Richardson# check for broken pkg-config 465a196330SBruce Richardsonifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),) 475a196330SBruce Richardson$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.") 485a196330SBruce Richardson$(error "Cannot generate statically-linked binaries with this version of pkg-config") 495a196330SBruce Richardsonendif 505a196330SBruce Richardsonendif 515a196330SBruce 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