13998e2a0SBruce Richardson# SPDX-License-Identifier: BSD-3-Clause 23998e2a0SBruce Richardson# Copyright(c) 2010-2015 Intel Corporation 3cc7e8ae8SMichal Jastrzebski 40eba4adeSBruce Richardson# binary name 50eba4adeSBruce RichardsonAPP = bond_app 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) 2022119c45SBruce Richardson 211842d194SBruce RichardsonLDFLAGS += -lrte_pmd_bond 221842d194SBruce Richardson 23*ca926852SBruce RichardsonPKGCONF=pkg-config --define-prefix 24*ca926852SBruce Richardson 25*ca926852SBruce RichardsonPC_FILE := $(shell $(PKGCONF) --path libdpdk) 26*ca926852SBruce RichardsonCFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) 27*ca926852SBruce RichardsonLDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) 28*ca926852SBruce RichardsonLDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) 291842d194SBruce Richardson 308728ccf3SThomas MonjalonCFLAGS += -DALLOW_EXPERIMENTAL_API 318728ccf3SThomas Monjalon 321842d194SBruce Richardsonbuild/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build 331842d194SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 341842d194SBruce Richardson 351842d194SBruce Richardsonbuild/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build 361842d194SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 3722119c45SBruce Richardson 3822119c45SBruce Richardsonbuild: 3922119c45SBruce Richardson @mkdir -p $@ 4022119c45SBruce Richardson 4122119c45SBruce Richardson.PHONY: clean 4222119c45SBruce Richardsonclean: 431842d194SBruce Richardson rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared 447e9562a1SBruce Richardson test -d build && rmdir -p build || true 4522119c45SBruce Richardson 4622119c45SBruce Richardsonelse 4722119c45SBruce Richardson 48cc7e8ae8SMichal Jastrzebskiifeq ($(RTE_SDK),) 49cc7e8ae8SMichal Jastrzebski$(error "Please define RTE_SDK environment variable") 50cc7e8ae8SMichal Jastrzebskiendif 51cc7e8ae8SMichal Jastrzebski 52e9c65942SBruce Richardson# Default target, detect a build directory, by looking for a path with a .config 53e9c65942SBruce RichardsonRTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.config))))) 54cc7e8ae8SMichal Jastrzebski 55cc7e8ae8SMichal Jastrzebskiinclude $(RTE_SDK)/mk/rte.vars.mk 56cc7e8ae8SMichal Jastrzebski 57cc7e8ae8SMichal JastrzebskiCFLAGS += $(WERROR_FLAGS) 58cc7e8ae8SMichal Jastrzebski 59cc7e8ae8SMichal Jastrzebski# workaround for a gcc bug with noreturn attribute 60cc7e8ae8SMichal Jastrzebski# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 61cc7e8ae8SMichal Jastrzebskiifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) 62cc7e8ae8SMichal JastrzebskiCFLAGS_main.o += -Wno-return-type 63cc7e8ae8SMichal Jastrzebskiendif 64cc7e8ae8SMichal Jastrzebski 65cc7e8ae8SMichal JastrzebskiCFLAGS += -O3 66b65ecf19SGaetan RivetCFLAGS += -DALLOW_EXPERIMENTAL_API 67cc7e8ae8SMichal Jastrzebski 68ab12f71bSFerruh Yigitifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) 69ab12f71bSFerruh YigitLDLIBS += -lrte_pmd_bond 70ab12f71bSFerruh Yigitendif 71ab12f71bSFerruh Yigit 72cc7e8ae8SMichal Jastrzebskiinclude $(RTE_SDK)/mk/rte.extapp.mk 7322119c45SBruce Richardson 7422119c45SBruce Richardsonendif 75