Skip to contentSkip to conversation

improve building examples

PATCH Superseded Bruce Richardson 3 participants 41 messages May 3, 2019 – Jul 2, 2019 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover improve building examples

This patchset adds support for testing a number of examples using the DPDK pkgconfig file, allowing us to check that the file works. It also includes some more general cleanups for the examples, including adding support for building from pkg-config to a couple of examples which were missing that.

This patchset includes some work that was previously discussed on-list:
https://mails.dpdk.org/archives/dev/2019-April/131041.html

Bruce Richardson (6):
examples: remove auto-generation of examples list
examples: add support for relocated DPDK install devtools/test-meson-builds: remove dependency on clang devtools/test-meson-builds: add testing of pkg-config file examples/vdpa: support building from pkg-config info examples/vhost_crypto: support building from pkg-config info

 devtools/test-meson-builds.sh           | 61 +++++++++++++++++--------
 examples/bbdev_app/Makefile             | 13 ++++--
 examples/bond/Makefile                  | 13 ++++--
 examples/cmdline/Makefile               | 13 ++++--
 examples/distributor/Makefile           | 13 ++++--
 examples/eventdev_pipeline/Makefile     | 13 ++++--
 examples/exception_path/Makefile        | 13 ++++--
 examples/fips_validation/Makefile       | 13 ++++--
 examples/flow_classify/Makefile         | 13 ++++--
 examples/flow_filtering/Makefile        | 13 ++++--
 examples/helloworld/Makefile            | 13 ++++--
 examples/ip_fragmentation/Makefile      | 13 ++++--
 examples/ip_pipeline/Makefile           | 13 ++++--
 examples/ip_reassembly/Makefile         | 13 ++++--
 examples/ipsec-secgw/Makefile           | 13 ++++--
 examples/ipv4_multicast/Makefile        | 13 ++++--
 examples/kni/Makefile                   | 13 ++++--
 examples/l2fwd-cat/Makefile             | 13 ++++--
 examples/l2fwd-crypto/Makefile          | 13 ++++--
 examples/l2fwd-jobstats/Makefile        | 13 ++++--
 examples/l2fwd-keepalive/Makefile       | 13 ++++--
 examples/l2fwd/Makefile                 | 13 ++++--
 examples/l3fwd-acl/Makefile             | 13 ++++--
 examples/l3fwd-power/Makefile           | 13 ++++--
 examples/l3fwd-vf/Makefile              | 13 ++++--
 examples/l3fwd/Makefile                 | 13 ++++--
 examples/link_status_interrupt/Makefile | 13 ++++--
 examples/load_balancer/Makefile         | 13 ++++--
 examples/meson.build                    | 31 +++++++++++--
 examples/packet_ordering/Makefile       | 13 ++++--
 examples/ptpclient/Makefile             | 13 ++++--
 examples/qos_meter/Makefile             | 13 ++++--
 examples/qos_sched/Makefile             | 13 ++++--
 examples/rxtx_callbacks/Makefile        | 13 ++++--
 examples/service_cores/Makefile         | 13 ++++--
 examples/skeleton/Makefile              | 13 ++++--
 examples/tep_termination/Makefile       | 13 ++++--
 examples/timer/Makefile                 | 13 ++++--
 examples/vdpa/Makefile                  | 55 ++++++++++++++++++----
 examples/vhost/Makefile                 | 13 ++++--
 examples/vhost_crypto/Makefile          | 55 ++++++++++++++++++----
 examples/vhost_scsi/Makefile            | 13 ++++--
 examples/vmdq/Makefile                  | 13 ++++--
 examples/vmdq_dcb/Makefile              | 13 ++++--
 44 files changed, 525 insertions(+), 197 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/6 examples: remove auto-generation of examples list

The examples/meson.build file scanned the filesystem to find all examples to build (for examples=all option) and install. However, using run_command and scanning the filesystem prevented ninja from properly detecting the addition or removal of any examples - one had to recreate the build directory from scratch to guarantee correct detection of all examples. This patch replaces this generated list with a static list of examples, thereby allowing proper tracking by ninja/meson, but at the cost of having to update this file when a new example is added or removed.

---
 examples/meson.build | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)
examples/meson.build +28 -3
index 1a6134f12..8b6577cf7 100644
@@ -8,9 +8,34 @@ endif
 
 execinfo = cc.find_library('execinfo', required: false)
 
-all_examples = run_command('sh', '-c',
-	'cd $MESON_SOURCE_ROOT/$MESON_SUBDIR && for d in * ; do if [ -d $d ] ; then echo $d ; fi ; done'
-	).stdout().split()
+# list of all example apps. Keep 1-3 per line, in alphabetical order.
+all_examples = [
+	'bbdev_app', 'bond',
+	'bpf', 'cmdline',
+	'distributor', 'ethtool',
+	'eventdev_pipeline', 'exception_path',
+	'fips_validation', 'flow_classify',
+	'flow_filtering', 'helloworld',
+	'ip_fragmentation', 'ip_pipeline',
+	'ip_reassembly', 'ipsec-secgw',
+	'ipv4_multicast', 'kni',
+	'l2fwd', 'l2fwd-cat',
+	'l2fwd-crypto', 'l2fwd-jobstats',
+	'l2fwd-keepalive', 'l3fwd',
+	'l3fwd-acl', 'l3fwd-power',
+	'l3fwd-vf', 'link_status_interrupt',
+	'load_balancer', 'multi_process',
+	'netmap_compat', 'packet_ordering',
+	'performance-thread', 'ptpclient',
+	'qos_meter', 'qos_sched',
+	'quota_watermark', 'rxtx_callbacks',
+	'server_node_efd', 'service_cores',
+	'skeleton', 'tep_termination',
+	'timer', 'vdpa',
+	'vhost', 'vhost_crypto',
+	'vhost_scsi', 'vm_power_manager',
+	'vmdq', 'vmdq_dcb',
+]
 # install all example code on install - irrespective of whether the example in
 # question is to be built as part of this build or not.
 foreach ex:all_examples
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/6 examples: add support for relocated DPDK install

In reply to Bruce Richardson

For testing of DPDK, we want to override the prefix given by the pkg-config file, so that we can get correct paths for DPDK installed in an unusual location.

---
 examples/bbdev_app/Makefile             | 13 +++++++++----
 examples/bond/Makefile                  | 13 +++++++++----
 examples/cmdline/Makefile               | 13 +++++++++----
 examples/distributor/Makefile           | 13 +++++++++----
 examples/eventdev_pipeline/Makefile     | 13 +++++++++----
 examples/exception_path/Makefile        | 13 +++++++++----
 examples/fips_validation/Makefile       | 13 +++++++++----
 examples/flow_classify/Makefile         | 13 +++++++++----
 examples/flow_filtering/Makefile        | 13 +++++++++----
 examples/helloworld/Makefile            | 13 +++++++++----
 examples/ip_fragmentation/Makefile      | 13 +++++++++----
 examples/ip_pipeline/Makefile           | 13 +++++++++----
 examples/ip_reassembly/Makefile         | 13 +++++++++----
 examples/ipsec-secgw/Makefile           | 13 +++++++++----
 examples/ipv4_multicast/Makefile        | 13 +++++++++----
 examples/kni/Makefile                   | 13 +++++++++----
 examples/l2fwd-cat/Makefile             | 13 +++++++++----
 examples/l2fwd-crypto/Makefile          | 13 +++++++++----
 examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
 examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
 examples/l2fwd/Makefile                 | 13 +++++++++----
 examples/l3fwd-acl/Makefile             | 13 +++++++++----
 examples/l3fwd-power/Makefile           | 13 +++++++++----
 examples/l3fwd-vf/Makefile              | 13 +++++++++----
 examples/l3fwd/Makefile                 | 13 +++++++++----
 examples/link_status_interrupt/Makefile | 13 +++++++++----
 examples/load_balancer/Makefile         | 13 +++++++++----
 examples/packet_ordering/Makefile       | 13 +++++++++----
 examples/ptpclient/Makefile             | 13 +++++++++----
 examples/qos_meter/Makefile             | 13 +++++++++----
 examples/qos_sched/Makefile             | 13 +++++++++----
 examples/rxtx_callbacks/Makefile        | 13 +++++++++----
 examples/service_cores/Makefile         | 13 +++++++++----
 examples/skeleton/Makefile              | 13 +++++++++----
 examples/tep_termination/Makefile       | 13 +++++++++----
 examples/timer/Makefile                 | 13 +++++++++----
 examples/vhost/Makefile                 | 13 +++++++++----
 examples/vhost_scsi/Makefile            | 13 +++++++++----
 examples/vmdq/Makefile                  | 13 +++++++++----
 examples/vmdq_dcb/Makefile              | 13 +++++++++----
 40 files changed, 360 insertions(+), 160 deletions(-)
examples/bbdev_app/Makefile +9 -4
index e8115b46a..603932ace 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/bond/Makefile +9 -4
index 488eeac70..95b913dab 100644
@@ -20,10 +20,15 @@ static: build/$(APP)-static
 
 LDFLAGS += -lrte_pmd_bond
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/cmdline/Makefile +9 -4
index a03dfa8ee..6bc6aa167 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/distributor/Makefile +9 -4
index 52076214b..e9c5c5d3c 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/eventdev_pipeline/Makefile +9 -4
index 0b0d1ade9..fd96080f3 100644
@@ -20,10 +20,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/exception_path/Makefile +9 -4
index 18db85ddb..d633be4f8 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/fips_validation/Makefile +9 -4
index e74252e27..95b6533b9 100644
@@ -27,10 +27,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/flow_classify/Makefile +9 -4
index dfce1a4bd..3078c5ec7 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/flow_filtering/Makefile +9 -4
index f657c0336..ee2eb8754 100644
@@ -16,10 +16,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/helloworld/Makefile +9 -4
index 97d82f68a..eaf028d02 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/ip_fragmentation/Makefile +9 -4
index 6d1a1fbba..979333af2 100644
@@ -19,10 +19,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/ip_pipeline/Makefile +9 -4
index 409966afd..a224080af 100644
@@ -31,10 +31,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -I.
 
examples/ip_reassembly/Makefile +9 -4
index 7bbc241c7..00b652e85 100644
@@ -19,10 +19,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/ipsec-secgw/Makefile +9 -4
index ac042e4ce..64379383b 100644
@@ -29,10 +29,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/ipv4_multicast/Makefile +9 -4
index 5a1e368fa..2758e1442 100644
@@ -19,10 +19,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/kni/Makefile +9 -4
index 634334f86..afc8ddcbf 100644
@@ -18,11 +18,16 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 CFLAGS += -DALLOW_EXPERIMENTAL_API
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l2fwd-cat/Makefile +9 -4
index fb3c4bc00..73db78ab2 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 LDFLAGS += -lpqos
 
examples/l2fwd-crypto/Makefile +9 -4
index ed5e2c73f..88ff086e7 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l2fwd-jobstats/Makefile +9 -4
index e14c3a2b2..064799609 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l2fwd-keepalive/Makefile +9 -4
index bc851b732..1fc3337ea 100644
@@ -20,10 +20,15 @@ static: build/$(APP)-static
 
 LDFLAGS += -pthread -lrt
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l2fwd/Makefile +9 -4
index 94d70a43e..b4cc1ae01 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l3fwd-acl/Makefile +9 -4
index fc236f129..4918a63eb 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l3fwd-power/Makefile +9 -4
index a106b0404..df7963895 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/l3fwd-vf/Makefile +9 -4
index cc93603e3..1c6ec41fe 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l3fwd/Makefile +9 -4
index 8c51c7b96..3d23f3ac4 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/link_status_interrupt/Makefile +9 -4
index d12e04782..fd7bb204d 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/load_balancer/Makefile +9 -4
index d4b145ca1..807a2f99a 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/packet_ordering/Makefile +9 -4
index 474ec9571..4ef8fef26 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/ptpclient/Makefile +9 -4
index f113c9d56..c94f64eb0 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/qos_meter/Makefile +9 -4
index fbcda09b2..fab91a0ff 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/qos_sched/Makefile +9 -4
index a25875900..e78b9fe56 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/rxtx_callbacks/Makefile +9 -4
index b937d599b..143d8383a 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/service_cores/Makefile +9 -4
index 351fb7e1d..c30920076 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/skeleton/Makefile +9 -4
index 56713a524..e1de10874 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/tep_termination/Makefile +9 -4
index f4b85e49b..474ce3f74 100644
@@ -20,10 +20,15 @@ static: build/$(APP)-static
 
 LDFLAGS += -pthread
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -Wno-deprecated-declarations
 
examples/timer/Makefile +9 -4
index 046348fd1..356094e72 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/vhost/Makefile +9 -4
index 80607b79c..ee2b9d8d6 100644
@@ -20,10 +20,15 @@ static: build/$(APP)-static
 
 LDFLAGS += -pthread
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/vhost_scsi/Makefile +9 -4
index 0a3450bae..61aa318fa 100644
@@ -21,10 +21,15 @@ static: build/$(APP)-static
 CFLAGS += -D_FILE_OFFSET_BITS=64
 LDFLAGS += -pthread
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/vmdq/Makefile +9 -4
index 6a389c776..27c618daf 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/vmdq_dcb/Makefile +9 -4
index 113bce7d1..6f76c7fd1 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
Signature · 1 line
2.20.1
#3 lore raw

Re: [dpdk-dev] [PATCH 19.08 2/6] examples: add support for relocated DPDK install

Quoted 75 lines · Bruce Richardson

For testing of DPDK, we want to override the prefix given by the pkg-config file, so that we can get correct paths for DPDK installed in an unusual location.

Signed-off-by: Bruce Richardson <
[email protected]

Quoted 1 line
---
 examples/bbdev_app/Makefile             | 13 +++++++++----
 examples/bond/Makefile                  | 13 +++++++++----
 examples/cmdline/Makefile               | 13 +++++++++----
 examples/distributor/Makefile           | 13 +++++++++----
 examples/eventdev_pipeline/Makefile     | 13 +++++++++----
 examples/exception_path/Makefile        | 13 +++++++++----
 examples/fips_validation/Makefile       | 13 +++++++++----
 examples/flow_classify/Makefile         | 13 +++++++++----
 examples/flow_filtering/Makefile        | 13 +++++++++----
 examples/helloworld/Makefile            | 13 +++++++++----
 examples/ip_fragmentation/Makefile      | 13 +++++++++----
 examples/ip_pipeline/Makefile           | 13 +++++++++----
 examples/ip_reassembly/Makefile         | 13 +++++++++----
 examples/ipsec-secgw/Makefile           | 13 +++++++++----
 examples/ipv4_multicast/Makefile        | 13 +++++++++----
 examples/kni/Makefile                   | 13 +++++++++----
 examples/l2fwd-cat/Makefile             | 13 +++++++++----
 examples/l2fwd-crypto/Makefile          | 13 +++++++++----
 examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
 examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
 examples/l2fwd/Makefile                 | 13 +++++++++----
 examples/l3fwd-acl/Makefile             | 13 +++++++++----
 examples/l3fwd-power/Makefile           | 13 +++++++++----
 examples/l3fwd-vf/Makefile              | 13 +++++++++----
 examples/l3fwd/Makefile                 | 13 +++++++++----
 examples/link_status_interrupt/Makefile | 13 +++++++++----
 examples/load_balancer/Makefile         | 13 +++++++++----
 examples/packet_ordering/Makefile       | 13 +++++++++----
 examples/ptpclient/Makefile             | 13 +++++++++----
 examples/qos_meter/Makefile             | 13 +++++++++----
 examples/qos_sched/Makefile             | 13 +++++++++----
 examples/rxtx_callbacks/Makefile        | 13 +++++++++----
 examples/service_cores/Makefile         | 13 +++++++++----
 examples/skeleton/Makefile              | 13 +++++++++----
 examples/tep_termination/Makefile       | 13 +++++++++----
 examples/timer/Makefile                 | 13 +++++++++----
 examples/vhost/Makefile                 | 13 +++++++++----
 examples/vhost_scsi/Makefile            | 13 +++++++++----
 examples/vmdq/Makefile                  | 13 +++++++++----
 examples/vmdq_dcb/Makefile              | 13 +++++++++----
 40 files changed, 360 insertions(+), 160 deletions(-)
examples/bbdev_app/Makefile +9 -4
index e8115b46a..603932ace 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
        ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs
 libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+       PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs
 libdpdk)
 
Quoted 1 line

CFLAGS += -DALLOW_EXPERIMENTAL_API

Hi,

Would using "--define-prefix" allow to avoid the special-sauced DPDK_PC_PREFIX variable?

Signature · 2 lines
Kind regards,
Luca Boccassi
#4 lore raw

Re: [dpdk-dev] [PATCH 19.08 2/6] examples: add support for relocated DPDK install

Quoted 76 lines · Luca Boccassi
Quoted 75 lines · Bruce Richardson

For testing of DPDK, we want to override the prefix given by the pkg-config file, so that we can get correct paths for DPDK installed in an unusual location.

Signed-off-by: Bruce Richardson <
[email protected]

Quoted 1 line
---
 examples/bbdev_app/Makefile             | 13 +++++++++----
 examples/bond/Makefile                  | 13 +++++++++----
 examples/cmdline/Makefile               | 13 +++++++++----
 examples/distributor/Makefile           | 13 +++++++++----
 examples/eventdev_pipeline/Makefile     | 13 +++++++++----
 examples/exception_path/Makefile        | 13 +++++++++----
 examples/fips_validation/Makefile       | 13 +++++++++----
 examples/flow_classify/Makefile         | 13 +++++++++----
 examples/flow_filtering/Makefile        | 13 +++++++++----
 examples/helloworld/Makefile            | 13 +++++++++----
 examples/ip_fragmentation/Makefile      | 13 +++++++++----
 examples/ip_pipeline/Makefile           | 13 +++++++++----
 examples/ip_reassembly/Makefile         | 13 +++++++++----
 examples/ipsec-secgw/Makefile           | 13 +++++++++----
 examples/ipv4_multicast/Makefile        | 13 +++++++++----
 examples/kni/Makefile                   | 13 +++++++++----
 examples/l2fwd-cat/Makefile             | 13 +++++++++----
 examples/l2fwd-crypto/Makefile          | 13 +++++++++----
 examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
 examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
 examples/l2fwd/Makefile                 | 13 +++++++++----
 examples/l3fwd-acl/Makefile             | 13 +++++++++----
 examples/l3fwd-power/Makefile           | 13 +++++++++----
 examples/l3fwd-vf/Makefile              | 13 +++++++++----
 examples/l3fwd/Makefile                 | 13 +++++++++----
 examples/link_status_interrupt/Makefile | 13 +++++++++----
 examples/load_balancer/Makefile         | 13 +++++++++----
 examples/packet_ordering/Makefile       | 13 +++++++++----
 examples/ptpclient/Makefile             | 13 +++++++++----
 examples/qos_meter/Makefile             | 13 +++++++++----
 examples/qos_sched/Makefile             | 13 +++++++++----
 examples/rxtx_callbacks/Makefile        | 13 +++++++++----
 examples/service_cores/Makefile         | 13 +++++++++----
 examples/skeleton/Makefile              | 13 +++++++++----
 examples/tep_termination/Makefile       | 13 +++++++++----
 examples/timer/Makefile                 | 13 +++++++++----
 examples/vhost/Makefile                 | 13 +++++++++----
 examples/vhost_scsi/Makefile            | 13 +++++++++----
 examples/vmdq/Makefile                  | 13 +++++++++----
 examples/vmdq_dcb/Makefile              | 13 +++++++++----
 40 files changed, 360 insertions(+), 160 deletions(-)
examples/bbdev_app/Makefile +9 -4
index e8115b46a..603932ace 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
        ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs
 libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+       PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs
 libdpdk)
 
Quoted 8 lines
Quoted 1 line

CFLAGS += -DALLOW_EXPERIMENTAL_API

Hi,

Would using "--define-prefix" allow to avoid the special-sauced DPDK_PC_PREFIX variable?

Perhaps I'm missing something, but I'm not seeing how, since the code above is already using the --define-variable flag. Swapping one pkg-config flag for another isn't likely to change the flow. Whatever way things work, we need an environment variable to pull in the path change. Since one doesn't seem to be available for pkg-config directly, we need a DPDK special-sauced one.

/Bruce

#5 lore raw

Re: [dpdk-dev] [PATCH 19.08 2/6] examples: add support for relocated DPDK install

Quoted 100 lines · Bruce Richardson
Quoted 78 lines · Luca Boccassi
Quoted 77 lines · Bruce Richardson

For testing of DPDK, we want to override the prefix given by the pkg-config file, so that we can get correct paths for DPDK installed
in an unusual location.

Signed-off-by: Bruce Richardson <
[email protected]

---
 examples/bbdev_app/Makefile             | 13 +++++++++----
 examples/bond/Makefile                  | 13 +++++++++----
 examples/cmdline/Makefile               | 13 +++++++++----
 examples/distributor/Makefile           | 13 +++++++++----
 examples/eventdev_pipeline/Makefile     | 13 +++++++++----
 examples/exception_path/Makefile        | 13 +++++++++----
 examples/fips_validation/Makefile       | 13 +++++++++----
 examples/flow_classify/Makefile         | 13 +++++++++----
 examples/flow_filtering/Makefile        | 13 +++++++++----
 examples/helloworld/Makefile            | 13 +++++++++----
 examples/ip_fragmentation/Makefile      | 13 +++++++++----
 examples/ip_pipeline/Makefile           | 13 +++++++++----
 examples/ip_reassembly/Makefile         | 13 +++++++++----
 examples/ipsec-secgw/Makefile           | 13 +++++++++----
 examples/ipv4_multicast/Makefile        | 13 +++++++++----
 examples/kni/Makefile                   | 13 +++++++++----
 examples/l2fwd-cat/Makefile             | 13 +++++++++----
 examples/l2fwd-crypto/Makefile          | 13 +++++++++----
 examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
 examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
 examples/l2fwd/Makefile                 | 13 +++++++++----
 examples/l3fwd-acl/Makefile             | 13 +++++++++----
 examples/l3fwd-power/Makefile           | 13 +++++++++----
 examples/l3fwd-vf/Makefile              | 13 +++++++++----
 examples/l3fwd/Makefile                 | 13 +++++++++----
 examples/link_status_interrupt/Makefile | 13 +++++++++----
 examples/load_balancer/Makefile         | 13 +++++++++----
 examples/packet_ordering/Makefile       | 13 +++++++++----
 examples/ptpclient/Makefile             | 13 +++++++++----
 examples/qos_meter/Makefile             | 13 +++++++++----
 examples/qos_sched/Makefile             | 13 +++++++++----
 examples/rxtx_callbacks/Makefile        | 13 +++++++++----
 examples/service_cores/Makefile         | 13 +++++++++----
 examples/skeleton/Makefile              | 13 +++++++++----
 examples/tep_termination/Makefile       | 13 +++++++++----
 examples/timer/Makefile                 | 13 +++++++++----
 examples/vhost/Makefile                 | 13 +++++++++----
 examples/vhost_scsi/Makefile            | 13 +++++++++----
 examples/vmdq/Makefile                  | 13 +++++++++----
 examples/vmdq_dcb/Makefile              | 13 +++++++++----
 40 files changed, 360 insertions(+), 160 deletions(-)
examples/bbdev_app/Makefile +9 -4
index e8115b46a..603932ace 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
        ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs
 libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+       PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs
 libdpdk)
 
Quoted 8 lines
Quoted 1 line

CFLAGS += -DALLOW_EXPERIMENTAL_API

Hi,

Would using "--define-prefix" allow to avoid the special-sauced DPDK_PC_PREFIX variable?

Perhaps I'm missing something, but I'm not seeing how, since the code above
is already using the --define-variable flag. Swapping one pkg-config flag
for another isn't likely to change the flow. Whatever way things work, we
need an environment variable to pull in the path change. Since one doesn't
seem to be available for pkg-config directly, we need a DPDK special- sauced
one.

Quoted 1 line

/Bruce

I think PKG_CONFIG_PATH is a more common and more well-understood flag to use - using define-prefix should allow to use that instead

Signature · 2 lines
Kind regards,
Luca Boccassi
#6 lore raw

Re: [dpdk-dev] [PATCH 19.08 2/6] examples: add support for relocated DPDK install

Quoted 101 lines · Luca Boccassi
Quoted 100 lines · Bruce Richardson
Quoted 78 lines · Luca Boccassi
Quoted 77 lines · Bruce Richardson

For testing of DPDK, we want to override the prefix given by the pkg-config file, so that we can get correct paths for DPDK installed
in an unusual location.

Signed-off-by: Bruce Richardson <
[email protected]

---
 examples/bbdev_app/Makefile             | 13 +++++++++----
 examples/bond/Makefile                  | 13 +++++++++----
 examples/cmdline/Makefile               | 13 +++++++++----
 examples/distributor/Makefile           | 13 +++++++++----
 examples/eventdev_pipeline/Makefile     | 13 +++++++++----
 examples/exception_path/Makefile        | 13 +++++++++----
 examples/fips_validation/Makefile       | 13 +++++++++----
 examples/flow_classify/Makefile         | 13 +++++++++----
 examples/flow_filtering/Makefile        | 13 +++++++++----
 examples/helloworld/Makefile            | 13 +++++++++----
 examples/ip_fragmentation/Makefile      | 13 +++++++++----
 examples/ip_pipeline/Makefile           | 13 +++++++++----
 examples/ip_reassembly/Makefile         | 13 +++++++++----
 examples/ipsec-secgw/Makefile           | 13 +++++++++----
 examples/ipv4_multicast/Makefile        | 13 +++++++++----
 examples/kni/Makefile                   | 13 +++++++++----
 examples/l2fwd-cat/Makefile             | 13 +++++++++----
 examples/l2fwd-crypto/Makefile          | 13 +++++++++----
 examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
 examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
 examples/l2fwd/Makefile                 | 13 +++++++++----
 examples/l3fwd-acl/Makefile             | 13 +++++++++----
 examples/l3fwd-power/Makefile           | 13 +++++++++----
 examples/l3fwd-vf/Makefile              | 13 +++++++++----
 examples/l3fwd/Makefile                 | 13 +++++++++----
 examples/link_status_interrupt/Makefile | 13 +++++++++----
 examples/load_balancer/Makefile         | 13 +++++++++----
 examples/packet_ordering/Makefile       | 13 +++++++++----
 examples/ptpclient/Makefile             | 13 +++++++++----
 examples/qos_meter/Makefile             | 13 +++++++++----
 examples/qos_sched/Makefile             | 13 +++++++++----
 examples/rxtx_callbacks/Makefile        | 13 +++++++++----
 examples/service_cores/Makefile         | 13 +++++++++----
 examples/skeleton/Makefile              | 13 +++++++++----
 examples/tep_termination/Makefile       | 13 +++++++++----
 examples/timer/Makefile                 | 13 +++++++++----
 examples/vhost/Makefile                 | 13 +++++++++----
 examples/vhost_scsi/Makefile            | 13 +++++++++----
 examples/vmdq/Makefile                  | 13 +++++++++----
 examples/vmdq_dcb/Makefile              | 13 +++++++++----
 40 files changed, 360 insertions(+), 160 deletions(-)
examples/bbdev_app/Makefile +9 -4
index e8115b46a..603932ace 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
        ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs
 libdpdk)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+       PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs
 libdpdk)
 
Quoted 8 lines
Quoted 1 line

CFLAGS += -DALLOW_EXPERIMENTAL_API

Hi,

Would using "--define-prefix" allow to avoid the special-sauced DPDK_PC_PREFIX variable?

Perhaps I'm missing something, but I'm not seeing how, since the code above
is already using the --define-variable flag. Swapping one pkg-config flag
for another isn't likely to change the flow. Whatever way things work, we
need an environment variable to pull in the path change. Since one doesn't
seem to be available for pkg-config directly, we need a DPDK special- sauced
one.

Quoted 5 lines
Quoted 1 line

/Bruce

I think PKG_CONFIG_PATH is a more common and more well-understood flag to use - using define-prefix should allow to use that instead

Yes, except pkg-config-path only gives the path to the pkg-config file, it doesn't affect the prefixes in the file itself, and it's the latter we need to modify.

#7 lore raw

Re: [dpdk-dev] [PATCH 19.08 2/6] examples: add support for relocated DPDK install

Quoted 117 lines · Bruce Richardson
Quoted 109 lines · Luca Boccassi
Quoted 108 lines · Bruce Richardson
Quoted 82 lines · Luca Boccassi
Quoted 81 lines · Bruce Richardson

For testing of DPDK, we want to override the prefix given by the
pkg-config file, so that we can get correct paths for DPDK installed
in an unusual location.

Signed-off-by: Bruce Richardson <
[email protected]

---
 examples/bbdev_app/Makefile             | 13 +++++++++----
 examples/bond/Makefile                  | 13 +++++++++----
 examples/cmdline/Makefile               | 13 +++++++++----
 examples/distributor/Makefile           | 13 +++++++++----
 examples/eventdev_pipeline/Makefile     | 13 +++++++++----
 examples/exception_path/Makefile        | 13 +++++++++----
 examples/fips_validation/Makefile       | 13 +++++++++----
 examples/flow_classify/Makefile         | 13 +++++++++----
 examples/flow_filtering/Makefile        | 13 +++++++++----
 examples/helloworld/Makefile            | 13 +++++++++----
 examples/ip_fragmentation/Makefile      | 13 +++++++++----
 examples/ip_pipeline/Makefile           | 13 +++++++++----
 examples/ip_reassembly/Makefile         | 13 +++++++++----
 examples/ipsec-secgw/Makefile           | 13 +++++++++----
 examples/ipv4_multicast/Makefile        | 13 +++++++++----
 examples/kni/Makefile                   | 13 +++++++++----
 examples/l2fwd-cat/Makefile             | 13 +++++++++----
 examples/l2fwd-crypto/Makefile          | 13 +++++++++----
 examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
 examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
 examples/l2fwd/Makefile                 | 13 +++++++++----
 examples/l3fwd-acl/Makefile             | 13 +++++++++----
 examples/l3fwd-power/Makefile           | 13 +++++++++----
 examples/l3fwd-vf/Makefile              | 13 +++++++++----
 examples/l3fwd/Makefile                 | 13 +++++++++----
 examples/link_status_interrupt/Makefile | 13 +++++++++----
 examples/load_balancer/Makefile         | 13 +++++++++----
 examples/packet_ordering/Makefile       | 13 +++++++++----
 examples/ptpclient/Makefile             | 13 +++++++++----
 examples/qos_meter/Makefile             | 13 +++++++++----
 examples/qos_sched/Makefile             | 13 +++++++++----
 examples/rxtx_callbacks/Makefile        | 13 +++++++++----
 examples/service_cores/Makefile         | 13 +++++++++----
 examples/skeleton/Makefile              | 13 +++++++++----
 examples/tep_termination/Makefile       | 13 +++++++++----
 examples/timer/Makefile                 | 13 +++++++++----
 examples/vhost/Makefile                 | 13 +++++++++----
 examples/vhost_scsi/Makefile            | 13 +++++++++----
 examples/vmdq/Makefile                  | 13 +++++++++----
 examples/vmdq_dcb/Makefile              | 13 +++++++++----
 40 files changed, 360 insertions(+), 160 deletions(-)
examples/bbdev_app/Makefile +0 -4
index e8115b46a..603932ace 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
        ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --

libs
libdpdk)

examples/bbdev_app/Makefile +9 -0
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+       PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --

libs
libdpdk)

Quoted 8 lines
Quoted 1 line

CFLAGS += -DALLOW_EXPERIMENTAL_API

Hi,

Would using "--define-prefix" allow to avoid the special-sauced DPDK_PC_PREFIX variable?

Perhaps I'm missing something, but I'm not seeing how, since the code
above
is already using the --define-variable flag. Swapping one pkg- config
flag
for another isn't likely to change the flow. Whatever way things work, we
need an environment variable to pull in the path change. Since one
doesn't
seem to be available for pkg-config directly, we need a DPDK special-
sauced
one.

Quoted 6 lines
Quoted 1 line

/Bruce

I think PKG_CONFIG_PATH is a more common and more well-understood flag
to use - using define-prefix should allow to use that instead

Quoted 5 lines

Yes, except pkg-config-path only gives the path to the pkg-config file, it
doesn't affect the prefixes in the file itself, and it's the latter we need
to modify.

Using --define-prefix will automatically adjust the prefixes based on the path:

$ grep prefix /tmp/test/usr/local/lib/x86_64-linux-gnu/pkgconfig/libdpdk.pc 
prefix=/usr/local
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include
$ PKG_CONFIG_PATH=/tmp/test/usr/local/lib/x86_64-linux-gnu/pkgconfig
pkg-config --cflags --libs libdpdk
-include rte_config.h -march=native -I/usr/local/include
-I/usr/include/libnl3 -L/usr/local/lib/x86_64-linux-gnu -lrte_telemetry
-lrte_bpf -lrte_flow_classify -lrte_pipeline -lrte_table -lrte_port
-lrte_ipsec -lrte_vhost -lrte_stack -lrte_security -lrte_sched
-lrte_reorder -lrte_rawdev -lrte_pdump -lrte_power -lrte_member
-lrte_lpm -lrte_latencystats -lrte_kni -lrte_jobstats -lrte_ip_frag
-lrte_gso -lrte_gro -lrte_eventdev -lrte_efd -lrte_distributor
-lrte_cryptodev -lrte_compressdev -lrte_cfgfile -lrte_bitratestats
-lrte_bbdev -lrte_acl -lrte_timer -lrte_hash -lrte_metrics -lrte_pci
-lrte_ethdev -lrte_meter -lrte_net -lrte_mbuf -lrte_mempool -lrte_ring
-lrte_cmdline -lrte_eal -lrte_kvargs
$ PKG_CONFIG_PATH=/tmp/test/usr/local/lib/x86_64-linux-gnu/pkgconfig
pkg-config --define-prefix --cflags --libs libdpdk
-include rte_config.h -march=native -I/tmp/test/usr/local/lib/include
-I/usr/lib/include -I/usr/lib/include/libnl3 -I/usr/lib/include
-L/tmp/test/usr/local/lib/lib/x86_64-linux-gnu -lrte_telemetry
-lrte_bpf -lrte_flow_classify -lrte_pipeline -lrte_table -lrte_port
-lrte_ipsec -lrte_vhost -lrte_stack -lrte_security -lrte_sched
-lrte_reorder -lrte_rawdev -lrte_pdump -lrte_power -lrte_member
-lrte_lpm -lrte_latencystats -lrte_kni -lrte_jobstats -lrte_ip_frag
-lrte_gso -lrte_gro -lrte_eventdev -lrte_efd -lrte_distributor
-lrte_cryptodev -lrte_compressdev -lrte_cfgfile -lrte_bitratestats
-lrte_bbdev -lrte_acl -lrte_timer -lrte_hash -lrte_metrics -lrte_pci
-lrte_ethdev -lrte_meter -lrte_net -lrte_mbuf -lrte_mempool -lrte_ring
-lrte_cmdline -lrte_eal -lrte_kvargs
Signature · 2 lines
Kind regards,
Luca Boccassi
#8 lore raw

Re: [dpdk-dev] [PATCH 19.08 2/6] examples: add support for relocated DPDK install

Quoted 118 lines · Luca Boccassi
Quoted 117 lines · Bruce Richardson
Quoted 115 lines · Luca Boccassi
Quoted 108 lines · Bruce Richardson
Quoted 82 lines · Luca Boccassi
Quoted 81 lines · Bruce Richardson

For testing of DPDK, we want to override the prefix given by the
pkg-config file, so that we can get correct paths for DPDK installed
in an unusual location.

Signed-off-by: Bruce Richardson <
[email protected]

---
 examples/bbdev_app/Makefile             | 13 +++++++++----
 examples/bond/Makefile                  | 13 +++++++++----
 examples/cmdline/Makefile               | 13 +++++++++----
 examples/distributor/Makefile           | 13 +++++++++----
 examples/eventdev_pipeline/Makefile     | 13 +++++++++----
 examples/exception_path/Makefile        | 13 +++++++++----
 examples/fips_validation/Makefile       | 13 +++++++++----
 examples/flow_classify/Makefile         | 13 +++++++++----
 examples/flow_filtering/Makefile        | 13 +++++++++----
 examples/helloworld/Makefile            | 13 +++++++++----
 examples/ip_fragmentation/Makefile      | 13 +++++++++----
 examples/ip_pipeline/Makefile           | 13 +++++++++----
 examples/ip_reassembly/Makefile         | 13 +++++++++----
 examples/ipsec-secgw/Makefile           | 13 +++++++++----
 examples/ipv4_multicast/Makefile        | 13 +++++++++----
 examples/kni/Makefile                   | 13 +++++++++----
 examples/l2fwd-cat/Makefile             | 13 +++++++++----
 examples/l2fwd-crypto/Makefile          | 13 +++++++++----
 examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
 examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
 examples/l2fwd/Makefile                 | 13 +++++++++----
 examples/l3fwd-acl/Makefile             | 13 +++++++++----
 examples/l3fwd-power/Makefile           | 13 +++++++++----
 examples/l3fwd-vf/Makefile              | 13 +++++++++----
 examples/l3fwd/Makefile                 | 13 +++++++++----
 examples/link_status_interrupt/Makefile | 13 +++++++++----
 examples/load_balancer/Makefile         | 13 +++++++++----
 examples/packet_ordering/Makefile       | 13 +++++++++----
 examples/ptpclient/Makefile             | 13 +++++++++----
 examples/qos_meter/Makefile             | 13 +++++++++----
 examples/qos_sched/Makefile             | 13 +++++++++----
 examples/rxtx_callbacks/Makefile        | 13 +++++++++----
 examples/service_cores/Makefile         | 13 +++++++++----
 examples/skeleton/Makefile              | 13 +++++++++----
 examples/tep_termination/Makefile       | 13 +++++++++----
 examples/timer/Makefile                 | 13 +++++++++----
 examples/vhost/Makefile                 | 13 +++++++++----
 examples/vhost_scsi/Makefile            | 13 +++++++++----
 examples/vmdq/Makefile                  | 13 +++++++++----
 examples/vmdq_dcb/Makefile              | 13 +++++++++----
 40 files changed, 360 insertions(+), 160 deletions(-)
examples/bbdev_app/Makefile +0 -4
index e8115b46a..603932ace 100644
@@ -18,10 +18,15 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
        ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --

libs
libdpdk)

examples/bbdev_app/Makefile +9 -0
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+       PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --

libs
libdpdk)

Quoted 8 lines
Quoted 1 line

CFLAGS += -DALLOW_EXPERIMENTAL_API

Hi,

Would using "--define-prefix" allow to avoid the special-sauced DPDK_PC_PREFIX variable?

Perhaps I'm missing something, but I'm not seeing how, since the code
above
is already using the --define-variable flag. Swapping one pkg- config
flag
for another isn't likely to change the flow. Whatever way things work, we
need an environment variable to pull in the path change. Since one
doesn't
seem to be available for pkg-config directly, we need a DPDK special-
sauced
one.

Quoted 1 line

/Bruce

I think PKG_CONFIG_PATH is a more common and more well-understood flag
to use - using define-prefix should allow to use that instead

Quoted 9 lines
Quoted 5 lines

Yes, except pkg-config-path only gives the path to the pkg-config file, it
doesn't affect the prefixes in the file itself, and it's the latter we need
to modify.

Using --define-prefix will automatically adjust the prefixes based on the path:

Sorry, I misunderstood what it did - I thought it required the prefix as parameter, so yes, it looks like a good fit here.

/Bruce

#9 lore raw

PATCH 3/6 devtools/test-meson-builds: remove dependency on clang

In reply to Bruce Richardson

Allow the script to run with a reduced set of builds if clang, or other compilers, are missing.

---
 devtools/test-meson-builds.sh | 38 ++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 18 deletions(-)
devtools/test-meson-builds.sh +20 -18
index 630a1a6fe..fe11e3c0a 100755
@@ -28,23 +28,25 @@ build () # <directory> <meson options>
 {
 	builddir=$1
 	shift
-	if [ ! -f "$builddir/build.ninja" ] ; then
-		options="--werror -Dexamples=all $*"
-		echo "$MESON $options $srcdir $builddir"
-		$MESON $options $srcdir $builddir
-		unset CC
-	fi
-	if [ -n "$TEST_MESON_BUILD_VERY_VERBOSE" ] ; then
-		# for full output from ninja use "-v"
-		echo "$ninja_cmd -v -C $builddir"
-		$ninja_cmd -v -C $builddir
-	elif [ -n "$TEST_MESON_BUILD_VERBOSE" ] ; then
-		# for keeping the history of short cmds, pipe through cat
-		echo "$ninja_cmd -C $builddir | cat"
-		$ninja_cmd -C $builddir | cat
-	else
-		echo "$ninja_cmd -C $builddir"
-		$ninja_cmd -C $builddir
+	if command -v $CC >/dev/null 2>&1 ; then
+		if [ ! -f "$builddir/build.ninja" ] ; then
+			options="--werror -Dexamples=all $*"
+			echo "$MESON $options $srcdir $builddir"
+			$MESON $options $srcdir $builddir
+			unset CC
+		fi
+		if [ -n "$TEST_MESON_BUILD_VERY_VERBOSE" ] ; then
+			# for full output from ninja use "-v"
+			echo "$ninja_cmd -v -C $builddir"
+			$ninja_cmd -v -C $builddir
+		elif [ -n "$TEST_MESON_BUILD_VERBOSE" ] ; then
+			# for keeping the history of short cmds, pipe through cat
+			echo "$ninja_cmd -C $builddir | cat"
+			$ninja_cmd -C $builddir | cat
+		else
+			echo "$ninja_cmd -C $builddir"
+			$ninja_cmd -C $builddir
+		fi
 	fi
 }
 
@@ -80,7 +82,7 @@ build build-x86-default -Dmachine=$default_machine $use_shared
 c=aarch64-linux-gnu-gcc
 if command -v $c >/dev/null 2>&1 ; then
 	# compile the general v8a also for clang to increase coverage
-	export CC="ccache clang"
+	export CC="clang"
 	build build-arm64-host-clang $use_shared \
 		--cross-file $srcdir/config/arm/arm64_armv8_linux_gcc
 
Signature · 1 line
2.20.1
#10 lore raw

PATCH 4/6 devtools/test-meson-builds: add testing of pkg-config file

In reply to Bruce Richardson

The pkg-config file generated as part of the build of DPDK should allow applications to be built with an installed DPDK. We can test this as part of the build by doing an install of DPDK to a temporary directory within the build folder, and by then compiling up a few sample apps using make working off that directory.

---
 devtools/test-meson-builds.sh | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
devtools/test-meson-builds.sh +23 -0
index fe11e3c0a..03ebc29ea 100755
@@ -15,6 +15,11 @@ srcdir=$(dirname $(readlink -f $0))/..
 MESON=${MESON:-meson}
 use_shared="--default-library=shared"
 
+if command -v gmake >/dev/null 2>&1 ; then
+	MAKE=gmake
+else
+	MAKE=make
+fi
 if command -v ninja >/dev/null 2>&1 ; then
 	ninja_cmd=ninja
 elif command -v ninja-build >/dev/null 2>&1 ; then
@@ -92,3 +97,21 @@ if command -v $c >/dev/null 2>&1 ; then
 			$use_shared --cross-file $f
 	done
 fi
+
+# Test installation of the x86-default target, to be used for checking
+# the sample apps build using the pkg-config file for cflags and libs
+build_path=build-x86-default
+export DESTDIR=$(pwd)/$build_path/install-root
+$ninja_cmd -C $build_path install
+
+pc_file=$(find $DESTDIR -name libdpdk.pc)
+export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH
+
+# Pkg-config paths need to be relative to the destination dir not globally
+# this value is picked up by our example makefiles
+export DPDK_PC_PREFIX=$DESTDIR/usr/local
+
+for example in cmdline helloworld l2fwd l3fwd skeleton timer; do
+	echo "## Building $example"
+	$MAKE -C $DESTDIR/usr/local/share/dpdk/examples/$example
+done
Signature · 1 line
2.20.1
#11 lore raw

PATCH 5/6 examples/vdpa: support building from pkg-config info

In reply to Bruce Richardson

The vdpa example app did not check for a libdpdk pkg-config file and attempt to build using that. Add support for that method of compile to align the app with the other examples.

---
 examples/vdpa/Makefile | 55 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 47 insertions(+), 8 deletions(-)
examples/vdpa/Makefile +47 -8
index 9d16d8eb5..58f439fd0 100644
@@ -1,6 +1,50 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
+# binary name
+APP = vdpa
+
+# all source are stored in SRCS-y
+SRCS-y := main.c
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+all: shared
+.PHONY: shared static
+shared: build/$(APP)-shared
+	ln -sf $(APP)-shared build/$(APP)
+static: build/$(APP)-static
+	ln -sf $(APP)-static build/$(APP)
+
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
+
+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
+	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
+
+build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
+	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
+
+build:
+	@mkdir -p $@
+
+.PHONY: clean
+clean:
+	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
+	rmdir --ignore-fail-on-non-empty build
+
+else
+
 ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
@@ -16,17 +60,12 @@ please change the definition of the RTE_TARGET environment variable)
 all:
 else
 
-# binary name
-APP = vdpa
-
-# all source are stored in SRCS-y
-SRCS-y := main.c
-
 CFLAGS += -O2 -D_FILE_OFFSET_BITS=64
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -D_GNU_SOURCE
-CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 include $(RTE_SDK)/mk/rte.extapp.mk
 
-endif
+endif # linuxapp
+
+endif # pkg-config
Signature · 1 line
2.20.1
#12 lore raw

PATCH 6/6 examples/vhost_crypto: support building from pkg-config info

In reply to Bruce Richardson

The vhost_crypto example app did not check for a libdpdk pkg-config file and attempt to build using that. Add support for that method of compile to align the app with the other examples.

---
 examples/vhost_crypto/Makefile | 55 +++++++++++++++++++++++++++++-----
 1 file changed, 47 insertions(+), 8 deletions(-)
examples/vhost_crypto/Makefile +47 -8
index 80af3de0c..cec85896f 100644
@@ -1,6 +1,50 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2018 Intel Corporation
 
+# binary name
+APP = vhost-crypto
+
+# all source are stored in SRCS-y
+SRCS-y := main.c
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+all: shared
+.PHONY: shared static
+shared: build/$(APP)-shared
+	ln -sf $(APP)-shared build/$(APP)
+static: build/$(APP)-static
+	ln -sf $(APP)-static build/$(APP)
+
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
+
+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
+	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
+
+build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
+	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
+
+build:
+	@mkdir -p $@
+
+.PHONY: clean
+clean:
+	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
+	rmdir --ignore-fail-on-non-empty build
+
+else
+
 ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
@@ -16,16 +60,11 @@ please change the definition of the RTE_TARGET environment variable)
 all:
 else
 
-# binary name
-APP = vhost-crypto
-
-# all source are stored in SRCS-y
-SRCS-y := main.c
-
-CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -O2 -D_FILE_OFFSET_BITS=64
 CFLAGS += $(WERROR_FLAGS)
 
 include $(RTE_SDK)/mk/rte.extapp.mk
 
-endif
+endif # Linux
+
+endif # pkg-config
Signature · 1 line
2.20.1
#13 lore raw

v2 cover Fixes for building examples

In reply to Bruce Richardson

A small set of fixes for building examples, that was previously part of the larger set, but pulled out separately for easier apply.

Bruce Richardson (3):
examples: fix install of sample apps if setting not provided
examples: remove auto-generation of examples list
examples: fix make clean when using pkg-config for building

 examples/bbdev_app/Makefile             |  2 +-
 examples/bond/Makefile                  |  2 +-
 examples/cmdline/Makefile               |  2 +-
 examples/distributor/Makefile           |  2 +-
 examples/eventdev_pipeline/Makefile     |  2 +-
 examples/exception_path/Makefile        |  2 +-
 examples/fips_validation/Makefile       |  2 +-
 examples/flow_classify/Makefile         |  2 +-
 examples/flow_filtering/Makefile        |  2 +-
 examples/helloworld/Makefile            |  2 +-
 examples/ip_fragmentation/Makefile      |  2 +-
 examples/ip_pipeline/Makefile           |  2 +-
 examples/ip_reassembly/Makefile         |  2 +-
 examples/ipsec-secgw/Makefile           |  2 +-
 examples/ipv4_multicast/Makefile        |  2 +-
 examples/kni/Makefile                   |  2 +-
 examples/l2fwd-cat/Makefile             |  2 +-
 examples/l2fwd-crypto/Makefile          |  2 +-
 examples/l2fwd-jobstats/Makefile        |  2 +-
 examples/l2fwd-keepalive/Makefile       |  2 +-
 examples/l2fwd/Makefile                 |  2 +-
 examples/l3fwd-acl/Makefile             |  2 +-
 examples/l3fwd-power/Makefile           |  2 +-
 examples/l3fwd-vf/Makefile              |  2 +-
 examples/l3fwd/Makefile                 |  2 +-
 examples/link_status_interrupt/Makefile |  2 +-
 examples/load_balancer/Makefile         |  2 +-
 examples/meson.build                    | 31 ++++++++++++++++++++++---
 examples/packet_ordering/Makefile       |  2 +-
 examples/ptpclient/Makefile             |  2 +-
 examples/qos_meter/Makefile             |  2 +-
 examples/qos_sched/Makefile             |  2 +-
 examples/rxtx_callbacks/Makefile        |  2 +-
 examples/service_cores/Makefile         |  2 +-
 examples/skeleton/Makefile              |  2 +-
 examples/tep_termination/Makefile       |  2 +-
 examples/timer/Makefile                 |  2 +-
 examples/vhost/Makefile                 |  2 +-
 examples/vhost_scsi/Makefile            |  2 +-
 examples/vmdq/Makefile                  |  2 +-
 examples/vmdq_dcb/Makefile              |  2 +-
 meson.build                             |  7 +++---
 42 files changed, 71 insertions(+), 47 deletions(-)
Signature · 1 line
2.21.0
#14 lore raw

PATCH v2 1/3 examples: fix install of sample apps if setting not provided

While the examples were being installed into the appropriate install path when processing the examples/meson.build file, that file was only processed if the "examples" meson parameter was non-empty. Since we now do more than just build the examples, we need to unconditionally process the file.

Fixes 2daf565f91b5 ("examples: install as part of ninja install")
---
 meson.build | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
meson.build +3 -4
index 46f9c5683..9cad43481 100644
@@ -42,10 +42,9 @@ subdir('app')
 # build docs
 subdir('doc')
 
-# build any examples explicitly requested - useful for developers
-if get_option('examples') != ''
-	subdir('examples')
-endif
+# build any examples explicitly requested - useful for developers - and
+# install any example code into the appropriate install path
+subdir('examples')
 
 # build kernel modules if enabled
 if get_option('enable_kmods')
Signature · 1 line
2.21.0
#15 lore raw

Re: [dpdk-dev] [PATCH v2 1/3] examples: fix install of sample apps if setting not provided

Quoted 21 lines · Bruce Richardson

While the examples were being installed into the appropriate install path when processing the examples/meson.build file, that file was only processed if the "examples" meson parameter was non-empty. Since we now do more than just build the examples, we need to unconditionally process the file.

Fixes 2daf565f91b5 ("examples: install as part of ninja install")
---
 meson.build | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
meson.build +0 -0
index 46f9c5683..9cad43481 100644
@@ -42,10 +42,9 @@ subdir('app')
 # build docs
 subdir('doc')
 

meson.build subdir('app') · line 50

Quoted 10 lines
meson.build +3 -4
-# build any examples explicitly requested - useful for developers
-if get_option('examples') != ''
-	subdir('examples')
-endif
+# build any examples explicitly requested - useful for developers - and
+# install any example code into the appropriate install path
+subdir('examples')
 
 # build kernel modules if enabled
 if get_option('enable_kmods')

Self-nak, sorry. Need to take account of an empty "examples" value inside examples/meson.build.

V3 to follow soon. :-(

/Bruce

#16 lore raw

PATCH v2 2/3 examples: remove auto-generation of examples list

In reply to Bruce Richardson

The examples/meson.build file scanned the filesystem to find all examples to build (for examples=all option) and install. However, using run_command and scanning the filesystem prevented ninja from properly detecting the addition or removal of any examples - one had to recreate the build directory from scratch to guarantee correct detection of all examples. This patch replaces this generated list with a static list of examples, thereby allowing proper tracking by ninja/meson, but at the cost of having to update this file when a new example is added or removed.

This also fixes an issue with Windows builds, since "sh" is not available there.

Fixes 2daf565f91b5 ("examples: install as part of ninja install")
---
 examples/meson.build | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)
examples/meson.build +28 -3
index 1a6134f12..8b6577cf7 100644
@@ -8,9 +8,34 @@ endif
 
 execinfo = cc.find_library('execinfo', required: false)
 
-all_examples = run_command('sh', '-c',
-	'cd $MESON_SOURCE_ROOT/$MESON_SUBDIR && for d in * ; do if [ -d $d ] ; then echo $d ; fi ; done'
-	).stdout().split()
+# list of all example apps. Keep 1-3 per line, in alphabetical order.
+all_examples = [
+	'bbdev_app', 'bond',
+	'bpf', 'cmdline',
+	'distributor', 'ethtool',
+	'eventdev_pipeline', 'exception_path',
+	'fips_validation', 'flow_classify',
+	'flow_filtering', 'helloworld',
+	'ip_fragmentation', 'ip_pipeline',
+	'ip_reassembly', 'ipsec-secgw',
+	'ipv4_multicast', 'kni',
+	'l2fwd', 'l2fwd-cat',
+	'l2fwd-crypto', 'l2fwd-jobstats',
+	'l2fwd-keepalive', 'l3fwd',
+	'l3fwd-acl', 'l3fwd-power',
+	'l3fwd-vf', 'link_status_interrupt',
+	'load_balancer', 'multi_process',
+	'netmap_compat', 'packet_ordering',
+	'performance-thread', 'ptpclient',
+	'qos_meter', 'qos_sched',
+	'quota_watermark', 'rxtx_callbacks',
+	'server_node_efd', 'service_cores',
+	'skeleton', 'tep_termination',
+	'timer', 'vdpa',
+	'vhost', 'vhost_crypto',
+	'vhost_scsi', 'vm_power_manager',
+	'vmdq', 'vmdq_dcb',
+]
 # install all example code on install - irrespective of whether the example in
 # question is to be built as part of this build or not.
 foreach ex:all_examples
Signature · 1 line
2.21.0
#17 lore raw

PATCH v2 3/3 examples: fix make clean when using pkg-config for building

In reply to Bruce Richardson

The "make clean" command had a number of issues:
- the "--ignore-fail-on-non-empty" flag is not present on BSD
- the call to remove the build folder would fail if there was no build folder present.

These are fixed by only removing the build folder if it exists, and by using -p flag to rmdir in place of --ignore-fail-on-non-empty

Fixes 22119c4591a0 ("examples: use pkg-config in makefiles")
---
 examples/bbdev_app/Makefile             | 2 +-
 examples/bond/Makefile                  | 2 +-
 examples/cmdline/Makefile               | 2 +-
 examples/distributor/Makefile           | 2 +-
 examples/eventdev_pipeline/Makefile     | 2 +-
 examples/exception_path/Makefile        | 2 +-
 examples/fips_validation/Makefile       | 2 +-
 examples/flow_classify/Makefile         | 2 +-
 examples/flow_filtering/Makefile        | 2 +-
 examples/helloworld/Makefile            | 2 +-
 examples/ip_fragmentation/Makefile      | 2 +-
 examples/ip_pipeline/Makefile           | 2 +-
 examples/ip_reassembly/Makefile         | 2 +-
 examples/ipsec-secgw/Makefile           | 2 +-
 examples/ipv4_multicast/Makefile        | 2 +-
 examples/kni/Makefile                   | 2 +-
 examples/l2fwd-cat/Makefile             | 2 +-
 examples/l2fwd-crypto/Makefile          | 2 +-
 examples/l2fwd-jobstats/Makefile        | 2 +-
 examples/l2fwd-keepalive/Makefile       | 2 +-
 examples/l2fwd/Makefile                 | 2 +-
 examples/l3fwd-acl/Makefile             | 2 +-
 examples/l3fwd-power/Makefile           | 2 +-
 examples/l3fwd-vf/Makefile              | 2 +-
 examples/l3fwd/Makefile                 | 2 +-
 examples/link_status_interrupt/Makefile | 2 +-
 examples/load_balancer/Makefile         | 2 +-
 examples/packet_ordering/Makefile       | 2 +-
 examples/ptpclient/Makefile             | 2 +-
 examples/qos_meter/Makefile             | 2 +-
 examples/qos_sched/Makefile             | 2 +-
 examples/rxtx_callbacks/Makefile        | 2 +-
 examples/service_cores/Makefile         | 2 +-
 examples/skeleton/Makefile              | 2 +-
 examples/tep_termination/Makefile       | 2 +-
 examples/timer/Makefile                 | 2 +-
 examples/vhost/Makefile                 | 2 +-
 examples/vhost_scsi/Makefile            | 2 +-
 examples/vmdq/Makefile                  | 2 +-
 examples/vmdq_dcb/Makefile              | 2 +-
 40 files changed, 40 insertions(+), 40 deletions(-)
examples/bbdev_app/Makefile +1 -1
index e8115b46a..af313d926 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/bond/Makefile +1 -1
index 488eeac70..278b5f690 100644
@@ -39,7 +39,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/cmdline/Makefile +1 -1
index a03dfa8ee..03d9ed3cc 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/distributor/Makefile +1 -1
index 52076214b..2edc0ea3d 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/eventdev_pipeline/Makefile +1 -1
index 0b0d1ade9..1d3394947 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/exception_path/Makefile +1 -1
index 18db85ddb..c3ba2787c 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/fips_validation/Makefile +1 -1
index e74252e27..19240911a 100644
@@ -44,7 +44,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/flow_classify/Makefile +1 -1
index dfce1a4bd..182debcba 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/flow_filtering/Makefile +1 -1
index f657c0336..b182a2a29 100644
@@ -33,7 +33,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/helloworld/Makefile +1 -1
index 97d82f68a..980b011fc 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/ip_fragmentation/Makefile +1 -1
index 6d1a1fbba..56726d688 100644
@@ -36,7 +36,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/ip_pipeline/Makefile +1 -1
index 409966afd..acd93e29b 100644
@@ -55,7 +55,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP)* build/*.o
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/ip_reassembly/Makefile +1 -1
index 7bbc241c7..1baec86ad 100644
@@ -36,7 +36,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/ipsec-secgw/Makefile +1 -1
index 75f2bcd00..a2d8244e8 100644
@@ -48,7 +48,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/ipv4_multicast/Makefile +1 -1
index 5a1e368fa..5595b9cbf 100644
@@ -36,7 +36,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/kni/Makefile +1 -1
index 634334f86..e01703567 100644
@@ -36,7 +36,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l2fwd-cat/Makefile +1 -1
index fb3c4bc00..b4f729a66 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l2fwd-crypto/Makefile +1 -1
index ed5e2c73f..3986a4c10 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l2fwd-jobstats/Makefile +1 -1
index e14c3a2b2..4517a3d7d 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l2fwd-keepalive/Makefile +1 -1
index bc851b732..56d0e0666 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l2fwd/Makefile +1 -1
index 94d70a43e..43277318f 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l3fwd-acl/Makefile +1 -1
index fc236f129..b38343725 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l3fwd-power/Makefile +1 -1
index a106b0404..8a4eee8ae 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l3fwd-vf/Makefile +1 -1
index cc93603e3..8ad2fbcbc 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l3fwd/Makefile +1 -1
index 8c51c7b96..dcc38a928 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/link_status_interrupt/Makefile +1 -1
index d12e04782..987724d47 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/load_balancer/Makefile +1 -1
index d4b145ca1..935ee1591 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/packet_ordering/Makefile +1 -1
index 474ec9571..2c3187a41 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/ptpclient/Makefile +1 -1
index f113c9d56..857a679b7 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/qos_meter/Makefile +1 -1
index fbcda09b2..7321f34f3 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/qos_sched/Makefile +1 -1
index a25875900..7012c3d4c 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/rxtx_callbacks/Makefile +1 -1
index b937d599b..22c4013db 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/service_cores/Makefile +1 -1
index 351fb7e1d..1dcd4c62e 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/skeleton/Makefile +1 -1
index 56713a524..b9cd05f2f 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/tep_termination/Makefile +1 -1
index f4b85e49b..3782378d9 100644
@@ -39,7 +39,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/timer/Makefile +1 -1
index 046348fd1..f49703ff4 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/vhost/Makefile +1 -1
index 80607b79c..9c3e0ece0 100644
@@ -39,7 +39,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/vhost_scsi/Makefile +1 -1
index 0a3450bae..813ab66a8 100644
@@ -38,7 +38,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/vmdq/Makefile +1 -1
index 6a389c776..b67d1937f 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/vmdq_dcb/Makefile +1 -1
index 113bce7d1..0ddcc320b 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
Signature · 1 line
2.21.0
#18 lore raw

v3 cover Fixes for building examples

In reply to Bruce Richardson

A small set of fixes for building examples, that was previously part of the larger set, but pulled out separately for easier apply.

V3: changed patch 1, to properly quit processing examples/meson.build
if the examples list was empty.

Bruce Richardson (3):
examples: fix install of sample apps if setting not provided
examples: remove auto-generation of examples list
examples: fix make clean when using pkg-config for building

 examples/bbdev_app/Makefile             |  2 +-
 examples/bond/Makefile                  |  2 +-
 examples/cmdline/Makefile               |  2 +-
 examples/distributor/Makefile           |  2 +-
 examples/eventdev_pipeline/Makefile     |  2 +-
 examples/exception_path/Makefile        |  2 +-
 examples/fips_validation/Makefile       |  2 +-
 examples/flow_classify/Makefile         |  2 +-
 examples/flow_filtering/Makefile        |  2 +-
 examples/helloworld/Makefile            |  2 +-
 examples/ip_fragmentation/Makefile      |  2 +-
 examples/ip_pipeline/Makefile           |  2 +-
 examples/ip_reassembly/Makefile         |  2 +-
 examples/ipsec-secgw/Makefile           |  2 +-
 examples/ipv4_multicast/Makefile        |  2 +-
 examples/kni/Makefile                   |  2 +-
 examples/l2fwd-cat/Makefile             |  2 +-
 examples/l2fwd-crypto/Makefile          |  2 +-
 examples/l2fwd-jobstats/Makefile        |  2 +-
 examples/l2fwd-keepalive/Makefile       |  2 +-
 examples/l2fwd/Makefile                 |  2 +-
 examples/l3fwd-acl/Makefile             |  2 +-
 examples/l3fwd-power/Makefile           |  2 +-
 examples/l3fwd-vf/Makefile              |  2 +-
 examples/l3fwd/Makefile                 |  2 +-
 examples/link_status_interrupt/Makefile |  2 +-
 examples/load_balancer/Makefile         |  2 +-
 examples/meson.build                    | 35 ++++++++++++++++++++++---
 examples/packet_ordering/Makefile       |  2 +-
 examples/ptpclient/Makefile             |  2 +-
 examples/qos_meter/Makefile             |  2 +-
 examples/qos_sched/Makefile             |  2 +-
 examples/rxtx_callbacks/Makefile        |  2 +-
 examples/service_cores/Makefile         |  2 +-
 examples/skeleton/Makefile              |  2 +-
 examples/tep_termination/Makefile       |  2 +-
 examples/timer/Makefile                 |  2 +-
 examples/vhost/Makefile                 |  2 +-
 examples/vhost_scsi/Makefile            |  2 +-
 examples/vmdq/Makefile                  |  2 +-
 examples/vmdq_dcb/Makefile              |  2 +-
 meson.build                             |  7 +++--
 42 files changed, 75 insertions(+), 47 deletions(-)
Signature · 1 line
2.21.0
#19 lore raw

PATCH v3 1/3 examples: fix install of sample apps if setting not provided

While the examples were being installed into the appropriate install path when processing the examples/meson.build file, that file was only processed if the "examples" meson parameter was non-empty. Since we now do more than just build the examples, we need to unconditionally process the file.

Fixes 2daf565f91b5 ("examples: install as part of ninja install")
---
 examples/meson.build | 4 ++++
 meson.build          | 7 +++----
 2 files changed, 7 insertions(+), 4 deletions(-)
examples/meson.build +4 -0
index 1a6134f12..1995f4dcb 100644
@@ -19,6 +19,10 @@ foreach ex:all_examples
 			exclude_files: 'meson.build')
 endforeach
 
+if get_option('examples') == ''
+	subdir_done()
+endif
+
 if get_option('examples').to_lower() == 'all'
 	examples = all_examples
 	allow_skips = true # don't flag an error if we can't build an app
meson.build +3 -4
index 46f9c5683..9cad43481 100644
@@ -42,10 +42,9 @@ subdir('app')
 # build docs
 subdir('doc')
 
-# build any examples explicitly requested - useful for developers
-if get_option('examples') != ''
-	subdir('examples')
-endif
+# build any examples explicitly requested - useful for developers - and
+# install any example code into the appropriate install path
+subdir('examples')
 
 # build kernel modules if enabled
 if get_option('enable_kmods')
Signature · 1 line
2.21.0
#20 lore raw

PATCH v3 2/3 examples: remove auto-generation of examples list

In reply to Bruce Richardson

The examples/meson.build file scanned the filesystem to find all examples to build (for examples=all option) and install. However, using run_command and scanning the filesystem prevented ninja from properly detecting the addition or removal of any examples - one had to recreate the build directory from scratch to guarantee correct detection of all examples. This patch replaces this generated list with a static list of examples, thereby allowing proper tracking by ninja/meson, but at the cost of having to update this file when a new example is added or removed.

This also fixes an issue with Windows builds, since "sh" is not available there.

Fixes 2daf565f91b5 ("examples: install as part of ninja install")
---
 examples/meson.build | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)
examples/meson.build +28 -3
index 1995f4dcb..de35656d4 100644
@@ -8,9 +8,34 @@ endif
 
 execinfo = cc.find_library('execinfo', required: false)
 
-all_examples = run_command('sh', '-c',
-	'cd $MESON_SOURCE_ROOT/$MESON_SUBDIR && for d in * ; do if [ -d $d ] ; then echo $d ; fi ; done'
-	).stdout().split()
+# list of all example apps. Keep 1-3 per line, in alphabetical order.
+all_examples = [
+	'bbdev_app', 'bond',
+	'bpf', 'cmdline',
+	'distributor', 'ethtool',
+	'eventdev_pipeline', 'exception_path',
+	'fips_validation', 'flow_classify',
+	'flow_filtering', 'helloworld',
+	'ip_fragmentation', 'ip_pipeline',
+	'ip_reassembly', 'ipsec-secgw',
+	'ipv4_multicast', 'kni',
+	'l2fwd', 'l2fwd-cat',
+	'l2fwd-crypto', 'l2fwd-jobstats',
+	'l2fwd-keepalive', 'l3fwd',
+	'l3fwd-acl', 'l3fwd-power',
+	'l3fwd-vf', 'link_status_interrupt',
+	'load_balancer', 'multi_process',
+	'netmap_compat', 'packet_ordering',
+	'performance-thread', 'ptpclient',
+	'qos_meter', 'qos_sched',
+	'quota_watermark', 'rxtx_callbacks',
+	'server_node_efd', 'service_cores',
+	'skeleton', 'tep_termination',
+	'timer', 'vdpa',
+	'vhost', 'vhost_crypto',
+	'vhost_scsi', 'vm_power_manager',
+	'vmdq', 'vmdq_dcb',
+]
 # install all example code on install - irrespective of whether the example in
 # question is to be built as part of this build or not.
 foreach ex:all_examples
Signature · 1 line
2.21.0
#21 lore raw

PATCH v3 3/3 examples: fix make clean when using pkg-config for building

In reply to Bruce Richardson

The "make clean" command had a number of issues:
- the "--ignore-fail-on-non-empty" flag is not present on BSD
- the call to remove the build folder would fail if there was no build folder present.

These are fixed by only removing the build folder if it exists, and by using -p flag to rmdir in place of --ignore-fail-on-non-empty

Fixes 22119c4591a0 ("examples: use pkg-config in makefiles")
---
 examples/bbdev_app/Makefile             | 2 +-
 examples/bond/Makefile                  | 2 +-
 examples/cmdline/Makefile               | 2 +-
 examples/distributor/Makefile           | 2 +-
 examples/eventdev_pipeline/Makefile     | 2 +-
 examples/exception_path/Makefile        | 2 +-
 examples/fips_validation/Makefile       | 2 +-
 examples/flow_classify/Makefile         | 2 +-
 examples/flow_filtering/Makefile        | 2 +-
 examples/helloworld/Makefile            | 2 +-
 examples/ip_fragmentation/Makefile      | 2 +-
 examples/ip_pipeline/Makefile           | 2 +-
 examples/ip_reassembly/Makefile         | 2 +-
 examples/ipsec-secgw/Makefile           | 2 +-
 examples/ipv4_multicast/Makefile        | 2 +-
 examples/kni/Makefile                   | 2 +-
 examples/l2fwd-cat/Makefile             | 2 +-
 examples/l2fwd-crypto/Makefile          | 2 +-
 examples/l2fwd-jobstats/Makefile        | 2 +-
 examples/l2fwd-keepalive/Makefile       | 2 +-
 examples/l2fwd/Makefile                 | 2 +-
 examples/l3fwd-acl/Makefile             | 2 +-
 examples/l3fwd-power/Makefile           | 2 +-
 examples/l3fwd-vf/Makefile              | 2 +-
 examples/l3fwd/Makefile                 | 2 +-
 examples/link_status_interrupt/Makefile | 2 +-
 examples/load_balancer/Makefile         | 2 +-
 examples/packet_ordering/Makefile       | 2 +-
 examples/ptpclient/Makefile             | 2 +-
 examples/qos_meter/Makefile             | 2 +-
 examples/qos_sched/Makefile             | 2 +-
 examples/rxtx_callbacks/Makefile        | 2 +-
 examples/service_cores/Makefile         | 2 +-
 examples/skeleton/Makefile              | 2 +-
 examples/tep_termination/Makefile       | 2 +-
 examples/timer/Makefile                 | 2 +-
 examples/vhost/Makefile                 | 2 +-
 examples/vhost_scsi/Makefile            | 2 +-
 examples/vmdq/Makefile                  | 2 +-
 examples/vmdq_dcb/Makefile              | 2 +-
 40 files changed, 40 insertions(+), 40 deletions(-)
examples/bbdev_app/Makefile +1 -1
index e8115b46a..af313d926 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/bond/Makefile +1 -1
index 488eeac70..278b5f690 100644
@@ -39,7 +39,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/cmdline/Makefile +1 -1
index a03dfa8ee..03d9ed3cc 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/distributor/Makefile +1 -1
index 52076214b..2edc0ea3d 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/eventdev_pipeline/Makefile +1 -1
index 0b0d1ade9..1d3394947 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/exception_path/Makefile +1 -1
index 18db85ddb..c3ba2787c 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/fips_validation/Makefile +1 -1
index e74252e27..19240911a 100644
@@ -44,7 +44,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/flow_classify/Makefile +1 -1
index dfce1a4bd..182debcba 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/flow_filtering/Makefile +1 -1
index f657c0336..b182a2a29 100644
@@ -33,7 +33,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/helloworld/Makefile +1 -1
index 97d82f68a..980b011fc 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/ip_fragmentation/Makefile +1 -1
index 6d1a1fbba..56726d688 100644
@@ -36,7 +36,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/ip_pipeline/Makefile +1 -1
index 409966afd..acd93e29b 100644
@@ -55,7 +55,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP)* build/*.o
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/ip_reassembly/Makefile +1 -1
index 7bbc241c7..1baec86ad 100644
@@ -36,7 +36,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/ipsec-secgw/Makefile +1 -1
index 75f2bcd00..a2d8244e8 100644
@@ -48,7 +48,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/ipv4_multicast/Makefile +1 -1
index 5a1e368fa..5595b9cbf 100644
@@ -36,7 +36,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/kni/Makefile +1 -1
index 634334f86..e01703567 100644
@@ -36,7 +36,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l2fwd-cat/Makefile +1 -1
index fb3c4bc00..b4f729a66 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l2fwd-crypto/Makefile +1 -1
index ed5e2c73f..3986a4c10 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l2fwd-jobstats/Makefile +1 -1
index e14c3a2b2..4517a3d7d 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l2fwd-keepalive/Makefile +1 -1
index bc851b732..56d0e0666 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l2fwd/Makefile +1 -1
index 94d70a43e..43277318f 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l3fwd-acl/Makefile +1 -1
index fc236f129..b38343725 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l3fwd-power/Makefile +1 -1
index a106b0404..8a4eee8ae 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l3fwd-vf/Makefile +1 -1
index cc93603e3..8ad2fbcbc 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/l3fwd/Makefile +1 -1
index 8c51c7b96..dcc38a928 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/link_status_interrupt/Makefile +1 -1
index d12e04782..987724d47 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/load_balancer/Makefile +1 -1
index d4b145ca1..935ee1591 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/packet_ordering/Makefile +1 -1
index 474ec9571..2c3187a41 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/ptpclient/Makefile +1 -1
index f113c9d56..857a679b7 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/qos_meter/Makefile +1 -1
index fbcda09b2..7321f34f3 100644
@@ -37,7 +37,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/qos_sched/Makefile +1 -1
index a25875900..7012c3d4c 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/rxtx_callbacks/Makefile +1 -1
index b937d599b..22c4013db 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/service_cores/Makefile +1 -1
index 351fb7e1d..1dcd4c62e 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else
 
examples/skeleton/Makefile +1 -1
index 56713a524..b9cd05f2f 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/tep_termination/Makefile +1 -1
index f4b85e49b..3782378d9 100644
@@ -39,7 +39,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/timer/Makefile +1 -1
index 046348fd1..f49703ff4 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/vhost/Makefile +1 -1
index 80607b79c..9c3e0ece0 100644
@@ -39,7 +39,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/vhost_scsi/Makefile +1 -1
index 0a3450bae..813ab66a8 100644
@@ -38,7 +38,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/vmdq/Makefile +1 -1
index 6a389c776..b67d1937f 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
examples/vmdq_dcb/Makefile +1 -1
index 113bce7d1..0ddcc320b 100644
@@ -35,7 +35,7 @@ build:
 .PHONY: clean
 clean:
 	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-	rmdir --ignore-fail-on-non-empty build
+	test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
Signature · 1 line
2.21.0
#22 lore raw

Re: [dpdk-dev] [PATCH v3 0/3] Fixes for building examples

In reply to Bruce Richardson
Quoted 48 lines · Bruce Richardson

A small set of fixes for building examples, that was previously part of
the larger set, but pulled out separately for easier apply.

V3: changed patch 1, to properly quit processing examples/meson.build
if the examples list was empty.

Bruce Richardson (3):
examples: fix install of sample apps if setting not provided
examples: remove auto-generation of examples list
examples: fix make clean when using pkg-config for building

 examples/bbdev_app/Makefile             |  2 +-
 examples/bond/Makefile                  |  2 +-
 examples/cmdline/Makefile               |  2 +-
 examples/distributor/Makefile           |  2 +-
 examples/eventdev_pipeline/Makefile     |  2 +-
 examples/exception_path/Makefile        |  2 +-
 examples/fips_validation/Makefile       |  2 +-
 examples/flow_classify/Makefile         |  2 +-
 examples/flow_filtering/Makefile        |  2 +-
 examples/helloworld/Makefile            |  2 +-
 examples/ip_fragmentation/Makefile      |  2 +-
 examples/ip_pipeline/Makefile           |  2 +-
 examples/ip_reassembly/Makefile         |  2 +-
 examples/ipsec-secgw/Makefile           |  2 +-
 examples/ipv4_multicast/Makefile        |  2 +-
 examples/kni/Makefile                   |  2 +-
 examples/l2fwd-cat/Makefile             |  2 +-
 examples/l2fwd-crypto/Makefile          |  2 +-
 examples/l2fwd-jobstats/Makefile        |  2 +-
 examples/l2fwd-keepalive/Makefile       |  2 +-
 examples/l2fwd/Makefile                 |  2 +-
 examples/l3fwd-acl/Makefile             |  2 +-
 examples/l3fwd-power/Makefile           |  2 +-
 examples/l3fwd-vf/Makefile              |  2 +-
 examples/l3fwd/Makefile                 |  2 +-
 examples/link_status_interrupt/Makefile |  2 +-
 examples/load_balancer/Makefile         |  2 +-
 examples/meson.build                    | 35 ++++++++++++++++++++++-
--
 examples/packet_ordering/Makefile       |  2 +-
 examples/ptpclient/Makefile             |  2 +-
 examples/qos_meter/Makefile             |  2 +-
 examples/qos_sched/Makefile             |  2 +-
 examples/rxtx_callbacks/Makefile        |  2 +-
 examples/service_cores/Makefile         |  2 +-
 examples/skeleton/Makefile              |  2 +-
Quoted 8 lines
 examples/tep_termination/Makefile       |  2 +-
 examples/timer/Makefile                 |  2 +-
 examples/vhost/Makefile                 |  2 +-
 examples/vhost_scsi/Makefile            |  2 +-
 examples/vmdq/Makefile                  |  2 +-
 examples/vmdq_dcb/Makefile              |  2 +-
 meson.build                             |  7 +++--
 42 files changed, 75 insertions(+), 47 deletions(-)
Signature · 2 lines
Kind regards,
Luca Boccassi
#23 lore raw

Re: [dpdk-dev] [PATCH v3 0/3] Fixes for building examples

17/05/2019 15:12, Luca Boccassi:

Quoted 8 lines · Bruce Richardson
Quoted 7 lines

A small set of fixes for building examples, that was previously part of
the larger set, but pulled out separately for easier apply.

V3: changed patch 1, to properly quit processing examples/meson.build
if the examples list was empty.

Quoted 6 lines
Quoted 4 lines

Bruce Richardson (3):
examples: fix install of sample apps if setting not provided
examples: remove auto-generation of examples list
examples: fix make clean when using pkg-config for building

Applied, thanks

#24 lore raw

v2 cover improve building examples

In reply to Bruce Richardson

This patchset adds support for testing a number of examples using the DPDK pkgconfig file, allowing us to check that the file works. It also includes some more general cleanups for the examples, including adding support for building from pkg-config to a couple of examples which were missing that.

V2: separated out a few bug-fixes into a separate set from this one
changed to use --define-prefix flag for pkgconfig rather than a custom environment variable.

Bruce Richardson (5):
examples: add support for relocated DPDK install devtools/test-meson-builds: remove dependency on clang devtools/test-meson-builds: add testing of pkg-config file examples/vdpa: support building from pkg-config info examples/vhost_crypto: support building from pkg-config info

 devtools/test-meson-builds.sh           | 57 +++++++++++++++++--------
 examples/bbdev_app/Makefile             | 10 +++--
 examples/bond/Makefile                  | 10 +++--
 examples/cmdline/Makefile               | 10 +++--
 examples/distributor/Makefile           | 10 +++--
 examples/eventdev_pipeline/Makefile     | 10 +++--
 examples/exception_path/Makefile        | 10 +++--
 examples/fips_validation/Makefile       | 10 +++--
 examples/flow_classify/Makefile         | 10 +++--
 examples/flow_filtering/Makefile        | 10 +++--
 examples/helloworld/Makefile            | 10 +++--
 examples/ip_fragmentation/Makefile      | 10 +++--
 examples/ip_pipeline/Makefile           | 10 +++--
 examples/ip_reassembly/Makefile         | 10 +++--
 examples/ipsec-secgw/Makefile           | 10 +++--
 examples/ipv4_multicast/Makefile        | 10 +++--
 examples/kni/Makefile                   | 10 +++--
 examples/l2fwd-cat/Makefile             | 10 +++--
 examples/l2fwd-crypto/Makefile          | 10 +++--
 examples/l2fwd-jobstats/Makefile        | 10 +++--
 examples/l2fwd-keepalive/Makefile       | 10 +++--
 examples/l2fwd/Makefile                 | 10 +++--
 examples/l3fwd-acl/Makefile             | 10 +++--
 examples/l3fwd-power/Makefile           | 10 +++--
 examples/l3fwd-vf/Makefile              | 10 +++--
 examples/l3fwd/Makefile                 | 10 +++--
 examples/link_status_interrupt/Makefile | 10 +++--
 examples/load_balancer/Makefile         | 10 +++--
 examples/packet_ordering/Makefile       | 10 +++--
 examples/ptpclient/Makefile             | 10 +++--
 examples/qos_meter/Makefile             | 10 +++--
 examples/qos_sched/Makefile             | 10 +++--
 examples/rxtx_callbacks/Makefile        | 10 +++--
 examples/service_cores/Makefile         | 10 +++--
 examples/skeleton/Makefile              | 10 +++--
 examples/tep_termination/Makefile       | 10 +++--
 examples/timer/Makefile                 | 10 +++--
 examples/vdpa/Makefile                  | 52 ++++++++++++++++++----
 examples/vhost/Makefile                 | 10 +++--
 examples/vhost_crypto/Makefile          | 52 ++++++++++++++++++----
 examples/vhost_scsi/Makefile            | 10 +++--
 examples/vmdq/Makefile                  | 10 +++--
 examples/vmdq_dcb/Makefile              | 10 +++--
 43 files changed, 367 insertions(+), 194 deletions(-)
Signature · 1 line
2.21.0
#25 lore raw

PATCH v2 1/5 examples: add support for relocated DPDK install

For testing of DPDK, we want to override the prefix given by the pkg-config file, so that we can get correct paths for DPDK installed in an unusual location.

---
 examples/bbdev_app/Makefile             | 10 ++++++----
 examples/bond/Makefile                  | 10 ++++++----
 examples/cmdline/Makefile               | 10 ++++++----
 examples/distributor/Makefile           | 10 ++++++----
 examples/eventdev_pipeline/Makefile     | 10 ++++++----
 examples/exception_path/Makefile        | 10 ++++++----
 examples/fips_validation/Makefile       | 10 ++++++----
 examples/flow_classify/Makefile         | 10 ++++++----
 examples/flow_filtering/Makefile        | 10 ++++++----
 examples/helloworld/Makefile            | 10 ++++++----
 examples/ip_fragmentation/Makefile      | 10 ++++++----
 examples/ip_pipeline/Makefile           | 10 ++++++----
 examples/ip_reassembly/Makefile         | 10 ++++++----
 examples/ipsec-secgw/Makefile           | 10 ++++++----
 examples/ipv4_multicast/Makefile        | 10 ++++++----
 examples/kni/Makefile                   | 10 ++++++----
 examples/l2fwd-cat/Makefile             | 10 ++++++----
 examples/l2fwd-crypto/Makefile          | 10 ++++++----
 examples/l2fwd-jobstats/Makefile        | 10 ++++++----
 examples/l2fwd-keepalive/Makefile       | 10 ++++++----
 examples/l2fwd/Makefile                 | 10 ++++++----
 examples/l3fwd-acl/Makefile             | 10 ++++++----
 examples/l3fwd-power/Makefile           | 10 ++++++----
 examples/l3fwd-vf/Makefile              | 10 ++++++----
 examples/l3fwd/Makefile                 | 10 ++++++----
 examples/link_status_interrupt/Makefile | 10 ++++++----
 examples/load_balancer/Makefile         | 10 ++++++----
 examples/packet_ordering/Makefile       | 10 ++++++----
 examples/ptpclient/Makefile             | 10 ++++++----
 examples/qos_meter/Makefile             | 10 ++++++----
 examples/qos_sched/Makefile             | 10 ++++++----
 examples/rxtx_callbacks/Makefile        | 10 ++++++----
 examples/service_cores/Makefile         | 10 ++++++----
 examples/skeleton/Makefile              | 10 ++++++----
 examples/tep_termination/Makefile       | 10 ++++++----
 examples/timer/Makefile                 | 10 ++++++----
 examples/vhost/Makefile                 | 10 ++++++----
 examples/vhost_scsi/Makefile            | 10 ++++++----
 examples/vmdq/Makefile                  | 10 ++++++----
 examples/vmdq_dcb/Makefile              | 10 ++++++----
 40 files changed, 240 insertions(+), 160 deletions(-)
examples/bbdev_app/Makefile +6 -4
index af313d926..2bf97e415 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/bond/Makefile +6 -4
index 278b5f690..96868f2fc 100644
@@ -20,10 +20,12 @@ static: build/$(APP)-static
 
 LDFLAGS += -lrte_pmd_bond
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/cmdline/Makefile +6 -4
index 03d9ed3cc..9b757316f 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/distributor/Makefile +6 -4
index 2edc0ea3d..6aa5e7a9e 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/eventdev_pipeline/Makefile +6 -4
index 1d3394947..626d56024 100644
@@ -20,10 +20,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/exception_path/Makefile +6 -4
index c3ba2787c..dc891b3d1 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/fips_validation/Makefile +6 -4
index 19240911a..f8cbba592 100644
@@ -27,10 +27,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/flow_classify/Makefile +6 -4
index 182debcba..aca7772b4 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/flow_filtering/Makefile +6 -4
index b182a2a29..a64a10a08 100644
@@ -16,10 +16,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/helloworld/Makefile +6 -4
index 980b011fc..2ab294091 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/ip_fragmentation/Makefile +6 -4
index 56726d688..63b66ce25 100644
@@ -19,10 +19,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/ip_pipeline/Makefile +6 -4
index acd93e29b..1553d705d 100644
@@ -31,10 +31,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -I.
 
examples/ip_reassembly/Makefile +6 -4
index 1baec86ad..5af5d63bd 100644
@@ -19,10 +19,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/ipsec-secgw/Makefile +6 -4
index a2d8244e8..1bfaf3b9a 100644
@@ -29,10 +29,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/ipv4_multicast/Makefile +6 -4
index 5595b9cbf..a03bfadbf 100644
@@ -19,10 +19,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/kni/Makefile +6 -4
index e01703567..46f592692 100644
@@ -18,11 +18,13 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 CFLAGS += -DALLOW_EXPERIMENTAL_API
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l2fwd-cat/Makefile +6 -4
index b4f729a66..e83d406b0 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 LDFLAGS += -lpqos
 
examples/l2fwd-crypto/Makefile +6 -4
index 3986a4c10..87d311193 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l2fwd-jobstats/Makefile +6 -4
index 4517a3d7d..d63ece8e3 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l2fwd-keepalive/Makefile +6 -4
index 56d0e0666..9b92bc238 100644
@@ -20,10 +20,12 @@ static: build/$(APP)-static
 
 LDFLAGS += -pthread -lrt
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l2fwd/Makefile +6 -4
index 43277318f..fb352e1b7 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l3fwd-acl/Makefile +6 -4
index b38343725..d12d3a987 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l3fwd-power/Makefile +6 -4
index 8a4eee8ae..befb7555f 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/l3fwd-vf/Makefile +6 -4
index 8ad2fbcbc..892ecf38b 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l3fwd/Makefile +6 -4
index dcc38a928..52976880a 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/link_status_interrupt/Makefile +6 -4
index 987724d47..77774eda7 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/load_balancer/Makefile +6 -4
index 935ee1591..09676a57c 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/packet_ordering/Makefile +6 -4
index 2c3187a41..eb01b2d5b 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/ptpclient/Makefile +6 -4
index 857a679b7..019476a7a 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/qos_meter/Makefile +6 -4
index 7321f34f3..e4d170177 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/qos_sched/Makefile +6 -4
index 7012c3d4c..0c92c4866 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/rxtx_callbacks/Makefile +6 -4
index 22c4013db..15866ca67 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/service_cores/Makefile +6 -4
index 1dcd4c62e..ae7d6478c 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/skeleton/Makefile +6 -4
index b9cd05f2f..68454a558 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/tep_termination/Makefile +6 -4
index 3782378d9..be5aa9a64 100644
@@ -20,10 +20,12 @@ static: build/$(APP)-static
 
 LDFLAGS += -pthread
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -Wno-deprecated-declarations
 
examples/timer/Makefile +6 -4
index f49703ff4..d21e4c63c 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/vhost/Makefile +6 -4
index 9c3e0ece0..5e1400678 100644
@@ -20,10 +20,12 @@ static: build/$(APP)-static
 
 LDFLAGS += -pthread
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/vhost_scsi/Makefile +6 -4
index 813ab66a8..3ea37ebc6 100644
@@ -21,10 +21,12 @@ static: build/$(APP)-static
 CFLAGS += -D_FILE_OFFSET_BITS=64
 LDFLAGS += -pthread
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/vmdq/Makefile +6 -4
index b67d1937f..dc1bc82d0 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/vmdq_dcb/Makefile +6 -4
index 0ddcc320b..a77e78987 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
Signature · 1 line
2.21.0
#26 lore raw

PATCH v2 2/5 devtools/test-meson-builds: remove dependency on clang

In reply to Bruce Richardson

Allow the script to run with a reduced set of builds if clang, or other compilers, are missing.

---
 devtools/test-meson-builds.sh | 38 ++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 18 deletions(-)
devtools/test-meson-builds.sh +20 -18
index 630a1a6fe..fe11e3c0a 100755
@@ -28,23 +28,25 @@ build () # <directory> <meson options>
 {
 	builddir=$1
 	shift
-	if [ ! -f "$builddir/build.ninja" ] ; then
-		options="--werror -Dexamples=all $*"
-		echo "$MESON $options $srcdir $builddir"
-		$MESON $options $srcdir $builddir
-		unset CC
-	fi
-	if [ -n "$TEST_MESON_BUILD_VERY_VERBOSE" ] ; then
-		# for full output from ninja use "-v"
-		echo "$ninja_cmd -v -C $builddir"
-		$ninja_cmd -v -C $builddir
-	elif [ -n "$TEST_MESON_BUILD_VERBOSE" ] ; then
-		# for keeping the history of short cmds, pipe through cat
-		echo "$ninja_cmd -C $builddir | cat"
-		$ninja_cmd -C $builddir | cat
-	else
-		echo "$ninja_cmd -C $builddir"
-		$ninja_cmd -C $builddir
+	if command -v $CC >/dev/null 2>&1 ; then
+		if [ ! -f "$builddir/build.ninja" ] ; then
+			options="--werror -Dexamples=all $*"
+			echo "$MESON $options $srcdir $builddir"
+			$MESON $options $srcdir $builddir
+			unset CC
+		fi
+		if [ -n "$TEST_MESON_BUILD_VERY_VERBOSE" ] ; then
+			# for full output from ninja use "-v"
+			echo "$ninja_cmd -v -C $builddir"
+			$ninja_cmd -v -C $builddir
+		elif [ -n "$TEST_MESON_BUILD_VERBOSE" ] ; then
+			# for keeping the history of short cmds, pipe through cat
+			echo "$ninja_cmd -C $builddir | cat"
+			$ninja_cmd -C $builddir | cat
+		else
+			echo "$ninja_cmd -C $builddir"
+			$ninja_cmd -C $builddir
+		fi
 	fi
 }
 
@@ -80,7 +82,7 @@ build build-x86-default -Dmachine=$default_machine $use_shared
 c=aarch64-linux-gnu-gcc
 if command -v $c >/dev/null 2>&1 ; then
 	# compile the general v8a also for clang to increase coverage
-	export CC="ccache clang"
+	export CC="clang"
 	build build-arm64-host-clang $use_shared \
 		--cross-file $srcdir/config/arm/arm64_armv8_linux_gcc
 
Signature · 1 line
2.21.0
#27 lore raw

PATCH v2 3/5 devtools/test-meson-builds: add testing of pkg-config file

In reply to Bruce Richardson

The pkg-config file generated as part of the build of DPDK should allow applications to be built with an installed DPDK. We can test this as part of the build by doing an install of DPDK to a temporary directory within the build folder, and by then compiling up a few sample apps using make working off that directory.

---
 devtools/test-meson-builds.sh | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
devtools/test-meson-builds.sh +19 -0
index fe11e3c0a..57d1af47e 100755
@@ -15,6 +15,11 @@ srcdir=$(dirname $(readlink -f $0))/..
 MESON=${MESON:-meson}
 use_shared="--default-library=shared"
 
+if command -v gmake >/dev/null 2>&1 ; then
+	MAKE=gmake
+else
+	MAKE=make
+fi
 if command -v ninja >/dev/null 2>&1 ; then
 	ninja_cmd=ninja
 elif command -v ninja-build >/dev/null 2>&1 ; then
@@ -92,3 +97,17 @@ if command -v $c >/dev/null 2>&1 ; then
 			$use_shared --cross-file $f
 	done
 fi
+
+# Test installation of the x86-default target, to be used for checking
+# the sample apps build using the pkg-config file for cflags and libs
+build_path=build-x86-default
+export DESTDIR=$(pwd)/$build_path/install-root
+$ninja_cmd -C $build_path install
+
+pc_file=$(find $DESTDIR -name libdpdk.pc)
+export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH
+
+for example in cmdline helloworld l2fwd l3fwd skeleton timer; do
+	echo "## Building $example"
+	$MAKE -C $DESTDIR/usr/local/share/dpdk/examples/$example clean all
+done
Signature · 1 line
2.21.0
#28 lore raw

PATCH v2 4/5 examples/vdpa: support building from pkg-config info

In reply to Bruce Richardson

The vdpa example app did not check for a libdpdk pkg-config file and attempt to build using that. Add support for that method of compile to align the app with the other examples.

---
 examples/vdpa/Makefile | 52 +++++++++++++++++++++++++++++++++++-------
 1 file changed, 44 insertions(+), 8 deletions(-)
examples/vdpa/Makefile +44 -8
index 9d16d8eb5..05a9b9029 100644
@@ -1,6 +1,47 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
+# binary name
+APP = vdpa
+
+# all source are stored in SRCS-y
+SRCS-y := main.c
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+all: shared
+.PHONY: shared static
+shared: build/$(APP)-shared
+	ln -sf $(APP)-shared build/$(APP)
+static: build/$(APP)-static
+	ln -sf $(APP)-static build/$(APP)
+
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
+
+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
+	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
+
+build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
+	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
+
+build:
+	@mkdir -p $@
+
+.PHONY: clean
+clean:
+	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
+	test -d build && rmdir -p build || true
+
+else
+
 ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
@@ -16,17 +57,12 @@ please change the definition of the RTE_TARGET environment variable)
 all:
 else
 
-# binary name
-APP = vdpa
-
-# all source are stored in SRCS-y
-SRCS-y := main.c
-
 CFLAGS += -O2 -D_FILE_OFFSET_BITS=64
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -D_GNU_SOURCE
-CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 include $(RTE_SDK)/mk/rte.extapp.mk
 
-endif
+endif # linuxapp
+
+endif # pkg-config
Signature · 1 line
2.21.0
#29 lore raw

Re: [dpdk-dev] [PATCH v2 4/5] examples/vdpa: support building from pkg-config info

17/05/2019 13:47, Bruce Richardson:

Quoted 3 lines

The vdpa example app did not check for a libdpdk pkg-config file and attempt to build using that. Add support for that method of compile to align the app with the other examples.

I see an issue with the experimental tag:

clang -Wp,-MD,./.main.o.d.tmp -m64 -pthread -fPIC -Ilib/librte_eal/linux/eal/include -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX -DRTE_MACHINE_CPUFLAG_RDRAND -DRTE_MACHINE_CPUFLAG_RDSEED -DRTE_MACHINE_CPUFLAG_FSGSBASE -DRTE_MACHINE_CPUFLAG_F16C -DRTE_MACHINE_CPUFLAG_AVX2 -Ix86_64-native-linux-clang+shared+next+debug+ASSERT/examples/vdpa/x86_64-native-linux-clang+shared+next+debug+ASSERT/include -Ix86_64-native-linux-clang+shared+next+debug+ASSERT/include -include x86_64-native-linux-clang+shared+next+debug+ASSERT/include/rte_config.h -D_GNU_SOURCE -O2 -D_FILE_OFFSET_BITS=64 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wpointer-arith -Wnested-externs -Wcast-qual -Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -Wdeprecated -Werror -Wno-missing-field-initializers -Wno-address-of-packed-member -D_GNU_SOURCE -o main.o -c examples/vdpa/main.c
examples/vdpa/main.c:172:8: error: 'rte_vhost_driver_attach_vdpa_device' is deprecated: Symbol is not yet part of stable ABI [-Werror,-Wdeprecated-declarations]

It seems "CFLAGS += -DALLOW_EXPERIMENTAL_API"
is reset by the call to pkg-config.

Quoted 1 line

+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build

Better to use the real directory name as prerequisite, instead of "build".

#30 lore raw

Re: [dpdk-dev] [PATCH v2 4/5] examples/vdpa: support building from pkg-config info

Quoted 5 lines · Thomas Monjalon

17/05/2019 13:47, Bruce Richardson:

Quoted 3 lines

The vdpa example app did not check for a libdpdk pkg-config file and attempt to build using that. Add support for that method of compile to align the app with the other examples.

Quoted 8 lines

I see an issue with the experimental tag:

clang -Wp,-MD,./.main.o.d.tmp -m64 -pthread -fPIC -Ilib/librte_eal/linux/eal/include -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX -DRTE_MACHINE_CPUFLAG_RDRAND -DRTE_MACHINE_CPUFLAG_RDSEED -DRTE_MACHINE_CPUFLAG_FSGSBASE -DRTE_MACHINE_CPUFLAG_F16C -DRTE_MACHINE_CPUFLAG_AVX2 -Ix86_64-native-linux-clang+shared+next+debug+ASSERT/examples/vdpa/x86_64-native-linux-clang+shared+next+debug+ASSERT/include -Ix86_64-native-linux-clang+shared+next+debug+ASSERT/include -include x86_64-native-linux-clang+shared+next+debug+ASSERT/include/rte_config.h -D_GNU_SOURCE -O2 -D_FILE_OFFSET_BITS=64 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wpointer-arith -Wnested-externs -Wcast-qual -Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -Wdeprecated -Werror -Wno-missing-field-initializers -Wno-address-of-packed-member -D_GNU_SOURCE -o main.o -c examples/vdpa/main.c
examples/vdpa/main.c:172:8: error: 'rte_vhost_driver_attach_vdpa_device' is deprecated: Symbol is not yet part of stable ABI [-Werror,-Wdeprecated-declarations]

It seems "CFLAGS += -DALLOW_EXPERIMENTAL_API"
is reset by the call to pkg-config.

No, it's not, it's reset by the call to the DPDK make build system in the other leg of the code. I'll fix this in the Makefile in v3.

Quoted 5 lines
Quoted 1 line

+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build

Better to use the real directory name as prerequisite, instead of "build".

Not sure what you mean here, build is the name of the directory. [This is also consistent with what is done in all the other example makefiles. If it needs updating, then it should be done as a general patch to all examples in 19.11 release timeframe.]

/Bruce

#31 lore raw

Re: [dpdk-dev] [PATCH v2 4/5] examples/vdpa: support building from pkg-config info

02/07/2019 16:35, Bruce Richardson:

Quoted 7 lines · Thomas Monjalon
Quoted 3 lines

It seems "CFLAGS += -DALLOW_EXPERIMENTAL_API"
is reset by the call to pkg-config.

No, it's not, it's reset by the call to the DPDK make build system in the other leg of the code. I'll fix this in the Makefile in v3.

OK

Quoted 9 lines
Quoted 5 lines
Quoted 1 line

+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build

Better to use the real directory name as prerequisite, instead of "build".

Not sure what you mean here, build is the name of the directory. [This is also consistent with what is done in all the other example makefiles. If it needs updating, then it should be done as a general patch to all examples in 19.11 release timeframe.]

Ah my bad, I overlooked it :)

#32 lore raw

PATCH v2 5/5 examples/vhost_crypto: support building from pkg-config info

In reply to Bruce Richardson

The vhost_crypto example app did not check for a libdpdk pkg-config file and attempt to build using that. Add support for that method of compile to align the app with the other examples.

---
 examples/vhost_crypto/Makefile | 52 ++++++++++++++++++++++++++++------
 1 file changed, 44 insertions(+), 8 deletions(-)
examples/vhost_crypto/Makefile +44 -8
index 80af3de0c..f22d7b6d3 100644
@@ -1,6 +1,47 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2018 Intel Corporation
 
+# binary name
+APP = vhost-crypto
+
+# all source are stored in SRCS-y
+SRCS-y := main.c
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+all: shared
+.PHONY: shared static
+shared: build/$(APP)-shared
+	ln -sf $(APP)-shared build/$(APP)
+static: build/$(APP)-static
+	ln -sf $(APP)-static build/$(APP)
+
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
+
+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
+	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
+
+build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
+	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
+
+build:
+	@mkdir -p $@
+
+.PHONY: clean
+clean:
+	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
+	test -d build && rmdir -p build || true
+
+else
+
 ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
@@ -16,16 +57,11 @@ please change the definition of the RTE_TARGET environment variable)
 all:
 else
 
-# binary name
-APP = vhost-crypto
-
-# all source are stored in SRCS-y
-SRCS-y := main.c
-
-CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -O2 -D_FILE_OFFSET_BITS=64
 CFLAGS += $(WERROR_FLAGS)
 
 include $(RTE_SDK)/mk/rte.extapp.mk
 
-endif
+endif # Linux
+
+endif # pkg-config
Signature · 1 line
2.21.0
#33 lore raw
In reply to Bruce Richardson
Quoted 57 lines · Bruce Richardson

This patchset adds support for testing a number of examples using the DPDK pkgconfig file, allowing us to check that the file works. It also
includes some more general cleanups for the examples, including adding
support for building from pkg-config to a couple of examples which were
missing that.

V2: separated out a few bug-fixes into a separate set from this one
changed to use --define-prefix flag for pkgconfig rather than a custom environment variable.

Bruce Richardson (5):
examples: add support for relocated DPDK install devtools/test-meson-builds: remove dependency on clang devtools/test-meson-builds: add testing of pkg-config file examples/vdpa: support building from pkg-config info examples/vhost_crypto: support building from pkg-config info

 devtools/test-meson-builds.sh           | 57 +++++++++++++++++----
----
 examples/bbdev_app/Makefile             | 10 +++--
 examples/bond/Makefile                  | 10 +++--
 examples/cmdline/Makefile               | 10 +++--
 examples/distributor/Makefile           | 10 +++--
 examples/eventdev_pipeline/Makefile     | 10 +++--
 examples/exception_path/Makefile        | 10 +++--
 examples/fips_validation/Makefile       | 10 +++--
 examples/flow_classify/Makefile         | 10 +++--
 examples/flow_filtering/Makefile        | 10 +++--
 examples/helloworld/Makefile            | 10 +++--
 examples/ip_fragmentation/Makefile      | 10 +++--
 examples/ip_pipeline/Makefile           | 10 +++--
 examples/ip_reassembly/Makefile         | 10 +++--
 examples/ipsec-secgw/Makefile           | 10 +++--
 examples/ipv4_multicast/Makefile        | 10 +++--
 examples/kni/Makefile                   | 10 +++--
 examples/l2fwd-cat/Makefile             | 10 +++--
 examples/l2fwd-crypto/Makefile          | 10 +++--
 examples/l2fwd-jobstats/Makefile        | 10 +++--
 examples/l2fwd-keepalive/Makefile       | 10 +++--
 examples/l2fwd/Makefile                 | 10 +++--
 examples/l3fwd-acl/Makefile             | 10 +++--
 examples/l3fwd-power/Makefile           | 10 +++--
 examples/l3fwd-vf/Makefile              | 10 +++--
 examples/l3fwd/Makefile                 | 10 +++--
 examples/link_status_interrupt/Makefile | 10 +++--
 examples/load_balancer/Makefile         | 10 +++--
 examples/packet_ordering/Makefile       | 10 +++--
 examples/ptpclient/Makefile             | 10 +++--
 examples/qos_meter/Makefile             | 10 +++--
 examples/qos_sched/Makefile             | 10 +++--
 examples/rxtx_callbacks/Makefile        | 10 +++--
 examples/service_cores/Makefile         | 10 +++--
 examples/skeleton/Makefile              | 10 +++--
 examples/tep_termination/Makefile       | 10 +++--
Quoted 8 lines
 examples/timer/Makefile                 | 10 +++--
 examples/vdpa/Makefile                  | 52 ++++++++++++++++++----
 examples/vhost/Makefile                 | 10 +++--
 examples/vhost_crypto/Makefile          | 52 ++++++++++++++++++----
 examples/vhost_scsi/Makefile            | 10 +++--
 examples/vmdq/Makefile                  | 10 +++--
 examples/vmdq_dcb/Makefile              | 10 +++--
 43 files changed, 367 insertions(+), 194 deletions(-)
Signature · 2 lines
Kind regards,
Luca Boccassi
#34 lore raw

v3 cover improve building examples

In reply to Bruce Richardson

This patchset adds support for testing a number of examples using the DPDK pkgconfig file, allowing us to check that the file works. It also includes some more general cleanups for the examples, including adding support for building from pkg-config to a couple of examples which were missing that.

V3:
* fix missing -DUSE_EXPERIMENTAL_API cflag when building using "make examples"

V2:
* separated out a few bug-fixes into a separate set from this one
* changed to use --define-prefix flag for pkgconfig rather than a custom environment variable.

Bruce Richardson (5):
examples: add support for relocated DPDK install devtools/test-meson-builds: remove dependency on clang devtools/test-meson-builds: add testing of pkg-config file examples/vdpa: support building from pkg-config info examples/vhost_crypto: support building from pkg-config info

 devtools/test-meson-builds.sh           | 57 +++++++++++++++++--------
 examples/bbdev_app/Makefile             | 10 +++--
 examples/bond/Makefile                  | 10 +++--
 examples/cmdline/Makefile               | 10 +++--
 examples/distributor/Makefile           | 10 +++--
 examples/eventdev_pipeline/Makefile     | 10 +++--
 examples/exception_path/Makefile        | 10 +++--
 examples/fips_validation/Makefile       | 10 +++--
 examples/flow_classify/Makefile         | 10 +++--
 examples/flow_filtering/Makefile        | 10 +++--
 examples/helloworld/Makefile            | 10 +++--
 examples/ip_fragmentation/Makefile      | 10 +++--
 examples/ip_pipeline/Makefile           | 10 +++--
 examples/ip_reassembly/Makefile         | 10 +++--
 examples/ipsec-secgw/Makefile           | 10 +++--
 examples/ipv4_multicast/Makefile        | 10 +++--
 examples/kni/Makefile                   | 10 +++--
 examples/l2fwd-cat/Makefile             | 10 +++--
 examples/l2fwd-crypto/Makefile          | 10 +++--
 examples/l2fwd-jobstats/Makefile        | 10 +++--
 examples/l2fwd-keepalive/Makefile       | 10 +++--
 examples/l2fwd/Makefile                 | 10 +++--
 examples/l3fwd-acl/Makefile             | 10 +++--
 examples/l3fwd-power/Makefile           | 10 +++--
 examples/l3fwd-vf/Makefile              | 10 +++--
 examples/l3fwd/Makefile                 | 10 +++--
 examples/link_status_interrupt/Makefile | 10 +++--
 examples/load_balancer/Makefile         | 10 +++--
 examples/packet_ordering/Makefile       | 10 +++--
 examples/ptpclient/Makefile             | 10 +++--
 examples/qos_meter/Makefile             | 10 +++--
 examples/qos_sched/Makefile             | 10 +++--
 examples/rxtx_callbacks/Makefile        | 10 +++--
 examples/service_cores/Makefile         | 10 +++--
 examples/skeleton/Makefile              | 10 +++--
 examples/tep_termination/Makefile       | 10 +++--
 examples/timer/Makefile                 | 10 +++--
 examples/vdpa/Makefile                  | 51 +++++++++++++++++++---
 examples/vhost/Makefile                 | 10 +++--
 examples/vhost_crypto/Makefile          | 51 +++++++++++++++++++---
 examples/vhost_scsi/Makefile            | 10 +++--
 examples/vmdq/Makefile                  | 10 +++--
 examples/vmdq_dcb/Makefile              | 10 +++--
 43 files changed, 367 insertions(+), 192 deletions(-)
Signature · 1 line
2.21.0
#35 lore raw

PATCH v3 1/5 examples: add support for relocated DPDK install

For testing of DPDK, we want to override the prefix given by the pkg-config file, so that we can get correct paths for DPDK installed in an unusual location.

---
 examples/bbdev_app/Makefile             | 10 ++++++----
 examples/bond/Makefile                  | 10 ++++++----
 examples/cmdline/Makefile               | 10 ++++++----
 examples/distributor/Makefile           | 10 ++++++----
 examples/eventdev_pipeline/Makefile     | 10 ++++++----
 examples/exception_path/Makefile        | 10 ++++++----
 examples/fips_validation/Makefile       | 10 ++++++----
 examples/flow_classify/Makefile         | 10 ++++++----
 examples/flow_filtering/Makefile        | 10 ++++++----
 examples/helloworld/Makefile            | 10 ++++++----
 examples/ip_fragmentation/Makefile      | 10 ++++++----
 examples/ip_pipeline/Makefile           | 10 ++++++----
 examples/ip_reassembly/Makefile         | 10 ++++++----
 examples/ipsec-secgw/Makefile           | 10 ++++++----
 examples/ipv4_multicast/Makefile        | 10 ++++++----
 examples/kni/Makefile                   | 10 ++++++----
 examples/l2fwd-cat/Makefile             | 10 ++++++----
 examples/l2fwd-crypto/Makefile          | 10 ++++++----
 examples/l2fwd-jobstats/Makefile        | 10 ++++++----
 examples/l2fwd-keepalive/Makefile       | 10 ++++++----
 examples/l2fwd/Makefile                 | 10 ++++++----
 examples/l3fwd-acl/Makefile             | 10 ++++++----
 examples/l3fwd-power/Makefile           | 10 ++++++----
 examples/l3fwd-vf/Makefile              | 10 ++++++----
 examples/l3fwd/Makefile                 | 10 ++++++----
 examples/link_status_interrupt/Makefile | 10 ++++++----
 examples/load_balancer/Makefile         | 10 ++++++----
 examples/packet_ordering/Makefile       | 10 ++++++----
 examples/ptpclient/Makefile             | 10 ++++++----
 examples/qos_meter/Makefile             | 10 ++++++----
 examples/qos_sched/Makefile             | 10 ++++++----
 examples/rxtx_callbacks/Makefile        | 10 ++++++----
 examples/service_cores/Makefile         | 10 ++++++----
 examples/skeleton/Makefile              | 10 ++++++----
 examples/tep_termination/Makefile       | 10 ++++++----
 examples/timer/Makefile                 | 10 ++++++----
 examples/vhost/Makefile                 | 10 ++++++----
 examples/vhost_scsi/Makefile            | 10 ++++++----
 examples/vmdq/Makefile                  | 10 ++++++----
 examples/vmdq_dcb/Makefile              | 10 ++++++----
 40 files changed, 240 insertions(+), 160 deletions(-)
examples/bbdev_app/Makefile +6 -4
index af313d926..2bf97e415 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/bond/Makefile +6 -4
index 278b5f690..96868f2fc 100644
@@ -20,10 +20,12 @@ static: build/$(APP)-static
 
 LDFLAGS += -lrte_pmd_bond
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/cmdline/Makefile +6 -4
index 03d9ed3cc..9b757316f 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/distributor/Makefile +6 -4
index 2edc0ea3d..6aa5e7a9e 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/eventdev_pipeline/Makefile +6 -4
index 1d3394947..626d56024 100644
@@ -20,10 +20,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/exception_path/Makefile +6 -4
index c3ba2787c..dc891b3d1 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/fips_validation/Makefile +6 -4
index 19240911a..f8cbba592 100644
@@ -27,10 +27,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/flow_classify/Makefile +6 -4
index 182debcba..aca7772b4 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/flow_filtering/Makefile +6 -4
index b182a2a29..a64a10a08 100644
@@ -16,10 +16,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/helloworld/Makefile +6 -4
index 980b011fc..2ab294091 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/ip_fragmentation/Makefile +6 -4
index 56726d688..63b66ce25 100644
@@ -19,10 +19,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/ip_pipeline/Makefile +6 -4
index acd93e29b..1553d705d 100644
@@ -31,10 +31,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -I.
 
examples/ip_reassembly/Makefile +6 -4
index 1baec86ad..5af5d63bd 100644
@@ -19,10 +19,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/ipsec-secgw/Makefile +6 -4
index a2d8244e8..1bfaf3b9a 100644
@@ -29,10 +29,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/ipv4_multicast/Makefile +6 -4
index 5595b9cbf..a03bfadbf 100644
@@ -19,10 +19,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/kni/Makefile +6 -4
index e01703567..46f592692 100644
@@ -18,11 +18,13 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 CFLAGS += -DALLOW_EXPERIMENTAL_API
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l2fwd-cat/Makefile +6 -4
index b4f729a66..e83d406b0 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 LDFLAGS += -lpqos
 
examples/l2fwd-crypto/Makefile +6 -4
index 3986a4c10..87d311193 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l2fwd-jobstats/Makefile +6 -4
index 4517a3d7d..d63ece8e3 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l2fwd-keepalive/Makefile +6 -4
index 56d0e0666..9b92bc238 100644
@@ -20,10 +20,12 @@ static: build/$(APP)-static
 
 LDFLAGS += -pthread -lrt
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l2fwd/Makefile +6 -4
index 43277318f..fb352e1b7 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l3fwd-acl/Makefile +6 -4
index b38343725..d12d3a987 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l3fwd-power/Makefile +6 -4
index 2b749d5c3..359f323dc 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/l3fwd-vf/Makefile +6 -4
index 8ad2fbcbc..892ecf38b 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/l3fwd/Makefile +6 -4
index dcc38a928..52976880a 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/link_status_interrupt/Makefile +6 -4
index 987724d47..77774eda7 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/load_balancer/Makefile +6 -4
index 935ee1591..09676a57c 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/packet_ordering/Makefile +6 -4
index 2c3187a41..eb01b2d5b 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/ptpclient/Makefile +6 -4
index 857a679b7..019476a7a 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/qos_meter/Makefile +6 -4
index 7321f34f3..e4d170177 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/qos_sched/Makefile +6 -4
index 7012c3d4c..0c92c4866 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/rxtx_callbacks/Makefile +6 -4
index a2fb1e3b0..2ababd2e4 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/service_cores/Makefile +6 -4
index 1dcd4c62e..ae7d6478c 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/skeleton/Makefile +6 -4
index b9cd05f2f..68454a558 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/tep_termination/Makefile +6 -4
index 3782378d9..be5aa9a64 100644
@@ -20,10 +20,12 @@ static: build/$(APP)-static
 
 LDFLAGS += -pthread
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -Wno-deprecated-declarations
 
examples/timer/Makefile +6 -4
index f49703ff4..d21e4c63c 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/vhost/Makefile +6 -4
index 9c3e0ece0..5e1400678 100644
@@ -20,10 +20,12 @@ static: build/$(APP)-static
 
 LDFLAGS += -pthread
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
examples/vhost_scsi/Makefile +6 -4
index 813ab66a8..3ea37ebc6 100644
@@ -21,10 +21,12 @@ static: build/$(APP)-static
 CFLAGS += -D_FILE_OFFSET_BITS=64
 LDFLAGS += -pthread
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/vmdq/Makefile +6 -4
index b67d1937f..dc1bc82d0 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
examples/vmdq_dcb/Makefile +6 -4
index 0ddcc320b..a77e78987 100644
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
 	ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
Signature · 1 line
2.21.0
#36 lore raw

PATCH v3 2/5 devtools/test-meson-builds: remove dependency on clang

In reply to Bruce Richardson

Allow the script to run with a reduced set of builds if clang, or other compilers, are missing.

---
 devtools/test-meson-builds.sh | 38 ++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 18 deletions(-)
devtools/test-meson-builds.sh +20 -18
index 630a1a6fe..fe11e3c0a 100755
@@ -28,23 +28,25 @@ build () # <directory> <meson options>
 {
 	builddir=$1
 	shift
-	if [ ! -f "$builddir/build.ninja" ] ; then
-		options="--werror -Dexamples=all $*"
-		echo "$MESON $options $srcdir $builddir"
-		$MESON $options $srcdir $builddir
-		unset CC
-	fi
-	if [ -n "$TEST_MESON_BUILD_VERY_VERBOSE" ] ; then
-		# for full output from ninja use "-v"
-		echo "$ninja_cmd -v -C $builddir"
-		$ninja_cmd -v -C $builddir
-	elif [ -n "$TEST_MESON_BUILD_VERBOSE" ] ; then
-		# for keeping the history of short cmds, pipe through cat
-		echo "$ninja_cmd -C $builddir | cat"
-		$ninja_cmd -C $builddir | cat
-	else
-		echo "$ninja_cmd -C $builddir"
-		$ninja_cmd -C $builddir
+	if command -v $CC >/dev/null 2>&1 ; then
+		if [ ! -f "$builddir/build.ninja" ] ; then
+			options="--werror -Dexamples=all $*"
+			echo "$MESON $options $srcdir $builddir"
+			$MESON $options $srcdir $builddir
+			unset CC
+		fi
+		if [ -n "$TEST_MESON_BUILD_VERY_VERBOSE" ] ; then
+			# for full output from ninja use "-v"
+			echo "$ninja_cmd -v -C $builddir"
+			$ninja_cmd -v -C $builddir
+		elif [ -n "$TEST_MESON_BUILD_VERBOSE" ] ; then
+			# for keeping the history of short cmds, pipe through cat
+			echo "$ninja_cmd -C $builddir | cat"
+			$ninja_cmd -C $builddir | cat
+		else
+			echo "$ninja_cmd -C $builddir"
+			$ninja_cmd -C $builddir
+		fi
 	fi
 }
 
@@ -80,7 +82,7 @@ build build-x86-default -Dmachine=$default_machine $use_shared
 c=aarch64-linux-gnu-gcc
 if command -v $c >/dev/null 2>&1 ; then
 	# compile the general v8a also for clang to increase coverage
-	export CC="ccache clang"
+	export CC="clang"
 	build build-arm64-host-clang $use_shared \
 		--cross-file $srcdir/config/arm/arm64_armv8_linux_gcc
 
Signature · 1 line
2.21.0
#37 lore raw

PATCH v3 3/5 devtools/test-meson-builds: add testing of pkg-config file

In reply to Bruce Richardson

The pkg-config file generated as part of the build of DPDK should allow applications to be built with an installed DPDK. We can test this as part of the build by doing an install of DPDK to a temporary directory within the build folder, and by then compiling up a few sample apps using make working off that directory.

---
 devtools/test-meson-builds.sh | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
devtools/test-meson-builds.sh +19 -0
index fe11e3c0a..57d1af47e 100755
@@ -15,6 +15,11 @@ srcdir=$(dirname $(readlink -f $0))/..
 MESON=${MESON:-meson}
 use_shared="--default-library=shared"
 
+if command -v gmake >/dev/null 2>&1 ; then
+	MAKE=gmake
+else
+	MAKE=make
+fi
 if command -v ninja >/dev/null 2>&1 ; then
 	ninja_cmd=ninja
 elif command -v ninja-build >/dev/null 2>&1 ; then
@@ -92,3 +97,17 @@ if command -v $c >/dev/null 2>&1 ; then
 			$use_shared --cross-file $f
 	done
 fi
+
+# Test installation of the x86-default target, to be used for checking
+# the sample apps build using the pkg-config file for cflags and libs
+build_path=build-x86-default
+export DESTDIR=$(pwd)/$build_path/install-root
+$ninja_cmd -C $build_path install
+
+pc_file=$(find $DESTDIR -name libdpdk.pc)
+export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH
+
+for example in cmdline helloworld l2fwd l3fwd skeleton timer; do
+	echo "## Building $example"
+	$MAKE -C $DESTDIR/usr/local/share/dpdk/examples/$example clean all
+done
Signature · 1 line
2.21.0
#38 lore raw

PATCH v3 4/5 examples/vdpa: support building from pkg-config info

In reply to Bruce Richardson

The vdpa example app did not check for a libdpdk pkg-config file and attempt to build using that. Add support for that method of compile to align the app with the other examples.

---
 examples/vdpa/Makefile | 51 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 44 insertions(+), 7 deletions(-)
examples/vdpa/Makefile +44 -7
index ab2bbdf76..734042380 100644
@@ -1,6 +1,47 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
+# binary name
+APP = vdpa
+
+# all source are stored in SRCS-y
+SRCS-y := main.c
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+all: shared
+.PHONY: shared static
+shared: build/$(APP)-shared
+	ln -sf $(APP)-shared build/$(APP)
+static: build/$(APP)-static
+	ln -sf $(APP)-static build/$(APP)
+
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
+
+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
+	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
+
+build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
+	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
+
+build:
+	@mkdir -p $@
+
+.PHONY: clean
+clean:
+	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
+	test -d build && rmdir -p build || true
+
+else
+
 ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
@@ -16,12 +57,6 @@ please change the definition of the RTE_TARGET environment variable)
 all:
 else
 
-# binary name
-APP = vdpa
-
-# all source are stored in SRCS-y
-SRCS-y := main.c
-
 CFLAGS += -O2 -D_FILE_OFFSET_BITS=64
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -D_GNU_SOURCE
@@ -29,4 +64,6 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 include $(RTE_SDK)/mk/rte.extapp.mk
 
-endif
+endif # linuxapp
+
+endif # pkg-config
Signature · 1 line
2.21.0
#39 lore raw

PATCH v3 5/5 examples/vhost_crypto: support building from pkg-config info

In reply to Bruce Richardson

The vhost_crypto example app did not check for a libdpdk pkg-config file and attempt to build using that. Add support for that method of compile to align the app with the other examples.

---
 examples/vhost_crypto/Makefile | 51 +++++++++++++++++++++++++++++-----
 1 file changed, 44 insertions(+), 7 deletions(-)
examples/vhost_crypto/Makefile +44 -7
index 80af3de0c..e7958b5ba 100644
@@ -1,6 +1,47 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2018 Intel Corporation
 
+# binary name
+APP = vhost-crypto
+
+# all source are stored in SRCS-y
+SRCS-y := main.c
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+all: shared
+.PHONY: shared static
+shared: build/$(APP)-shared
+	ln -sf $(APP)-shared build/$(APP)
+static: build/$(APP)-static
+	ln -sf $(APP)-static build/$(APP)
+
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
+
+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
+	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
+
+build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
+	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
+
+build:
+	@mkdir -p $@
+
+.PHONY: clean
+clean:
+	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
+	test -d build && rmdir -p build || true
+
+else
+
 ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
@@ -16,16 +57,12 @@ please change the definition of the RTE_TARGET environment variable)
 all:
 else
 
-# binary name
-APP = vhost-crypto
-
-# all source are stored in SRCS-y
-SRCS-y := main.c
-
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -O2 -D_FILE_OFFSET_BITS=64
 CFLAGS += $(WERROR_FLAGS)
 
 include $(RTE_SDK)/mk/rte.extapp.mk
 
-endif
+endif # Linux
+
+endif # pkg-config
Signature · 1 line
2.21.0
#40 lore raw
In reply to Bruce Richardson
Quoted 6 lines

Bruce Richardson (5):
examples: add support for relocated DPDK install devtools/test-meson-builds: remove dependency on clang devtools/test-meson-builds: add testing of pkg-config file examples/vdpa: support building from pkg-config info examples/vhost_crypto: support building from pkg-config info

Applied, thanks