summaryrefslogtreecommitdiff
path: root/examples/ip_pipeline/Makefile
diff options
context:
space:
mode:
authorBruce Richardson <bruce.richardson@intel.com>2017-10-09 14:13:16 +0100
committerBruce Richardson <bruce.richardson@intel.com>2018-01-30 21:58:59 +0100
commit22119c4591a008abe5de8e395a97fcc09c8dc14a (patch)
treed6e42fc5b35f7a68888aa03c7eca60c82752f449 /examples/ip_pipeline/Makefile
parent0eba4ade654bae51877474fb64ab5e79df0f3442 (diff)
downloaddpdk-22119c4591a008abe5de8e395a97fcc09c8dc14a.zip
dpdk-22119c4591a008abe5de8e395a97fcc09c8dc14a.tar.gz
dpdk-22119c4591a008abe5de8e395a97fcc09c8dc14a.tar.xz
examples: use pkg-config in makefiles
Change the example app Makefiles to query if DPDK is installed and registered using pkg-config. If so, build directly using pkg-config info, otherwise fall back to using the original build system with RTE_SDK and RTE_TARGET This commit changes the makefiles for the basic examples, i.e. those which do not have multiple subdirectories underneath the main examples dir. Examples not covered are: * ethtool * multi_process * performance-thread * quota_watermark * netmap_compat * server_node_efd * vm_power_manager Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Luca Boccassi <bluca@debian.org>
Diffstat (limited to 'examples/ip_pipeline/Makefile')
-rw-r--r--examples/ip_pipeline/Makefile35
1 files changed, 33 insertions, 2 deletions
diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile
index 183532a..308c9e4 100644
--- a/examples/ip_pipeline/Makefile
+++ b/examples/ip_pipeline/Makefile
@@ -4,8 +4,6 @@
# binary name
APP = ip_pipeline
-VPATH += $(SRCDIR)/pipeline
-
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += config_parse.c
@@ -32,10 +30,41 @@ SRCS-y += pipeline_flow_actions.c
SRCS-y += pipeline_routing_be.c
SRCS-y += pipeline_routing.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+VPATH += pipeline
+CFLAGS += -I. -I./pipeline/
+
+OBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
+
+build/%.o: %.c Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) -c $< -o $@
+
+build/$(APP): $(OBJS)
+ $(CC) $(OBJS) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP) build/*.o
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
+VPATH += $(SRCDIR)/pipeline
+
# Default target, can be overridden by command line or environment
RTE_TARGET ?= x86_64-native-linuxapp-gcc
@@ -50,3 +79,5 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif