2
0

subdir-order.sh 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. # The $(SUDBIRS) entries are processed in the order they are specified.
  17. . test-init.sh
  18. cat >> configure.ac << 'END'
  19. AC_CONFIG_FILES([
  20. sub0/Makefile
  21. sub1/Makefile
  22. sub2/Makefile
  23. sub3/Makefile
  24. sub3/a/Makefile
  25. sub3/b/Makefile
  26. ])
  27. AC_OUTPUT
  28. END
  29. mkdir sub0 sub1 sub2 sub3 sub3/a sub3/b
  30. cat > Makefile.am << 'END'
  31. SUBDIRS = sub2 sub1 sub3 sub0
  32. all-local:
  33. test -f sub0/run
  34. test -f sub1/run
  35. test -f sub2/run
  36. test -f sub3/run
  37. test -f sub3/a/run
  38. test -f sub3/b/run
  39. test ! -f run
  40. : > run
  41. CLEANFILES = \
  42. run \
  43. sub0/run \
  44. sub1/run \
  45. sub2/run \
  46. sub3/run \
  47. sub3/a/run \
  48. sub3/b/run
  49. END
  50. cat > sub0/Makefile.am << 'END'
  51. all-local:
  52. test ! -f $(top_builddir)/run
  53. test -f $(top_builddir)/sub1/run
  54. test -f $(top_builddir)/sub3/run
  55. test -f $(top_builddir)/sub3/a/run
  56. test -f $(top_builddir)/sub3/b/run
  57. test ! -f run
  58. : > run
  59. END
  60. cat > sub1/Makefile.am << 'END'
  61. all-local:
  62. test ! -f $(top_builddir)/run
  63. test ! -f $(top_builddir)/sub0/run
  64. test -f $(top_builddir)/sub2/run
  65. test ! -f $(top_builddir)/sub3/run
  66. test ! -f $(top_builddir)/sub3/a/run
  67. test ! -f $(top_builddir)/sub3/b/run
  68. test ! -f run
  69. : > run
  70. END
  71. cat > sub2/Makefile.am << 'END'
  72. all-local:
  73. test ! -f $(top_builddir)/run
  74. test ! -f $(top_builddir)/sub0/run
  75. test ! -f $(top_builddir)/sub1/run
  76. test ! -f $(top_builddir)/sub3/run
  77. test ! -f $(top_builddir)/sub3/a/run
  78. test ! -f $(top_builddir)/sub3/b/run
  79. test ! -f run
  80. : > run
  81. END
  82. cat > sub3/Makefile.am << 'END'
  83. SUBDIRS = b . a
  84. all-local:
  85. test ! -f $(top_builddir)/run
  86. test ! -f $(top_builddir)/sub0/run
  87. test -f $(top_builddir)/sub1/run
  88. test ! -f $(top_builddir)/sub3/a/run
  89. test -f $(top_builddir)/sub3/b/run
  90. test ! -f run
  91. : > run
  92. END
  93. cat > sub3/a/Makefile.am << 'END'
  94. all-local:
  95. test ! -f $(top_builddir)/run
  96. test ! -f $(top_builddir)/sub0/run
  97. test -f $(top_builddir)/sub1/run
  98. test -f $(top_builddir)/sub3/b/run
  99. test -f $(top_builddir)/sub3/run
  100. test ! -f run
  101. : > run
  102. END
  103. cat > sub3/b/Makefile.am << 'END'
  104. all-local:
  105. test ! -f $(top_builddir)/run
  106. test ! -f $(top_builddir)/sub0/run
  107. test -f $(top_builddir)/sub1/run
  108. test ! -f $(top_builddir)/sub3/b/run
  109. test ! -f $(top_builddir)/sub3/run
  110. test ! -f run
  111. : > run
  112. END
  113. echo dummy: > Makefile
  114. if using_gmake; then
  115. jobs=-j12
  116. elif $MAKE -j12; then
  117. jobs=-j12
  118. elif $MAKE -j 12; then
  119. jobs="-j 12"
  120. else
  121. jobs=none
  122. fi
  123. rm -f Makefile
  124. $ACLOCAL
  125. $AUTOCONF
  126. $AUTOMAKE -c --add-missing
  127. ./configure
  128. for j in '' "$jobs"; do
  129. test x"$j" = x"none" && continue
  130. $MAKE $j
  131. test -f run
  132. test -f sub0/run
  133. test -f sub1/run
  134. test -f sub3/run
  135. test -f sub3/a/run
  136. test -f sub3/b/run
  137. $MAKE clean
  138. find . | grep 'run$' && exit 1
  139. : # For shells with busted 'set -e'
  140. done
  141. :