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 1122119c45SBruce Richardson$(shell pkg-config --exists libdpdk) 1222119c45SBruce Richardsonifeq ($(.SHELLSTATUS),0) 1322119c45SBruce Richardson 141842d194SBruce Richardsonall: shared 151842d194SBruce Richardson.PHONY: shared static 161842d194SBruce Richardsonshared: build/$(APP)-shared 171842d194SBruce Richardson ln -sf $(APP)-shared build/$(APP) 181842d194SBruce Richardsonstatic: build/$(APP)-static 191842d194SBruce Richardson ln -sf $(APP)-static build/$(APP) 201842d194SBruce Richardson 21*ca926852SBruce RichardsonPKGCONF=pkg-config --define-prefix 22*ca926852SBruce Richardson 23*ca926852SBruce RichardsonPC_FILE := $(shell $(PKGCONF) --path libdpdk) 24*ca926852SBruce RichardsonCFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) 25*ca926852SBruce RichardsonLDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) 26*ca926852SBruce RichardsonLDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) 2722119c45SBruce Richardson 2822119c45SBruce RichardsonCFLAGS += -DALLOW_EXPERIMENTAL_API 2922119c45SBruce Richardson 301842d194SBruce Richardsonbuild/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build 311842d194SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 321842d194SBruce Richardson 331842d194SBruce Richardsonbuild/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build 341842d194SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 3522119c45SBruce Richardson 3622119c45SBruce Richardsonbuild: 3722119c45SBruce Richardson @mkdir -p $@ 3822119c45SBruce Richardson 3922119c45SBruce Richardson.PHONY: clean 4022119c45SBruce Richardsonclean: 411842d194SBruce Richardson rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared 427e9562a1SBruce Richardson test -d build && rmdir -p build || true 4322119c45SBruce Richardson 4422119c45SBruce Richardsonelse 4522119c45SBruce Richardson 461ffee690SAmr Mokhtarifeq ($(RTE_SDK),) 471ffee690SAmr Mokhtar$(error "Please define RTE_SDK environment variable") 481ffee690SAmr Mokhtarendif 491ffee690SAmr Mokhtar 50e9c65942SBruce Richardson# Default target, detect a build directory, by looking for a path with a .config 51e9c65942SBruce RichardsonRTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.config))))) 521ffee690SAmr Mokhtar 531ffee690SAmr Mokhtarinclude $(RTE_SDK)/mk/rte.vars.mk 541ffee690SAmr Mokhtar 55a6ec3159SNeil HormanCFLAGS += -DALLOW_EXPERIMENTAL_API 561ffee690SAmr MokhtarCFLAGS += -O3 571ffee690SAmr MokhtarCFLAGS += $(WERROR_FLAGS) 581ffee690SAmr Mokhtar 591ffee690SAmr Mokhtarinclude $(RTE_SDK)/mk/rte.extapp.mk 6022119c45SBruce Richardson 6122119c45SBruce Richardsonendif 62