tests: quote 'like this', not `like this', as per GCS recommendation
[platform/upstream/automake.git] / lib / am / configure.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 2001-2012 Free Software Foundation, Inc.
3
4 ## This program is free software; you can redistribute it and/or modify
5 ## it under the terms of the GNU General Public License as published by
6 ## the Free Software Foundation; either version 2, or (at your option)
7 ## any later version.
8
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ## GNU General Public License for more details.
13
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17
18 ## This dummy rule is called from subdirectories whenever one of the
19 ## top-level Makefile's dependencies must be updated.  It does depend
20 ## on %MAKEFILE% for the benefit of non-GNU make implementations (GNU
21 ## make will always make sure %MAKEFILE% is updated before considering
22 ## the am--refresh target anyway).
23 if %?TOPDIR_P%
24 .PHONY: am--refresh
25 am--refresh: %MAKEFILE%
26         @:
27 endif %?TOPDIR_P%
28
29 ## --------------------- ##
30 ## Building Makefile.*.  ##
31 ## --------------------- ##
32
33 ## This rule remakes the Makefile.in.
34 %MAKEFILE-IN%: %MAINTAINER-MODE% %MAKEFILE-AM% %MAKEFILE-IN-DEPS% $(am__configure_deps)
35 ## If configure.ac or one of configure's dependencies has changed, all
36 ## Makefile.in are to be updated; it is then more efficient to run
37 ## automake on all the Makefiles at once.  It also allow Automake to be
38 ## run for newly added directories.
39         @for dep in $?; do \
40           case '$(am__configure_deps)' in \
41             *$$dep*) \
42 ?TOPDIR_P?            echo ' cd $(srcdir) && $(AUTOMAKE) %AUTOMAKE-OPTIONS%'; \
43 ?TOPDIR_P?            $(am__cd) $(srcdir) && $(AUTOMAKE) %AUTOMAKE-OPTIONS% \
44 ?TOPDIR_P?              && exit 0; \
45 ?!TOPDIR_P?           ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
46 ## If on the other hand, subdir/Makefile.in has been removed, then toplevel
47 ## am--refresh will not be aware of any need to run.  We still invoke it
48 ## due to $? listing all prerequisites.  Fix up for it by running the rebuild
49 ## rule for this file only, below.
50 ?!TOPDIR_P?             && { if test -f $@; then exit 0; else break; fi; }; \
51               exit 1;; \
52           esac; \
53         done; \
54 ## Otherwise, rebuild only this file.
55         echo ' cd $(top_srcdir) && $(AUTOMAKE) %AUTOMAKE-OPTIONS% %MAKEFILE-AM-SOURCES%'; \
56         $(am__cd) $(top_srcdir) && \
57           $(AUTOMAKE) %AUTOMAKE-OPTIONS% %MAKEFILE-AM-SOURCES%
58
59 ## Ensure that GNU make doesn't remove Makefile if ./config.status (below)
60 ## is interrupted.  Otherwise, the user would need to know to rerun
61 ## ./config.status to recreate the lost Makefile.
62 .PRECIOUS: %MAKEFILE%
63 ## This rule remakes the Makefile.
64 %MAKEFILE%: %MAKEFILE-DEPS% $(top_builddir)/config.status
65 ## If Makefile is to be updated because of config.status, then run
66 ## config.status without argument in order to (i) rerun all the
67 ## AC_CONFIG_COMMANDS including those that are not visible to
68 ## Automake, and (ii) to save time by running config.status all with
69 ## all the files, instead of once per file (iii) generate Makefiles
70 ## in newly added directories.
71         @case '$?' in \
72 ## Don't prefix $(top_builddir), because GNU make will strip it out
73 ## when it's `.'.
74           *config.status*) \
75 ?TOPDIR_P?          echo ' $(SHELL) ./config.status'; \
76 ?TOPDIR_P?          $(SHELL) ./config.status;; \
77 ?!TOPDIR_P?         cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
78           *) \
79 ## FIXME: $(am__depfiles_maybe) lets us re-run the rule to create the
80 ## .P files.  Ideally we wouldn't have to do this by hand.
81             echo ' cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% $(am__depfiles_maybe)'; \
82             cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% $(am__depfiles_maybe);; \
83         esac;
84
85 ## Avoid the "deleted header file" problem for the dependencies.
86 ?HAVE-MAKEFILE-IN-DEPS?%MAKEFILE-IN-DEPS%:
87
88 DIST_COMMON += %MAKEFILE-AM%
89
90
91 ## --------------------------- ##
92 ## config.status & configure.  ##
93 ## --------------------------- ##
94
95 if %?TOPDIR_P%
96 ## Always require configure.ac and configure at top level, even if they
97 ## don't exist.  This is especially important for configure, since it
98 ## won't be created until autoconf is run -- which might be after
99 ## automake is run.
100 DIST_COMMON += $(top_srcdir)/configure $(am__configure_deps)
101 endif %?TOPDIR_P%
102
103 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
104 ?TOPDIR_P?      $(SHELL) ./config.status --recheck
105 ?!TOPDIR_P?     cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
106
107 $(top_srcdir)/configure: %MAINTAINER-MODE% $(am__configure_deps)
108 ?TOPDIR_P?      $(am__cd) $(srcdir) && $(AUTOCONF)
109 ?!TOPDIR_P?     cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
110
111
112 ## ------------ ##
113 ## aclocal.m4.  ##
114 ## ------------ ##
115
116 ## aclocal.m4 must be built by the top-level Makefile, because this is
117 ## where the user is expected to define $(ACLOCAL_AMFLAGS).
118 ##
119 ## Whenever a configure dependency changes we need to rebuild
120 ## aclocal.m4 too.  Changing configure.ac, or any file included by
121 ## aclocal.m4 might require adding more files to aclocal.m4.  Hence
122 ## the $(am__configure_deps) dependency.
123 if %?REGEN-ACLOCAL-M4%
124 $(ACLOCAL_M4): %MAINTAINER-MODE% $(am__aclocal_m4_deps)
125 ?TOPDIR_P?      $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
126 ?!TOPDIR_P?     cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
127
128 ## Avoid the "deleted header file" problem for the dependencies.
129 $(am__aclocal_m4_deps):
130 endif %?REGEN-ACLOCAL-M4%
131
132
133 ## --------- ##
134 ## cleanup.  ##
135 ## --------- ##
136
137 ## We special-case config.status here.  If we do it as part of the
138 ## normal clean processing for this directory, then it might be
139 ## removed before some subdir is cleaned.  However, that subdir's
140 ## Makefile depends on config.status.
141
142 if %?TOPDIR_P%
143 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
144  configure.lineno config.status.lineno
145 distclean:
146         -rm -f $(am__CONFIG_DISTCLEAN_FILES)
147
148 ## Note: you might think we should remove Makefile.in, configure, or
149 ## aclocal.m4 here in a maintainer-clean rule.  However, the GNU
150 ## Coding Standards explicitly prohibit this.
151
152 maintainer-clean:
153         -rm -f $(am__CONFIG_DISTCLEAN_FILES)
154 ## autom4te.cache is created by Autoconf; the only valid target to
155 ## remove it is maintainer-clean, not distclean.
156 ## If you have an autom4te.cache that cause distcheck to fail, then
157 ## it is good news: you finally discovered that autoconf and/or
158 ## autoheader is needed to use your tarball, which is wrong.
159         -rm -rf $(top_srcdir)/autom4te.cache
160
161
162 endif %?TOPDIR_P%