Skip to contentSkip to conversation

examples: warn about broken pkg-config

PATCH Applied Bruce Richardson 3 participants 8 messages Jan 19, 2021 – Jan 30, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples: warn about broken pkg-config

Since the examples are designed to be built by end-users using Make, we can detect and warn about broken pkg-config on the user's system as part of the build process.

---
 examples/bbdev_app/Makefile                          |  8 ++++++++
 examples/bond/Makefile                               |  8 ++++++++
 examples/cmdline/Makefile                            |  8 ++++++++
 examples/distributor/Makefile                        |  8 ++++++++
 examples/ethtool/ethtool-app/Makefile                |  8 ++++++++
 examples/eventdev_pipeline/Makefile                  |  8 ++++++++
 examples/fips_validation/Makefile                    |  8 ++++++++
 examples/flow_classify/Makefile                      |  8 ++++++++
 examples/flow_filtering/Makefile                     |  8 ++++++++
 examples/helloworld/Makefile                         |  8 ++++++++
 examples/ioat/Makefile                               |  8 ++++++++
 examples/ip_fragmentation/Makefile                   | 11 ++++++++++-
 examples/ip_pipeline/Makefile                        |  8 ++++++++
 examples/ip_reassembly/Makefile                      |  8 ++++++++
 examples/ipsec-secgw/Makefile                        |  8 ++++++++
 examples/ipv4_multicast/Makefile                     |  8 ++++++++
 examples/kni/Makefile                                |  8 ++++++++
 examples/l2fwd-cat/Makefile                          |  8 ++++++++
 examples/l2fwd-crypto/Makefile                       |  8 ++++++++
 examples/l2fwd-event/Makefile                        |  8 ++++++++
 examples/l2fwd-jobstats/Makefile                     |  8 ++++++++
 examples/l2fwd-keepalive/Makefile                    |  8 ++++++++
 examples/l2fwd-keepalive/ka-agent/Makefile           |  8 ++++++++
 examples/l2fwd/Makefile                              |  8 ++++++++
 examples/l3fwd-acl/Makefile                          |  8 ++++++++
 examples/l3fwd-graph/Makefile                        | 12 +++++++++++-
 examples/l3fwd-power/Makefile                        |  8 ++++++++
 examples/l3fwd/Makefile                              |  8 ++++++++
 examples/link_status_interrupt/Makefile              |  8 ++++++++
 .../client_server_mp/mp_client/Makefile              |  8 ++++++++
 .../client_server_mp/mp_server/Makefile              |  8 ++++++++
 examples/multi_process/hotplug_mp/Makefile           |  8 ++++++++
 examples/multi_process/simple_mp/Makefile            |  8 ++++++++
 examples/multi_process/symmetric_mp/Makefile         |  8 ++++++++
 examples/ntb/Makefile                                | 11 ++++++++++-
 examples/packet_ordering/Makefile                    |  8 ++++++++
 examples/performance-thread/l3fwd-thread/Makefile    |  8 ++++++++
 examples/performance-thread/pthread_shim/Makefile    |  8 ++++++++
 examples/pipeline/Makefile                           |  8 ++++++++
 examples/ptpclient/Makefile                          |  8 ++++++++
 examples/qos_meter/Makefile                          |  8 ++++++++
 examples/qos_sched/Makefile                          |  8 ++++++++
 examples/rxtx_callbacks/Makefile                     |  8 ++++++++
 examples/server_node_efd/node/Makefile               |  8 ++++++++
 examples/server_node_efd/server/Makefile             |  8 ++++++++
 examples/service_cores/Makefile                      |  8 ++++++++
 examples/skeleton/Makefile                           |  8 ++++++++
 examples/timer/Makefile                              |  8 ++++++++
 examples/vdpa/Makefile                               |  8 ++++++++
 examples/vhost/Makefile                              |  8 ++++++++
 examples/vhost_blk/Makefile                          |  8 ++++++++
 examples/vhost_crypto/Makefile                       |  8 ++++++++
 examples/vm_power_manager/Makefile                   |  8 ++++++++
 examples/vm_power_manager/guest_cli/Makefile         |  8 ++++++++
 examples/vmdq/Makefile                               |  8 ++++++++
 examples/vmdq_dcb/Makefile                           |  8 ++++++++
 56 files changed, 455 insertions(+), 3 deletions(-)
examples/bbdev_app/Makefile +8 -0
index 2f156736d..03bf1edb1 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/bond/Makefile +8 -0
index 8700b589f..313a5389e 100644
@@ -28,6 +28,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/cmdline/Makefile +8 -0
index 09da84ba0..0b6a3c6dd 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/distributor/Makefile +8 -0
index d7615f9a3..9630fea3f 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/ethtool/ethtool-app/Makefile +8 -0
index 93ef5c27c..685afbdf3 100644
@@ -31,6 +31,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED += $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC += $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/eventdev_pipeline/Makefile +8 -0
index f5072a2b0..5cf88ca41 100644
@@ -28,6 +28,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/fips_validation/Makefile +8 -0
index 8f82a4c6c..1cc33450c 100644
@@ -36,6 +36,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/flow_classify/Makefile +8 -0
index 4c215daf1..1caa93a9b 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/flow_filtering/Makefile +8 -0
index 9bc917934..b0cdeab3a 100644
@@ -24,6 +24,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/helloworld/Makefile +8 -0
index 436569f5a..1b4dfcdde 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/ioat/Makefile +8 -0
index c13ad8d8a..c82ba1758 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/ip_fragmentation/Makefile +10 -1
index f6baf635b..b5b546e20 100644
@@ -24,10 +24,19 @@ PKGCONF ?= pkg-config
 
 PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
 CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
-CFLAGS += -DALLOW_EXPERIMENTAL_API
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
 
examples/ip_pipeline/Makefile +8 -0
index 4b391973c..96f492a5e 100644
@@ -39,6 +39,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -I. -DALLOW_EXPERIMENTAL_API -D_GNU_SOURCE
 
 OBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
examples/ip_reassembly/Makefile +8 -0
index 740f4721d..f9d0e5a6c 100644
@@ -27,6 +27,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/ipsec-secgw/Makefile +8 -0
index 7670cc368..55a7ac6d8 100644
@@ -41,6 +41,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -Wno-address-of-packed-member
 
examples/ipv4_multicast/Makefile +8 -0
index 7ea44e6f6..614b17705 100644
@@ -27,6 +27,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/kni/Makefile +8 -0
index bbf3bcae1..f87e93dcf 100644
@@ -27,6 +27,14 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 LDFLAGS += -pthread
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/l2fwd-cat/Makefile +8 -0
index 9ba113561..85066612b 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 LDFLAGS += -lpqos
examples/l2fwd-crypto/Makefile +8 -0
index 7731eccd0..8d44e95ed 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 CONFIG_DEFINES = $(shell $(CC) $(CFLAGS) -dM -E - < /dev/null)
 ifneq ($(findstring RTE_CRYPTO_SCHEDULER,$(CONFIG_DEFINES)),)
examples/l2fwd-event/Makefile +8 -0
index 384224b24..1570b1f83 100644
@@ -32,6 +32,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/l2fwd-jobstats/Makefile +8 -0
index fcb60b2a3..1a8842c64 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/l2fwd-keepalive/Makefile +8 -0
index 09a891149..bcc075f0d 100644
@@ -28,6 +28,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/l2fwd-keepalive/ka-agent/Makefile +8 -0
index 8b329a78b..ef4950f23 100644
@@ -30,6 +30,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/l2fwd/Makefile +8 -0
index b180deb86..44bc9ef4d 100644
@@ -28,6 +28,14 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
 
examples/l3fwd-acl/Makefile +8 -0
index 3420ea3a9..49ad69811 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/l3fwd-graph/Makefile +11 -1
index 6e3d0bca0..9622e2358 100644
@@ -22,10 +22,20 @@ static: build/$(APP)-static
 PKGCONF ?= pkg-config
 
 PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
-CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) -DALLOW_EXPERIMENTAL_API
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
 
examples/l3fwd-power/Makefile +8 -0
index d69854c9f..50edc34e6 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/l3fwd/Makefile +8 -0
index 7e70bbd82..ff3930c42 100644
@@ -29,6 +29,14 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
 
examples/link_status_interrupt/Makefile +8 -0
index fa608c56a..583a84736 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/multi_process/client_server_mp/mp_client/Makefile +8 -0
index bc00a1c87..2c389f35b 100644
@@ -28,6 +28,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/multi_process/client_server_mp/mp_server/Makefile +8 -0
index d066524b3..bc04ab733 100644
@@ -28,6 +28,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/multi_process/hotplug_mp/Makefile +8 -0
index 3122449d6..75ae8eb9a 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/multi_process/simple_mp/Makefile +8 -0
index d03597c4c..675e8c3f9 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/multi_process/symmetric_mp/Makefile +8 -0
index 45b7214cb..5a671e54a 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/ntb/Makefile +10 -1
index d35dabc47..8e1f52f17 100644
@@ -26,10 +26,19 @@ LDFLAGS += -pthread
 
 PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
 CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
-CFLAGS += -DALLOW_EXPERIMENTAL_API
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
 
examples/packet_ordering/Makefile +8 -0
index 09abda91e..dcf583ec0 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/performance-thread/l3fwd-thread/Makefile +8 -0
index ca1a5d087..4f518358d 100644
@@ -9,6 +9,14 @@ SRCS-y := main.c
 
 include ../common/common.mk
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 # Build using pkg-config variables if possible
examples/performance-thread/pthread_shim/Makefile +8 -0
index 6b19ff63f..5aa401dc4 100644
@@ -9,6 +9,14 @@ SRCS-y := main.c pthread_shim.c
 
 include ../common/common.mk
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -D_GNU_SOURCE
 LDFLAGS += "-Wl,--copy-dt-needed-entries"
examples/pipeline/Makefile +8 -0
index d0a1f02e1..fcba51fd4 100644
@@ -30,6 +30,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -I. -DALLOW_EXPERIMENTAL_API -D_GNU_SOURCE
 
 OBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
examples/ptpclient/Makefile +8 -0
index 9f56a5e7a..f0d38c5c4 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/qos_meter/Makefile +8 -0
index 7a5381829..1772c75a1 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/qos_sched/Makefile +8 -0
index f42406fe1..8187542eb 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/rxtx_callbacks/Makefile +8 -0
index a618cdf75..4296b19f6 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/server_node_efd/node/Makefile +8 -0
index 2120de539..56550e6fe 100644
@@ -28,6 +28,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/server_node_efd/server/Makefile +8 -0
index 6b5878d8c..50e18e150 100644
@@ -28,6 +28,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/service_cores/Makefile +8 -0
index 754333c87..df0284bd0 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/skeleton/Makefile +8 -0
index 4fa97cb97..bbd2dc181 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/timer/Makefile +8 -0
index 70b1af9f4..4c0a0f62f 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/vdpa/Makefile +8 -0
index c4b2184ea..470ca57df 100644
@@ -27,6 +27,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
 
examples/vhost/Makefile +8 -0
index 8c969caaa..145b3f79a 100644
@@ -28,6 +28,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/vhost_blk/Makefile +8 -0
index 792591386..2fe199454 100644
@@ -28,6 +28,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/vhost_crypto/Makefile +8 -0
index 27abd9199..ce6f04624 100644
@@ -27,6 +27,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
 
examples/vm_power_manager/Makefile +8 -0
index 8ac1180b2..2fff8dadd 100644
@@ -32,6 +32,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 ifneq ($(shell $(PKGCONF) --atleast-version=0.9.3 libvirt; echo $$?), 0)
examples/vm_power_manager/guest_cli/Makefile +8 -0
index 1ee1ca101..e9dff4753 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/vmdq/Makefile +8 -0
index 749ed53c6..8edda6cd6 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
examples/vmdq_dcb/Makefile +8 -0
index 1dd42105d..b5d2efa4a 100644
@@ -26,6 +26,14 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+ifeq ($(MAKECMDGOALS),static)
+# check for broken pkg-config
+ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
+$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
+$(error "Cannot generate statically-linked binaries with this version of pkg-config")
+endif
+endif
+
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
Signature · 1 line
2.27.0
#1 lore raw

19/01/2021 14:03, Bruce Richardson:

Quoted 55 lines

Since the examples are designed to be built by end-users using Make, we can detect and warn about broken pkg-config on the user's system as part of the build process.

---
 examples/bbdev_app/Makefile                          |  8 ++++++++
 examples/bond/Makefile                               |  8 ++++++++
 examples/cmdline/Makefile                            |  8 ++++++++
 examples/distributor/Makefile                        |  8 ++++++++
 examples/ethtool/ethtool-app/Makefile                |  8 ++++++++
 examples/eventdev_pipeline/Makefile                  |  8 ++++++++
 examples/fips_validation/Makefile                    |  8 ++++++++
 examples/flow_classify/Makefile                      |  8 ++++++++
 examples/flow_filtering/Makefile                     |  8 ++++++++
 examples/helloworld/Makefile                         |  8 ++++++++
 examples/ioat/Makefile                               |  8 ++++++++
 examples/ip_fragmentation/Makefile                   | 11 ++++++++++-
 examples/ip_pipeline/Makefile                        |  8 ++++++++
 examples/ip_reassembly/Makefile                      |  8 ++++++++
 examples/ipsec-secgw/Makefile                        |  8 ++++++++
 examples/ipv4_multicast/Makefile                     |  8 ++++++++
 examples/kni/Makefile                                |  8 ++++++++
 examples/l2fwd-cat/Makefile                          |  8 ++++++++
 examples/l2fwd-crypto/Makefile                       |  8 ++++++++
 examples/l2fwd-event/Makefile                        |  8 ++++++++
 examples/l2fwd-jobstats/Makefile                     |  8 ++++++++
 examples/l2fwd-keepalive/Makefile                    |  8 ++++++++
 examples/l2fwd-keepalive/ka-agent/Makefile           |  8 ++++++++
 examples/l2fwd/Makefile                              |  8 ++++++++
 examples/l3fwd-acl/Makefile                          |  8 ++++++++
 examples/l3fwd-graph/Makefile                        | 12 +++++++++++-
 examples/l3fwd-power/Makefile                        |  8 ++++++++
 examples/l3fwd/Makefile                              |  8 ++++++++
 examples/link_status_interrupt/Makefile              |  8 ++++++++
 .../client_server_mp/mp_client/Makefile              |  8 ++++++++
 .../client_server_mp/mp_server/Makefile              |  8 ++++++++
 examples/multi_process/hotplug_mp/Makefile           |  8 ++++++++
 examples/multi_process/simple_mp/Makefile            |  8 ++++++++
 examples/multi_process/symmetric_mp/Makefile         |  8 ++++++++
 examples/ntb/Makefile                                | 11 ++++++++++-
 examples/packet_ordering/Makefile                    |  8 ++++++++
 examples/performance-thread/l3fwd-thread/Makefile    |  8 ++++++++
 examples/performance-thread/pthread_shim/Makefile    |  8 ++++++++
 examples/pipeline/Makefile                           |  8 ++++++++
 examples/ptpclient/Makefile                          |  8 ++++++++
 examples/qos_meter/Makefile                          |  8 ++++++++
 examples/qos_sched/Makefile                          |  8 ++++++++
 examples/rxtx_callbacks/Makefile                     |  8 ++++++++
 examples/server_node_efd/node/Makefile               |  8 ++++++++
 examples/server_node_efd/server/Makefile             |  8 ++++++++
 examples/service_cores/Makefile                      |  8 ++++++++
 examples/skeleton/Makefile                           |  8 ++++++++
 examples/timer/Makefile                              |  8 ++++++++
 examples/vdpa/Makefile                               |  8 ++++++++
Quoted 8 lines
 examples/vhost/Makefile                              |  8 ++++++++
 examples/vhost_blk/Makefile                          |  8 ++++++++
 examples/vhost_crypto/Makefile                       |  8 ++++++++
 examples/vm_power_manager/Makefile                   |  8 ++++++++
 examples/vm_power_manager/guest_cli/Makefile         |  8 ++++++++
 examples/vmdq/Makefile                               |  8 ++++++++
 examples/vmdq_dcb/Makefile                           |  8 ++++++++
 56 files changed, 455 insertions(+), 3 deletions(-)

That's a lot of duplicated code that may need some extension in future. What about having a file examples/common.mk to include?
With the special syntax -include there will be no error in case ../common.mk does not exist. Deal?

ref: https://www.gnu.org/software/make/manual/html_node/Include.html

#2 lore raw
Quoted 65 lines · Thomas Monjalon

19/01/2021 14:03, Bruce Richardson:

Quoted 55 lines

Since the examples are designed to be built by end-users using Make, we can detect and warn about broken pkg-config on the user's system as part of the build process.

---
 examples/bbdev_app/Makefile                          |  8 ++++++++
 examples/bond/Makefile                               |  8 ++++++++
 examples/cmdline/Makefile                            |  8 ++++++++
 examples/distributor/Makefile                        |  8 ++++++++
 examples/ethtool/ethtool-app/Makefile                |  8 ++++++++
 examples/eventdev_pipeline/Makefile                  |  8 ++++++++
 examples/fips_validation/Makefile                    |  8 ++++++++
 examples/flow_classify/Makefile                      |  8 ++++++++
 examples/flow_filtering/Makefile                     |  8 ++++++++
 examples/helloworld/Makefile                         |  8 ++++++++
 examples/ioat/Makefile                               |  8 ++++++++
 examples/ip_fragmentation/Makefile                   | 11 ++++++++++-
 examples/ip_pipeline/Makefile                        |  8 ++++++++
 examples/ip_reassembly/Makefile                      |  8 ++++++++
 examples/ipsec-secgw/Makefile                        |  8 ++++++++
 examples/ipv4_multicast/Makefile                     |  8 ++++++++
 examples/kni/Makefile                                |  8 ++++++++
 examples/l2fwd-cat/Makefile                          |  8 ++++++++
 examples/l2fwd-crypto/Makefile                       |  8 ++++++++
 examples/l2fwd-event/Makefile                        |  8 ++++++++
 examples/l2fwd-jobstats/Makefile                     |  8 ++++++++
 examples/l2fwd-keepalive/Makefile                    |  8 ++++++++
 examples/l2fwd-keepalive/ka-agent/Makefile           |  8 ++++++++
 examples/l2fwd/Makefile                              |  8 ++++++++
 examples/l3fwd-acl/Makefile                          |  8 ++++++++
 examples/l3fwd-graph/Makefile                        | 12 +++++++++++-
 examples/l3fwd-power/Makefile                        |  8 ++++++++
 examples/l3fwd/Makefile                              |  8 ++++++++
 examples/link_status_interrupt/Makefile              |  8 ++++++++
 .../client_server_mp/mp_client/Makefile              |  8 ++++++++
 .../client_server_mp/mp_server/Makefile              |  8 ++++++++
 examples/multi_process/hotplug_mp/Makefile           |  8 ++++++++
 examples/multi_process/simple_mp/Makefile            |  8 ++++++++
 examples/multi_process/symmetric_mp/Makefile         |  8 ++++++++
 examples/ntb/Makefile                                | 11 ++++++++++-
 examples/packet_ordering/Makefile                    |  8 ++++++++
 examples/performance-thread/l3fwd-thread/Makefile    |  8 ++++++++
 examples/performance-thread/pthread_shim/Makefile    |  8 ++++++++
 examples/pipeline/Makefile                           |  8 ++++++++
 examples/ptpclient/Makefile                          |  8 ++++++++
 examples/qos_meter/Makefile                          |  8 ++++++++
 examples/qos_sched/Makefile                          |  8 ++++++++
 examples/rxtx_callbacks/Makefile                     |  8 ++++++++
 examples/server_node_efd/node/Makefile               |  8 ++++++++
 examples/server_node_efd/server/Makefile             |  8 ++++++++
 examples/service_cores/Makefile                      |  8 ++++++++
 examples/skeleton/Makefile                           |  8 ++++++++
 examples/timer/Makefile                              |  8 ++++++++
 examples/vdpa/Makefile                               |  8 ++++++++
Quoted 8 lines
 examples/vhost/Makefile                              |  8 ++++++++
 examples/vhost_blk/Makefile                          |  8 ++++++++
 examples/vhost_crypto/Makefile                       |  8 ++++++++
 examples/vm_power_manager/Makefile                   |  8 ++++++++
 examples/vm_power_manager/guest_cli/Makefile         |  8 ++++++++
 examples/vmdq/Makefile                               |  8 ++++++++
 examples/vmdq_dcb/Makefile                           |  8 ++++++++
 56 files changed, 455 insertions(+), 3 deletions(-)
Quoted 7 lines

That's a lot of duplicated code that may need some extension in future. What about having a file examples/common.mk to include?
With the special syntax -include there will be no error in case ../common.mk does not exist. Deal?

ref: https://www.gnu.org/software/make/manual/html_node/Include.html

Yes, and no. There is far more boilerplate already in these files which needs to be consolidated, so I see little point in just trying to extract this part out alone. Therefore, what I'd like to see done (if ever someone has the time) is to extract all the boilerplate out to a common makefile, but also add a postinstall script to flatten out the makefile on install, so that each example is once again self-contained.

I've been thinking about this for a while, just haven't got time for it.

/Bruce

#3 lore raw
Quoted 81 lines · Bruce Richardson
Quoted 65 lines · Thomas Monjalon

19/01/2021 14:03, Bruce Richardson:

Quoted 55 lines

Since the examples are designed to be built by end-users using Make, we can detect and warn about broken pkg-config on the user's system as part of the build process.

---
  examples/bbdev_app/Makefile                          |  8 ++++++++
  examples/bond/Makefile                               |  8 ++++++++
  examples/cmdline/Makefile                            |  8 ++++++++
  examples/distributor/Makefile                        |  8 ++++++++
  examples/ethtool/ethtool-app/Makefile                |  8 ++++++++
  examples/eventdev_pipeline/Makefile                  |  8 ++++++++
  examples/fips_validation/Makefile                    |  8 ++++++++
  examples/flow_classify/Makefile                      |  8 ++++++++
  examples/flow_filtering/Makefile                     |  8 ++++++++
  examples/helloworld/Makefile                         |  8 ++++++++
  examples/ioat/Makefile                               |  8 ++++++++
  examples/ip_fragmentation/Makefile                   | 11 ++++++++++-
  examples/ip_pipeline/Makefile                        |  8 ++++++++
  examples/ip_reassembly/Makefile                      |  8 ++++++++
  examples/ipsec-secgw/Makefile                        |  8 ++++++++
  examples/ipv4_multicast/Makefile                     |  8 ++++++++
  examples/kni/Makefile                                |  8 ++++++++
  examples/l2fwd-cat/Makefile                          |  8 ++++++++
  examples/l2fwd-crypto/Makefile                       |  8 ++++++++
  examples/l2fwd-event/Makefile                        |  8 ++++++++
  examples/l2fwd-jobstats/Makefile                     |  8 ++++++++
  examples/l2fwd-keepalive/Makefile                    |  8 ++++++++
  examples/l2fwd-keepalive/ka-agent/Makefile           |  8 ++++++++
  examples/l2fwd/Makefile                              |  8 ++++++++
  examples/l3fwd-acl/Makefile                          |  8 ++++++++
  examples/l3fwd-graph/Makefile                        | 12 +++++++++++-
  examples/l3fwd-power/Makefile                        |  8 ++++++++
  examples/l3fwd/Makefile                              |  8 ++++++++
  examples/link_status_interrupt/Makefile              |  8 ++++++++
  .../client_server_mp/mp_client/Makefile              |  8 ++++++++
  .../client_server_mp/mp_server/Makefile              |  8 ++++++++
  examples/multi_process/hotplug_mp/Makefile           |  8 ++++++++
  examples/multi_process/simple_mp/Makefile            |  8 ++++++++
  examples/multi_process/symmetric_mp/Makefile         |  8 ++++++++
  examples/ntb/Makefile                                | 11 ++++++++++-
  examples/packet_ordering/Makefile                    |  8 ++++++++
  examples/performance-thread/l3fwd-thread/Makefile    |  8 ++++++++
  examples/performance-thread/pthread_shim/Makefile    |  8 ++++++++
  examples/pipeline/Makefile                           |  8 ++++++++
  examples/ptpclient/Makefile                          |  8 ++++++++
  examples/qos_meter/Makefile                          |  8 ++++++++
  examples/qos_sched/Makefile                          |  8 ++++++++
  examples/rxtx_callbacks/Makefile                     |  8 ++++++++
  examples/server_node_efd/node/Makefile               |  8 ++++++++
  examples/server_node_efd/server/Makefile             |  8 ++++++++
  examples/service_cores/Makefile                      |  8 ++++++++
  examples/skeleton/Makefile                           |  8 ++++++++
  examples/timer/Makefile                              |  8 ++++++++
  examples/vdpa/Makefile                               |  8 ++++++++
Quoted 8 lines
  examples/vhost/Makefile                              |  8 ++++++++
  examples/vhost_blk/Makefile                          |  8 ++++++++
  examples/vhost_crypto/Makefile                       |  8 ++++++++
  examples/vm_power_manager/Makefile                   |  8 ++++++++
  examples/vm_power_manager/guest_cli/Makefile         |  8 ++++++++
  examples/vmdq/Makefile                               |  8 ++++++++
  examples/vmdq_dcb/Makefile                           |  8 ++++++++
  56 files changed, 455 insertions(+), 3 deletions(-)
Quoted 7 lines

That's a lot of duplicated code that may need some extension in future. What about having a file examples/common.mk to include?
With the special syntax -include there will be no error in case ../common.mk does not exist. Deal?

ref: https://www.gnu.org/software/make/manual/html_node/Include.html

Yes, and no. There is far more boilerplate already in these files which needs to be consolidated, so I see little point in just trying to extract this part out alone. Therefore, what I'd like to see done (if ever someone has the time) is to extract all the boilerplate out to a common makefile, but also add a postinstall script to flatten out the makefile on install, so that each example is once again self-contained.

Quoted 4 lines

I've been thinking about this for a while, just haven't got time for it.

/Bruce

These makefiles are supposed to be examples. Meaning, it should be possible to just take the example app and compile it as is. That means we can't rely on external makefiles, they're supposed to be self-contained.

Signature · 2 lines
Thanks,
Anatoly
#4 lore raw
Quoted 82 lines · Anatoly
Quoted 81 lines · Bruce Richardson
Quoted 65 lines · Thomas Monjalon

19/01/2021 14:03, Bruce Richardson:

Quoted 55 lines

Since the examples are designed to be built by end-users using Make, we can detect and warn about broken pkg-config on the user's system as part of the build process.

---
  examples/bbdev_app/Makefile                          |  8 ++++++++
  examples/bond/Makefile                               |  8 ++++++++
  examples/cmdline/Makefile                            |  8 ++++++++
  examples/distributor/Makefile                        |  8 ++++++++
  examples/ethtool/ethtool-app/Makefile                |  8 ++++++++
  examples/eventdev_pipeline/Makefile                  |  8 ++++++++
  examples/fips_validation/Makefile                    |  8 ++++++++
  examples/flow_classify/Makefile                      |  8 ++++++++
  examples/flow_filtering/Makefile                     |  8 ++++++++
  examples/helloworld/Makefile                         |  8 ++++++++
  examples/ioat/Makefile                               |  8 ++++++++
  examples/ip_fragmentation/Makefile                   | 11 ++++++++++-
  examples/ip_pipeline/Makefile                        |  8 ++++++++
  examples/ip_reassembly/Makefile                      |  8 ++++++++
  examples/ipsec-secgw/Makefile                        |  8 ++++++++
  examples/ipv4_multicast/Makefile                     |  8 ++++++++
  examples/kni/Makefile                                |  8 ++++++++
  examples/l2fwd-cat/Makefile                          |  8 ++++++++
  examples/l2fwd-crypto/Makefile                       |  8 ++++++++
  examples/l2fwd-event/Makefile                        |  8 ++++++++
  examples/l2fwd-jobstats/Makefile                     |  8 ++++++++
  examples/l2fwd-keepalive/Makefile                    |  8 ++++++++
  examples/l2fwd-keepalive/ka-agent/Makefile           |  8 ++++++++
  examples/l2fwd/Makefile                              |  8 ++++++++
  examples/l3fwd-acl/Makefile                          |  8 ++++++++
  examples/l3fwd-graph/Makefile                        | 12 +++++++++++-
  examples/l3fwd-power/Makefile                        |  8 ++++++++
  examples/l3fwd/Makefile                              |  8 ++++++++
  examples/link_status_interrupt/Makefile              |  8 ++++++++
  .../client_server_mp/mp_client/Makefile              |  8 ++++++++
  .../client_server_mp/mp_server/Makefile              |  8 ++++++++
  examples/multi_process/hotplug_mp/Makefile           |  8 ++++++++
  examples/multi_process/simple_mp/Makefile            |  8 ++++++++
  examples/multi_process/symmetric_mp/Makefile         |  8 ++++++++
  examples/ntb/Makefile                                | 11 ++++++++++-
  examples/packet_ordering/Makefile                    |  8 ++++++++
  examples/performance-thread/l3fwd-thread/Makefile    |  8 ++++++++
  examples/performance-thread/pthread_shim/Makefile    |  8 ++++++++
  examples/pipeline/Makefile                           |  8 ++++++++
  examples/ptpclient/Makefile                          |  8 ++++++++
  examples/qos_meter/Makefile                          |  8 ++++++++
  examples/qos_sched/Makefile                          |  8 ++++++++
  examples/rxtx_callbacks/Makefile                     |  8 ++++++++
  examples/server_node_efd/node/Makefile               |  8 ++++++++
  examples/server_node_efd/server/Makefile             |  8 ++++++++
  examples/service_cores/Makefile                      |  8 ++++++++
  examples/skeleton/Makefile                           |  8 ++++++++
  examples/timer/Makefile                              |  8 ++++++++
  examples/vdpa/Makefile                               |  8 ++++++++
Quoted 8 lines
  examples/vhost/Makefile                              |  8 ++++++++
  examples/vhost_blk/Makefile                          |  8 ++++++++
  examples/vhost_crypto/Makefile                       |  8 ++++++++
  examples/vm_power_manager/Makefile                   |  8 ++++++++
  examples/vm_power_manager/guest_cli/Makefile         |  8 ++++++++
  examples/vmdq/Makefile                               |  8 ++++++++
  examples/vmdq_dcb/Makefile                           |  8 ++++++++
  56 files changed, 455 insertions(+), 3 deletions(-)
Quoted 7 lines

That's a lot of duplicated code that may need some extension in future. What about having a file examples/common.mk to include?
With the special syntax -include there will be no error in case ../common.mk does not exist. Deal?

ref: https://www.gnu.org/software/make/manual/html_node/Include.html

Yes, and no. There is far more boilerplate already in these files which needs to be consolidated, so I see little point in just trying to extract this part out alone. Therefore, what I'd like to see done (if ever someone has the time) is to extract all the boilerplate out to a common makefile, but also add a postinstall script to flatten out the makefile on install, so that each example is once again self-contained.

Quoted 9 lines
Quoted 4 lines

I've been thinking about this for a while, just haven't got time for it.

/Bruce

These makefiles are supposed to be examples. Meaning, it should be possible to just take the example app and compile it as is. That means we can't rely on external makefiles, they're supposed to be self-contained.

Exactly. Hence the need to "flatten" out the makefiles, by changing the include to be the actual contents.

#5 lore raw

29/01/2021 17:05, Bruce Richardson:

Quoted 9 lines · Anatoly
Quoted 8 lines · Bruce Richardson
Quoted 7 lines · Thomas Monjalon
Quoted 6 lines

19/01/2021 14:03, Bruce Richardson:

Quoted 5 lines

Since the examples are designed to be built by end-users using Make, we can detect and warn about broken pkg-config on the user's system as part of the build process.

[...]

Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 9 lines
Quoted 1 line
  56 files changed, 455 insertions(+), 3 deletions(-)

That's a lot of duplicated code that may need some extension in future. What about having a file examples/common.mk to include?
With the special syntax -include there will be no error in case ../common.mk does not exist. Deal?

ref: https://www.gnu.org/software/make/manual/html_node/Include.html

Yes, and no. There is far more boilerplate already in these files which needs to be consolidated, so I see little point in just trying to extract this part out alone. Therefore, what I'd like to see done (if ever someone has the time) is to extract all the boilerplate out to a common makefile, but also add a postinstall script to flatten out the makefile on install, so that each example is once again self-contained.

I've been thinking about this for a while, just haven't got time for it.

/Bruce

Quoted 6 lines
Quoted 4 lines

These makefiles are supposed to be examples. Meaning, it should be possible to just take the example app and compile it as is. That means we can't rely on external makefiles, they're supposed to be self-contained.

Exactly. Hence the need to "flatten" out the makefiles, by changing the include to be the actual contents.

My proposal is just for pkg-config check, which doesn't serve as an example. If this check is not there, it still works.
That's what -include is for: include optional stuff which can be missing.

#6 lore raw
Quoted 37 lines · Thomas Monjalon

29/01/2021 17:05, Bruce Richardson:

Quoted 9 lines · Anatoly
Quoted 8 lines · Bruce Richardson
Quoted 7 lines · Thomas Monjalon
Quoted 6 lines

19/01/2021 14:03, Bruce Richardson:

Quoted 5 lines

Since the examples are designed to be built by end-users using Make, we can detect and warn about broken pkg-config on the user's system as part of the build process.

[...]

Quoted 26 lines
Quoted 26 lines
Quoted 17 lines
Quoted 9 lines
Quoted 1 line
  56 files changed, 455 insertions(+), 3 deletions(-)

That's a lot of duplicated code that may need some extension in future. What about having a file examples/common.mk to include?
With the special syntax -include there will be no error in case ../common.mk does not exist. Deal?

ref: https://www.gnu.org/software/make/manual/html_node/Include.html

Yes, and no. There is far more boilerplate already in these files which needs to be consolidated, so I see little point in just trying to extract this part out alone. Therefore, what I'd like to see done (if ever someone has the time) is to extract all the boilerplate out to a common makefile, but also add a postinstall script to flatten out the makefile on install, so that each example is once again self-contained.

Quoted 4 lines

I've been thinking about this for a while, just haven't got time for it.

/Bruce

These makefiles are supposed to be examples. Meaning, it should be possible to just take the example app and compile it as is. That means we can't rely on external makefiles, they're supposed to be self-contained.

Quoted 7 lines
Quoted 2 lines

Exactly. Hence the need to "flatten" out the makefiles, by changing the include to be the actual contents.

My proposal is just for pkg-config check, which doesn't serve as an example. If this check is not there, it still works.
That's what -include is for: include optional stuff which can be missing.

Yes, but given the number of times I've had queries about the static builds being broken on RHEL7, I think it's quite important that this check be there to flag it. Therefore, I'd rather not have it in a common file that could be missed.