unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/1] build: write VERSION file containing $(VERSION) string
@ 2014-01-25 22:43 Tomi Ollila
  2014-01-26 19:55 ` Mark Walters
  0 siblings, 1 reply; 10+ messages in thread
From: Tomi Ollila @ 2014-01-25 22:43 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

This version file will be as prerequisite to the target files
that use the version info for some purpose, like printing
it to the user to examine. The contents of the VERSION file
is seldom read by the build system itself as the $(VERSION)
variable has the same information.
---
 Makefile.local | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/Makefile.local b/Makefile.local
index c85e09c..1f876b3 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -22,6 +22,8 @@ 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/-/~/)
+# Make the 'VERSION' file depend *also* on .git/HEAD in this case
+VERSION: .git/HEAD
 endif
 endif
 
@@ -69,6 +71,11 @@ ifeq ($(shell cat .first-build-message 2>/dev/null),)
 endif
 endif
 
+# This VERSION file is used mostly for triggering other file remakes...
+# This may get other dependency to .git/HEAD above in this file.
+VERSION: version
+	echo $(VERSION) > $@
+
 $(TAR_FILE):
 	if git tag -v $(VERSION) >/dev/null 2>&1; then \
            ref=$(VERSION); \
@@ -280,6 +287,8 @@ notmuch_client_srcs =		\
 
 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
 
+notmuch.o: VERSION
+
 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 +327,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) VERSION notmuch notmuch-shared $(notmuch_client_modules)
 
 DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config
 
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] build: write VERSION file containing $(VERSION) string
  2014-01-25 22:43 [PATCH 1/1] build: write VERSION file containing $(VERSION) string Tomi Ollila
@ 2014-01-26 19:55 ` Mark Walters
  2014-01-27 21:43   ` [PATCH v2] " Tomi Ollila
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Walters @ 2014-01-26 19:55 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila


Hi

I experimented with this and it didn't always seem to rebuild VERSION
when it should. Looking at the file .git/HEAD that just seems to be the
branch name not the commit id (unless in detached HEAD state)

This link
http://stackoverflow.com/questions/6526451/how-to-include-git-commit-number-into-a-c-executable 
suggests adding .git/index to the VERSION depends.

I tested that and that does seem to work. It may mean that VERSION gets
rebuilt if you stash (for example) but that is probably not a big
problem.

Best wishes

Mark

On Sat, 25 Jan 2014, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> This version file will be as prerequisite to the target files
> that use the version info for some purpose, like printing
> it to the user to examine. The contents of the VERSION file
> is seldom read by the build system itself as the $(VERSION)
> variable has the same information.
> ---
>  Makefile.local | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile.local b/Makefile.local
> index c85e09c..1f876b3 100644
> --- a/Makefile.local
> +++ b/Makefile.local
> @@ -22,6 +22,8 @@ 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/-/~/)
> +# Make the 'VERSION' file depend *also* on .git/HEAD in this case
> +VERSION: .git/HEAD
>  endif
>  endif
>  
> @@ -69,6 +71,11 @@ ifeq ($(shell cat .first-build-message 2>/dev/null),)
>  endif
>  endif
>  
> +# This VERSION file is used mostly for triggering other file remakes...
> +# This may get other dependency to .git/HEAD above in this file.
> +VERSION: version
> +	echo $(VERSION) > $@
> +
>  $(TAR_FILE):
>  	if git tag -v $(VERSION) >/dev/null 2>&1; then \
>             ref=$(VERSION); \
> @@ -280,6 +287,8 @@ notmuch_client_srcs =		\
>  
>  notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
>  
> +notmuch.o: VERSION
> +
>  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 +327,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) VERSION notmuch notmuch-shared $(notmuch_client_modules)
>  
>  DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config
>  
> -- 
> 1.8.5.3
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] build: write VERSION file containing $(VERSION) string
  2014-01-26 19:55 ` Mark Walters
@ 2014-01-27 21:43   ` Tomi Ollila
  2014-01-27 21:48     ` [PATCH v3] " Tomi Ollila
  0 siblings, 1 reply; 10+ messages in thread
From: Tomi Ollila @ 2014-01-27 21:43 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

This version file will be as prerequisite to the target files
that use the version info for some purpose, like printing
it to the user to examine. The contents of the VERSION file
is seldom read by the build system itself as the $(VERSION)
variable has the same information.
---

This is version 2 of id:1390689800-16654-1-git-send-email-tomi.ollila@iki.fi

in case of IS_GIT = yes, the contents of file VERSION is compared what
git describe returns and if this differs then VERSION file is updated.

 Makefile.local | 10 +++++++++-

diff --git a/Makefile.local b/Makefile.local
index c85e09c..96f39be 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -21,7 +21,8 @@ endif
 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/-/~/)
+# Also write VERSION file in case its contents differ from $(VERSION)
+VERSION:=$(shell gv=`exec git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/`; test -f VERSION || touch VERSION; read fv < VERSION; test x"$$fv" = x"$$gv" || echo "$$gv" > VERSION; echo "$$gv")
 endif
 endif
 
@@ -69,6 +70,11 @@ ifeq ($(shell cat .first-build-message 2>/dev/null),)
 endif
 endif
 
+# Depend (also) on 'version' file. In case of ifeq ($(IS_GIT),yes)
+# this file may already have been updated.
+VERSION: version
+	echo $(VERSION) > version
+
 $(TAR_FILE):
 	if git tag -v $(VERSION) >/dev/null 2>&1; then \
            ref=$(VERSION); \
@@ -280,6 +286,8 @@ notmuch_client_srcs =		\
 
 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
 
+notmuch.o: VERSION
+
 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 $@
 
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3] build: write VERSION file containing $(VERSION) string
  2014-01-27 21:43   ` [PATCH v2] " Tomi Ollila
@ 2014-01-27 21:48     ` Tomi Ollila
  2014-01-28  1:56       ` David Bremner
  0 siblings, 1 reply; 10+ messages in thread
From: Tomi Ollila @ 2014-01-27 21:48 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

This version file will be as prerequisite to the target files
that use the version info for some purpose, like printing
it to the user to examine. The contents of the VERSION file
is seldom read by the build system itself as the $(VERSION)
variable has the same information.
---

diffdiff to v2

-CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc
+CLEAN := $(CLEAN) VERSION notmuch notmuch-shared $(notmuch_client_modules)

 Makefile.local | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index 174506c..9293ed1 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -21,7 +21,8 @@ endif
 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/-/~/)
+# Also write VERSION file in case its contents differ from $(VERSION)
+VERSION:=$(shell gv=`exec git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/`; test -f VERSION || touch VERSION; read fv < VERSION; test x"$$fv" = x"$$gv" || echo "$$gv" > VERSION; echo "$$gv")
 endif
 endif
 
@@ -69,6 +70,11 @@ ifeq ($(shell cat .first-build-message 2>/dev/null),)
 endif
 endif
 
+# Depend (also) on 'version' file. In case of ifeq ($(IS_GIT),yes)
+# this file may already have been updated.
+VERSION: version
+	echo $(VERSION) > version
+
 $(TAR_FILE):
 	if git tag -v $(VERSION) >/dev/null 2>&1; then \
            ref=$(VERSION); \
@@ -280,6 +286,8 @@ notmuch_client_srcs =		\
 
 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
 
+notmuch.o: VERSION
+
 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 +326,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) VERSION notmuch notmuch-shared $(notmuch_client_modules)
 
 DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config
 
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v3] build: write VERSION file containing $(VERSION) string
  2014-01-27 21:48     ` [PATCH v3] " Tomi Ollila
@ 2014-01-28  1:56       ` David Bremner
  2014-01-28 11:13         ` Tomi Ollila
  0 siblings, 1 reply; 10+ messages in thread
From: David Bremner @ 2014-01-28  1:56 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila

Tomi Ollila <tomi.ollila@iki.fi> writes:

> +VERSION:=$(shell gv=`exec git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/`; test -f VERSION || touch VERSION; read fv < VERSION; test x"$$fv" = x"$$gv" || echo "$$gv" > VERSION; echo "$$gv")

does this need to be one line long? It's a bit scary.

> +# this file may already have been updated.
> +VERSION: version
> +	echo $(VERSION) > version

I'd prefer the build process does not change any version controlled
file. It should be source, or generated, but not both. did  you mean to
write to VERSION here?

d

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3] build: write VERSION file containing $(VERSION) string
  2014-01-28  1:56       ` David Bremner
@ 2014-01-28 11:13         ` Tomi Ollila
  2014-02-05 22:58           ` [PATCH v4] " Tomi Ollila
  0 siblings, 1 reply; 10+ messages in thread
From: Tomi Ollila @ 2014-01-28 11:13 UTC (permalink / raw)
  To: David Bremner, notmuch

On Tue, Jan 28 2014, David Bremner <david@tethera.net> wrote:

> Tomi Ollila <tomi.ollila@iki.fi> writes:
>
>> +VERSION:=$(shell gv=`exec git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/`; test -f VERSION || touch VERSION; read fv < VERSION; test x"$$fv" = x"$$gv" || echo "$$gv" > VERSION; echo "$$gv")
>
> does this need to be one line long? It's a bit scary.

Probably not -- I realized after sending v3 I could have split that
(among one other problem...)

>
>> +# this file may already have been updated.
>> +VERSION: version
>> +	echo $(VERSION) > version
>
> I'd prefer the build process does not change any version controlled
> file. It should be source, or generated, but not both. did  you mean to
> write to VERSION here?

I sure meant to. actually echo $(VERSION) > $@

>
> d
>

Tnx for the review...


Tomi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4] build: write VERSION file containing $(VERSION) string
  2014-01-28 11:13         ` Tomi Ollila
@ 2014-02-05 22:58           ` Tomi Ollila
  2014-02-08 23:56             ` W. Trevor King
  0 siblings, 1 reply; 10+ messages in thread
From: Tomi Ollila @ 2014-02-05 22:58 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

This version file will be as prerequisite to the target files
that use the version info for some purpose, like printing
it to the user to examine. The contents of the VERSION file
is seldom read by the build system itself as the $(VERSION)
variable has the same information.
---

ctested also with:
       mv .git .x
       make
       cat VERSION version
       mv .x .git
       make
       cat VERSION version

 Makefile.local | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index 174506c..65c91cb 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -21,7 +21,13 @@ endif
 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/-/~/)
+# Also write VERSION file in case its contents differ from $(VERSION)
+VERSION:=$(shell\
+	gv=`git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/`;\
+	test -f VERSION || touch VERSION;\
+	read fv < VERSION;\
+	test x"$$fv" = x"$$gv" || echo "$$gv" > VERSION;\
+	echo "$$gv")
 endif
 endif
 
@@ -69,6 +75,11 @@ ifeq ($(shell cat .first-build-message 2>/dev/null),)
 endif
 endif
 
+# Depend (also) on 'version' file. In case of ifeq ($(IS_GIT),yes)
+# this file may already have been updated.
+VERSION: version
+	echo $(VERSION) > $@
+
 $(TAR_FILE):
 	if git tag -v $(VERSION) >/dev/null 2>&1; then \
            ref=$(VERSION); \
@@ -280,6 +291,8 @@ notmuch_client_srcs =		\
 
 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
 
+notmuch.o: VERSION
+
 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 +331,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) VERSION notmuch notmuch-shared $(notmuch_client_modules)
 
 DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config
 
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v4] build: write VERSION file containing $(VERSION) string
  2014-02-05 22:58           ` [PATCH v4] " Tomi Ollila
@ 2014-02-08 23:56             ` W. Trevor King
  2014-02-09  8:26               ` Tomi Ollila
  0 siblings, 1 reply; 10+ messages in thread
From: W. Trevor King @ 2014-02-08 23:56 UTC (permalink / raw)
  To: Tomi Ollila; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 1223 bytes --]

On Thu, Feb 06, 2014 at 12:58:33AM +0200, Tomi Ollila wrote:
> -VERSION:=$(shell git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/)
> +# Also write VERSION file in case its contents differ from $(VERSION)
> +VERSION:=$(shell\
> +	gv=`git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/`;\

Ew, backticks ;).  What about handling more of the logic in Make:

  VERSION := $(shell git describe …)
  FILE_VERSION := $(shell test -f VERSION || touch VERSION; cat VERSION)
  ifneq ($(FILE_VERSION), $(VERSION))
  	$(shell echo "$(VERSION)" > VERSION)
  endif

> +# Depend (also) on 'version' file. In case of ifeq ($(IS_GIT),yes)
> +# this file may already have been updated.
> +VERSION: version
> +	echo $(VERSION) > $@

Do we care about case-insensitive filesystems where VERSION will
collide with version?

> -CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc
> +CLEAN := $(CLEAN) VERSION notmuch notmuch-shared $(notmuch_client_modules)

Where did notmuch.elc go?

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4] build: write VERSION file containing $(VERSION) string
  2014-02-08 23:56             ` W. Trevor King
@ 2014-02-09  8:26               ` Tomi Ollila
  2014-02-09 14:38                 ` [PATCH v5] build: write version.stamp " Tomi Ollila
  0 siblings, 1 reply; 10+ messages in thread
From: Tomi Ollila @ 2014-02-09  8:26 UTC (permalink / raw)
  To: W. Trevor King; +Cc: notmuch

On Sun, Feb 09 2014, "W. Trevor King" <wking@tremily.us> wrote:

> On Thu, Feb 06, 2014 at 12:58:33AM +0200, Tomi Ollila wrote:
>> -VERSION:=$(shell git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/)
>> +# Also write VERSION file in case its contents differ from $(VERSION)
>> +VERSION:=$(shell\
>> +	gv=`git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/`;\
>
> Ew, backticks ;).  What about handling more of the logic in Make:
>
>   VERSION := $(shell git describe …)
>   FILE_VERSION := $(shell test -f VERSION || touch VERSION; cat VERSION)
>   ifneq ($(FILE_VERSION), $(VERSION))
>   	$(shell echo "$(VERSION)" > VERSION)
>   endif

Sure makes that clearer...

>
>> +# Depend (also) on 'version' file. In case of ifeq ($(IS_GIT),yes)
>> +# this file may already have been updated.
>> +VERSION: version
>> +	echo $(VERSION) > $@
>
> Do we care about case-insensitive filesystems where VERSION will
> collide with version?

Very good point! We do not wan't to have a chance to overwrite version
... I have to look a new filename for that...

>
>> -CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc
>> +CLEAN := $(CLEAN) VERSION notmuch notmuch-shared $(notmuch_client_modules)
>
> Where did notmuch.elc go?

To emacs/notmuch.elc years ago.

>
> Cheers,
> Trevor

Thanks for review.

Tomi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v5] build: write version.stamp file containing $(VERSION) string
  2014-02-09  8:26               ` Tomi Ollila
@ 2014-02-09 14:38                 ` Tomi Ollila
  0 siblings, 0 replies; 10+ messages in thread
From: Tomi Ollila @ 2014-02-09 14:38 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

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.
---
 Makefile.local | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/Makefile.local b/Makefile.local
index 174506c..2cdd281 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -18,10 +18,16 @@ else
 DATE:=$(shell date +%F)
 endif
 
+VERSTAMP=version.stamp
 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 $(VERSTAMP) && read vs < $(VERSTAMP) || vs=; echo $$vs)
+ifneq ($(FILE_VERSION),$(VERSION))
+       $(shell echo "$(VERSION)" > $(VERSTAMP))
+endif
 endif
 endif
 
@@ -69,6 +75,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.
+$(VERSTAMP): version
+	echo $(VERSION) > $@
+
 $(TAR_FILE):
 	if git tag -v $(VERSION) >/dev/null 2>&1; then \
            ref=$(VERSION); \
@@ -280,6 +291,8 @@ notmuch_client_srcs =		\
 
 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
 
+notmuch.o: $(VERSTAMP)
+
 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 +331,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) $(VERSTAMP)
 
 DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config
 
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-02-09 14:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-25 22:43 [PATCH 1/1] build: write VERSION file containing $(VERSION) string Tomi Ollila
2014-01-26 19:55 ` Mark Walters
2014-01-27 21:43   ` [PATCH v2] " Tomi Ollila
2014-01-27 21:48     ` [PATCH v3] " Tomi Ollila
2014-01-28  1:56       ` David Bremner
2014-01-28 11:13         ` Tomi Ollila
2014-02-05 22:58           ` [PATCH v4] " Tomi Ollila
2014-02-08 23:56             ` W. Trevor King
2014-02-09  8:26               ` Tomi Ollila
2014-02-09 14:38                 ` [PATCH v5] build: write version.stamp " Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).