13998e2a0SBruce Richardson# SPDX-License-Identifier: BSD-3-Clause 23998e2a0SBruce Richardson# Copyright(c) 2010-2014 Intel Corporation 3af75078fSIntel 4af75078fSIntel# binary name 5af75078fSIntelAPP = symmetric_mp 6af75078fSIntel 7af75078fSIntel# all source are stored in SRCS-y 8af75078fSIntelSRCS-y := main.c 9af75078fSIntel 10*11e02702SJerin JacobPKGCONF ?= pkg-config 11*11e02702SJerin Jacob 1213abe17cSBruce Richardson# Build using pkg-config variables if possible 13*11e02702SJerin Jacobifneq ($(shell $(PKGCONF) --exists libdpdk && echo 0),0) 1413abe17cSBruce Richardson$(error "no installation of DPDK found") 1513abe17cSBruce Richardsonendif 16af75078fSIntel 1713abe17cSBruce Richardsonall: shared 1813abe17cSBruce Richardson.PHONY: shared static 1913abe17cSBruce Richardsonshared: build/$(APP)-shared 2013abe17cSBruce Richardson ln -sf $(APP)-shared build/$(APP) 2113abe17cSBruce Richardsonstatic: build/$(APP)-static 2213abe17cSBruce Richardson ln -sf $(APP)-static build/$(APP) 2313abe17cSBruce Richardson 2413abe17cSBruce RichardsonPC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) 2513abe17cSBruce RichardsonCFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) 2613abe17cSBruce RichardsonLDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) 2713abe17cSBruce RichardsonLDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) 2813abe17cSBruce Richardson 295a196330SBruce Richardsonifeq ($(MAKECMDGOALS),static) 305a196330SBruce Richardson# check for broken pkg-config 315a196330SBruce Richardsonifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),) 325a196330SBruce Richardson$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.") 335a196330SBruce Richardson$(error "Cannot generate statically-linked binaries with this version of pkg-config") 345a196330SBruce Richardsonendif 355a196330SBruce Richardsonendif 365a196330SBruce Richardson 37bc8e3247SDavid MarchandCFLAGS += -DALLOW_EXPERIMENTAL_API 38bc8e3247SDavid Marchand 3913abe17cSBruce Richardsonbuild/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build 4013abe17cSBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 4113abe17cSBruce Richardson 4213abe17cSBruce Richardsonbuild/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build 4313abe17cSBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 4413abe17cSBruce Richardson 4513abe17cSBruce Richardsonbuild: 4613abe17cSBruce Richardson @mkdir -p $@ 4713abe17cSBruce Richardson 4813abe17cSBruce Richardson.PHONY: clean 4913abe17cSBruce Richardsonclean: 5013abe17cSBruce Richardson rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared 5113abe17cSBruce Richardson test -d build && rmdir -p build || true 52