remake-subdir-gnu.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 using
  17. # 'GNUmakefile' as makefiles name. This obviously requires GNU
  18. # make.
  19. # See also the other similar tests 'remake-subdir*.sh', and the
  20. # related test 'aclocal5.sh'
  21. required=GNUmake
  22. . test-init.sh
  23. magic1='::MagicString::One::'
  24. magic2='__MagicString__Two__'
  25. debug_info ()
  26. {
  27. grep -i magic configure GNUmakefile.in GNUmakefile \
  28. sub/GNUmakefile.in sub/GNUmakefile
  29. }
  30. cat > configure.ac <<END
  31. AC_INIT([$me], [1.0])
  32. AM_INIT_AUTOMAKE
  33. AC_CONFIG_FILES([GNUmakefile sub/GNUmakefile])
  34. AC_SUBST([MAGIC], [magic])
  35. AC_OUTPUT
  36. END
  37. cat > GNUmakefile.am <<'END'
  38. SUBDIRS = sub
  39. END
  40. mkdir sub
  41. : > sub/GNUmakefile.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. $MAKE
  53. cd ..
  54. debug_info
  55. $FGREP $magic1 configure
  56. $FGREP $magic1 GNUmakefile
  57. $FGREP $magic1 sub/GNUmakefile
  58. $sleep
  59. cd sub
  60. echo MAGIC = $magic2 >> GNUmakefile.am
  61. $MAKE
  62. cd ..
  63. debug_info
  64. $FGREP $magic2 sub/GNUmakefile
  65. $FGREP $magic2 sub/GNUmakefile.in
  66. $FGREP $magic1 sub/GNUmakefile sub/GNUmakefile.in && exit 1
  67. $FGREP $magic2 GNUmakefile GNUmakefile.in && exit 1
  68. :