From 85dd9d8bd36acf214490b5507f83eb4d3ccddb65 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 15 Apr 2010 14:25:16 +0000 Subject: [PATCH] Add the subversion revision number to the version info. --- configure.ac | 1 - src/Makefile.am | 24 ++++++++++++++++++++++-- src/version.h.in | 1 + 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d1442dd..2b39cbc 100644 --- a/configure.ac +++ b/configure.ac @@ -67,7 +67,6 @@ AC_CONFIG_FILES([ libdivecomputer.pc Makefile src/Makefile - src/version.h src/libdivecomputer.rc examples/Makefile ]) diff --git a/src/Makefile.am b/src/Makefile.am index 67fc6de..b98c00a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -113,5 +113,25 @@ libdivecomputer.exp: libdivecomputer.symbols .rc.lo: $(AM_V_GEN) $(LIBTOOL) --silent --tag=RC --mode=compile $(RC) $< -o $@ -CLEANFILES = libdivecomputer.exp -EXTRA_DIST = libdivecomputer.symbols +FORCE: +$(top_srcdir)/revision: FORCE + @if (test -d $(top_srcdir)/.svn && cd $(top_srcdir) \ + && svnversion | sed -e 's/[MSP]//g') > revision-t 2>/dev/null \ + && ! cmp -s revision-t $@; then \ + mv -f revision-t $@; \ + else \ + rm -f revision-t; \ + if ! test -f $@; then touch $@; fi; \ + fi + +version.h: $(top_srcdir)/revision version.h.in Makefile.am + $(AM_V_GEN) sed \ + -e 's/\@DC_VERSION_MAJOR\@/@DC_VERSION_MAJOR@/' \ + -e 's/\@DC_VERSION_MINOR\@/@DC_VERSION_MINOR@/' \ + -e 's/\@DC_VERSION_MICRO\@/@DC_VERSION_MICRO@/' \ + -e 's/\@DC_VERSION_EXTRA\@/'`cat $(top_srcdir)/revision`'/' \ + $(srcdir)/version.h.in > $@ + +BUILT_SOURCES = version.h +EXTRA_DIST = libdivecomputer.symbols $(top_srcdir)/revision version.h.in +CLEANFILES = libdivecomputer.exp revision-t diff --git a/src/version.h.in b/src/version.h.in index e45aa7b..1231cd0 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -29,6 +29,7 @@ extern "C" { #define DC_VERSION_MAJOR @DC_VERSION_MAJOR@ #define DC_VERSION_MINOR @DC_VERSION_MINOR@ #define DC_VERSION_MICRO @DC_VERSION_MICRO@ +#define DC_VERSION_EXTRA "@DC_VERSION_EXTRA@" #ifdef __cplusplus }