2
0

recurs-user-indir.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 works with various types of indirections
  17. # *involved in the definition of the '*-local' targets*: make macros,
  18. # AC_SUBST'd strings, automake-time file inclusions, automake
  19. # conditionals...
  20. . test-init.sh
  21. cat >> configure.ac <<'END'
  22. AC_CONFIG_FILES([
  23. sub1/Makefile
  24. sub1/subsub/Makefile
  25. sub2/Makefile
  26. sub2/subsub/Makefile
  27. ])
  28. AM_EXTRA_RECURSIVE_TARGETS([foo])
  29. AC_SUBST([FOO_LOCAL], [foo-local])
  30. AM_CONDITIONAL([COND], [:])
  31. AC_OUTPUT
  32. END
  33. mkdir sub1 sub1/subsub sub2 sub2/subsub
  34. cat > Makefile.am <<'END'
  35. SUBDIRS = sub1 sub2
  36. AM_FOO_LOCAL = foo-local
  37. $(AM_FOO_LOCAL):
  38. pwd && : > foo
  39. CLEANFILES = foo
  40. all-local: foo
  41. check-local:
  42. test -f foo
  43. test -f sub1/foo
  44. test -f sub1/subsub/foo
  45. test -f sub2/foo
  46. test -f sub2/subsub/foo
  47. test ! -r sub2/subsub/bar
  48. END
  49. cat > sub1/Makefile.am <<'END'
  50. SUBDIRS = subsub
  51. @FOO_LOCAL@:
  52. pwd && : > foo
  53. CLEANFILES = foo
  54. END
  55. cat > sub1/subsub/Makefile.am <<'END'
  56. $(FOO_LOCAL):
  57. pwd && : > foo
  58. CLEANFILES = foo
  59. END
  60. cat > sub2/Makefile.am <<'END'
  61. include $(srcdir)/bar.am
  62. include $(srcdir)/baz.am
  63. CLEANFILES = foo
  64. END
  65. echo 'SUBDIRS = subsub' > sub2/bar.am
  66. echo 'foo-local: ; pwd && : > foo' > sub2/baz.am
  67. cat > sub2/subsub/Makefile.am <<'END'
  68. if COND
  69. foo-local:
  70. pwd && : > foo
  71. CLEANFILES = foo
  72. else !COND
  73. foo-local:
  74. pwd && : > bar
  75. endif !COND
  76. END
  77. $ACLOCAL
  78. $AUTOCONF
  79. $AUTOMAKE
  80. ./configure
  81. $MAKE check
  82. $MAKE distcheck
  83. :