doc: Fix various typos and phrasing
[automake.git] / GNUmakefile
blob3af6592d4487727e0e2d1054a8dbc79a524b5ce8
1 # Maintainer makefile for Automake. Requires GNU make.
3 # Copyright (C) 2012-2018 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
18 ifeq ($(filter bootstrap,$(MAKECMDGOALS)),)
20 ifeq ($(wildcard Makefile),)
21 # Any target but 'bootstrap' specified in an unconfigured tree
22 # is an error, even when the user is running GNU make.
23 $(warning There seems to be no Makefile in this directory.)
24 $(warning You must run ./configure before running 'make'.)
25 $(error Fatal Error)
26 endif
27 include ./Makefile
28 include $(srcdir)/maintainer/maint.mk
29 include $(srcdir)/maintainer/syntax-checks.mk
31 else # ! bootstrap in $(MAKECMDGOALS)
33 other-targets := $(filter-out bootstrap,$(MAKECMDGOALS))
34 config-status := $(wildcard ./config.status)
36 BOOTSTRAP_SHELL ?= /bin/sh
37 export BOOTSTRAP_SHELL
39 # Allow the user (or more likely the developer) to ask for a bootstrap
40 # of the package.
42 # Two issues that must be kept in mind in the implementation below:
44 # [1] "make bootstrap" can be invoked before 'configure' is run (and in
45 # fact, even before it is created, if we are bootstrapping from a
46 # freshly-cloned checkout).
48 # [2] When re-bootstrapping an already configured tree, we must ensure
49 # that the automatic remake rules for Makefile and company do not
50 # kick in, because the tree might be in an inconsistent state (e.g.,
51 # we have just switched from 'maint' to 'master', and have the built
52 # 'automake' script left from 'maint', but the files 'lib/am/*.am'
53 # are from 'master': if 'automake' gets run and uses those files --
54 # boom!).
56 ifdef config-status # Bootstrap from an already-configured tree.
57 # We need the definition of $(srcdir) in the 'bootstrap' rule
58 # below.
59 srcdir := $(shell echo @srcdir@ | $(config-status) --file=-)
60 ifndef srcdir
61 $(error Could not obtain $$(srcdir) from $(config-status))
62 endif
63 # Also, if we are re-bootstrapping an already-configured tree, we
64 # want to re-configure it with the same pre-existing configuration.
65 old-configure-flags := $(shell $(config-status) --config)
66 else # Assume we are bootstrapping from an unconfigured srcdir.
67 srcdir := .
68 old-configure-flags :=
69 endif
71 configure-flags := $(old-configure-flags) $(BOOTSTRAP_CONFIGURE_FLAGS)
73 .PHONY: bootstrap
74 bootstrap:
75 cd $(srcdir) && $(SHELL) ./bootstrap
76 $(srcdir)/configure $(configure-flags)
77 $(MAKE) clean
78 $(MAKE) check TESTS=t/get-sysconf
80 # Ensure that all the specified targets but 'bootstrap' (if any) are
81 # run with a properly re-bootstrapped tree.
82 ifdef other-targets
83 $(other-targets): restart
84 .PHONY: $(other-targets) restart
85 restart: bootstrap; $(MAKE) $(AM_MAKEFLAGS) $(other-targets)
86 endif
88 endif # ! bootstrap in $(MAKECMDGOALS)