summaryrefslogtreecommitdiff
path: root/lib/Makefile.am
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2012-11-27 01:34:56 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2012-12-12 15:34:37 +0100
commit0be793e674c8b076f0e8bf327257f15803480f49 (patch)
tree28c42a679265d25ea41f4265232e2bcc167b1f49 /lib/Makefile.am
parent324ed1f87aedf30a45aea951edb2e717c5f9b7fb (diff)
build: include git info
If enabled with --with-pkg-gitversion on ./configure, this will append git version strings and branch information at the following places: - overall version number: 0.99.21-g0123456 - login motd and show version: tag information + git id + branches Sample output: Hello, this is Quagga (version 0.99.21-g14b49ad-dirty). Copyright 1996-2005 Kunihiro Ishiguro, et al. This is a git build of quagga_0_99_21_release-106-g14b49ad-dirty Associated branch(es): local:master [v2]: fix build without gitinfo (add "else" branch) [v2]: fix for repos without any tags (different git describe output) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/Makefile.am')
-rw-r--r--lib/Makefile.am24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index e00ad54d..690c18ff 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -14,7 +14,7 @@ libzebra_la_SOURCES = \
zclient.c sockopt.c smux.c agentx.c snmp.c md5.c if_rmap.c keychain.c privs.c \
sigevent.c pqueue.c jhash.c memtypes.c workqueue.c
-BUILT_SOURCES = memtypes.h route_types.h
+BUILT_SOURCES = memtypes.h route_types.h gitversion.h
libzebra_la_DEPENDENCIES = @LIB_REGEX@
@@ -36,3 +36,25 @@ memtypes.h: $(srcdir)/memtypes.c $(srcdir)/memtypes.awk
route_types.h: $(srcdir)/route_types.txt $(srcdir)/route_types.pl
@PERL@ $(srcdir)/route_types.pl < $(srcdir)/route_types.txt > $@
+
+if GIT_VERSION
+
+# bit of a trick here to always have up-to-date git stamps without triggering
+# unneccessary rebuilds. .PHONY causes the .tmp file to be rebuilt always,
+# but if we use that on gitversion.h it'll ripple through the .c file deps.
+# (even if gitversion.h's file timestamp doesn't change, make will think it
+# did, because of .PHONY...)
+
+.PHONY: gitversion.h.tmp
+.SILENT: gitversion.h gitversion.h.tmp
+GITH=gitversion.h
+gitversion.h.tmp: $(srcdir)/../.git
+ @PERL@ $(srcdir)/gitversion.pl $(srcdir) > ${GITH}.tmp
+gitversion.h: gitversion.h.tmp
+ { test -f ${GITH} && diff -s -q ${GITH}.tmp ${GITH}; } || cp -v ${GITH}.tmp ${GITH}
+
+else
+.PHONY: gitversion.h
+gitversion.h:
+ /bin/true
+endif