am: do not quote `like this', as per GCS recommendation
[platform/upstream/automake.git] / lib / am / remake-hdr.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994-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 ## Explicitly look in srcdir for benefit of non-GNU makes.
18
19
20 %CONFIG_H%: %STAMP%
21 ## Recover from removal of CONFIG_HEADER
22         @if test ! -f $@; then rm -f %STAMP%; else :; fi
23         @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) %STAMP%; else :; fi
24
25
26 %STAMP%: %CONFIG_H_DEPS% $(top_builddir)/config.status
27         @rm -f %STAMP%
28         cd $(top_builddir) && $(SHELL) ./config.status %CONFIG_H_PATH%
29
30
31 ## Only the first file of AC_CONFIG_HEADERS is assumed to be generated
32 ## by autoheader.
33 if %?FIRST%
34 %CONFIG_HIN%: %MAINTAINER-MODE% $(am__configure_deps) %FILES%
35 ## Cater to parallel BSD make.
36         ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
37 ## Whenever $(AUTOHEADER) has run, we must make sure that
38 ## ./config.status will rebuild config.h.  The dependency from %STAMP%
39 ## on %CONFIG_H_DEPS% (which contains config.hin) is not enough to
40 ## express this.
41 ##
42 ## There are some tricky cases where this rule will build a
43 ## config.hin which has the same timestamp as %STAMP%, in which case
44 ## ./config.status will not be rerun (meaning that users will use an
45 ## out-of-date config.h without knowing it).  One situation where this
46 ## can occur is the following:
47 ## 1. the user updates some configure dependency (let's say foo.m4)
48 ##    and runs 'make';
49 ## 2. the rebuild rules detect that a foo.m4 has changed,
50 ##    run aclocal, autoconf, automake, and then run ./config.status.
51 ##    (Note that autoheader hasn't been called yet, so ./config.status
52 ##    outputs a config.h from an obsolete config.hin);
53 ## 3. once Makefile has been regenerated, make continues, and
54 ##    discovers that config.h is a dependency of the 'all' rule.
55 ##    Because config.h depends on stamp-h1, stamp-h1 depends on
56 ##    config.hin, and config.hin depends on aclocal.m4, make runs
57 ##    autoheader to rebuild config.hin.
58 ## Now make ought to call ./config.status once again to rebuild
59 ## config.h from the new config.hin, but if you have a sufficiently
60 ## fast box, steps 2 and 3 will occur within the same second: the
61 ## config.h/stamp-h1 generated from the outdated config.hin will have
62 ## the same mtime as the new config.hin.  Hence make will think that
63 ## config.h is up to date.
64 ##
65 ## A solution is to erase %STAMP% here so that the %STAMP% rule
66 ## is always triggered after the this one.
67         rm -f %STAMP%
68 ## Autoheader has the bad habit of not changing the timestamp if
69 ## config.hin is unchanged, which breaks Make targets.  Since what
70 ## must not changed gratuitously is config.h, which is already handled
71 ## by config.status, there is no reason to make things complex for
72 ## config.hin.
73         touch $@
74 endif %?FIRST%