diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 16 | ||||
-rw-r--r-- | src/version.cc | 9 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 34c05e30..c0205f7d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -138,5 +138,21 @@ dillo_SOURCES = \ xembed.cc \ xembed.hh +# https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html +nodist_dillo_SOURCES = commit.h +dillo.$(OBJEXT): commit.h +CLEANFILES = commit.h + +if GIT_AVAILABLE +# Always rebuild +.PHONY: commit.h +commit.h: + printf '#define GIT_COMMIT "%s"\n' `git --work-tree="$(top_srcdir)" describe --dirty` > commit.h +else +# No need to rebuild +commit.h: + echo "" > commit.h +endif # GIT_AVAILABLE + dist_sysconf_DATA = domainrc keysrc hsts_preload EXTRA_DIST = chg srch diff --git a/src/version.cc b/src/version.cc index f118c202..44b894e5 100644 --- a/src/version.cc +++ b/src/version.cc @@ -18,6 +18,7 @@ */ #include "config.h" +#include "commit.h" #include "djpeg.h" #include "dpng.h" @@ -114,7 +115,13 @@ static void print_features() void a_Version_print_info(void) { - printf("Dillo version " VERSION "\n"); + const char *version = "v" VERSION; + +#ifdef GIT_COMMIT + version = GIT_COMMIT; +#endif + + printf("Dillo %s\n", version); print_libs(); print_features(); } |