11ffee690SAmr Mokhtar# SPDX-License-Identifier: BSD-3-Clause 21ffee690SAmr Mokhtar# Copyright(c) 2017 Intel Corporation 31ffee690SAmr Mokhtar 40eba4adeSBruce Richardson# binary name 50eba4adeSBruce RichardsonAPP = bbdev 60eba4adeSBruce Richardson 70eba4adeSBruce Richardson# all source are stored in SRCS-y 80eba4adeSBruce RichardsonSRCS-y := main.c 90eba4adeSBruce Richardson 1022119c45SBruce Richardson# Build using pkg-config variables if possible 11*fda34680SCiara Powerifneq ($(shell pkg-config --exists libdpdk && echo 0),0) 12*fda34680SCiara Power$(error "no installation of DPDK found") 13*fda34680SCiara Powerendif 1422119c45SBruce Richardson 151842d194SBruce Richardsonall: shared 161842d194SBruce Richardson.PHONY: shared static 171842d194SBruce Richardsonshared: build/$(APP)-shared 181842d194SBruce Richardson ln -sf $(APP)-shared build/$(APP) 191842d194SBruce Richardsonstatic: build/$(APP)-static 201842d194SBruce Richardson ln -sf $(APP)-static build/$(APP) 211842d194SBruce Richardson 2212a652a0SBruce RichardsonPKGCONF ?= pkg-config 23ca926852SBruce Richardson 2469b1bb49SBruce RichardsonPC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) 25ca926852SBruce RichardsonCFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) 26ca926852SBruce RichardsonLDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) 278549295dSBruce RichardsonLDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) 2822119c45SBruce Richardson 2922119c45SBruce RichardsonCFLAGS += -DALLOW_EXPERIMENTAL_API 3022119c45SBruce Richardson 311842d194SBruce Richardsonbuild/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build 321842d194SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 331842d194SBruce Richardson 341842d194SBruce Richardsonbuild/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build 351842d194SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 3622119c45SBruce Richardson 3722119c45SBruce Richardsonbuild: 3822119c45SBruce Richardson @mkdir -p $@ 3922119c45SBruce Richardson 4022119c45SBruce Richardson.PHONY: clean 4122119c45SBruce Richardsonclean: 421842d194SBruce Richardson rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared 437e9562a1SBruce Richardson test -d build && rmdir -p build || true 44