recurs-user-keep-going.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 "make -k".
  17. . test-init.sh
  18. cat >> configure.ac <<'END'
  19. AM_EXTRA_RECURSIVE_TARGETS([foo])
  20. AC_CONFIG_FILES([
  21. sub1/Makefile
  22. sub1/subsub1/Makefile
  23. sub2/Makefile
  24. sub2/subsub2/Makefile
  25. sub3/Makefile
  26. ])
  27. FAIL='@echo "FAIL $@ in `pwd`"; exit 1'
  28. PASS='@echo "PASS $@ in `pwd`"; : > foo'
  29. AC_SUBST([FAIL])
  30. AC_SUBST([PASS])
  31. AC_OUTPUT
  32. END
  33. mkdir sub1 sub1/subsub1 sub2 sub2/subsub2 sub3
  34. cat > Makefile.am <<'END'
  35. SUBDIRS = sub1 . sub2 sub3
  36. foo-local:; @FAIL@
  37. END
  38. cat > sub1/Makefile.am <<'END'
  39. SUBDIRS = subsub1
  40. foo-local:; @PASS@
  41. END
  42. cat > sub2/Makefile.am <<'END'
  43. SUBDIRS = subsub2
  44. foo-local:; @FAIL@
  45. END
  46. echo 'foo-local:; @FAIL@' > sub1/subsub1/Makefile.am
  47. echo 'foo-local:; @PASS@' > sub2/subsub2/Makefile.am
  48. echo 'foo-local:; @PASS@' > sub3/Makefile.am
  49. $ACLOCAL
  50. $AUTOCONF
  51. $AUTOMAKE
  52. ./configure
  53. cat > exp <<END
  54. ./sub1/foo
  55. ./sub2/subsub2/foo
  56. ./sub3/foo
  57. END
  58. as_expected ()
  59. {
  60. find . -name foo > t || { cat t; exit 1; }
  61. LC_ALL=C sort t > got
  62. cat exp
  63. cat got
  64. diff exp got
  65. }
  66. # Without "-k", we fail in 'sub1/subsub1', and do nothing else.
  67. # So, no 'foo' file gets created.
  68. $MAKE foo && exit 1
  69. find . -name foo | grep . && exit 1
  70. if using_gmake; then
  71. $MAKE -k foo && exit 1
  72. as_expected
  73. $MAKE --keep-going foo && exit 1
  74. as_expected
  75. else
  76. # Don't trust the exit status of 'make -k' for non-GNU makes.
  77. $MAKE -k foo || :
  78. as_expected
  79. fi
  80. :