aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile.local
diff options
context:
space:
mode:
authorGravatar Tomi Ollila <tomi.ollila@iki.fi>2014-03-19 22:37:09 +0200
committerGravatar David Bremner <david@tethera.net>2014-04-10 23:24:10 -0300
commitfeb3ce957213350db6c3e954cf4016aced1f65ce (patch)
tree355a68eef3f8857aa67d9d1861a12f18d3b1ff3a /Makefile.local
parentc20016742681e1ed48c83de32639e10507ffa14d (diff)
build: write version.stamp file containing $(VERSION) string
This version file will be as prerequisite to the target files that use the version info for some purpose, like printing it for the user to examine. The contents of the version.stamp file is seldom read by the build system itself as the $(VERSION) variable has the same information. Thanks to Trevor, David and Mark for their contributions.
Diffstat (limited to 'Makefile.local')
-rw-r--r--Makefile.local14
1 files changed, 13 insertions, 1 deletions
diff --git a/Makefile.local b/Makefile.local
index cb7b1061..1856350e 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -22,6 +22,11 @@ VERSION:=$(shell cat ${srcdir}/version)
ifeq ($(filter release release-message pre-release update-versions,$(MAKECMDGOALS)),)
ifeq ($(IS_GIT),yes)
VERSION:=$(shell git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/)
+# Write the file 'version.stamp' in case its contents differ from $(VERSION)
+FILE_VERSION:=$(shell test -f version.stamp && read vs < version.stamp || vs=; echo $$vs)
+ifneq ($(FILE_VERSION),$(VERSION))
+ $(shell echo "$(VERSION)" > version.stamp)
+endif
endif
endif
@@ -69,6 +74,11 @@ ifeq ($(shell cat .first-build-message 2>/dev/null),)
endif
endif
+# Depend (also) on the file 'version'. In case of ifeq ($(IS_GIT),yes)
+# this file may already have been updated.
+version.stamp: $(srcdir)/version
+ echo $(VERSION) > $@
+
$(TAR_FILE):
if git tag -v $(VERSION) >/dev/null 2>&1; then \
ref=$(VERSION); \
@@ -280,6 +290,8 @@ notmuch_client_srcs = \
notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
+notmuch.o: version.stamp
+
notmuch: $(notmuch_client_modules) lib/libnotmuch.a util/libutil.a parse-time-string/libparse-time-string.a
$(call quiet,CXX $(CFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) -o $@
@@ -318,7 +330,7 @@ install-desktop:
desktop-file-install --mode 0644 --dir "$(DESTDIR)$(desktop_dir)" notmuch.desktop
SRCS := $(SRCS) $(notmuch_client_srcs)
-CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc
+CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) version.stamp
DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config