git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Martin von Zweigbergk <martinvonz@gmail.com>
Date
Jan 2, 2013, 01:11 UTC
Message-ID
<CANiSa6jt7_ixi7L6U9sfpV2mvT_7zgYV+m+sLiXjkDsFehAuwA@mail.gmail.com>
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])
Next: Jonathan Nieder
Message 1 of 13 in “Makefile dependency from 'configure' to 'GIT-VERSION-FILE'”
  1. Martin von ZweigbergkJan 2, 2013
  2. Jonathan NiederJan 2, 2013
  3. Martin von ZweigbergkJan 2, 2013
  4. build: do not automatically reconfigure unless configure.ac changedJonathan Nieder, Jan 2, 2013
  5. Jeff KingJan 2, 2013
  6. Jonathan NiederJan 2, 2013
  7. Stefano LattariniJan 2, 2013
  8. Junio C HamanoJan 2, 2013
  9. Martin von ZweigbergkJan 2, 2013
  10. Stefano LattariniJan 2, 2013
  11. Junio C HamanoJan 2, 2013
  12. Stefano LattariniJan 2, 2013
  13. Jonathan NiederJan 2, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.