txinfo-no-clutter.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 info, html, pdf, ps and dvi targets shouldn't let clutter in the
  17. # build directory. Related to automake bug#11146.
  18. required='makeinfo tex texi2dvi dvips'
  19. . test-init.sh
  20. cat >> configure.ac <<'END'
  21. AC_CONFIG_FILES([sub/Makefile])
  22. AC_OUTPUT
  23. END
  24. cat > Makefile.am << 'END'
  25. all-local: ps pdf dvi html # For "make distcheck".
  26. info_TEXINFOS = foo.texi doc/bar.texi baz.texi
  27. SUBDIRS = sub
  28. END
  29. mkdir sub doc
  30. cat > sub/Makefile.am << 'END'
  31. all-local: ps pdf dvi html # For "make distcheck".
  32. info_TEXINFOS = baz.texi
  33. END
  34. cat > foo.texi << 'END'
  35. \input texinfo
  36. @setfilename foo.info
  37. @settitle foo
  38. @node Top
  39. Hello walls.
  40. @include version.texi
  41. @bye
  42. END
  43. cat > doc/bar.texi << 'END'
  44. \input texinfo
  45. @setfilename bar.info
  46. @settitle bar
  47. @node Top
  48. Hello walls.
  49. @include version2.texi
  50. @bye
  51. END
  52. cat > baz.texi << 'END'
  53. \input texinfo
  54. @setfilename baz.info
  55. @settitle baz
  56. @defindex au
  57. @defindex sa
  58. @defindex sb
  59. @node Top
  60. Hello walls.
  61. @cindex foo
  62. foo
  63. @pindex bar
  64. bar
  65. @auindex baz
  66. baz
  67. @saindex sa
  68. sa
  69. @sbindex sb
  70. sb
  71. @bye
  72. END
  73. cp baz.texi sub
  74. $ACLOCAL
  75. $AUTOMAKE --add-missing
  76. $AUTOCONF
  77. ./configure
  78. # Try one by one, to ensure later targets don't involuntarily
  79. # clean up potential cruft left by earlier ones.
  80. for fmt in info pdf ps dvi html all; do
  81. $MAKE $fmt
  82. # For debugging.
  83. ls -l . doc sub
  84. # Sanity check.
  85. case $fmt in
  86. html)
  87. test -e foo.html
  88. test -e doc/bar.html
  89. test -e baz.html
  90. test -e sub/baz.html
  91. ;;
  92. all)
  93. for x in info pdf ps dvi; do
  94. test -f foo.$x
  95. test -f doc/bar.$x
  96. test -f baz.$x
  97. test -f sub/baz.$x
  98. done
  99. test -e foo.html
  100. test -e doc/bar.html
  101. test -e baz.html
  102. test -e sub/baz.html
  103. ;;
  104. *)
  105. test -f foo.$fmt
  106. test -f doc/bar.$fmt
  107. test -f baz.$fmt
  108. test -f sub/baz.$fmt
  109. ;;
  110. esac
  111. # Real test.
  112. ls -d foo* baz* sub/baz* doc/bar* > lst
  113. basename_rx='(foo|doc/bar|baz|sub/baz)'
  114. case $fmt in
  115. pdf) extension_rx="(texi|pdf|t2p)";;
  116. dvi) extension_rx="(texi|dvi|t2d)";;
  117. ps) extension_rx="(texi|ps|dvi|t2d)";;
  118. info) extension_rx="(texi|info)";;
  119. html) extension_rx="(texi|html)";;
  120. all) extension_rx="(texi|html|info|pdf|ps|dvi|t2[pd])";;
  121. *) fatal_ "unreachable code reached";;
  122. esac
  123. $EGREP -v "^$basename_rx\.$extension_rx$" lst && exit 1
  124. # Cleanup for checks on the next format.
  125. case $fmt in
  126. info) rm -f *.info doc/*.info sub/*.info;;
  127. *) $MAKE clean;;
  128. esac
  129. done
  130. $MAKE distcheck
  131. :