13998e2a0SBruce Richardson# SPDX-License-Identifier: BSD-3-Clause 2fbc74e66SJasvinder Singh# Copyright(c) 2010-2018 Intel Corporation 377a33467SCristian Dumitrescu 40eba4adeSBruce Richardson# binary name 50eba4adeSBruce RichardsonAPP = ip_pipeline 60eba4adeSBruce Richardson 70eba4adeSBruce Richardson# all source are stored in SRCS-y 871937434SJasvinder SinghSRCS-y := action.c 971937434SJasvinder SinghSRCS-y += cli.c 104bbf8e30SJasvinder SinghSRCS-y += conn.c 119a408cc8SJasvinder SinghSRCS-y += kni.c 12133c2c65SJasvinder SinghSRCS-y += link.c 134bbf8e30SJasvinder SinghSRCS-y += main.c 146bfe74f8SJasvinder SinghSRCS-y += mempool.c 150eba4adeSBruce RichardsonSRCS-y += parser.c 16d75c371eSJasvinder SinghSRCS-y += pipeline.c 178245472cSJasvinder SinghSRCS-y += swq.c 182f74ae28SJasvinder SinghSRCS-y += tap.c 19c0b668e0SJasvinder SinghSRCS-y += thread.c 2025961ff3SJasvinder SinghSRCS-y += tmgr.c 21bd9b67a1SFan ZhangSRCS-y += cryptodev.c 220eba4adeSBruce Richardson 2322119c45SBruce Richardson# Build using pkg-config variables if possible 24fda34680SCiara Powerifneq ($(shell pkg-config --exists libdpdk && echo 0),0) 25fda34680SCiara Power$(error "no installation of DPDK found") 26fda34680SCiara Powerendif 2722119c45SBruce Richardson 281842d194SBruce Richardsonall: shared 291842d194SBruce Richardson.PHONY: shared static 301842d194SBruce Richardsonshared: build/$(APP)-shared 311842d194SBruce Richardson ln -sf $(APP)-shared build/$(APP) 321842d194SBruce Richardsonstatic: build/$(APP)-static 331842d194SBruce Richardson ln -sf $(APP)-static build/$(APP) 341842d194SBruce Richardson 3512a652a0SBruce RichardsonPKGCONF ?= pkg-config 36ca926852SBruce Richardson 3769b1bb49SBruce RichardsonPC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) 38ca926852SBruce RichardsonCFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) 39ca926852SBruce RichardsonLDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) 408549295dSBruce RichardsonLDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) 4122119c45SBruce Richardson 42*5a196330SBruce Richardsonifeq ($(MAKECMDGOALS),static) 43*5a196330SBruce Richardson# check for broken pkg-config 44*5a196330SBruce Richardsonifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),) 45*5a196330SBruce Richardson$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.") 46*5a196330SBruce Richardson$(error "Cannot generate statically-linked binaries with this version of pkg-config") 47*5a196330SBruce Richardsonendif 48*5a196330SBruce Richardsonendif 49*5a196330SBruce Richardson 50570e6810SCristian DumitrescuCFLAGS += -I. -DALLOW_EXPERIMENTAL_API -D_GNU_SOURCE 5122119c45SBruce Richardson 5222119c45SBruce RichardsonOBJS := $(patsubst %.c,build/%.o,$(SRCS-y)) 5322119c45SBruce Richardson 5422119c45SBruce Richardsonbuild/%.o: %.c Makefile $(PC_FILE) | build 5522119c45SBruce Richardson $(CC) $(CFLAGS) -c $< -o $@ 5622119c45SBruce Richardson 571842d194SBruce Richardsonbuild/$(APP)-shared: $(OBJS) 581842d194SBruce Richardson $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 591842d194SBruce Richardson 601842d194SBruce Richardsonbuild/$(APP)-static: $(OBJS) 611842d194SBruce Richardson $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 6222119c45SBruce Richardson 6322119c45SBruce Richardsonbuild: 6422119c45SBruce Richardson @mkdir -p $@ 6522119c45SBruce Richardson 6622119c45SBruce Richardson.PHONY: clean 6722119c45SBruce Richardsonclean: 681842d194SBruce Richardson rm -f build/$(APP)* build/*.o 697e9562a1SBruce Richardson test -d build && rmdir -p build || true 70