remake-mild-stress.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 basic remake rules for Makefiles with non-default names
  17. # and/or with multiple sources.
  18. . test-init.sh
  19. magic1=::MagicStringOne::
  20. magic2=__MagicStringTwo__
  21. magic3=%%MagicStringThree%%
  22. # See if the user's make implementation support an include directive.
  23. # We need it in this test.
  24. echo 'all:; @echo include is supported' > incl.mk
  25. echo 'include incl.mk' > gnu-style.mk
  26. echo '.include "incl.mk"' > bsd-style.mk
  27. if $MAKE -f gnu-style.mk | grep 'include is supported'; then
  28. echo "$me: GNU make include style supported"
  29. include_zardoz='include zardoz'
  30. elif $MAKE -f bsd-style.mk | grep 'include is supported'; then
  31. echo "$me: BSD make include style supported"
  32. include_zardoz='.include "zardoz"'
  33. else
  34. skip_ "make doesn't support any \"include\" directive"
  35. fi
  36. cat > configure.ac <<END
  37. AC_INIT([$me], [1.0])
  38. AM_INIT_AUTOMAKE
  39. AC_CONFIG_FILES([zardoz])
  40. AC_CONFIG_LINKS([Makefile:Makefile])
  41. AC_OUTPUT
  42. END
  43. cat > zardoz.am <<END
  44. EXTRA_DIST = Makefile
  45. #H: $magic1
  46. END
  47. cat > Makefile <<END
  48. $include_zardoz
  49. nil:
  50. .PHONY: nil
  51. END
  52. $ACLOCAL
  53. $AUTOCONF
  54. $AUTOMAKE
  55. ./configure
  56. if using_gmake; then
  57. $MAKE nil
  58. else
  59. $MAKE Makefile
  60. fi
  61. grep '^#H:' zardoz.in # For debugging.
  62. $FGREP $magic1 zardoz
  63. $FGREP $magic1 zardoz.in
  64. $MAKE distcheck
  65. $MAKE distclean # This shouldn't remove Makefile.
  66. ls -l
  67. test -f Makefile
  68. ./configure
  69. $sleep
  70. sed "s/%MAGIC3%/$magic3/" >> Makefile <<'END'
  71. my-check:
  72. ls -l . $(srcdir) ;: For debugging.
  73. test -f $(srcdir)/quux.am
  74. test -f $(srcdir)/quux.in
  75. test -f $(srcdir)/bot.in
  76. test -f $(srcdir)/top.in
  77. test ! -r $(srcdir)/zardoz.am
  78. test ! -r $(srcdir)/zardoz.in
  79. grep FOO zardoz ;: For debugging.
  80. test x'$(FOO)' = x'%MAGIC3%'
  81. test:
  82. ls -l ;: For debugging.
  83. test x'$(FOO)' = x'dummy'
  84. .PHONY: test my-check
  85. END
  86. sed "s/^#H:.*/#H: $magic2/" zardoz.am > t
  87. cat >> t <<'END'
  88. # Used by "make distcheck" below.
  89. check-local: my-check
  90. END
  91. mv -f t zardoz.am
  92. cat zardoz.am # For debugging.
  93. if using_gmake; then
  94. $MAKE nil
  95. else
  96. $MAKE zardoz
  97. fi
  98. $FGREP my-check zardoz # Sanity check.
  99. $FGREP $magic1 zardoz zardoz.in && exit 1
  100. $FGREP $magic2 zardoz
  101. $FGREP $magic2 zardoz.in
  102. ./configure
  103. $sleep
  104. sed 's/^\(AC_CONFIG_FILES\)(.*/\1([zardoz:top.in:quux.in:bot.in])/' \
  105. <configure.ac >t
  106. mv -f t configure.ac
  107. cat configure.ac # For debugging.
  108. sed '/^#H:/d' zardoz.am > quux.am
  109. echo 'FOO = dummy' >> quux.am
  110. echo 'BAR = $(BAZ)' > top.in
  111. echo "BAZ = $magic3" > bot.in
  112. is_gmake || $MAKE zardoz
  113. $MAKE test
  114. $FGREP my-check zardoz # Sanity check.
  115. $FGREP $magic3 quux.in && exit 1
  116. $FGREP $magic3 zardoz
  117. $FGREP $magic1 zardoz && exit 1
  118. $FGREP $magic2 zardoz && exit 1
  119. # After the remake above, the files 'zardoz.am' and 'zardoz.in'
  120. # should be no more needed.
  121. echo 'endif' > zardoz.am # Put in a syntax error.
  122. is_gmake || $MAKE zardoz
  123. $MAKE test
  124. rm -f zardoz.in zardoz.am # Get rid of them.
  125. is_gmake || $MAKE zardoz
  126. $MAKE test
  127. echo 'FOO = $(BAR)' >> quux.am
  128. is_gmake || $MAKE zardoz
  129. $MAKE distcheck
  130. :