summaryrefslogtreecommitdiff
path: root/src/Makefile.am
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-12-08 20:06:00 +0100
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-12-09 20:23:37 +0100
commit458776d704579528c999a70024dcce73329beee5 (patch)
tree80b03139d073889639007a495c574fca82c5719b /src/Makefile.am
parent8169f76a3b95f07fd84bdc4aed41deb87973fb9a (diff)
Add git commit to the reported version with -v
When git is available, records the git commit in the dillo binary, so dillo -v reports the version and the commit. Otherwise only the release version is reported (as we do now). The commit is *always* recomputed when "make" is called. This allows switching branches, doing a dirty rebuild and still get the correct commit with "dillo -v". Using AC_INIT() doesn't update the commit when the source is already configured. Fixes: https://github.com/dillo-browser/dillo/issues/288
Diffstat (limited to 'src/Makefile.am')
-rw-r--r--src/Makefile.am16
1 files changed, 16 insertions, 0 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