recurs-user.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. # Basic checks on user-defined recursive rules.
  17. # Check that user recursion respect $(SUBDIRS) order,
  18. # and proceeds in a depth-first fashion.
  19. . test-init.sh
  20. cat >> configure.ac <<'END'
  21. AM_EXTRA_RECURSIVE_TARGETS([foo])
  22. AC_CONFIG_FILES([
  23. sub1/Makefile
  24. sub2/Makefile
  25. sub3/Makefile
  26. sub3/deeper/Makefile
  27. ])
  28. AC_OUTPUT
  29. END
  30. mkdir sub1 sub2 sub3 sub3/deeper
  31. cat > Makefile.am <<'END'
  32. SUBDIRS = sub1 . sub3 sub2
  33. foo-local:
  34. echo '.' >> $(top_builddir)/got
  35. .PHONY: test
  36. test: foo
  37. cat $(srcdir)/exp
  38. cat ./got
  39. diff $(srcdir)/exp ./got
  40. check-local: test
  41. MOSTLYCLEANFILES = got
  42. EXTRA_DIST = exp
  43. END
  44. for i in 1 2 3; do
  45. cat > sub$i/Makefile.am <<END
  46. foo-local:
  47. echo 'sub$i' >> \$(top_builddir)/got
  48. END
  49. done
  50. echo SUBDIRS = deeper >> sub3/Makefile.am
  51. cat >> sub3/deeper/Makefile.am <<'END'
  52. foo-local:
  53. echo sub3/deeper >> $(top_builddir)/got
  54. END
  55. cat >> exp <<'END'
  56. sub1
  57. .
  58. sub3/deeper
  59. sub3
  60. sub2
  61. END
  62. $ACLOCAL
  63. $AUTOCONF
  64. $AUTOMAKE
  65. ./configure
  66. $MAKE test
  67. $MAKE distcheck
  68. :