xref: /dpdk/examples/ip_fragmentation/Makefile (revision 78d44153)
13998e2a0SBruce Richardson# SPDX-License-Identifier: BSD-3-Clause
23998e2a0SBruce Richardson# Copyright(c) 2010-2014 Intel Corporation
3e107e82eSAnatoly Burakov#
4e107e82eSAnatoly Burakov
50eba4adeSBruce Richardson# binary name
60eba4adeSBruce RichardsonAPP = ip_fragmentation
70eba4adeSBruce Richardson
80eba4adeSBruce Richardson# all source are stored in SRCS-y
90eba4adeSBruce RichardsonSRCS-y := main.c
100eba4adeSBruce Richardson
1122119c45SBruce Richardson# Build using pkg-config variables if possible
124131ad5dSBruce Richardsonifeq ($(shell pkg-config --exists libdpdk && echo 0),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
2112a652a0SBruce RichardsonPKGCONF ?= pkg-config
22ca926852SBruce Richardson
2369b1bb49SBruce RichardsonPC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
24ca926852SBruce RichardsonCFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
25*78d44153SSunil Kumar KoriCFLAGS += -DALLOW_EXPERIMENTAL_API
26ca926852SBruce RichardsonLDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
27ca926852SBruce RichardsonLDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
281842d194SBruce Richardson
291842d194SBruce Richardsonbuild/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
301842d194SBruce Richardson	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
311842d194SBruce Richardson
321842d194SBruce Richardsonbuild/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
331842d194SBruce Richardson	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
3422119c45SBruce Richardson
3522119c45SBruce Richardsonbuild:
3622119c45SBruce Richardson	@mkdir -p $@
3722119c45SBruce Richardson
3822119c45SBruce Richardson.PHONY: clean
3922119c45SBruce Richardsonclean:
401842d194SBruce Richardson	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
417e9562a1SBruce Richardson	test -d build && rmdir -p build || true
4222119c45SBruce Richardson
4322119c45SBruce Richardsonelse
4422119c45SBruce Richardson
45e107e82eSAnatoly Burakovifeq ($(RTE_SDK),)
46e107e82eSAnatoly Burakov$(error "Please define RTE_SDK environment variable")
47e107e82eSAnatoly Burakovendif
48e107e82eSAnatoly Burakov
49e9c65942SBruce Richardson# Default target, detect a build directory, by looking for a path with a .config
50e9c65942SBruce RichardsonRTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.config)))))
51e107e82eSAnatoly Burakov
52e107e82eSAnatoly Burakovinclude $(RTE_SDK)/mk/rte.vars.mk
53e107e82eSAnatoly Burakov
54e107e82eSAnatoly BurakovCFLAGS += -O3
55e107e82eSAnatoly BurakovCFLAGS += $(WERROR_FLAGS)
56*78d44153SSunil Kumar KoriCFLAGS += -DALLOW_EXPERIMENTAL_API
57e107e82eSAnatoly Burakov
58e107e82eSAnatoly Burakov# workaround for a gcc bug with noreturn attribute
59e107e82eSAnatoly Burakov# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
60e107e82eSAnatoly Burakovifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
61e107e82eSAnatoly BurakovCFLAGS_main.o += -Wno-return-type
62e107e82eSAnatoly Burakovendif
63e107e82eSAnatoly Burakov
64e107e82eSAnatoly Burakovinclude $(RTE_SDK)/mk/rte.extapp.mk
6522119c45SBruce Richardson
6622119c45SBruce Richardsonendif
67