remake-subdir.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 remake rules works from subdirectories, even with non-GNU
  17. # make implementations.
  18. # See also the other similar tests 'remake-subdir*.sh', and the
  19. # related test 'aclocal5.sh'.
  20. . test-init.sh
  21. if using_gmake; then
  22. remake=$MAKE
  23. else
  24. remake="$MAKE Makefile"
  25. fi
  26. magic1='::MagicString::One::'
  27. magic2='__MagicString__Two__'
  28. debug_info ()
  29. {
  30. grep -i magic configure Makefile.in Makefile sub/Makefile.in sub/Makefile
  31. }
  32. cat >> configure.ac <<'END'
  33. AC_CONFIG_FILES([sub/Makefile])
  34. AC_SUBST([MAGIC], [magic])
  35. AC_OUTPUT
  36. END
  37. cat > Makefile.am <<'END'
  38. SUBDIRS = sub
  39. END
  40. mkdir sub
  41. : > sub/Makefile.am
  42. $ACLOCAL
  43. $AUTOCONF
  44. $AUTOMAKE
  45. ./configure
  46. $MAKE
  47. debug_info
  48. $sleep
  49. sed "s|magic|$magic1|" configure.ac > t
  50. mv -f t configure.ac
  51. cd sub
  52. $remake
  53. cd ..
  54. debug_info
  55. $FGREP $magic1 configure
  56. $FGREP $magic1 Makefile
  57. $FGREP $magic1 sub/Makefile
  58. $sleep
  59. cd sub
  60. echo MAGIC = $magic2 >> Makefile.am
  61. $remake
  62. cd ..
  63. debug_info
  64. $FGREP $magic2 sub/Makefile
  65. $FGREP $magic2 sub/Makefile.in
  66. $FGREP $magic1 sub/Makefile sub/Makefile.in && exit 1
  67. $FGREP $magic2 Makefile Makefile.in && exit 1
  68. :