]> git.droids-corp.org - dpdk.git/commitdiff
examples: use pkg-config in makefiles
authorBruce Richardson <bruce.richardson@intel.com>
Mon, 9 Oct 2017 13:13:16 +0000 (14:13 +0100)
committerBruce Richardson <bruce.richardson@intel.com>
Tue, 30 Jan 2018 20:58:59 +0000 (21:58 +0100)
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>
40 files changed:
examples/bbdev_app/Makefile
examples/bond/Makefile
examples/cmdline/Makefile
examples/distributor/Makefile
examples/eventdev_pipeline/Makefile
examples/exception_path/Makefile
examples/flow_classify/Makefile
examples/flow_filtering/Makefile
examples/helloworld/Makefile
examples/ip_fragmentation/Makefile
examples/ip_pipeline/Makefile
examples/ip_reassembly/Makefile
examples/ipsec-secgw/Makefile
examples/ipv4_multicast/Makefile
examples/kni/Makefile
examples/l2fwd-cat/Makefile
examples/l2fwd-crypto/Makefile
examples/l2fwd-jobstats/Makefile
examples/l2fwd-keepalive/Makefile
examples/l2fwd/Makefile
examples/l3fwd-acl/Makefile
examples/l3fwd-power/Makefile
examples/l3fwd-vf/Makefile
examples/l3fwd/Makefile
examples/link_status_interrupt/Makefile
examples/load_balancer/Makefile
examples/packet_ordering/Makefile
examples/ptpclient/Makefile
examples/qos_meter/Makefile
examples/qos_sched/Makefile
examples/rxtx_callbacks/Makefile
examples/service_cores/Makefile
examples/skeleton/Makefile
examples/tep_termination/Makefile
examples/timer/Makefile
examples/vhost/Makefile
examples/vhost_scsi/Makefile
examples/vm_power_manager/Makefile
examples/vmdq/Makefile
examples/vmdq_dcb/Makefile

index 8cb89799f91a111a84913256168dd45fe069b21d..0c12dd29b8c505c6607e3ae6616bb0d12d40876b 100644 (file)
@@ -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
index edc699da46bf78e9a5822244c258c09330abc5fc..7944b561ce27fbfcc22228d026a708461ed5bfc7 100644 (file)
@@ -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
index fca3a8259bfd8ad881ea80358959028c256850a7..3597c9f7b08525ad059e332e72d5704a4c9a622b 100644 (file)
@@ -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
index 42778779143021763e539de51fe591affd1a2cdd..2dcdd7dd26dff6df11716ede45cd5abbc3b69d75 100644 (file)
@@ -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
index 888f8215f603451d91e2694569b3aaab1fd6b837..f8063ce45fb9af45907364da95bc5acd3c9c9ee5 100644 (file)
@@ -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
index e0a31ccba4b014364d3b73f6cc2f13ef71b9c3ac..6f2dce86f909bd36ccd307d2da3f2e8a6775407b 100644 (file)
@@ -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
index 9246f15d7d63468f93fc493ea3c7f85c35e9932a..baeac3b7dba98eb1d57ad294246f83890b81847e 100644 (file)
@@ -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
index d6c71e33c71ef9e787b5c6e256e3ff1c39ffbf4f..ba15651ab00515ceae018a583c50e9666a55d0b4 100644 (file)
@@ -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
index 1e58e4112424150cde3bb156870d40169061a8be..19b33850bff5060520b315a7563fff181375e8ff 100644 (file)
@@ -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
index e323e00156cf55c7b01649aad0a3c34de9b517c3..7c158b1d60f8c781362d9153e053337a91de92ab 100644 (file)
@@ -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
index 183532a72875d06bd2710b5a16b5bade38781f4e..308c9e4798a5f15d2ef6a04417138b9825178057 100644 (file)
@@ -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
index 592e14c2b9b793f70868f4a0b356bd0e57292afe..d5fe47d13b9b5ac6d00ee027f38b1caa929278f3 100644 (file)
@@ -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
index 36acd3f74e8e7c2d6fd14de583a16671c24abe9b..5a553e685a754f4fc99dc1622c4c66454efd618c 100644 (file)
@@ -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
index c5a33ed9eb40202043ff9c3224beaec9ec5240a3..806ae32efc6fe9d7769bbbe9324ae1ef6e0d136f 100644 (file)
@@ -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
index 0aab997fd526b7ea86f648eb2b6155dfde989ebc..8d30b241d9f6118f3663f9e85a11b34f6052625b 100644 (file)
@@ -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
index afb15c2909b87ecacae52d2b346f247ce96508f1..c8aa6112184fc9f05de7ffd495319aa6e6e8ba88 100644 (file)
@@ -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
index c920be75ea362b1bfc4c5b31b7b92e3574a1ed76..1048e9444880aa11dc4309b332eae3d60466337e 100644 (file)
@@ -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
index 642717e2b020105d0ecb6a815230b983c1232bdd..a3490a66b1384e49c828be4a682cfdcb715d2eec 100644 (file)
@@ -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
index d1cf4c79518842fbb96277281995372fb5a55e01..e1ddb2a769bd1875e2fbf4d29ec1426a745063ae 100644 (file)
@@ -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
index 8b6ac945fef46c5b019fb5c7e49afef70a4da5db..05c22e97bbb25ad8dd123e7a78ea0789832c6f44 100644 (file)
@@ -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
index 56129fad32740eb54fc2ec7621addbfd51abecee..a9e0e2102faec08138ebd9dfad8a4bcff2e6e781 100644 (file)
@@ -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
index 9b8f63f483fbaceccff61773efaf75284f06df4d..28aa1bdac3bfd9af16e578fc720593cba0185e12 100644 (file)
@@ -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
index 2dc8a7c067799e9459c82f276c0ee373186c42f2..2c92ce84ccab81c2f8491643c9d8eb301ecfcf70 100644 (file)
@@ -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
index f44bf898bbbdc8bf6cd90deca869419a79615bbe..384706bbc06c7b118626c14d35a507e743c1596c 100644 (file)
@@ -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
index d9ecddf7c2100ace408421e1841a2be7e6d71037..a9cf6353805c0579d75b2e28dd93f5309b613605 100644 (file)
@@ -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
index 8476a0d81a0d79a5b09bea2150fb8156942f3cfa..6d2fc48f418188f02f0857d8753f2f35dacab0a3 100644 (file)
@@ -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
index 18fac4a98ecb99f419052edacb0b126fe98f10bc..01b2ea58d758b3185ec011f58199cf0f0151bebe 100644 (file)
@@ -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
index a2f4638d15b08bf1b1e184514890cb58bcfaa5d3..7f683b146bff8a12f111f820bc2b885f748e0d08 100644 (file)
@@ -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
index e2407bc5975aefcb0cdd28d10335460b4e0cfdb7..7ca297e51af68b3b750e277bfb2cb2b286dab214 100644 (file)
@@ -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
index 22e5b6d8eb1cc13415f18419949840f67f8f3fe1..4ee89a975ea651e922c39c8f901415ab4bf18208 100644 (file)
@@ -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
index 53109dee218c57fe47f3899dbfcdbaab52f77d2d..8ab47562e46e563820d647869403f69d088f589b 100644 (file)
@@ -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
index 46f6c54b13dfcdb301754378680c635ca9176cec..01743ba65bd77ba6c1cc2d38ee54b8ec72ddfe3a 100644 (file)
@@ -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
index 2ee64434b898ac0aa920c558a0b4d74b24a70300..84f4adb58a9df18f89e13d1c4d92910f8f0323db 100644 (file)
@@ -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
index be12e01b92932f6bb3bc379cdb580134b63e8943..717cccd6360f016c8f56196fb380edfff7ff310e 100644 (file)
@@ -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
index e1491ed1cac1f68d953230f6e081d3983a5ba160..1a90b19a95cb86bfd070be932bb249afa7df86d9 100644 (file)
@@ -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
index 6328ada9904bb54282cccddb75d75627fe54275e..ac0f48dc34906715e3cfcf565c78b0454e1b2c84 100644 (file)
@@ -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
index 8f0c5802977d85a34da8c6134a43551f91da0df3..05b8a8cdd1cdb84bf512c6cc4078b122512a7793 100644 (file)
@@ -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
index 700b1193118d3becf1ad7090dd169351dfd7e0af..ef2a9f959781e0f7698bacae0892557927e8d367 100644 (file)
@@ -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)
 
index ddb3b0c7677d7ad635f61397ea6b2f5f3a3681b3..9a74b24a51a04a77799bf56591bc1370c582404a 100644 (file)
@@ -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
index 1ebeef58e102a7eb6a54b5604c8f5a80091798cc..27af156c9c8430049b4d938073b43883ce51544e 100644 (file)
@@ -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