diff mbox

[PATCHv2] odp version script

Message ID 1418380217-24085-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Dec. 12, 2014, 10:30 a.m. UTC
Update odp version in one place (C code), and use it for doxygen also.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 v2: changed DOC_VERSION to VERSION.

 Anders also talked that it will be worth to put script to variable.
 I have not idea how to do that in configure.ac. Actually there is no
 big reason for that due to it's used only once.

 BR,
 Maxim.

 configure.ac           | 2 +-
 doc/doxygen.cfg        | 2 +-
 m4/ax_prog_doxygen.m4  | 2 +-
 scripts/odp_version.sh | 7 +++++++
 4 files changed, 10 insertions(+), 3 deletions(-)
 create mode 100755 scripts/odp_version.sh

Comments

Anders Roxell Dec. 12, 2014, 12:04 p.m. UTC | #1
On 2014-12-12 13:30, Maxim Uvarov wrote:
> Update odp version in one place (C code), and use it for doxygen also.
> 
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> ---
>  v2: changed DOC_VERSION to VERSION.
> 
>  Anders also talked that it will be worth to put script to variable.
>  I have not idea how to do that in configure.ac. Actually there is no
>  big reason for that due to it's used only once.
> 
>  BR,
>  Maxim.
> 
>  configure.ac           | 2 +-
>  doc/doxygen.cfg        | 2 +-
>  m4/ax_prog_doxygen.m4  | 2 +-
>  scripts/odp_version.sh | 7 +++++++
>  4 files changed, 10 insertions(+), 3 deletions(-)
>  create mode 100755 scripts/odp_version.sh
> 
> diff --git a/configure.ac b/configure.ac
> index 2f27261..8dbad4b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1,5 +1,5 @@
>  AC_PREREQ([2.5])
> -AC_INIT([OpenDataPlane], [0.4.0], [lng-odp@lists.linaro.org])
> +AC_INIT([OpenDataPlane], m4_esyscmd(./scripts/odp_version.sh), [lng-odp@lists.linaro.org])
>  AM_INIT_AUTOMAKE([subdir-objects])
>  AC_CONFIG_SRCDIR([helper/config.h.in])
>  AM_CONFIG_HEADER([helper/config.h])
> diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg
> index 03bcc20..050c94a 100644
> --- a/doc/doxygen.cfg
> +++ b/doc/doxygen.cfg
> @@ -1,5 +1,5 @@
>  PROJECT_NAME = "API Reference Manual"
> -PROJECT_NUMBER = 0.4.0
> +PROJECT_NUMBER = $(VERSION)
>  PROJECT_LOGO = $(SRCDIR)/doc/images/ODP-Logo-HQ.png
>  QUIET = YES
>  OUTPUT_DIRECTORY = $(DOCDIR)
> diff --git a/m4/ax_prog_doxygen.m4 b/m4/ax_prog_doxygen.m4
> index aa4acc2..0f58b3e 100644
> --- a/m4/ax_prog_doxygen.m4
> +++ b/m4/ax_prog_doxygen.m4
> @@ -407,7 +407,7 @@ AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
>  DX_ENV_APPEND(SRCDIR, $srcdir)
>  DX_ENV_APPEND(PROJECT, $DX_PROJECT)
>  DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
> -DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
> +DX_ENV_APPEND(VERSION, $VERSION)
>  
>  # Doxygen itself:
>  DX_ARG_ABLE(doc, [generate any doxygen documentation],
> diff --git a/scripts/odp_version.sh b/scripts/odp_version.sh
> new file mode 100755
> index 0000000..357f017
> --- /dev/null
> +++ b/scripts/odp_version.sh
> @@ -0,0 +1,7 @@
> +#!/bin/bash
> +
> +GEN=`grep "define ODP_VERSION_API_GENERATION" platform/linux-generic/include/api/odp_version.h| cut -d ' ' -f 3`
> +MAJ=`grep "define ODP_VERSION_API_MAJOR" platform/linux-generic/include/api/odp_version.h| cut -d ' ' -f 3`
> +MIN=`grep "define ODP_VERSION_API_MINOR" platform/linux-generic/include/api/odp_version.h| cut -d ' ' -f 3`

Factorise out the common parts.

Cheers,
Anders
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index 2f27261..8dbad4b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@ 
 AC_PREREQ([2.5])
-AC_INIT([OpenDataPlane], [0.4.0], [lng-odp@lists.linaro.org])
+AC_INIT([OpenDataPlane], m4_esyscmd(./scripts/odp_version.sh), [lng-odp@lists.linaro.org])
 AM_INIT_AUTOMAKE([subdir-objects])
 AC_CONFIG_SRCDIR([helper/config.h.in])
 AM_CONFIG_HEADER([helper/config.h])
diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg
index 03bcc20..050c94a 100644
--- a/doc/doxygen.cfg
+++ b/doc/doxygen.cfg
@@ -1,5 +1,5 @@ 
 PROJECT_NAME = "API Reference Manual"
-PROJECT_NUMBER = 0.4.0
+PROJECT_NUMBER = $(VERSION)
 PROJECT_LOGO = $(SRCDIR)/doc/images/ODP-Logo-HQ.png
 QUIET = YES
 OUTPUT_DIRECTORY = $(DOCDIR)
diff --git a/m4/ax_prog_doxygen.m4 b/m4/ax_prog_doxygen.m4
index aa4acc2..0f58b3e 100644
--- a/m4/ax_prog_doxygen.m4
+++ b/m4/ax_prog_doxygen.m4
@@ -407,7 +407,7 @@  AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
 DX_ENV_APPEND(SRCDIR, $srcdir)
 DX_ENV_APPEND(PROJECT, $DX_PROJECT)
 DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
-DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
+DX_ENV_APPEND(VERSION, $VERSION)
 
 # Doxygen itself:
 DX_ARG_ABLE(doc, [generate any doxygen documentation],
diff --git a/scripts/odp_version.sh b/scripts/odp_version.sh
new file mode 100755
index 0000000..357f017
--- /dev/null
+++ b/scripts/odp_version.sh
@@ -0,0 +1,7 @@ 
+#!/bin/bash
+
+GEN=`grep "define ODP_VERSION_API_GENERATION" platform/linux-generic/include/api/odp_version.h| cut -d ' ' -f 3`
+MAJ=`grep "define ODP_VERSION_API_MAJOR" platform/linux-generic/include/api/odp_version.h| cut -d ' ' -f 3`
+MIN=`grep "define ODP_VERSION_API_MINOR" platform/linux-generic/include/api/odp_version.h| cut -d ' ' -f 3`
+
+echo -n $GEN.$MAJ.$MIN