From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id B84B31B81D for ; Tue, 17 Oct 2017 18:13:07 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP; 17 Oct 2017 09:13:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,391,1503385200"; d="scan'208";a="163648863" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.223]) by fmsmga005.fm.intel.com with ESMTP; 17 Oct 2017 09:13:06 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Date: Tue, 17 Oct 2017 17:12:20 +0100 Message-Id: <20171017161220.59941-9-bruce.richardson@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171017161220.59941-1-bruce.richardson@intel.com> References: <20171017161220.59941-1-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH 8/8] examples: use pkg-config info when building examples X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Oct 2017 16:13:08 -0000 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 --- examples/bond/Makefile | 23 ++++++++++++++++++++ examples/cmdline/Makefile | 23 ++++++++++++++++++++ examples/distributor/Makefile | 23 ++++++++++++++++++++ examples/eventdev_pipeline_sw_pmd/Makefile | 23 ++++++++++++++++++++ examples/exception_path/Makefile | 23 ++++++++++++++++++++ examples/helloworld/Makefile | 23 ++++++++++++++++++++ examples/ip_fragmentation/Makefile | 23 ++++++++++++++++++++ examples/ip_pipeline/Makefile | 35 ++++++++++++++++++++++++++++-- examples/ip_reassembly/Makefile | 23 ++++++++++++++++++++ examples/ipsec-secgw/Makefile | 27 ++++++++++++++++++++++- examples/ipv4_multicast/Makefile | 23 ++++++++++++++++++++ examples/kni/Makefile | 22 +++++++++++++++++++ examples/l2fwd-cat/Makefile | 25 +++++++++++++++++++++ examples/l2fwd-crypto/Makefile | 22 +++++++++++++++++++ examples/l2fwd-jobstats/Makefile | 22 +++++++++++++++++++ examples/l2fwd-keepalive/Makefile | 24 +++++++++++++++++++- examples/l2fwd/Makefile | 22 +++++++++++++++++++ examples/l3fwd-acl/Makefile | 22 +++++++++++++++++++ examples/l3fwd-power/Makefile | 22 +++++++++++++++++++ examples/l3fwd-vf/Makefile | 22 +++++++++++++++++++ examples/l3fwd/Makefile | 22 +++++++++++++++++++ examples/link_status_interrupt/Makefile | 22 +++++++++++++++++++ examples/load_balancer/Makefile | 22 +++++++++++++++++++ examples/packet_ordering/Makefile | 22 +++++++++++++++++++ examples/ptpclient/Makefile | 22 +++++++++++++++++++ examples/qos_meter/Makefile | 22 +++++++++++++++++++ examples/qos_sched/Makefile | 22 +++++++++++++++++++ examples/rxtx_callbacks/Makefile | 22 +++++++++++++++++++ examples/skeleton/Makefile | 22 +++++++++++++++++++ examples/tep_termination/Makefile | 22 +++++++++++++++++++ examples/timer/Makefile | 22 +++++++++++++++++++ examples/vhost/Makefile | 22 +++++++++++++++++++ examples/vhost_scsi/Makefile | 27 +++++++++++++++++++++-- examples/vm_power_manager/Makefile | 14 ++++++------ examples/vmdq/Makefile | 22 +++++++++++++++++++ examples/vmdq_dcb/Makefile | 22 +++++++++++++++++++ 36 files changed, 808 insertions(+), 13 deletions(-) diff --git a/examples/bond/Makefile b/examples/bond/Makefile index 5e7927489..47e9adc77 100644 --- a/examples/bond/Makefile +++ b/examples/bond/Makefile @@ -35,6 +35,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 @@ -59,3 +80,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 118082e04..a9b61c508 100644 --- a/examples/cmdline/Makefile +++ b/examples/cmdline/Makefile @@ -35,6 +35,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 @@ -55,3 +76,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 e800446ae..96b250407 100644 --- a/examples/distributor/Makefile +++ b/examples/distributor/Makefile @@ -35,6 +35,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 @@ -55,3 +76,5 @@ endif EXTRA_CFLAGS += -O3 -Wfatal-errors include $(RTE_SDK)/mk/rte.extapp.mk + +endif diff --git a/examples/eventdev_pipeline_sw_pmd/Makefile b/examples/eventdev_pipeline_sw_pmd/Makefile index eac984734..18fd35a55 100644 --- a/examples/eventdev_pipeline_sw_pmd/Makefile +++ b/examples/eventdev_pipeline_sw_pmd/Makefile @@ -34,6 +34,27 @@ APP = eventdev_pipeline_sw_pmd # 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 @@ -47,3 +68,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 010cc82e7..60bcf63fa 100644 --- a/examples/exception_path/Makefile +++ b/examples/exception_path/Makefile @@ -35,6 +35,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 @@ -48,3 +69,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 53bb9620f..e5378f118 100644 --- a/examples/helloworld/Makefile +++ b/examples/helloworld/Makefile @@ -35,6 +35,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 @@ -48,3 +69,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 b6f63e7be..b879ed694 100644 --- a/examples/ip_fragmentation/Makefile +++ b/examples/ip_fragmentation/Makefile @@ -36,6 +36,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 @@ -55,3 +76,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 05137eb14..0d36ff223 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -32,8 +32,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 @@ -60,10 +58,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 @@ -78,3 +107,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 c17055b5f..f20f89744 100644 --- a/examples/ip_reassembly/Makefile +++ b/examples/ip_reassembly/Makefile @@ -36,6 +36,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 @@ -55,3 +76,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 e115ca56e..0a14fc1e5 100644 --- a/examples/ipsec-secgw/Makefile +++ b/examples/ipsec-secgw/Makefile @@ -43,6 +43,29 @@ 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) + +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 @@ -52,7 +75,7 @@ RTE_TARGET ?= x86_64-native-linuxapp-gcc include $(RTE_SDK)/mk/rte.vars.mk -CFLAGS += -O3 -gdwarf-2 +CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y) CFLAGS_sa.o += -diag-disable=vec @@ -63,3 +86,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 28a3a619e..5278c15ef 100644 --- a/examples/ipv4_multicast/Makefile +++ b/examples/ipv4_multicast/Makefile @@ -36,6 +36,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 @@ -55,3 +76,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 89304ade5..63d57472c 100644 --- a/examples/kni/Makefile +++ b/examples/kni/Makefile @@ -35,6 +35,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 @@ -53,3 +74,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 66bc00f92..308a4e078 100644 --- a/examples/l2fwd-cat/Makefile +++ b/examples/l2fwd-cat/Makefile @@ -35,6 +35,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 @@ -65,3 +89,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 49cffe965..afa32b010 100644 --- a/examples/l2fwd-crypto/Makefile +++ b/examples/l2fwd-crypto/Makefile @@ -35,6 +35,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 @@ -48,3 +69,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 d905ef86f..315daf691 100644 --- a/examples/l2fwd-jobstats/Makefile +++ b/examples/l2fwd-jobstats/Makefile @@ -35,6 +35,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 @@ -49,3 +70,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 a58a710cd..a4daeeb04 100644 --- a/examples/l2fwd-keepalive/Makefile +++ b/examples/l2fwd-keepalive/Makefile @@ -34,6 +34,28 @@ APP = l2fwd-keepalive # all source are stored in SRCS-y SRCS-y := main.c shm.c +LDFLAGS += -lrt + +# 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") @@ -46,6 +68,6 @@ include $(RTE_SDK)/mk/rte.vars.mk CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) -LDFLAGS += -lrt include $(RTE_SDK)/mk/rte.extapp.mk +endif diff --git a/examples/l2fwd/Makefile b/examples/l2fwd/Makefile index 52f852f23..55a67d636 100644 --- a/examples/l2fwd/Makefile +++ b/examples/l2fwd/Makefile @@ -35,6 +35,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 @@ -48,3 +69,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 aa1423211..afd7421ff 100644 --- a/examples/l3fwd-acl/Makefile +++ b/examples/l3fwd-acl/Makefile @@ -35,6 +35,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 @@ -54,3 +75,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 d68b413f8..c17e66db3 100644 --- a/examples/l3fwd-power/Makefile +++ b/examples/l3fwd-power/Makefile @@ -35,6 +35,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 @@ -61,3 +82,4 @@ endif include $(RTE_SDK)/mk/rte.extapp.mk endif +endif diff --git a/examples/l3fwd-vf/Makefile b/examples/l3fwd-vf/Makefile index f95651945..f3b324db0 100644 --- a/examples/l3fwd-vf/Makefile +++ b/examples/l3fwd-vf/Makefile @@ -35,6 +35,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 @@ -54,3 +75,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 0ae1dc43b..41abfe7f6 100644 --- a/examples/l3fwd/Makefile +++ b/examples/l3fwd/Makefile @@ -35,6 +35,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 @@ -49,3 +70,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 9607da6ad..0e36eac0c 100644 --- a/examples/link_status_interrupt/Makefile +++ b/examples/link_status_interrupt/Makefile @@ -35,6 +35,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 @@ -48,3 +69,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 cff10e1b6..458e712de 100644 --- a/examples/load_balancer/Makefile +++ b/examples/load_balancer/Makefile @@ -35,6 +35,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 @@ -55,3 +76,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 19fe743a7..a9b4eb016 100644 --- a/examples/packet_ordering/Makefile +++ b/examples/packet_ordering/Makefile @@ -35,6 +35,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 @@ -48,3 +69,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 4cbb9528e..7ed57d9fc 100644 --- a/examples/ptpclient/Makefile +++ b/examples/ptpclient/Makefile @@ -35,6 +35,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 @@ -54,3 +75,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 178835836..34879e105 100644 --- a/examples/qos_meter/Makefile +++ b/examples/qos_meter/Makefile @@ -35,6 +35,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 @@ -54,3 +75,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 3cd5c229f..f33c5b61d 100644 --- a/examples/qos_sched/Makefile +++ b/examples/qos_sched/Makefile @@ -35,6 +35,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 @@ -59,3 +80,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 4bf72fbee..40989fdd5 100644 --- a/examples/rxtx_callbacks/Makefile +++ b/examples/rxtx_callbacks/Makefile @@ -35,6 +35,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 @@ -55,3 +76,4 @@ endif EXTRA_CFLAGS += -O3 -g -Wfatal-errors include $(RTE_SDK)/mk/rte.extapp.mk +endif diff --git a/examples/skeleton/Makefile b/examples/skeleton/Makefile index fc54c0a48..ff13e7888 100644 --- a/examples/skeleton/Makefile +++ b/examples/skeleton/Makefile @@ -35,6 +35,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 @@ -55,3 +76,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 9974e75fa..52149a4b0 100644 --- a/examples/tep_termination/Makefile +++ b/examples/tep_termination/Makefile @@ -35,6 +35,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 @@ -54,3 +75,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 e4bce3161..dc1fb74ce 100644 --- a/examples/timer/Makefile +++ b/examples/timer/Makefile @@ -35,6 +35,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 @@ -54,3 +75,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 5b743af03..de0c8d872 100644 --- a/examples/vhost/Makefile +++ b/examples/vhost/Makefile @@ -35,6 +35,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 @@ -57,3 +78,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 1f3fd2a9a..29b654da6 100644 --- a/examples/vhost_scsi/Makefile +++ b/examples/vhost_scsi/Makefile @@ -35,6 +35,29 @@ APP = vhost-scsi # all source are stored in SRCS-y SRCS-y := scsi.c vhost_scsi.c +CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 + +# 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 @@ -50,10 +73,10 @@ please change the definition of the RTE_TARGET environment variable) all: else -CFLAGS += -O2 -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 bee0f5e41..9cf20a289 100644 --- a/examples/vm_power_manager/Makefile +++ b/examples/vm_power_manager/Makefile @@ -29,13 +29,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# 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 @@ -49,6 +42,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 7deaf4506..bd2aae34c 100644 --- a/examples/vmdq/Makefile +++ b/examples/vmdq/Makefile @@ -35,6 +35,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 @@ -49,3 +70,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 554f6c0cb..d75498c45 100644 --- a/examples/vmdq_dcb/Makefile +++ b/examples/vmdq_dcb/Makefile @@ -35,6 +35,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 @@ -57,3 +78,4 @@ endif EXTRA_CFLAGS += -O3 -g include $(RTE_SDK)/mk/rte.extapp.mk +endif -- 2.13.6