remake-deleted-am-subdir.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #! /bin/sh
  2. # Copyright (C) 2011-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. # Check that inclusion of '.am' fragments by automake does not suffer
  17. # of the "deleted header problem". This test does the check when the
  18. # SUBDIRS variable is involved.
  19. . test-init.sh
  20. cat >> configure.ac <<'END'
  21. AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
  22. AC_OUTPUT
  23. END
  24. $ACLOCAL
  25. $AUTOCONF
  26. cat > Makefile.am <<'END'
  27. include foo.am
  28. SUBDIRS = sub1 sub2
  29. END
  30. echo '# this is foo.am' > foo.am
  31. mkdir sub1 sub2
  32. echo 'include $(srcdir)/bar.am' > sub1/Makefile.am
  33. echo '# this is bar.am' > sub1/bar.am
  34. echo 'include $(top_srcdir)/foo.am' > sub2/Makefile.am
  35. $AUTOMAKE
  36. # Sanity checks.
  37. $FGREP 'this is foo.am' Makefile.in
  38. $FGREP 'this is bar.am' sub1/Makefile.in
  39. $FGREP 'this is foo.am' sub2/Makefile.in
  40. ./configure
  41. $MAKE # Should be no-op.
  42. $sleep
  43. echo '# this is sub1/Makefile.am' > sub1/Makefile.am
  44. rm -f sub1/bar.am
  45. $MAKE all
  46. # Sanity checks.
  47. $FGREP 'this is bar' sub1/Makefile.in sub1/Makefile && exit 1
  48. $FGREP 'this is sub1/Makefile.am' sub1/Makefile.in
  49. $FGREP 'this is sub1/Makefile.am' sub1/Makefile
  50. $sleep
  51. for d in . sub2; do
  52. sed "s|.*include.*foo\.am.*|# this is $d/Makefile.am|" $d/Makefile.am > t
  53. mv -f t $d/Makefile.am
  54. done
  55. rm -f foo.am
  56. $MAKE all
  57. # Sanity checks.
  58. $FGREP 'this is foo' sub*/Makefile* Makefile* && exit 1
  59. for d in . sub1 sub2; do
  60. $FGREP "this is $d/Makefile.am" $d/Makefile.in
  61. $FGREP "this is $d/Makefile.am" $d/Makefile
  62. done
  63. :