13998e2a0SBruce Richardson# SPDX-License-Identifier: BSD-3-Clause 23998e2a0SBruce Richardson# Copyright(c) 2010-2015 Intel Corporation 3e7bc40daSBruce Richardson 40eba4adeSBruce Richardson# binary name 50eba4adeSBruce RichardsonAPP = rxtx_callbacks 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 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) 271842d194SBruce Richardson 281842d194SBruce Richardsonbuild/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build 291842d194SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 301842d194SBruce Richardson 311842d194SBruce Richardsonbuild/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build 321842d194SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 3322119c45SBruce Richardson 3422119c45SBruce Richardsonbuild: 3522119c45SBruce Richardson @mkdir -p $@ 3622119c45SBruce Richardson 3722119c45SBruce Richardson.PHONY: clean 3822119c45SBruce Richardsonclean: 391842d194SBruce Richardson rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared 407e9562a1SBruce Richardson test -d build && rmdir -p build || true 4122119c45SBruce Richardson 4222119c45SBruce Richardsonelse # Build using legacy build system 4322119c45SBruce Richardson 44e7bc40daSBruce Richardsonifeq ($(RTE_SDK),) 45e7bc40daSBruce Richardson$(error "Please define RTE_SDK environment variable") 46e7bc40daSBruce Richardsonendif 47e7bc40daSBruce Richardson 48e9c65942SBruce Richardson# Default target, detect a build directory, by looking for a path with a .config 49e9c65942SBruce RichardsonRTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.config))))) 50e7bc40daSBruce Richardson 51e7bc40daSBruce Richardsoninclude $(RTE_SDK)/mk/rte.vars.mk 52e7bc40daSBruce Richardson 53e7bc40daSBruce RichardsonCFLAGS += $(WERROR_FLAGS) 54e7bc40daSBruce Richardson 55cd1dadebSTom Barbette# rte_eth_read_clock is experimental 56cd1dadebSTom BarbetteCFLAGS += -DALLOW_EXPERIMENTAL_API 57cd1dadebSTom Barbette 58e7bc40daSBruce Richardson# workaround for a gcc bug with noreturn attribute 59e7bc40daSBruce Richardson# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 60e7bc40daSBruce Richardsonifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) 61e7bc40daSBruce RichardsonCFLAGS_main.o += -Wno-return-type 62e7bc40daSBruce Richardsonendif 63e7bc40daSBruce Richardson 64e7bc40daSBruce RichardsonEXTRA_CFLAGS += -O3 -g -Wfatal-errors 65e7bc40daSBruce Richardson 66e7bc40daSBruce Richardsoninclude $(RTE_SDK)/mk/rte.extapp.mk 6722119c45SBruce Richardsonendif 68