summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Richardson <bruce.richardson@intel.com>2017-10-09 14:13:16 +0100
committerBruce Richardson <bruce.richardson@intel.com>2018-01-30 21:58:59 +0100
commit22119c4591a008abe5de8e395a97fcc09c8dc14a (patch)
treed6e42fc5b35f7a68888aa03c7eca60c82752f449
parent0eba4ade654bae51877474fb64ab5e79df0f3442 (diff)
downloaddpdk-22119c4591a008abe5de8e395a97fcc09c8dc14a.zip
dpdk-22119c4591a008abe5de8e395a97fcc09c8dc14a.tar.gz
dpdk-22119c4591a008abe5de8e395a97fcc09c8dc14a.tar.xz
examples: use pkg-config in makefiles
Change the example app Makefiles to query if DPDK is installed and registered using pkg-config. If so, build directly using pkg-config info, otherwise fall back to using the original build system with RTE_SDK and RTE_TARGET This commit changes the makefiles for the basic examples, i.e. those which do not have multiple subdirectories underneath the main examples dir. Examples not covered are: * ethtool * multi_process * performance-thread * quota_watermark * netmap_compat * server_node_efd * vm_power_manager Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Luca Boccassi <bluca@debian.org>
-rw-r--r--examples/bbdev_app/Makefile25
-rw-r--r--examples/bond/Makefile23
-rw-r--r--examples/cmdline/Makefile23
-rw-r--r--examples/distributor/Makefile23
-rw-r--r--examples/eventdev_pipeline/Makefile25
-rw-r--r--examples/exception_path/Makefile23
-rw-r--r--examples/flow_classify/Makefile25
-rw-r--r--examples/flow_filtering/Makefile23
-rw-r--r--examples/helloworld/Makefile23
-rw-r--r--examples/ip_fragmentation/Makefile23
-rw-r--r--examples/ip_pipeline/Makefile35
-rw-r--r--examples/ip_reassembly/Makefile23
-rw-r--r--examples/ipsec-secgw/Makefile27
-rw-r--r--examples/ipv4_multicast/Makefile23
-rw-r--r--examples/kni/Makefile22
-rw-r--r--examples/l2fwd-cat/Makefile25
-rw-r--r--examples/l2fwd-crypto/Makefile22
-rw-r--r--examples/l2fwd-jobstats/Makefile22
-rw-r--r--examples/l2fwd-keepalive/Makefile24
-rw-r--r--examples/l2fwd/Makefile22
-rw-r--r--examples/l3fwd-acl/Makefile22
-rw-r--r--examples/l3fwd-power/Makefile22
-rw-r--r--examples/l3fwd-vf/Makefile22
-rw-r--r--examples/l3fwd/Makefile22
-rw-r--r--examples/link_status_interrupt/Makefile22
-rw-r--r--examples/load_balancer/Makefile22
-rw-r--r--examples/packet_ordering/Makefile22
-rw-r--r--examples/ptpclient/Makefile22
-rw-r--r--examples/qos_meter/Makefile22
-rw-r--r--examples/qos_sched/Makefile22
-rw-r--r--examples/rxtx_callbacks/Makefile22
-rw-r--r--examples/service_cores/Makefile25
-rw-r--r--examples/skeleton/Makefile22
-rw-r--r--examples/tep_termination/Makefile22
-rw-r--r--examples/timer/Makefile22
-rw-r--r--examples/vhost/Makefile22
-rw-r--r--examples/vhost_scsi/Makefile28
-rw-r--r--examples/vm_power_manager/Makefile14
-rw-r--r--examples/vmdq/Makefile22
-rw-r--r--examples/vmdq_dcb/Makefile22
40 files changed, 911 insertions, 11 deletions
diff --git a/examples/bbdev_app/Makefile b/examples/bbdev_app/Makefile
index 8cb8979..0c12dd2 100644
--- a/examples/bbdev_app/Makefile
+++ b/examples/bbdev_app/Makefile
@@ -7,6 +7,29 @@ APP = bbdev
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -21,3 +44,5 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/bond/Makefile b/examples/bond/Makefile
index edc699d..7944b56 100644
--- a/examples/bond/Makefile
+++ b/examples/bond/Makefile
@@ -7,6 +7,27 @@ APP = bond_app
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -31,3 +52,5 @@ LDLIBS += -lrte_pmd_bond
endif
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/cmdline/Makefile b/examples/cmdline/Makefile
index fca3a82..3597c9f 100644
--- a/examples/cmdline/Makefile
+++ b/examples/cmdline/Makefile
@@ -7,6 +7,27 @@ APP = cmdline
# all source are stored in SRCS-y
SRCS-y := main.c commands.c parse_obj_list.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -27,3 +48,5 @@ CFLAGS += $(WERROR_FLAGS)
CFLAGS_parse_obj_list.o := -D_GNU_SOURCE
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/distributor/Makefile b/examples/distributor/Makefile
index 4277877..2dcdd7d 100644
--- a/examples/distributor/Makefile
+++ b/examples/distributor/Makefile
@@ -7,6 +7,27 @@ APP = distributor_app
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -27,3 +48,5 @@ endif
EXTRA_CFLAGS += -O3 -Wfatal-errors
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/eventdev_pipeline/Makefile b/examples/eventdev_pipeline/Makefile
index 888f821..f8063ce 100644
--- a/examples/eventdev_pipeline/Makefile
+++ b/examples/eventdev_pipeline/Makefile
@@ -9,6 +9,29 @@ SRCS-y := main.c
SRCS-y += pipeline_worker_generic.c
SRCS-y += pipeline_worker_tx.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -23,3 +46,5 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/exception_path/Makefile b/examples/exception_path/Makefile
index e0a31cc..6f2dce8 100644
--- a/examples/exception_path/Makefile
+++ b/examples/exception_path/Makefile
@@ -7,6 +7,27 @@ APP = exception_path
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -20,3 +41,5 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/flow_classify/Makefile b/examples/flow_classify/Makefile
index 9246f15..baeac3b 100644
--- a/examples/flow_classify/Makefile
+++ b/examples/flow_classify/Makefile
@@ -7,6 +7,29 @@ APP = flow_classify
# all source are stored in SRCS-y
SRCS-y := flow_classify.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -27,3 +50,5 @@ CFLAGS_main.o += -Wno-return-type
endif
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/flow_filtering/Makefile b/examples/flow_filtering/Makefile
index d6c71e3..ba15651 100644
--- a/examples/flow_filtering/Makefile
+++ b/examples/flow_filtering/Makefile
@@ -34,6 +34,27 @@ APP = flow
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -47,3 +68,5 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/helloworld/Makefile b/examples/helloworld/Makefile
index 1e58e41..19b3385 100644
--- a/examples/helloworld/Makefile
+++ b/examples/helloworld/Makefile
@@ -7,6 +7,27 @@ APP = helloworld
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -20,3 +41,5 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/ip_fragmentation/Makefile b/examples/ip_fragmentation/Makefile
index e323e00..7c158b1 100644
--- a/examples/ip_fragmentation/Makefile
+++ b/examples/ip_fragmentation/Makefile
@@ -8,6 +8,27 @@ APP = ip_fragmentation
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -27,3 +48,5 @@ CFLAGS_main.o += -Wno-return-type
endif
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile
index 183532a..308c9e4 100644
--- a/examples/ip_pipeline/Makefile
+++ b/examples/ip_pipeline/Makefile
@@ -4,8 +4,6 @@
# binary name
APP = ip_pipeline
-VPATH += $(SRCDIR)/pipeline
-
# all source are stored in SRCS-y
SRCS-y := main.c
SRCS-y += config_parse.c
@@ -32,10 +30,41 @@ SRCS-y += pipeline_flow_actions.c
SRCS-y += pipeline_routing_be.c
SRCS-y += pipeline_routing.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+VPATH += pipeline
+CFLAGS += -I. -I./pipeline/
+
+OBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
+
+build/%.o: %.c Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) -c $< -o $@
+
+build/$(APP): $(OBJS)
+ $(CC) $(OBJS) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP) build/*.o
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
+VPATH += $(SRCDIR)/pipeline
+
# Default target, can be overridden by command line or environment
RTE_TARGET ?= x86_64-native-linuxapp-gcc
@@ -50,3 +79,5 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/ip_reassembly/Makefile b/examples/ip_reassembly/Makefile
index 592e14c..d5fe47d 100644
--- a/examples/ip_reassembly/Makefile
+++ b/examples/ip_reassembly/Makefile
@@ -8,6 +8,27 @@ APP = ip_reassembly
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -27,3 +48,5 @@ CFLAGS_main.o += -Wno-return-type
endif
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/ipsec-secgw/Makefile b/examples/ipsec-secgw/Makefile
index 36acd3f..5a553e6 100644
--- a/examples/ipsec-secgw/Makefile
+++ b/examples/ipsec-secgw/Makefile
@@ -15,6 +15,31 @@ SRCS-y += sa.c
SRCS-y += rt.c
SRCS-y += ipsec-secgw.c
+CFLAGS += -gdwarf-2
+
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -42,3 +67,5 @@ CFLAGS += -DIPSEC_DEBUG -fstack-protector-all -O0
endif
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/ipv4_multicast/Makefile b/examples/ipv4_multicast/Makefile
index c5a33ed..806ae32 100644
--- a/examples/ipv4_multicast/Makefile
+++ b/examples/ipv4_multicast/Makefile
@@ -8,6 +8,27 @@ APP = ipv4_multicast
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -27,3 +48,5 @@ CFLAGS_main.o += -Wno-return-type
endif
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/kni/Makefile b/examples/kni/Makefile
index 0aab997..8d30b24 100644
--- a/examples/kni/Makefile
+++ b/examples/kni/Makefile
@@ -7,6 +7,27 @@ APP = kni
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -25,3 +46,4 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/l2fwd-cat/Makefile b/examples/l2fwd-cat/Makefile
index afb15c2..c8aa611 100644
--- a/examples/l2fwd-cat/Makefile
+++ b/examples/l2fwd-cat/Makefile
@@ -7,6 +7,30 @@ APP = l2fwd-cat
# all source are stored in SRCS-y
SRCS-y := l2fwd-cat.c cat.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+CFLAGS += -D_GNU_SOURCE
+LDFLAGS += -lpqos
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -37,3 +61,4 @@ LDLIBS += -L$(PQOS_INSTALL_PATH)
LDLIBS += -lpqos
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/l2fwd-crypto/Makefile b/examples/l2fwd-crypto/Makefile
index c920be7..1048e94 100644
--- a/examples/l2fwd-crypto/Makefile
+++ b/examples/l2fwd-crypto/Makefile
@@ -7,6 +7,27 @@ APP = l2fwd-crypto
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -20,3 +41,4 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/l2fwd-jobstats/Makefile b/examples/l2fwd-jobstats/Makefile
index 642717e..a3490a6 100644
--- a/examples/l2fwd-jobstats/Makefile
+++ b/examples/l2fwd-jobstats/Makefile
@@ -7,6 +7,27 @@ APP = l2fwd-jobstats
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -21,3 +42,4 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/l2fwd-keepalive/Makefile b/examples/l2fwd-keepalive/Makefile
index d1cf4c7..e1ddb2a 100644
--- a/examples/l2fwd-keepalive/Makefile
+++ b/examples/l2fwd-keepalive/Makefile
@@ -7,6 +7,29 @@ APP = l2fwd-keepalive
# all source are stored in SRCS-y
SRCS-y := main.c shm.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+LDFLAGS += -lrt
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -21,3 +44,4 @@ CFLAGS += $(WERROR_FLAGS)
LDFLAGS += -lrt
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/l2fwd/Makefile b/examples/l2fwd/Makefile
index 8b6ac94..05c22e9 100644
--- a/examples/l2fwd/Makefile
+++ b/examples/l2fwd/Makefile
@@ -7,6 +7,27 @@ APP = l2fwd
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -20,3 +41,4 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/l3fwd-acl/Makefile b/examples/l3fwd-acl/Makefile
index 56129fa..a9e0e21 100644
--- a/examples/l3fwd-acl/Makefile
+++ b/examples/l3fwd-acl/Makefile
@@ -7,6 +7,27 @@ APP = l3fwd-acl
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -26,3 +47,4 @@ CFLAGS_main.o += -Wno-return-type
endif
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/l3fwd-power/Makefile b/examples/l3fwd-power/Makefile
index 9b8f63f..28aa1bd 100644
--- a/examples/l3fwd-power/Makefile
+++ b/examples/l3fwd-power/Makefile
@@ -7,6 +7,27 @@ APP = l3fwd-power
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -33,3 +54,4 @@ endif
include $(RTE_SDK)/mk/rte.extapp.mk
endif
+endif
diff --git a/examples/l3fwd-vf/Makefile b/examples/l3fwd-vf/Makefile
index 2dc8a7c..2c92ce8 100644
--- a/examples/l3fwd-vf/Makefile
+++ b/examples/l3fwd-vf/Makefile
@@ -7,6 +7,27 @@ APP = l3fwd-vf
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -26,3 +47,4 @@ CFLAGS_main.o += -Wno-return-type
endif
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/l3fwd/Makefile b/examples/l3fwd/Makefile
index f44bf89..384706b 100644
--- a/examples/l3fwd/Makefile
+++ b/examples/l3fwd/Makefile
@@ -7,6 +7,27 @@ APP = l3fwd
# all source are stored in SRCS-y
SRCS-y := main.c l3fwd_lpm.c l3fwd_em.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -21,3 +42,4 @@ CFLAGS += -O3 $(USER_FLAGS)
CFLAGS += $(WERROR_FLAGS)
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/link_status_interrupt/Makefile b/examples/link_status_interrupt/Makefile
index d9ecddf..a9cf635 100644
--- a/examples/link_status_interrupt/Makefile
+++ b/examples/link_status_interrupt/Makefile
@@ -7,6 +7,27 @@ APP = link_status_interrupt
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -20,3 +41,4 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/load_balancer/Makefile b/examples/load_balancer/Makefile
index 8476a0d..6d2fc48 100644
--- a/examples/load_balancer/Makefile
+++ b/examples/load_balancer/Makefile
@@ -7,6 +7,27 @@ APP = load_balancer
# all source are stored in SRCS-y
SRCS-y := main.c config.c init.c runtime.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -27,3 +48,4 @@ CFLAGS_main.o += -Wno-return-type
endif
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/packet_ordering/Makefile b/examples/packet_ordering/Makefile
index 18fac4a..01b2ea5 100644
--- a/examples/packet_ordering/Makefile
+++ b/examples/packet_ordering/Makefile
@@ -7,6 +7,27 @@ APP = packet_ordering
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -20,3 +41,4 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/ptpclient/Makefile b/examples/ptpclient/Makefile
index a2f4638..7f683b1 100644
--- a/examples/ptpclient/Makefile
+++ b/examples/ptpclient/Makefile
@@ -7,6 +7,27 @@ APP = ptpclient
# all source are stored in SRCS-y
SRCS-y := ptpclient.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -26,3 +47,4 @@ CFLAGS_main.o += -Wno-return-type
endif
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/qos_meter/Makefile b/examples/qos_meter/Makefile
index e2407bc..7ca297e 100644
--- a/examples/qos_meter/Makefile
+++ b/examples/qos_meter/Makefile
@@ -7,6 +7,27 @@ APP = qos_meter
# all source are stored in SRCS-y
SRCS-y := main.c rte_policer.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -26,3 +47,4 @@ CFLAGS_main.o += -Wno-return-type
endif
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/qos_sched/Makefile b/examples/qos_sched/Makefile
index 22e5b6d..4ee89a9 100644
--- a/examples/qos_sched/Makefile
+++ b/examples/qos_sched/Makefile
@@ -7,6 +7,27 @@ APP = qos_sched
# all source are stored in SRCS-y
SRCS-y := main.c args.c init.c app_thread.c cfg_file.c cmdline.c stats.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -31,3 +52,4 @@ CFLAGS_cfg_file.o := -D_GNU_SOURCE
include $(RTE_SDK)/mk/rte.extapp.mk
endif
+endif
diff --git a/examples/rxtx_callbacks/Makefile b/examples/rxtx_callbacks/Makefile
index 53109de..8ab4756 100644
--- a/examples/rxtx_callbacks/Makefile
+++ b/examples/rxtx_callbacks/Makefile
@@ -7,6 +7,27 @@ APP = rxtx_callbacks
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -27,3 +48,4 @@ endif
EXTRA_CFLAGS += -O3 -g -Wfatal-errors
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/service_cores/Makefile b/examples/service_cores/Makefile
index 46f6c54..01743ba 100644
--- a/examples/service_cores/Makefile
+++ b/examples/service_cores/Makefile
@@ -7,6 +7,29 @@ APP = service_cores
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -26,3 +49,5 @@ CFLAGS_main.o += -Wno-return-type
endif
include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/skeleton/Makefile b/examples/skeleton/Makefile
index 2ee6443..84f4adb 100644
--- a/examples/skeleton/Makefile
+++ b/examples/skeleton/Makefile
@@ -7,6 +7,27 @@ APP = basicfwd
# all source are stored in SRCS-y
SRCS-y := basicfwd.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -27,3 +48,4 @@ endif
EXTRA_CFLAGS += -O3 -g -Wfatal-errors
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/tep_termination/Makefile b/examples/tep_termination/Makefile
index be12e01..717cccd 100644
--- a/examples/tep_termination/Makefile
+++ b/examples/tep_termination/Makefile
@@ -7,6 +7,27 @@ APP = tep_termination
# all source are stored in SRCS-y
SRCS-y := main.c vxlan_setup.c vxlan.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -26,3 +47,4 @@ CFLAGS += $(WERROR_FLAGS)
CFLAGS += -D_GNU_SOURCE
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/timer/Makefile b/examples/timer/Makefile
index e1491ed..1a90b19 100644
--- a/examples/timer/Makefile
+++ b/examples/timer/Makefile
@@ -7,6 +7,27 @@ APP = timer
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -26,3 +47,4 @@ CFLAGS_main.o += -Wno-return-type
endif
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/vhost/Makefile b/examples/vhost/Makefile
index 6328ada..ac0f48d 100644
--- a/examples/vhost/Makefile
+++ b/examples/vhost/Makefile
@@ -7,6 +7,27 @@ APP = vhost-switch
# all source are stored in SRCS-y
SRCS-y := main.c virtio_net.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -29,3 +50,4 @@ CFLAGS += -D_GNU_SOURCE
include $(RTE_SDK)/mk/rte.extapp.mk
endif
+endif
diff --git a/examples/vhost_scsi/Makefile b/examples/vhost_scsi/Makefile
index 8f0c580..05b8a8c 100644
--- a/examples/vhost_scsi/Makefile
+++ b/examples/vhost_scsi/Makefile
@@ -7,6 +7,29 @@ APP = vhost-scsi
# all source are stored in SRCS-y
SRCS-y := scsi.c vhost_scsi.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -22,10 +45,11 @@ please change the definition of the RTE_TARGET environment variable)
all:
else
-CFLAGS += -O2 -D_FILE_OFFSET_BITS=64
+CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS += -O2
CFLAGS += $(WERROR_FLAGS)
-CFLAGS += -D_GNU_SOURCE
include $(RTE_SDK)/mk/rte.extapp.mk
endif
+endif
diff --git a/examples/vm_power_manager/Makefile b/examples/vm_power_manager/Makefile
index 700b119..ef2a9f9 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -1,13 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2010-2014 Intel Corporation
-# binary name
-APP = vm_power_mgr
-
-# all source are stored in SRCS-y
-SRCS-y := main.c vm_power_cli.c power_manager.c channel_manager.c
-SRCS-y += channel_monitor.c
-
ifneq ($(shell pkg-config --atleast-version=0.9.3 libvirt; echo $$?), 0)
$(error vm_power_manager requires libvirt >= 0.9.3)
else
@@ -21,6 +14,13 @@ RTE_TARGET ?= x86_64-native-linuxapp-gcc
include $(RTE_SDK)/mk/rte.vars.mk
+# binary name
+APP = vm_power_mgr
+
+# all source are stored in SRCS-y
+SRCS-y := main.c vm_power_cli.c power_manager.c channel_manager.c
+SRCS-y += channel_monitor.c
+
CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
CFLAGS += $(WERROR_FLAGS)
diff --git a/examples/vmdq/Makefile b/examples/vmdq/Makefile
index ddb3b0c..9a74b24 100644
--- a/examples/vmdq/Makefile
+++ b/examples/vmdq/Makefile
@@ -7,6 +7,27 @@ APP = vmdq_app
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -21,3 +42,4 @@ CFLAGS += $(WERROR_FLAGS)
EXTRA_CFLAGS += -O3
include $(RTE_SDK)/mk/rte.extapp.mk
+endif
diff --git a/examples/vmdq_dcb/Makefile b/examples/vmdq_dcb/Makefile
index 1ebeef5..27af156 100644
--- a/examples/vmdq_dcb/Makefile
+++ b/examples/vmdq_dcb/Makefile
@@ -7,6 +7,27 @@ APP = vmdq_dcb_app
# all source are stored in SRCS-y
SRCS-y := main.c
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += $(shell pkg-config --cflags libdpdk)
+LDFLAGS += $(shell pkg-config --libs libdpdk)
+
+build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
+ $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
+
+build:
+ @mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -f build/$(APP)
+ rmdir --ignore-fail-on-non-empty build
+
+else # Build using legacy build system
+
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
@@ -29,3 +50,4 @@ endif
EXTRA_CFLAGS += -O3 -g
include $(RTE_SDK)/mk/rte.extapp.mk
+endif