DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 0/6] examples: add a new makefile to build all examples
@ 2014-05-09 10:32 Olivier Matz
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 1/6] mk: introduce rte.extsubdir.mk Olivier Matz
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Olivier Matz @ 2014-05-09 10:32 UTC (permalink / raw)
  To: dev

This patch series adds a makefile to build all examples supported
by the configuration. It helps to check that all examples compile
after a dpdk modification.

After applying the patches, it is possible to build all examples for
given targets, given the installation directory:

  # first, install the x86_64-default-linuxapp-gcc in
  # ${RTE_SDK}/x86_64-default-linuxapp-gcc directory
  user@droids:~/dpdk.org$ make install T=x86_64-default-linuxapp-gcc
  # build examples for this new installation in
  # ${RTE_SDK}/examples directory
  user@droids:~/dpdk.org$ make examples T=x86_64-default-linuxapp-gcc

Or directly from examples directory:

  user@droids:~/dpdk.org$ cd examples
  user@droids:~/dpdk.org/examples$ make RTE_SDK=${PWD}/.. \
      RTE_TARGET=x86_64-default-linuxapp-gcc


Changes included in v2:
  - do not build kni example if CONFIG_RTE_LIBRTE_KNI is not set
  - fix rte.extsubdir.mk when there are several levels of subdirectories
  - allow to build examples directly from dpdk root directory
  - explain in commit logs that it requires an install directory

Olivier Matz (6):
  mk: introduce rte.extsubdir.mk
  examples: use rte.extsubdir.mk to process subdirectories
  examples: add a makefile to build all examples
  examples: fix qos_sched makefile
  examples: fix netmap_compat example
  mk: add "make examples" target in root makefile

 doc/build-sdk-quick.txt                          | 14 +++--
 examples/Makefile                                | 68 ++++++++++++++++++++
 examples/l2fwd-ivshmem/Makefile                  |  9 +--
 examples/multi_process/Makefile                  | 16 +++--
 examples/multi_process/client_server_mp/Makefile | 15 ++---
 examples/netmap_compat/bridge/Makefile           |  5 +-
 examples/qos_sched/Makefile                      |  2 -
 examples/quota_watermark/Makefile                | 12 +---
 mk/rte.extsubdir.mk                              | 53 ++++++++++++++++
 mk/rte.sdkexamples.mk                            | 79 ++++++++++++++++++++++++
 mk/rte.sdkroot.mk                                |  4 ++
 11 files changed, 233 insertions(+), 44 deletions(-)
 create mode 100644 examples/Makefile
 create mode 100644 mk/rte.extsubdir.mk
 create mode 100644 mk/rte.sdkexamples.mk

-- 
1.9.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dpdk-dev] [PATCH v2 1/6] mk: introduce rte.extsubdir.mk
  2014-05-09 10:32 [dpdk-dev] [PATCH v2 0/6] examples: add a new makefile to build all examples Olivier Matz
@ 2014-05-09 10:32 ` Olivier Matz
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 2/6] examples: use rte.extsubdir.mk to process subdirectories Olivier Matz
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Olivier Matz @ 2014-05-09 10:32 UTC (permalink / raw)
  To: dev

This makefile can be included by a project that needs to build several
applications or libraries that are located in different directories.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 mk/rte.extsubdir.mk | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 mk/rte.extsubdir.mk

diff --git a/mk/rte.extsubdir.mk b/mk/rte.extsubdir.mk
new file mode 100644
index 0000000..f50f006
--- /dev/null
+++ b/mk/rte.extsubdir.mk
@@ -0,0 +1,53 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2014 6WIND S.A.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#     * Neither the name of 6WIND S.A. nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+MAKEFLAGS += --no-print-directory
+
+# output directory
+O ?= .
+BASE_OUTPUT ?= $(O)
+CUR_SUBDIR ?= .
+
+.PHONY: all
+all: $(DIRS-y)
+
+.PHONY: clean
+clean: $(DIRS-y)
+
+.PHONY: $(DIRS-y)
+$(DIRS-y):
+	@echo "== $@"
+	$(Q)$(MAKE) -C $(@) \
+		M=$(CURDIR)/$(@)/Makefile \
+		O=$(BASE_OUTPUT)/$(CUR_SUBDIR)/$(@)/$(RTE_TARGET) \
+		BASE_OUTPUT=$(BASE_OUTPUT) \
+		CUR_SUBDIR=$(CUR_SUBDIR)/$(@) \
+		S=$(CURDIR)/$(@) \
+		$(filter-out $(DIRS-y),$(MAKECMDGOALS))
-- 
1.9.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dpdk-dev] [PATCH v2 2/6] examples: use rte.extsubdir.mk to process subdirectories
  2014-05-09 10:32 [dpdk-dev] [PATCH v2 0/6] examples: add a new makefile to build all examples Olivier Matz
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 1/6] mk: introduce rte.extsubdir.mk Olivier Matz
@ 2014-05-09 10:32 ` Olivier Matz
  2014-05-13 13:51   ` [dpdk-dev] [PATCH v3 " Olivier Matz
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 3/6] examples: add a makefile to build all examples Olivier Matz
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Olivier Matz @ 2014-05-09 10:32 UTC (permalink / raw)
  To: dev

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 examples/l2fwd-ivshmem/Makefile                  |  9 +--------
 examples/multi_process/Makefile                  | 16 +++++++---------
 examples/multi_process/client_server_mp/Makefile | 15 ++++++---------
 examples/quota_watermark/Makefile                | 12 +++---------
 4 files changed, 17 insertions(+), 35 deletions(-)

diff --git a/examples/l2fwd-ivshmem/Makefile b/examples/l2fwd-ivshmem/Makefile
index 7286b37..df59ed8 100644
--- a/examples/l2fwd-ivshmem/Makefile
+++ b/examples/l2fwd-ivshmem/Makefile
@@ -37,14 +37,7 @@ endif
 RTE_TARGET ?= x86_64-ivshmem-linuxapp-gcc
 
 include $(RTE_SDK)/mk/rte.vars.mk
-unexport RTE_SRCDIR RTE_OUTPUT RTE_EXTMK
 
 DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += host guest
 
-.PHONY: all clean $(DIRS-y)
-
-all: $(DIRS-y)
-clean: $(DIRS-y)
-
-$(DIRS-y):
-	$(MAKE) -C $@ $(MAKECMDGOALS)
+include $(RTE_SDK)/mk/rte.extsubdir.mk
diff --git a/examples/multi_process/Makefile b/examples/multi_process/Makefile
index ba96a7e..f2c8e68 100644
--- a/examples/multi_process/Makefile
+++ b/examples/multi_process/Makefile
@@ -33,15 +33,13 @@ ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
 
-include $(RTE_SDK)/mk/rte.vars.mk
-unexport RTE_SRCDIR RTE_OUTPUT RTE_EXTMK
-
-DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += $(wildcard *_mp)
+# Default target, can be overriden by command line or environment
+RTE_TARGET ?= x86_64-ivshmem-linuxapp-gcc
 
-.PHONY: all clean $(DIRS-y)
+include $(RTE_SDK)/mk/rte.vars.mk
 
-all: $(DIRS-y)
-clean: $(DIRS-y)
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += client_server_mp
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += simple_mp
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += symmetric_mp
 
-$(DIRS-y):
-	$(MAKE) -C $@ $(MAKECMDGOALS)
+include $(RTE_SDK)/mk/rte.extsubdir.mk
diff --git a/examples/multi_process/client_server_mp/Makefile b/examples/multi_process/client_server_mp/Makefile
index 24d31b0..b8d6b3f 100644
--- a/examples/multi_process/client_server_mp/Makefile
+++ b/examples/multi_process/client_server_mp/Makefile
@@ -33,15 +33,12 @@ ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
 
-include $(RTE_SDK)/mk/rte.vars.mk
-unexport RTE_SRCDIR RTE_OUTPUT RTE_EXTMK
-
-DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += $(wildcard mp_*)
+# Default target, can be overriden by command line or environment
+RTE_TARGET ?= x86_64-ivshmem-linuxapp-gcc
 
-.PHONY: all clean $(DIRS-y)
+include $(RTE_SDK)/mk/rte.vars.mk
 
-all: $(DIRS-y)
-clean: $(DIRS-y)
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += mp_client
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += mp_server
 
-$(DIRS-y):
-	$(MAKE) -C $@ $(MAKECMDGOALS)
+include $(RTE_SDK)/mk/rte.extsubdir.mk
diff --git a/examples/quota_watermark/Makefile b/examples/quota_watermark/Makefile
index 5596dcc..e4d54c2 100644
--- a/examples/quota_watermark/Makefile
+++ b/examples/quota_watermark/Makefile
@@ -37,14 +37,8 @@ endif
 RTE_TARGET ?= x86_64-default-linuxapp-gcc
 
 include $(RTE_SDK)/mk/rte.vars.mk
-unexport RTE_SRCDIR RTE_OUTPUT RTE_EXTMK
 
-DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += $(wildcard qw*)
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += qw
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += qwctl
 
-.PHONY: all clean $(DIRS-y)
-
-all: $(DIRS-y)
-clean: $(DIRS-y)
-
-$(DIRS-y):
-	$(MAKE) -C $@ $(MAKECMDGOALS)
+include $(RTE_SDK)/mk/rte.extsubdir.mk
-- 
1.9.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dpdk-dev] [PATCH v2 3/6] examples: add a makefile to build all examples
  2014-05-09 10:32 [dpdk-dev] [PATCH v2 0/6] examples: add a new makefile to build all examples Olivier Matz
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 1/6] mk: introduce rte.extsubdir.mk Olivier Matz
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 2/6] examples: use rte.extsubdir.mk to process subdirectories Olivier Matz
@ 2014-05-09 10:32 ` Olivier Matz
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 4/6] examples: fix qos_sched makefile Olivier Matz
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Olivier Matz @ 2014-05-09 10:32 UTC (permalink / raw)
  To: dev

It is now possible to build all examples by doing the following:

  user@droids:~/dpdk.org$ make install T=x86_64-default-linuxapp-gcc
  user@droids:~/dpdk.org$ cd examples
  user@droids:~/dpdk.org/examples$ make RTE_SDK=${PWD}/.. \
      RTE_TARGET=x86_64-default-linuxapp-gcc

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 examples/Makefile | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 examples/Makefile

diff --git a/examples/Makefile b/examples/Makefile
new file mode 100644
index 0000000..5e36c92
--- /dev/null
+++ b/examples/Makefile
@@ -0,0 +1,68 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2014 6WIND S.A.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#     * Neither the name of 6WIND S.A. nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ifeq ($(RTE_SDK),)
+$(error "Please define RTE_SDK environment variable")
+endif
+
+# Default target, can be overriden by command line or environment
+RTE_TARGET ?= x86_64-default-linuxapp-gcc
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+DIRS-y += cmdline
+ifneq ($(ICP_ROOT),)
+DIRS-y += dpdk_qat
+endif
+DIRS-y += exception_path
+DIRS-y += helloworld
+DIRS-y += ip_reassembly
+DIRS-$(CONFIG_RTE_MBUF_SCATTER_GATHER) += ipv4_frag
+DIRS-$(CONFIG_RTE_MBUF_SCATTER_GATHER) += ipv4_multicast
+DIRS-$(CONFIG_RTE_LIBRTE_KNI) += kni
+DIRS-y += l2fwd
+DIRS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += l2fwd-ivshmem
+DIRS-y += l3fwd
+DIRS-y += l3fwd-power
+DIRS-y += l3fwd-vf
+DIRS-y += link_status_interrupt
+DIRS-y += load_balancer
+DIRS-y += multi_process
+DIRS-y += netmap_compat/bridge
+DIRS-$(CONFIG_RTE_LIBRTE_METER) += qos_meter
+DIRS-$(CONFIG_RTE_LIBRTE_SCHED) += qos_sched
+DIRS-y += quota_watermark
+DIRS-y += timer
+DIRS-y += vhost
+DIRS-$(CONFIG_RTE_LIBRTE_XEN_DOM0) += vhost_xen
+DIRS-y += vmdq
+DIRS-y += vmdq_dcb
+
+include $(RTE_SDK)/mk/rte.extsubdir.mk
-- 
1.9.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dpdk-dev] [PATCH v2 4/6] examples: fix qos_sched makefile
  2014-05-09 10:32 [dpdk-dev] [PATCH v2 0/6] examples: add a new makefile to build all examples Olivier Matz
                   ` (2 preceding siblings ...)
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 3/6] examples: add a makefile to build all examples Olivier Matz
@ 2014-05-09 10:32 ` Olivier Matz
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 5/6] examples: fix netmap_compat example Olivier Matz
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 6/6] mk: add "make examples" target in root makefile Olivier Matz
  5 siblings, 0 replies; 10+ messages in thread
From: Olivier Matz @ 2014-05-09 10:32 UTC (permalink / raw)
  To: dev

The example does not compile as the linker complains about duplicated
symbols.

Remove -lsched from LDLIBS, it is already present in rte.app.mk and
added by the DPDK framework automatically.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 examples/qos_sched/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/examples/qos_sched/Makefile b/examples/qos_sched/Makefile
index b91fe37..9366efe 100755
--- a/examples/qos_sched/Makefile
+++ b/examples/qos_sched/Makefile
@@ -54,6 +54,4 @@ CFLAGS += $(WERROR_FLAGS)
 CFLAGS_args.o := -D_GNU_SOURCE
 CFLAGS_cfg_file.o := -D_GNU_SOURCE
 
-LDLIBS += -lrte_sched
-
 include $(RTE_SDK)/mk/rte.extapp.mk
-- 
1.9.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dpdk-dev] [PATCH v2 5/6] examples: fix netmap_compat example
  2014-05-09 10:32 [dpdk-dev] [PATCH v2 0/6] examples: add a new makefile to build all examples Olivier Matz
                   ` (3 preceding siblings ...)
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 4/6] examples: fix qos_sched makefile Olivier Matz
@ 2014-05-09 10:32 ` Olivier Matz
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 6/6] mk: add "make examples" target in root makefile Olivier Matz
  5 siblings, 0 replies; 10+ messages in thread
From: Olivier Matz @ 2014-05-09 10:32 UTC (permalink / raw)
  To: dev

It is not allowed to reference a an absolute file name in SRCS-y.
A VPATH has to be used, else the dependencies won't be checked
properly.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 examples/netmap_compat/bridge/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/examples/netmap_compat/bridge/Makefile b/examples/netmap_compat/bridge/Makefile
index 74feb1e..ebc6b1c 100644
--- a/examples/netmap_compat/bridge/Makefile
+++ b/examples/netmap_compat/bridge/Makefile
@@ -41,9 +41,12 @@ include $(RTE_SDK)/mk/rte.vars.mk
 # binary name
 APP = bridge
 
+# for compat_netmap.c
+VPATH := $(SRCDIR)/../lib
+
 # all source are stored in SRCS-y
 SRCS-y := bridge.c
-SRCS-y += $(SRCDIR)/../lib/compat_netmap.c
+SRCS-y += compat_netmap.c
 
 CFLAGS += -O3 -I$(SRCDIR)/../lib -I$(SRCDIR)/../netmap
 CFLAGS += $(WERROR_FLAGS)
-- 
1.9.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dpdk-dev] [PATCH v2 6/6] mk: add "make examples" target in root makefile
  2014-05-09 10:32 [dpdk-dev] [PATCH v2 0/6] examples: add a new makefile to build all examples Olivier Matz
                   ` (4 preceding siblings ...)
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 5/6] examples: fix netmap_compat example Olivier Matz
@ 2014-05-09 10:32 ` Olivier Matz
  2014-05-14 14:04   ` Thomas Monjalon
  5 siblings, 1 reply; 10+ messages in thread
From: Olivier Matz @ 2014-05-09 10:32 UTC (permalink / raw)
  To: dev

It is now possible to build all projects from the examples/ directory
using one command from root directory.

Some illustration of what is possible:

- build examples in the DPDK tree for one target

  # install the x86_64-default-linuxapp-gcc in
  # ${RTE_SDK}/x86_64-default-linuxapp-gcc directory
  user@droids:~/dpdk.org$ make install T=x86_64-default-linuxapp-gcc
  # build examples for this new installation in
  # ${RTE_SDK}/examples directory
  user@droids:~/dpdk.org$ make examples T=x86_64-default-linuxapp-gcc

- build examples outside DPDK tree for several targets

  # install all targets matching x86_64-*-linuxapp-gcc in
  # ${RTE_SDK}/x86_64-*-linuxapp-gcc directories
  user@droids:~/dpdk.org$ make install T=x86_64-*-linuxapp-gcc
  # build examples for these installations in /tmp/foobar
  user@droids:~/dpdk.org$ make examples T=x86_64-*-linuxapp-gcc O=/tmp/foobar

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 doc/build-sdk-quick.txt | 14 +++++----
 mk/rte.sdkexamples.mk   | 79 +++++++++++++++++++++++++++++++++++++++++++++++++
 mk/rte.sdkroot.mk       |  4 +++
 3 files changed, 91 insertions(+), 6 deletions(-)
 create mode 100644 mk/rte.sdkexamples.mk

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index 8989a32..d768c44 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -1,12 +1,14 @@
 Basic build
 	make config T=x86_64-default-linuxapp-gcc && make
 Build commands
-	config      get configuration from target template (T=)
-	all         same as build (default rule)
-	build       build in a configured directory
-	clean       remove files but keep configuration
-	install     build many targets (wildcard allowed) and install in DESTDIR
-	uninstall   remove all installed targets
+	config           get configuration from target template (T=)
+	all              same as build (default rule)
+	build            build in a configured directory
+	clean            remove files but keep configuration
+	install          build many targets (wildcard allowed) and install in DESTDIR
+	uninstall        remove all installed targets
+	examples         build examples for given targets (T=)
+	examples_clean   clean examples for given targets (T=)
 Build variables
 	EXTRA_CPPFLAGS   preprocessor options
 	EXTRA_CFLAGS     compiler options
diff --git a/mk/rte.sdkexamples.mk b/mk/rte.sdkexamples.mk
new file mode 100644
index 0000000..a76570e
--- /dev/null
+++ b/mk/rte.sdkexamples.mk
@@ -0,0 +1,79 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2014 6WIND S.A.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#     * Neither the name of 6WIND S.A. nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# examples application are seen as external applications which are
+# not part of SDK.
+BUILDING_RTE_SDK :=
+export BUILDING_RTE_SDK
+
+# Build directory is given with O=
+ifndef O
+O = $(RTE_SDK)/examples
+endif
+
+# Target for which examples should be built.
+ifndef T
+T = *
+endif
+
+# list all available configurations
+EXAMPLES_CONFIGS := $(patsubst $(RTE_SRCDIR)/config/defconfig_%,%,\
+	$(wildcard $(RTE_SRCDIR)/config/defconfig_$(T)))
+EXAMPLES_TARGETS := $(addsuffix _examples,\
+	$(filter-out %~,$(EXAMPLES_CONFIGS)))
+
+.PHONY: examples
+examples: $(EXAMPLES_TARGETS)
+
+%_examples:
+	@echo ================== Build examples for $*
+	$(Q)if [ ! -d "${RTE_SDK}/${*}" ]; then \
+		echo "Target ${*} does not exist in ${RTE_SDK}/${*}." ; \
+		echo -n "Please install DPDK first (make install) or use another " ; \
+		echo "target argument (T=target)." ; \
+	else \
+		$(MAKE) -C examples O=$(O) RTE_TARGET=$(*); \
+	fi
+
+EXAMPLES_CLEAN_TARGETS := $(addsuffix _examples_clean,\
+	$(filter-out %~,$(EXAMPLES_CONFIGS)))
+
+.PHONY: examples_clean
+examples_clean: $(EXAMPLES_CLEAN_TARGETS)
+
+%_examples_clean:
+	@echo ================== Clean examples for $*
+	$(Q)if [ ! -d "${RTE_SDK}/${*}" ]; then \
+		echo "Target ${*} does not exist in ${RTE_SDK}/${*}." ; \
+		echo -n "Please install DPDK first (make install) or use another " ; \
+		echo "target argument (T=target)." ; \
+	else \
+		$(MAKE) -C examples O=$(O) RTE_TARGET=$(*) clean; \
+	fi
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index 28e404b..54aa204 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -115,6 +115,10 @@ depdirs depgraph:
 gcov gcovclean:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkgcov.mk $@
 
+.PHONY: examples examples_clean
+examples examples_clean:
+	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkexamples.mk $@
+
 # all other build targets
 %:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk checkconfig
-- 
1.9.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dpdk-dev] [PATCH v3 2/6] examples: use rte.extsubdir.mk to process subdirectories
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 2/6] examples: use rte.extsubdir.mk to process subdirectories Olivier Matz
@ 2014-05-13 13:51   ` Olivier Matz
  0 siblings, 0 replies; 10+ messages in thread
From: Olivier Matz @ 2014-05-13 13:51 UTC (permalink / raw)
  To: dev

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 examples/l2fwd-ivshmem/Makefile                  |  9 +--------
 examples/multi_process/Makefile                  | 16 +++++++---------
 examples/multi_process/client_server_mp/Makefile | 15 ++++++---------
 examples/quota_watermark/Makefile                | 12 +++---------
 4 files changed, 17 insertions(+), 35 deletions(-)

change included in v3:
  use x86_64-default-linuxapp-gcc instead of x86_64-ivshmem-linuxapp-gcc
  for default RTE_TARGET of multi_process example (was a bad copy/paste).

diff --git a/examples/l2fwd-ivshmem/Makefile b/examples/l2fwd-ivshmem/Makefile
index 7286b37..df59ed8 100644
--- a/examples/l2fwd-ivshmem/Makefile
+++ b/examples/l2fwd-ivshmem/Makefile
@@ -37,14 +37,7 @@ endif
 RTE_TARGET ?= x86_64-ivshmem-linuxapp-gcc
 
 include $(RTE_SDK)/mk/rte.vars.mk
-unexport RTE_SRCDIR RTE_OUTPUT RTE_EXTMK
 
 DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += host guest
 
-.PHONY: all clean $(DIRS-y)
-
-all: $(DIRS-y)
-clean: $(DIRS-y)
-
-$(DIRS-y):
-	$(MAKE) -C $@ $(MAKECMDGOALS)
+include $(RTE_SDK)/mk/rte.extsubdir.mk
diff --git a/examples/multi_process/Makefile b/examples/multi_process/Makefile
index ba96a7e..5e01f9a 100644
--- a/examples/multi_process/Makefile
+++ b/examples/multi_process/Makefile
@@ -33,15 +33,13 @@ ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
 
-include $(RTE_SDK)/mk/rte.vars.mk
-unexport RTE_SRCDIR RTE_OUTPUT RTE_EXTMK
-
-DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += $(wildcard *_mp)
+# Default target, can be overriden by command line or environment
+RTE_TARGET ?= x86_64-default-linuxapp-gcc
 
-.PHONY: all clean $(DIRS-y)
+include $(RTE_SDK)/mk/rte.vars.mk
 
-all: $(DIRS-y)
-clean: $(DIRS-y)
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += client_server_mp
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += simple_mp
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += symmetric_mp
 
-$(DIRS-y):
-	$(MAKE) -C $@ $(MAKECMDGOALS)
+include $(RTE_SDK)/mk/rte.extsubdir.mk
diff --git a/examples/multi_process/client_server_mp/Makefile b/examples/multi_process/client_server_mp/Makefile
index 24d31b0..d2046ba 100644
--- a/examples/multi_process/client_server_mp/Makefile
+++ b/examples/multi_process/client_server_mp/Makefile
@@ -33,15 +33,12 @@ ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
 
-include $(RTE_SDK)/mk/rte.vars.mk
-unexport RTE_SRCDIR RTE_OUTPUT RTE_EXTMK
-
-DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += $(wildcard mp_*)
+# Default target, can be overriden by command line or environment
+RTE_TARGET ?= x86_64-default-linuxapp-gcc
 
-.PHONY: all clean $(DIRS-y)
+include $(RTE_SDK)/mk/rte.vars.mk
 
-all: $(DIRS-y)
-clean: $(DIRS-y)
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += mp_client
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += mp_server
 
-$(DIRS-y):
-	$(MAKE) -C $@ $(MAKECMDGOALS)
+include $(RTE_SDK)/mk/rte.extsubdir.mk
diff --git a/examples/quota_watermark/Makefile b/examples/quota_watermark/Makefile
index 5596dcc..e4d54c2 100644
--- a/examples/quota_watermark/Makefile
+++ b/examples/quota_watermark/Makefile
@@ -37,14 +37,8 @@ endif
 RTE_TARGET ?= x86_64-default-linuxapp-gcc
 
 include $(RTE_SDK)/mk/rte.vars.mk
-unexport RTE_SRCDIR RTE_OUTPUT RTE_EXTMK
 
-DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += $(wildcard qw*)
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += qw
+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += qwctl
 
-.PHONY: all clean $(DIRS-y)
-
-all: $(DIRS-y)
-clean: $(DIRS-y)
-
-$(DIRS-y):
-	$(MAKE) -C $@ $(MAKECMDGOALS)
+include $(RTE_SDK)/mk/rte.extsubdir.mk
-- 
1.9.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-dev] [PATCH v2 6/6] mk: add "make examples" target in root makefile
  2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 6/6] mk: add "make examples" target in root makefile Olivier Matz
@ 2014-05-14 14:04   ` Thomas Monjalon
  2014-05-15 16:03     ` Olivier MATZ
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Monjalon @ 2014-05-14 14:04 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev

Hi Olivier,

2014-05-09 12:32, Olivier Matz:
> It is now possible to build all projects from the examples/ directory
> using one command from root directory.
> 
> Some illustration of what is possible:
> 
> - build examples in the DPDK tree for one target
> 
>   # install the x86_64-default-linuxapp-gcc in
>   # ${RTE_SDK}/x86_64-default-linuxapp-gcc directory
>   user@droids:~/dpdk.org$ make install T=x86_64-default-linuxapp-gcc
>   # build examples for this new installation in
>   # ${RTE_SDK}/examples directory
>   user@droids:~/dpdk.org$ make examples T=x86_64-default-linuxapp-gcc
> 
> - build examples outside DPDK tree for several targets
> 
>   # install all targets matching x86_64-*-linuxapp-gcc in
>   # ${RTE_SDK}/x86_64-*-linuxapp-gcc directories
>   user@droids:~/dpdk.org$ make install T=x86_64-*-linuxapp-gcc
>   # build examples for these installations in /tmp/foobar
>   user@droids:~/dpdk.org$ make examples T=x86_64-*-linuxapp-gcc
> O=/tmp/foobar
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
[..]
> +# Build directory is given with O=
> +ifndef O
> +O = $(RTE_SDK)/examples
> +endif
> +
> +# Target for which examples should be built.
> +ifndef T
> +T = *
> +endif

Using "?=" should be cleaner than "ifndef" I think.

[...]
> +	$(Q)if [ ! -d "${RTE_SDK}/${*}" ]; then \
> +		echo "Target ${*} does not exist in ${RTE_SDK}/${*}." ; \
> +		echo -n "Please install DPDK first (make install) or use another " ; 
\
> +		echo "target argument (T=target)." ; \

You should stop make execution with "false" on such error.

> +	else \
> +		$(MAKE) -C examples O=$(O) RTE_TARGET=$(*); \
> +	fi

We should use "abspath $O" here when changing directory.

Last comment: I cannot use
	make examples T=x86_64-default-linuxapp-gcc O=build
because of
	RTE_SDK := $(CURDIR)
in GNUmakefile

Thanks
-- 
Thomas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-dev] [PATCH v2 6/6] mk: add "make examples" target in root makefile
  2014-05-14 14:04   ` Thomas Monjalon
@ 2014-05-15 16:03     ` Olivier MATZ
  0 siblings, 0 replies; 10+ messages in thread
From: Olivier MATZ @ 2014-05-15 16:03 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

Hi Thomas,

Thank you for your comments.

On 05/14/2014 04:04 PM, Thomas Monjalon wrote:
>> +# Build directory is given with O=
>> +ifndef O
>> +O = $(RTE_SDK)/examples
>> +endif
>> +
>> +# Target for which examples should be built.
>> +ifndef T
>> +T = *
>> +endif
>
> Using "?=" should be cleaner than "ifndef" I think.

Agree, I'll fix that.

> [...]
>> +	$(Q)if [ ! -d "${RTE_SDK}/${*}" ]; then \
>> +		echo "Target ${*} does not exist in ${RTE_SDK}/${*}." ; \
>> +		echo -n "Please install DPDK first (make install) or use another " ;
> \
>> +		echo "target argument (T=target)." ; \
>
> You should stop make execution with "false" on such error.

The idea was to be able to build the examples for all installed
targets, skipping those which are not installed:

   make install T=x86_64-default-linuxapp-gcc
   # build for x86_64-default-linuxapp-gcc only
   make examples

But if you prefer, I can change it so the user has to specify
the target explicitly.

>> +	else \
>> +		$(MAKE) -C examples O=$(O) RTE_TARGET=$(*); \
>> +	fi
>
> We should use "abspath $O" here when changing directory.

Yes, I'll fix that too.

> Last comment: I cannot use
> 	make examples T=x86_64-default-linuxapp-gcc O=build
> because of
> 	RTE_SDK := $(CURDIR)
> in GNUmakefile

This works fine if you do:

   # install the x86_64-default-linuxapp-gcc target in RTE_SDK=.
   make install T=x86_64-default-linuxapp-gcc
   # compile examples in build, using the installed target
   # x86_64-default-linuxapp-gcc from RTE_SDK=.
   make examples T=x86_64-default-linuxapp-gcc O=build

Indeed, I would say that all makefile commands called from DPDK
root directory assume that RTE_SDK=. so that's the expected
behavior.

I'll send a v3 with the fixes tomorrow.

Regards,
Olivier

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-05-15 16:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-09 10:32 [dpdk-dev] [PATCH v2 0/6] examples: add a new makefile to build all examples Olivier Matz
2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 1/6] mk: introduce rte.extsubdir.mk Olivier Matz
2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 2/6] examples: use rte.extsubdir.mk to process subdirectories Olivier Matz
2014-05-13 13:51   ` [dpdk-dev] [PATCH v3 " Olivier Matz
2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 3/6] examples: add a makefile to build all examples Olivier Matz
2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 4/6] examples: fix qos_sched makefile Olivier Matz
2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 5/6] examples: fix netmap_compat example Olivier Matz
2014-05-09 10:32 ` [dpdk-dev] [PATCH v2 6/6] mk: add "make examples" target in root makefile Olivier Matz
2014-05-14 14:04   ` Thomas Monjalon
2014-05-15 16:03     ` Olivier MATZ

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).