Eric Blake <[EMAIL PROTECTED]> writes:
> Simon Josefsson <simon <at> josefsson.org> writes:
>
>>
>> A patch explains what I mean more clear. Skip your patch, and apply
>> this instead. There already was a git-version-gen module. What do you
>> think?
>
> Looks nice. Please apply, with these nits fixed:
>
>> # Ensure that $(VERSION) is up to date for dist-related targets, but not
>> # for others: rerunning autoreconf and recompiling everything isn't cheap.
>> -ifeq (0,$(MAKELEVEL))
>> +_have-git-version-gen := $(shell test -f ./build-aux/git-version-gen &&
>> echo
> yes)
>
> Do we want to hard-code build-aux? Or should we do:
>
> _build-aux ?= build-aux
>
> ./$(_build-aux)/git-version-gen
Yes, that is better. At least it allows people to override the
build-aux directory name in cfg.mk. It would be even nicer to make this
more automatic (pull it from gnulib-cache.m4?), but at least this gives
people an option.
>> +ifeq ($(_have-git-version-gen),yes)
>> + ifeq (0,$(MAKELEVEL))
>> _is-dist-target = $(filter-out %clean, \
>
> I like two space indents. But rather than reindent everything, will it work
> to
> combine the two conditions into one test?
>
> ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
Clever.
I've pushed the patch below.
/Simon
>From 216173c7d70cbd66f8791b6710cb8f8c3bf6eef9 Mon Sep 17 00:00:00 2001
From: Simon Josefsson <[EMAIL PROTECTED]>
Date: Thu, 20 Mar 2008 15:50:57 +0100
Subject: [PATCH] Make git-version-gen optional. Add _build-aux variable.
---
ChangeLog | 5 +++++
build-aux/GNUmakefile | 8 ++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 85d2587..490b40e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-20 Simon Josefsson <[EMAIL PROTECTED]>
+
+ * build-aux/GNUmakefile: Make git-version-gen optional. Add
+ _build-aux variable. Suggested by Eric Blake <[EMAIL PROTECTED]>.
+
2008-03-20 Eric Blake <[EMAIL PROTECTED]>
Sync GNUmakefile with coreutils.
diff --git a/build-aux/GNUmakefile b/build-aux/GNUmakefile
index fac11d3..a9d6196 100644
--- a/build-aux/GNUmakefile
+++ b/build-aux/GNUmakefile
@@ -40,6 +40,9 @@ export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
include Makefile
+# Allow cfg.mk to override this.
+_build-aux ?= build-aux
+
# Some projects override e.g., _autoreconf here.
-include $(srcdir)/cfg.mk
include $(srcdir)/maint.mk
@@ -48,11 +51,12 @@ _autoreconf ?= autoreconf
# Ensure that $(VERSION) is up to date for dist-related targets, but not
# for others: rerunning autoreconf and recompiling everything isn't cheap.
-ifeq (0,$(MAKELEVEL))
+_have-git-version-gen := $(shell test -f ./$(_build-aux)/git-version-gen &&
echo yes)
+ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
_is-dist-target = $(filter-out %clean, \
$(filter dist% alpha beta major,$(MAKECMDGOALS)))
ifneq (,$(_is-dist-target))
- _curr-ver := $(shell cd $(srcdir) && ./build-aux/git-version-gen \
+ _curr-ver := $(shell cd $(srcdir) && ./$(_build-aux)/git-version-gen \
$(srcdir)/.tarball-version)
ifneq ($(_curr-ver),$(VERSION))
$(info INFO: running autoreconf for new version string: $(_curr-ver))
--
1.5.4.3