From c6685ac0a3014969ca919fb0e81a206cedf31dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Wed, 5 Dec 2007 22:58:20 +0000 Subject: [PATCH] automatically generate version.h from ChangeLog's Revision tag used for printing the JTAG Tools build number upon startup git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@811 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 7 ++++++- jtag/src/Makefile.am | 6 ++++++ jtag/src/jtag.c | 6 ++++-- jtag/src/version.awk | 26 ++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 jtag/src/version.awk diff --git a/jtag/ChangeLog b/jtag/ChangeLog index ab424d44..295db35c 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,4 +1,7 @@ -=== ChangeLog for UrJTAG $Revision$ === +2007-12-05 Arnim Laeuger + + * src/jtag.c (main): Print build number based on version.h. + * src/Makefile.am (version.h): Added rules to generate version.h from ChangeLog's Revision tag. 2004-11-24 Marcel Telka @@ -1743,3 +1746,5 @@ Version 0.1 released. + +$Revision$ diff --git a/jtag/src/Makefile.am b/jtag/src/Makefile.am index 7040ce1d..16dd6b24 100644 --- a/jtag/src/Makefile.am +++ b/jtag/src/Makefile.am @@ -68,5 +68,11 @@ jtag_LDADD = \ -lm \ @LIBINTL@ +nodist_jtag_SOURCES = version.h +BUILT_SOURCES = version.h +CLEANFILES = version.h +version.h: ../ChangeLog version.awk + $(AWK) -f version.awk $< > $@ + localedir = $(datadir)/locale INCLUDES = -DLOCALEDIR=\"$(localedir)\" diff --git a/jtag/src/jtag.c b/jtag/src/jtag.c index 6f812cb8..de4a104f 100644 --- a/jtag/src/jtag.c +++ b/jtag/src/jtag.c @@ -24,6 +24,7 @@ */ #include "sysdep.h" +#include "version.h" #include #include @@ -445,11 +446,12 @@ main( int argc, const char **argv ) /* interactive */ printf( - _("%s\n" + _("%s Build %s\n" "Copyright (C) 2002, 2003 ETC s.r.o.\n" "%s is free software, covered by the GNU General Public License, and you are\n" "welcome to change it and/or distribute copies of it under certain conditions.\n" - "There is absolutely no warranty for %s.\n\n"), PACKAGE_STRING, PACKAGE_NAME, PACKAGE_NAME + "There is absolutely no warranty for %s.\n\n"), PACKAGE_STRING, URJTAG_BUILD_NUMBER, + PACKAGE_NAME, PACKAGE_NAME ); chain = chain_alloc(); diff --git a/jtag/src/version.awk b/jtag/src/version.awk new file mode 100644 index 00000000..bfbf26b9 --- /dev/null +++ b/jtag/src/version.awk @@ -0,0 +1,26 @@ +BEGIN { +print "/*" +print " * version.h" +print " * control long build version number" +print " *" +print " * Created automatically with version.awk script" +print " *" +print " */" +print "" +print "#ifndef __VERSION_H__" +print "#define __VERSION_H__" +print "" + +FS="[ \t.]" +} + +/Revision/ { printf "#define URJTAG_BUILD_NUMBER\t\"%s\"\n", $2 } + +END { +print "" +print "#ifndef URJTAG_BUILD_NUMBER" +print "#define URJTAG_BUILD_NUMBER \"0\"" +print "#endif" +print "" +print "#endif" +}