13998e2a0SBruce Richardson# SPDX-License-Identifier: BSD-3-Clause 23998e2a0SBruce Richardson# Copyright(c) 2010-2014 Intel Corporation 3af75078fSIntel 40eba4adeSBruce Richardson# binary name 50eba4adeSBruce RichardsonAPP = timer 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 14*1842d194SBruce Richardsonall: shared 15*1842d194SBruce Richardson.PHONY: shared static 16*1842d194SBruce Richardsonshared: build/$(APP)-shared 17*1842d194SBruce Richardson ln -sf $(APP)-shared build/$(APP) 18*1842d194SBruce Richardsonstatic: build/$(APP)-static 19*1842d194SBruce Richardson ln -sf $(APP)-static build/$(APP) 2022119c45SBruce Richardson 21*1842d194SBruce RichardsonPC_FILE := $(shell pkg-config --path libdpdk) 22*1842d194SBruce RichardsonCFLAGS += -O3 $(shell pkg-config --cflags libdpdk) 23*1842d194SBruce RichardsonLDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) 24*1842d194SBruce RichardsonLDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) 25*1842d194SBruce Richardson 26*1842d194SBruce Richardsonbuild/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build 27*1842d194SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 28*1842d194SBruce Richardson 29*1842d194SBruce Richardsonbuild/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build 30*1842d194SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 3122119c45SBruce Richardson 3222119c45SBruce Richardsonbuild: 3322119c45SBruce Richardson @mkdir -p $@ 3422119c45SBruce Richardson 3522119c45SBruce Richardson.PHONY: clean 3622119c45SBruce Richardsonclean: 37*1842d194SBruce Richardson rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared 3822119c45SBruce Richardson rmdir --ignore-fail-on-non-empty build 3922119c45SBruce Richardson 4022119c45SBruce Richardsonelse # Build using legacy build system 4122119c45SBruce Richardson 42af75078fSIntelifeq ($(RTE_SDK),) 43af75078fSIntel$(error "Please define RTE_SDK environment variable") 44af75078fSIntelendif 45af75078fSIntel 4698a7ea33SJerin Jacob# Default target, can be overridden by command line or environment 47519f3227SDavid MarchandRTE_TARGET ?= x86_64-native-linuxapp-gcc 48af75078fSIntel 49af75078fSIntelinclude $(RTE_SDK)/mk/rte.vars.mk 50af75078fSIntel 51af75078fSIntelCFLAGS += -O3 52af75078fSIntelCFLAGS += $(WERROR_FLAGS) 53af75078fSIntel 54af75078fSIntel# workaround for a gcc bug with noreturn attribute 55af75078fSIntel# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 56af75078fSIntelifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) 57af75078fSIntelCFLAGS_main.o += -Wno-return-type 58af75078fSIntelendif 59af75078fSIntel 60af75078fSIntelinclude $(RTE_SDK)/mk/rte.extapp.mk 6122119c45SBruce Richardsonendif 62