2
0

recurs-user2.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #! /bin/sh
  2. # Copyright (C) 2012-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 user recursion can be made to work when $(SUBDIRS) are
  17. # not "strictly" nested, as in e.g.:
  18. # SUBDIRS = src external/lib external/tests
  19. # with no Makefile in 'external'.
  20. . test-init.sh
  21. cat >> configure.ac <<'END'
  22. AC_CONFIG_FILES(
  23. sub1/Makefile
  24. sub2/Makefile
  25. dnl There's deliberately no 'sub3/Makefile'.
  26. sub3/subsub/Makefile
  27. sub4/Makefile
  28. sub4/subsub/Makefile
  29. )
  30. AM_EXTRA_RECURSIVE_TARGETS([foo])
  31. AC_OUTPUT
  32. END
  33. mkdir sub1 sub2 sub3 sub4 sub3/subsub sub4/subsub
  34. cat > Makefile.am <<'END'
  35. SUBDIRS = sub1 sub2 sub3/subsub sub4 sub4/subsub
  36. foo-local:
  37. echo _rootdir_ >foo
  38. MOSTLYCLEANFILES = foo
  39. .PHONY: test
  40. test: foo
  41. grep _rootdir_ foo
  42. grep ':sub1:' sub1/foo
  43. grep ',sub1,' sub1/bar
  44. test ! -r sub2/foo
  45. test ! -r sub3/foo
  46. grep '%sub3/subsub%' sub3/subsub/quux
  47. test ! -r sub3/subsub/foo
  48. test ! -r sub4/foo
  49. grep '=sub4/subsub=' sub4/subsub/foo
  50. check-local: test
  51. END
  52. # A 'foo-local' target with dependencies shouldn't cause problems.
  53. cat > sub1/Makefile.am <<'END'
  54. foo-local: bar
  55. sed 's/,/:/g' bar >foo
  56. bar:
  57. echo ',sub1,' >$@
  58. MOSTLYCLEANFILES = foo bar
  59. END
  60. # The lack of a 'foo' target here shouldn't cause any error in
  61. # automake nor in make.
  62. : > sub2/Makefile.am
  63. # The lack of file 'sub3/Makefile.am' shouldn't cause any problem either.
  64. rm -f sub3/Makefile.am
  65. # A 'foo-local' creating a file != 'foo' shouldn't cause any problem.
  66. cat > sub3/subsub/Makefile.am <<'END'
  67. foo-local:
  68. echo '%sub3/subsub%' >quux
  69. MOSTLYCLEANFILES = quux
  70. END
  71. # No 'foo-local' nor 'foo' target here ...
  72. : > sub4/Makefile.am
  73. # ... should not cause errors, nor cause the 'foo-local' target
  74. # here not to be executed.
  75. cat > sub4/subsub/Makefile.am <<'END'
  76. foo-local:
  77. echo '=sub4/subsub=' >foo
  78. MOSTLYCLEANFILES = foo
  79. END
  80. $ACLOCAL
  81. $AUTOCONF
  82. $AUTOMAKE
  83. ./configure
  84. $MAKE test
  85. $MAKE distcheck
  86. :