From: Bruce Richardson Date: Mon, 9 Oct 2017 13:13:16 +0000 (+0100) Subject: examples: use pkg-config in makefiles X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=22119c4591a0;p=dpdk.git 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 Reviewed-by: Luca Boccassi --- diff --git a/examples/bbdev_app/Makefile b/examples/bbdev_app/Makefile index 8cb89799f9..0c12dd29b8 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 edc699da46..7944b561ce 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 fca3a8259b..3597c9f7b0 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 4277877914..2dcdd7dd26 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 888f8215f6..f8063ce45f 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 e0a31ccba4..6f2dce86f9 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 9246f15d7d..baeac3b7db 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 d6c71e33c7..ba15651ab0 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 1e58e41124..19b33850bf 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 e323e00156..7c158b1d60 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 183532a728..308c9e4798 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 592e14c2b9..d5fe47d13b 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 36acd3f74e..5a553e685a 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 c5a33ed9eb..806ae32efc 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 0aab997fd5..8d30b241d9 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 afb15c2909..c8aa611218 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 c920be75ea..1048e94448 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 642717e2b0..a3490a66b1 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 d1cf4c7951..e1ddb2a769 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 8b6ac945fe..05c22e97bb 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 56129fad32..a9e0e2102f 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 9b8f63f483..28aa1bdac3 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 2dc8a7c067..2c92ce84cc 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 f44bf898bb..384706bbc0 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 d9ecddf7c2..a9cf635380 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 8476a0d81a..6d2fc48f41 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 18fac4a98e..01b2ea58d7 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 a2f4638d15..7f683b146b 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 e2407bc597..7ca297e51a 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 22e5b6d8eb..4ee89a975e 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 53109dee21..8ab47562e4 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 46f6c54b13..01743ba65b 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 2ee64434b8..84f4adb58a 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 be12e01b92..717cccd636 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 e1491ed1ca..1a90b19a95 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 6328ada990..ac0f48dc34 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 8f0c580297..05b8a8cdd1 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 700b119311..ef2a9f9597 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 ddb3b0c767..9a74b24a51 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 1ebeef58e1..27af156c9c 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