]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Merge branch 'master' into ng/master
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 20 Jun 2012 16:50:28 +0000 (18:50 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 20 Jun 2012 16:50:28 +0000 (18:50 +0200)
* master:
  bootstrap: overhaul and improve
  docs: quote 'like this', not `like this'
  fixup: tests: special requirement 'makeinfo-html' removed from ./defs

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
1  2 
GNUmakefile
defs
doc/automake-ng.texi

diff --cc GNUmakefile
index 5890be6ec5ce42f8b69840f7736466df766a04af,20af004b9a64a6609ce74014daa4646d9622c5f9..0c970efd82243d3ded308368d14bb1a4d46ecc71
  # You should have received a copy of the GNU General Public License
  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
+ ifeq ($(filter bootstrap,$(MAKECMDGOALS)),)
  ifeq ($(wildcard Makefile),)
-   ifeq ($(filter bootstrap,$(MAKECMDGOALS)),bootstrap)
-     # Allow the user (or more likely the developer) to ask for a bootstrap
-     # of the package; of course, this can happen before configure is run,
-     # and in fact even before it is created.
-   else
-     # Else, If the user runs GNU make but has not yet run ./configure,
-     # give them an helpful diagnostic instead of a cryptic error.
-     $(warning There seems to be no Makefile in this directory.)
-     $(warning You must run ./configure before running 'make'.)
-     $(error Fatal Error)
-   endif
- else
-   include ./Makefile
-   include $(srcdir)/syntax-checks.mk
+   # Any target but 'bootstrap' specified in an unconfigured tree
+   # is an error, env when the user is running GNU make.
+   $(warning There seems to be no Makefile in this directory.)
+   $(warning You must run ./configure before running 'make'.)
+   $(error Fatal Error)
  endif
+ include ./Makefile
+ include $(srcdir)/syntax-checks.mk
+ else # ! bootstrap in $(MAKECMDGOALS)
+ other-targets := $(filter-out bootstrap,$(MAKECMDGOALS))
+ config-status := $(wildcard ./config.status)
  
- # To allow bootstrapping also in an unconfigured tree.
- srcdir ?= .
- V ?= 0
+ BOOTSTRAP_SHELL ?= /bin/sh
+ export BOOTSTRAP_SHELL
 +unexport CDPATH
  
- ifeq ($(V),0)
-   AM_V_BOOTSTRAP = @echo "  BOOTSTRAP";
-   AM_V_CONFIGURE = @echo "  CONFIGURE";
-   AM_V_REMAKE    = @echo "  REMAKE";
- else
-   AM_V_BOOTSTRAP =
-   AM_V_CONFIGURE =
-   AM_V_REMAKE    =
+ # Allow the user (or more likely the developer) to ask for a bootstrap
+ # of the package.
+ #
+ # Two issues that must be kept in mind in the implementation below:
+ #
+ #  [1] "make bootstrap" can be invoked before 'configure' is run (and in
+ #      fact, even before it is created, if we are bootstrapping from a
+ #      freshly-cloned checkout).
+ #
+ #  [2] When re-bootstrapping an already configured tree, we must ensure
+ #      that the automatic remake rules for Makefile and company do not
+ #      kick in, because the tree might be in an inconsistent state (e.g.,
+ #      we have just switched from 'maint' to 'master', and have the built
+ #      'automake' script left from 'maint', but the files 'lib/am/*.am'
+ #      are from 'master': if 'automake' gets run and used those files --
+ #      boom!).
+ ifdef config-status # Bootstrap from an already-configured tree.
+   # We need the definition of $(srcdir) in the 'bootstrap' rule
+   # below.
+   srcdir := $(shell echo @srcdir@ | $(config-status) --file=-)
+   ifndef srcdir
+     $(error Could not obtain $$(srcdir) from $(config-status))
+   endif
+   # Also, if we are re-bootstrapping an already-configured tree, we
+   # want to re-configure it with the same pre-existing configuration.
+   old-configure-flags := $(shell $(config-status) --config)
+ else # Assume we are bootstrapping from an unconfigured srcdir.
+   srcdir := .
+   old-configure-flags :=
  endif
  
- # Must be phony, not to be confused with the 'bootstrap' script.
+ configure-flags := $(old-configure-flags) $(BOOTSTRAP_CONFIGURE_FLAGS)
  .PHONY: bootstrap
  bootstrap:
-       $(AM_V_BOOTSTRAP)cd $(srcdir) && ./bootstrap.sh
-       $(AM_V_CONFIGURE)set -e; \
-       am__bootstrap_configure () { \
-         $(srcdir)/configure $${1+"$$@"} $(BOOTSTRAP_CONFIGURE_FLAGS); \
-       }; \
-       if test -f $(srcdir)/config.status; then \
-         : config.status should return a string properly quoted for eval; \
-         old_configure_flags=`$(srcdir)/config.status --config`; \
-       else \
-         old_configure_flags=""; \
-       fi; \
-       eval am__bootstrap_configure "$$old_configure_flags"
-       # The "make check" below is to ensure all the testsuite-required
-       # files are rebuilt.
-       $(AM_V_REMAKE)$(MAKE) clean && $(MAKE) check TESTS=t/get-sysconf
+       cd $(srcdir) && $(SHELL) ./bootstrap.sh
+       $(srcdir)/configure $(configure-flags)
+       $(MAKE) clean
+       $(MAKE) check TESTS=t/get-sysconf
+ # Ensure that all the specified targets but 'bootstrap' (if any) are
+ # run with a properly re-bootstrapped tree.
+ ifdef other-targets
+ $(other-targets): restart
+ .PHONY: $(other-targets) restart
 -restart: bootstrap; $(MAKE) $(AM_MAKEFLAGS) $(other-targets)
++restart: bootstrap; $(MAKE) $(other-targets)
+ endif
+ endif # ! bootstrap in $(MAKECMDGOALS)
diff --cc defs
Simple merge
Simple merge