Makefile dependency from 'configure' to 'GIT-VERSION-FILE'

2013-01-01 Thread Martin von Zweigbergk
Hi,

I use autoconf with git.git. I have noticed lately, especially when
doing things like git rebase -i --exec make, that ./configure is run
every time. If I understand correctly, this is because of 8242ff4
(build: reconfigure automatically if configure.ac changes,
2012-07-19). Just a few days before that commit, on 2012-07-15, the
branch jn/makefile-cleanup including 520a6cd (Makefile: move
GIT-VERSION-FILE dependencies closer to use, 2012-06-20) was merged
(to next?). I wonder if these two subjects were aware of each other.

The reason 'configure' depends on GIT-VERSION-FILE is because it
inserts the version into the call to AC_INIT. I have close to no
experience with autoconf or even make and it's not at all clear to me
why we need to pass the verison to AC_INIT. It seems like it's just
for messages printed by ./configure. If that's the case, we shouldn't
need to generate a new 'configure' file ever time. At the very least,
we shouldn't need to run it.

Do you think we should simply remove the dependency from 'configure'
to 'GIT-VERSION-FILE' and leave a comment there instead? Or should we
instead somehow make 'reconfigure' depend only on 'configure.ac'? Both
of these feel a little wrong to me, because they would remove real
dependencies. Maybe the (probably mangled) patch at the end of this
message is better?

Martin


diff --git a/Makefile b/Makefile
index 736ecd4..ec5d7ca 100644
--- a/Makefile
+++ b/Makefile
@@ -2267,12 +2267,9 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)): % : unimplemented.sh
mv $@+ $@
 endif # NO_PYTHON

-configure: configure.ac GIT-VERSION-FILE
-   $(QUIET_GEN)$(RM) $@ $+  \
-   sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-   $  $+  \
-   autoconf -o $@ $+  \
-   $(RM) $+
+configure: configure.ac
+   $(QUIET_GEN)$(RM) $@  \
+   autoconf -o $@ $

 ifdef AUTOCONFIGURED
 config.status: configure
diff --git a/configure.ac b/configure.ac
index ad215cc..00c3e38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,10 @@ fi
 ## Configure body starts here.

 AC_PREREQ(2.59)
-AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
+AC_INIT([git],
+   m4_esyscmd([ ./GIT-VERSION-GEN 
+{ sed -ne 's/GIT_VERSION = //p' GIT-VERSION-FILE
| xargs echo -n; } ]),
+   [git@vger.kernel.org])

 AC_CONFIG_SRCDIR([git.c])
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Makefile dependency from 'configure' to 'GIT-VERSION-FILE'

2013-01-01 Thread Jonathan Nieder
Hi Martin,

Martin von Zweigbergk wrote:

 I use autoconf with git.git. I have noticed lately, especially when
 doing things like git rebase -i --exec make, that ./configure is run
 every time. If I understand correctly, this is because of 8242ff4
 (build: reconfigure automatically if configure.ac changes,
 2012-07-19).

How about this patch (untested)?

-- 8 --
Subject: build: do not automatically reconfigure unless configure.ac changed

Starting with v1.7.12-rc0~4^2 (build: reconfigure automatically if
configure.ac changes, 2012-07-19), config.status --recheck is
automatically run every time the configure script changes.  In
particular, that means the configuration procedure repeats whenever
the version number changes (since the configure script changes to
support ./configure --version and ./configure --help), making
bisecting painfully slow.

The intent was to make the reconfiguration process only trigger for
changes to configure.ac's logic.  Tweak the Makefile rule to match
that intent by depending on configure.ac instead of configure.

Reported-by: Martin von Zweigbergk martinv...@gmail.com
Signed-off-by: Jonathan Nieder jrnie...@gmail.com
---
[...]
 --- a/Makefile
 +++ b/Makefile
 @@ -2267,12 +2267,9 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)): % : 
 unimplemented.sh
 mv $@+ $@
  endif # NO_PYTHON
 
 -configure: configure.ac GIT-VERSION-FILE
 +configure: configure.ac
[...]
 --- a/configure.ac
 +++ b/configure.ac
 @@ -142,7 +142,10 @@ fi
  ## Configure body starts here.
 
  AC_PREREQ(2.59)
 -AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
 +AC_INIT([git],
 +   m4_esyscmd([ ./GIT-VERSION-GEN 
 +{ sed -ne 's/GIT_VERSION = //p' GIT-VERSION-FILE | xargs 
 echo -n; } ]),
 +   [git@vger.kernel.org])

I don't think that would warrant dropping the GIT-VERSION-FILE
dependency, since the resulting configure script still hard-codes the
version number.

Sane?

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 736ecd45..2a22041f 100644
--- a/Makefile
+++ b/Makefile
@@ -2275,7 +2275,7 @@ configure: configure.ac GIT-VERSION-FILE
$(RM) $+
 
 ifdef AUTOCONFIGURED
-config.status: configure
+config.status: configure.ac
$(QUIET_GEN)if test -f config.status; then \
  ./config.status --recheck; \
else \
-- 
1.8.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Makefile dependency from 'configure' to 'GIT-VERSION-FILE'

2013-01-01 Thread Martin von Zweigbergk
On Tue, Jan 1, 2013 at 11:21 PM, Jonathan Nieder jrnie...@gmail.com wrote:

 How about this patch (untested)?

Looks good. Thanks!

 --- a/Makefile
 +++ b/Makefile
 @@ -2267,12 +2267,9 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)): % : 
 unimplemented.sh
 mv $@+ $@
  endif # NO_PYTHON

 -configure: configure.ac GIT-VERSION-FILE
 +configure: configure.ac
 [...]
 --- a/configure.ac
 +++ b/configure.ac
 @@ -142,7 +142,10 @@ fi
  ## Configure body starts here.

  AC_PREREQ(2.59)
 -AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
 +AC_INIT([git],
 +   m4_esyscmd([ ./GIT-VERSION-GEN 
 +{ sed -ne 's/GIT_VERSION = //p' GIT-VERSION-FILE | 
 xargs echo -n; } ]),
 +   [git@vger.kernel.org])

 I don't think that would warrant dropping the GIT-VERSION-FILE
 dependency, since the resulting configure script still hard-codes the
 version number.

Yeah, you're right. I was merely sweeping the dependency under the rug :-(


 diff --git a/Makefile b/Makefile
 index 736ecd45..2a22041f 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -2275,7 +2275,7 @@ configure: configure.ac GIT-VERSION-FILE
 $(RM) $+

  ifdef AUTOCONFIGURED
 -config.status: configure
 +config.status: configure.ac
 $(QUIET_GEN)if test -f config.status; then \
   ./config.status --recheck; \
 else \

The next line just outside the context here does depend on
'configure', which is why I thought this would not be right. But it
seems impossible to get away from that, and AUTOCONFIGURED should only
be set when ./configure has been run (IIUC), so it's not even
realistic to have git reconfigure fail to find ./configure. So,
again, looks good.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html