remake-all-2.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. # Check that the "all" target triggers rebuilt of outdated makefiles.
  17. # This handle the case in which the makefiles are not called 'Makefile'.
  18. # See also sister test 'remake-all-1.sh'.
  19. . test-init.sh
  20. mkfile=foobar
  21. magic1=::MagicStringOne::
  22. magic2=__MagicStringTwo__
  23. magic3=%%MagicStringThree%%
  24. cat > configure.ac <<END
  25. AC_INIT([$me], [1.0])
  26. AM_INIT_AUTOMAKE
  27. AC_CONFIG_FILES([$mkfile sub/$mkfile])
  28. FOO='$magic1'
  29. AC_OUTPUT
  30. END
  31. mkdir sub
  32. cat > $mkfile.am <<END
  33. SUBDIRS = sub
  34. AM_MAKEFLAGS = -f $mkfile
  35. END
  36. cat > sub/$mkfile.am <<END
  37. AM_MAKEFLAGS = -f $mkfile
  38. END
  39. $ACLOCAL
  40. $AUTOMAKE
  41. $EGREP "^all-am:.* $mkfile( |$)" $mkfile.in sub/$mkfile.in
  42. $AUTOCONF
  43. ./configure
  44. $FGREP "$magic1" mkfile.in && exit 1 # Sanity check.
  45. # Two code paths in configure.am:
  46. # - either a file in $(am__configure_deps) has been updated ...
  47. $sleep
  48. echo "AC_SUBST([FOO])" >> configure.ac
  49. $MAKE -f $mkfile
  50. $FGREP FOO $mkfile # For debugging.
  51. $FGREP $magic1 $mkfile
  52. # - ... or not; i.e., Makefile.am or an included file has.
  53. $sleep
  54. echo "# $magic2" >> $mkfile.am
  55. echo "# $magic3" >> sub/$mkfile.am
  56. $MAKE -f $mkfile
  57. $FGREP $magic2 $mkfile
  58. $FGREP $magic3 sub/$mkfile
  59. :