remake-subdir2.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 when makefiles
  17. # are not named "Makefile".
  18. # See also the other similar tests 'remake-subdir*.sh', and the
  19. # related test 'aclocal5.sh'.
  20. . test-init.sh
  21. magic1='::MagicString::One::'
  22. magic2='__MagicString__Two__'
  23. debug_info ()
  24. {
  25. grep -i magic configure build.in build.mk sub/build.in sub/build.mk
  26. }
  27. cat > configure.ac <<END
  28. AC_INIT([$me], [1.0])
  29. AM_INIT_AUTOMAKE
  30. AC_CONFIG_FILES([build.mk:build.in])
  31. AC_CONFIG_FILES([sub/build.mk:sub/build.in])
  32. AC_SUBST([MAGIC], [magic])
  33. AC_OUTPUT
  34. END
  35. cat > build.am <<'END'
  36. AM_MAKEFLAGS = -f build.mk
  37. SUBDIRS = sub
  38. END
  39. mkdir sub
  40. cat > sub/build.am <<'END'
  41. AM_MAKEFLAGS = -f build.mk
  42. END
  43. $ACLOCAL
  44. $AUTOCONF
  45. $AUTOMAKE
  46. ./configure
  47. ls -l # For debugging.
  48. $MAKE -f build.mk
  49. debug_info
  50. $sleep
  51. sed "s|magic|$magic1|" configure.ac > t
  52. mv -f t configure.ac
  53. cd sub
  54. $MAKE -f build.mk build.mk
  55. cd ..
  56. debug_info
  57. $FGREP $magic1 configure
  58. $FGREP $magic1 build.mk
  59. $FGREP $magic1 sub/build.mk
  60. $sleep
  61. cd sub
  62. echo MAGIC = $magic2 >> build.am
  63. $MAKE -f build.mk build.mk
  64. cd ..
  65. debug_info
  66. $FGREP $magic2 sub/build.mk
  67. $FGREP $magic2 sub/build.in
  68. $FGREP $magic1 sub/build.in sub/build.mk && exit 1
  69. $FGREP $magic2 build.in build.mk && exit 1
  70. :