[dpdk-dev] [PATCH 0/3] make help

2013-05-07 Thread Thomas Monjalon
Let's add help for building DPDK.

---

Thomas Monjalon (3):
  mk: rule showconfigs for configs listing
  doc: how to build
  mk: rule help

 doc/build-sdk-quick.txt |   22 ++
 mk/rte.sdkconfig.mk |4 
 mk/rte.sdkdoc.mk|8 
 mk/rte.sdkroot.mk   |7 ---
 4 files changed, 38 insertions(+), 3 deletions(-)
 create mode 100644 doc/build-sdk-quick.txt


[dpdk-dev] [PATCH 1/3] mk: rule showconfigs for configs listing

2013-05-07 Thread Thomas Monjalon
Allow to list configs in config/ directory with a simple make rule.

Signed-off-by: Thomas Monjalon 
---
 mk/rte.sdkconfig.mk |4 
 mk/rte.sdkroot.mk   |4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index ed81c47..179089e 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -36,6 +36,10 @@ INSTALL_CONFIGS := $(filter-out %~,\
$(wildcard $(RTE_SRCDIR)/config/defconfig_*)))
 INSTALL_TARGETS := $(addsuffix _install,$(INSTALL_CONFIGS))

+.PHONY: showconfigs
+showconfigs:
+   @$(foreach CONFIG, $(INSTALL_CONFIGS), echo $(CONFIG);)
+
 .PHONY: config
 ifeq ($(RTE_CONFIG_TEMPLATE),)
 config:
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index f555e33..6bbbd54 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -87,8 +87,8 @@ export ROOTDIRS-y ROOTDIRS- ROOTDIRS-n
 .PHONY: default
 default: all

-.PHONY: config
-config:
+.PHONY: config showconfigs
+config showconfigs:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk $@

 .PHONY: test fast_test ring_test mempool_test
-- 
1.7.10.4



[dpdk-dev] [PATCH 2/3] doc: how to build

2013-05-07 Thread Thomas Monjalon
This is a cheat sheet to build DPDK and can be used for a "make help".
It is explicitly described as a build help in order to concatenate it
with other helps such as test commands.

Signed-off-by: Thomas Monjalon 
---
 doc/build-sdk-quick.txt |   22 ++
 1 file changed, 22 insertions(+)
 create mode 100644 doc/build-sdk-quick.txt

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
new file mode 100644
index 000..3f88522
--- /dev/null
+++ b/doc/build-sdk-quick.txt
@@ -0,0 +1,22 @@
+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) in fixed directories
+   uninstall   remove all installed targets
+Build options
+   T   target template (install default: *) - used with config or install
+   O   output directory (default: build/)   - cannot be used with install
+   V   verbose
+   D   debug dependencies
+   CROSStoolchain prefix
+   EXTRA_CPPFLAGS   preprocessor options
+   EXTRA_CFLAGS compiler options
+   EXTRA_LDFLAGSlinker options
+Build targets
+   format: 
+   templates in config/defconfig_*:
+   # make showconfigs
-- 
1.7.10.4



[dpdk-dev] [PATCH 3/3] mk: rule help

2013-05-07 Thread Thomas Monjalon
The goal of this rule is to show which rules/options are available from a
"make" command.
Let's start by printing short doc about SDK building.

The macro maketxt allow to interpret syntax "# make foo" while keeping
indentation of the source document.
Here, it is used to call "make showconfigs" to list available targets.

Signed-off-by: Thomas Monjalon 
---
 mk/rte.sdkdoc.mk  |8 
 mk/rte.sdkroot.mk |3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/mk/rte.sdkdoc.mk b/mk/rte.sdkdoc.mk
index edae1e7..6850c39 100644
--- a/mk/rte.sdkdoc.mk
+++ b/mk/rte.sdkdoc.mk
@@ -38,6 +38,14 @@ $(error "Cannot use T= with doc target")
 endif
 endif

+define maketxt
+   sed 's,^\([[:space:]]*\)# make \(.*\),make -rRs \2 | sed "s/^/\1/",e' $1
+endef
+
+.PHONY: help
+help:
+   @$(call maketxt, $(RTE_SDK)/doc/build-sdk-quick.txt)
+
 .PHONY: all
 all: htmlapi

diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index 6bbbd54..905b678 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -103,8 +103,9 @@ testall testimport:
 install uninstall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@

-.PHONY: doc
+.PHONY: doc help
 doc: doc-all
+help: doc-help
 doc-%:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkdoc.mk $*

-- 
1.7.10.4



[dpdk-dev] [PATCH] lib: set version 1.2.3r2 and more helper macros

2013-05-07 Thread Thomas Monjalon
Applications can test versions, for compatibility, this way:
#if RTE_VERSION >= RTE_VERSION_NUM(1,2,3,4)
Previous versions can be tested with:
#ifndef RTE_VERSION_NUM

RTE_VERSION was already defined for use with rte_config.
It is moved in rte_version.h and updated to current version number.

Note that the first tag having this helper will be 1.2.3r2.

Signed-off-by: Thomas Monjalon 
---
 lib/librte_eal/common/include/rte_eal.h |1 -
 lib/librte_eal/common/include/rte_version.h |   17 +++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_eal.h 
b/lib/librte_eal/common/include/rte_eal.h
index 58fa1cc..9aa5de8 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -50,7 +50,6 @@
 extern "C" {
 #endif

-#define RTE_VERSION 1 /**< The version of the RTE configuration structure. */
 #define RTE_MAGIC 19820526 /**< Magic number written by the main partition 
when ready. */

 /**
diff --git a/lib/librte_eal/common/include/rte_version.h 
b/lib/librte_eal/common/include/rte_version.h
index b29c1d3..0ef475f 100644
--- a/lib/librte_eal/common/include/rte_version.h
+++ b/lib/librte_eal/common/include/rte_version.h
@@ -63,10 +63,22 @@ extern "C" {
  */
 #define RTE_VER_PATCH_LEVEL 3

+/**
+ * Patch release number i.e. the w in x.y.zrw
+ */
+#define RTE_VER_PATCH_RELEASE 2
+
+#define RTE_VERSION_NUM(a,b,c,d) ((a) << 24 | (b) << 16 | (c) << 8 | (d))
+#define RTE_VERSION RTE_VERSION_NUM( \
+   RTE_VER_MAJOR, \
+   RTE_VER_MINOR, \
+   RTE_VER_PATCH_LEVEL, \
+   RTE_VER_PATCH_RELEASE)
+
 #define RTE_VER_PREFIX "RTE"

 /**
- * Function returning string of version number: "RTE x.y.z"
+ * Function returning string of version number: "RTE x.y.zrw"
  * @return
  * string
  */
@@ -75,7 +87,8 @@ rte_version(void) {
return RTE_VER_PREFIX" "
RTE_STR(RTE_VER_MAJOR)"."
RTE_STR(RTE_VER_MINOR)"."
-   RTE_STR(RTE_VER_PATCH_LEVEL);
+   RTE_STR(RTE_VER_PATCH_LEVEL)"r"
+   RTE_STR(RTE_VER_PATCH_RELEASE);
 }

 #ifdef __cplusplus
-- 
1.7.10.4