remake-include-makefile.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #! /bin/sh
  2. # Copyright (C) 2010-2017 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. # Test remake rules for am files included (also recursively) by
  17. # Makefile.am. Keep in sync with sister tests:
  18. # - remake-include-aclocal.sh
  19. # - remake-include-configure.sh
  20. . test-init.sh
  21. magic1=::MagicStringOne::
  22. magic2=__MagicStringTwo__
  23. magic3=%%MagicStringThree%%
  24. if using_gmake; then
  25. remake="$MAKE nil"
  26. else
  27. remake="$MAKE Makefile"
  28. fi
  29. cat >> configure.ac <<'END'
  30. AC_OUTPUT
  31. END
  32. cat > Makefile.am <<'END'
  33. .PHONY: nil
  34. nil:
  35. include foo.am
  36. ## Used by "make distcheck" later.
  37. check-local:
  38. test -f $(top_srcdir)/foo.am
  39. test ! -r $(top_srcdir)/bar.am
  40. test x'$(FINGERPRINT)' = x'DummyValue'
  41. END
  42. echo 'FINGERPRINT = BadBadBad' > foo.am
  43. $ACLOCAL
  44. $AUTOCONF
  45. $AUTOMAKE
  46. for vpath in : false; do
  47. if $vpath; then
  48. mkdir build
  49. cd build
  50. top_srcdir=..
  51. else
  52. top_srcdir=.
  53. fi
  54. $top_srcdir/configure
  55. $MAKE # Should be a no-op.
  56. $sleep
  57. echo "FINGERPRINT = $magic1" > $top_srcdir/foo.am
  58. $remake
  59. $FGREP FINGERPRINT Makefile # For debugging.
  60. $FGREP $magic1 Makefile
  61. $sleep
  62. echo "FINGERPRINT = $magic2" > $top_srcdir/foo.am
  63. $remake
  64. $FGREP FINGERPRINT Makefile # For debugging.
  65. $FGREP $magic1 Makefile && exit 1
  66. $FGREP $magic2 Makefile
  67. $sleep
  68. echo 'include $(top_srcdir)/bar.am' > $top_srcdir/foo.am
  69. echo "FINGERPRINT = $magic3" > $top_srcdir/bar.am
  70. $remake
  71. $FGREP FINGERPRINT Makefile # For debugging.
  72. $FGREP $magic1 Makefile && exit 1
  73. $FGREP $magic2 Makefile && exit 1
  74. $FGREP $magic3 Makefile
  75. $sleep
  76. echo "FINGERPRINT = $magic1" > $top_srcdir/bar.am
  77. $remake
  78. $FGREP $magic2 Makefile && exit 1
  79. $FGREP $magic3 Makefile && exit 1
  80. $FGREP $magic1 Makefile
  81. $sleep
  82. echo "FINGERPRINT = DummyValue" > $top_srcdir/foo.am
  83. using_gmake || $remake
  84. $MAKE distcheck
  85. $FGREP $magic1 Makefile && exit 1 # Sanity check.
  86. $FGREP $magic2 Makefile && exit 1 # Likewise.
  87. $FGREP $magic3 Makefile && exit 1 # Likewise.
  88. $MAKE distclean
  89. cd $top_srcdir
  90. done
  91. :