Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 7f1b697

Browse files
peffgitster
authored andcommitted
Makefile: avoid infinite loop on configure.ac change
If you are using autoconf and change the configure.ac, the Makefile will notice that config.status is older than configure.ac, and will attempt to rebuild and re-run the configure script to pick up your changes. The first step in doing so is to run "make configure". Unfortunately, this tries to include config.mak.autogen, which depends on config.status, which depends on configure.ac; so we must rebuild config.status. Which leads to us running "make configure", and so on. It's easy to demonstrate with: make configure ./configure touch configure.ac make We can break this cycle by not re-invoking make to build "configure", and instead just putting its rules inline into our config.status rebuild procedure. We can avoid a copy by factoring the rules into a make variable. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1226504 commit 7f1b697

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,12 +2159,14 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)): % : unimplemented.sh
21592159
mv $@+ $@
21602160
endif # NO_PYTHON
21612161

2162+
CONFIGURE_RECIPE = $(RM) configure configure.ac+ && \
2163+
sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
2164+
configure.ac >configure.ac+ && \
2165+
autoconf -o configure configure.ac+ && \
2166+
$(RM) configure.ac+
2167+
21622168
configure: configure.ac GIT-VERSION-FILE
2163-
$(QUIET_GEN)$(RM) $@ $<+ && \
2164-
sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
2165-
$< > $<+ && \
2166-
autoconf -o $@ $<+ && \
2167-
$(RM) $<+
2169+
$(QUIET_GEN)$(CONFIGURE_RECIPE)
21682170

21692171
ifdef AUTOCONFIGURED
21702172
# We avoid depending on 'configure' here, because it gets rebuilt
@@ -2173,7 +2175,7 @@ ifdef AUTOCONFIGURED
21732175
# do want to recheck when the platform/environment detection logic
21742176
# changes, hence this depends on configure.ac.
21752177
config.status: configure.ac
2176-
$(QUIET_GEN)$(MAKE) configure && \
2178+
$(QUIET_GEN)$(CONFIGURE_RECIPE) && \
21772179
if test -f config.status; then \
21782180
./config.status --recheck; \
21792181
else \

0 commit comments

Comments
 (0)