remake-hdr.am 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. ## automake - create Makefile.in from Makefile.am
  2. ## Copyright (C) 1994-2017 Free Software Foundation, Inc.
  3. ## This program is free software; you can redistribute it and/or modify
  4. ## it under the terms of the GNU General Public License as published by
  5. ## the Free Software Foundation; either version 2, or (at your option)
  6. ## any later version.
  7. ## This program is distributed in the hope that it will be useful,
  8. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. ## GNU General Public License for more details.
  11. ## You should have received a copy of the GNU General Public License
  12. ## along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. %CONFIG_H%: %STAMP%
  14. ## Recover from removal of CONFIG_HEADER.
  15. @test -f $@ || rm -f %STAMP%
  16. @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %STAMP%
  17. %STAMP%: %CONFIG_H_DEPS% $(top_builddir)/config.status
  18. @rm -f %STAMP%
  19. cd $(top_builddir) && $(SHELL) ./config.status %CONFIG_H_PATH%
  20. ## Only the first file of AC_CONFIG_HEADERS is assumed to be generated
  21. ## by autoheader.
  22. if %?FIRST-HDR%
  23. %CONFIG_HIN%: %MAINTAINER-MODE% $(am__configure_deps) %FILES%
  24. ## Cater to parallel BSD make.
  25. ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
  26. ## Whenever $(AUTOHEADER) has run, we must make sure that
  27. ## ./config.status will rebuild config.h. The dependency from %STAMP%
  28. ## on %CONFIG_H_DEPS% (which contains config.hin) is not enough to
  29. ## express this.
  30. ##
  31. ## There are some tricky cases where this rule will build a
  32. ## config.hin which has the same timestamp as %STAMP%, in which case
  33. ## ./config.status will not be rerun (meaning that users will use an
  34. ## out-of-date config.h without knowing it). One situation where this
  35. ## can occur is the following:
  36. ## 1. the user updates some configure dependency (let's say foo.m4)
  37. ## and runs 'make';
  38. ## 2. the rebuild rules detect that a foo.m4 has changed,
  39. ## run aclocal, autoconf, automake, and then run ./config.status.
  40. ## (Note that autoheader hasn't been called yet, so ./config.status
  41. ## outputs a config.h from an obsolete config.hin);
  42. ## 3. once Makefile has been regenerated, make continues, and
  43. ## discovers that config.h is a dependency of the 'all' rule.
  44. ## Because config.h depends on stamp-h1, stamp-h1 depends on
  45. ## config.hin, and config.hin depends on aclocal.m4, make runs
  46. ## autoheader to rebuild config.hin.
  47. ## Now make ought to call ./config.status once again to rebuild
  48. ## config.h from the new config.hin, but if you have a sufficiently
  49. ## fast box, steps 2 and 3 will occur within the same second: the
  50. ## config.h/stamp-h1 generated from the outdated config.hin will have
  51. ## the same mtime as the new config.hin. Hence make will think that
  52. ## config.h is up to date.
  53. ##
  54. ## A solution is to erase %STAMP% here so that the %STAMP% rule
  55. ## is always triggered after the this one.
  56. rm -f %STAMP%
  57. ## Autoheader has the bad habit of not changing the timestamp if
  58. ## config.hin is unchanged, which breaks Make targets. Since what
  59. ## must not changed gratuitously is config.h, which is already handled
  60. ## by config.status, there is no reason to make things complex for
  61. ## config.hin.
  62. touch $@
  63. endif %?FIRST-HDR%