xref: /dpdk/examples/packet_ordering/Makefile (revision e9c65942)
13998e2a0SBruce Richardson# SPDX-License-Identifier: BSD-3-Clause
23998e2a0SBruce Richardson# Copyright(c) 2010-2014 Intel Corporation
3850f3733SSergio Gonzalez Monroy
40eba4adeSBruce Richardson# binary name
50eba4adeSBruce RichardsonAPP = packet_ordering
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 RichardsonPC_FILE := $(shell pkg-config --path libdpdk)
221842d194SBruce RichardsonCFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
231842d194SBruce RichardsonLDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
241842d194SBruce RichardsonLDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
251842d194SBruce Richardson
261842d194SBruce Richardsonbuild/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
271842d194SBruce Richardson	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
281842d194SBruce Richardson
291842d194SBruce Richardsonbuild/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
301842d194SBruce 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:
371842d194SBruce 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
42850f3733SSergio Gonzalez Monroyifeq ($(RTE_SDK),)
43850f3733SSergio Gonzalez Monroy$(error "Please define RTE_SDK environment variable")
44850f3733SSergio Gonzalez Monroyendif
45850f3733SSergio Gonzalez Monroy
46*e9c65942SBruce Richardson# Default target, detect a build directory, by looking for a path with a .config
47*e9c65942SBruce RichardsonRTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.config)))))
48850f3733SSergio Gonzalez Monroy
49850f3733SSergio Gonzalez Monroyinclude $(RTE_SDK)/mk/rte.vars.mk
50850f3733SSergio Gonzalez Monroy
51850f3733SSergio Gonzalez MonroyCFLAGS += -O3
52850f3733SSergio Gonzalez MonroyCFLAGS += $(WERROR_FLAGS)
53850f3733SSergio Gonzalez Monroy
54850f3733SSergio Gonzalez Monroyinclude $(RTE_SDK)/mk/rte.extapp.mk
5522119c45SBruce Richardsonendif
56