Makefile.am 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. # Makefile for GNU tar documentation.
  2. # Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2003 Free
  3. # Software Foundation, Inc.
  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. ## This program is distributed in the hope that it will be useful,
  9. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ## GNU General Public License for more details.
  12. ## You should have received a copy of the GNU General Public License
  13. ## along with this program; if not, write to the Free Software Foundation,
  14. ## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15. info_TEXINFOS = tar.texi
  16. tar_TEXINFOS = fdl.texi freemanuals.texi getdate.texi header.texi
  17. EXTRA_DIST = convtexi.pl
  18. CLEANFILES = tmp-* tmp2-* index.html
  19. # The rendering level is anyone of PUBLISH, DISTRIB or PROOF.
  20. # Just call `make dvi RENDITION=PROOF' if you want PROOF rendition.
  21. RENDITION = DISTRIB
  22. $(srcdir)/tar.info: tar.texi fdl.texi freemanuals.texi getdate.texi \
  23. $(srcdir)/header.texi version.texi
  24. $(MAKEINFO) --no-split -D$(RENDITION) -I$(srcdir) tar.texi -o $@
  25. tmp-tar.texi: tar.texi getdate.texi $(srcdir)/header.texi version.texi
  26. $(MAKEINFO) -D$(RENDITION) -Etmp-tar.tmp -otmp-tar.info \
  27. -I$(srcdir) tar.texi
  28. rm -f tmp-tar.sed tmp-tar.info*
  29. test $(RENDITION) = DISTRIB \
  30. || echo >>tmp-tar.sed 's/^@set DISTRIB/@set $(RENDITION)/'
  31. test $(RENDITION) = PUBLISH \
  32. || echo >>tmp-tar.sed '/^@smallbook/d'
  33. sed -f tmp-tar.sed tmp-tar.tmp > tmp-tar.texi
  34. rm -f tmp-tar.sed tmp-tar.tmp
  35. tar.dvi: tmp-tar.texi
  36. TEXINPUTS=$(top_srcdir)/config:$$TEXINPUTS \
  37. MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
  38. $(TEXI2DVI) tmp-tar.texi
  39. mv tmp-tar.dvi $@
  40. $(srcdir)/header.texi: $(top_srcdir)/src/tar.h
  41. sed -n '/Archive Format/,/End of Format/p' $(top_srcdir)/src/tar.h \
  42. | expand | sed 's/\([{}]\)/@\1/g' >$@
  43. ##
  44. PROJECT=$(PACKAGE_TARNAME)
  45. BASE_URL="http://www.gnu.org/software/$(PROJECT)/manual/"
  46. TEXI2HTML=${SHELL} `cd $(top_srcdir); pwd`/config/missing --run texi2html
  47. INFO=${SHELL} `cd $(top_srcdir); pwd`/config/missing --run info
  48. DVIPDF=${SHELL} `cd $(top_srcdir); pwd`/config/missing --run dvipdf
  49. clean-local:
  50. rm -rf $(WEBDOC) $(WEB_HTML_STAMPS)
  51. html: html_mono.stamp html_node.stamp html_chapter.stamp
  52. tmp2-$(PROJECT).texi: Makefile tmp-$(PROJECT).texi
  53. echo '/@copying/,/@end copying/{H;x;s/@copying//;s/@end copying//;x;}' > tmp2.sed
  54. echo '/@insertcopying/{x;h;}' >> tmp2.sed
  55. echo 's/\(.\)@ifset/\1\' >> tmp2.sed
  56. echo '@ifset/' >> tmp2.sed
  57. sed -f tmp2.sed tmp-$(PROJECT).texi > tmp2-$(PROJECT).texi
  58. rm -f tmp2.sed
  59. html_node.stamp: tmp2-$(PROJECT).texi
  60. texi2html="$(TEXI2HTML)";\
  61. if ! test -d html_node; then mkdir html_node; fi; \
  62. cd html_node; \
  63. $$texi2html -menu -split_node -prefix $(PROJECT) ../tmp2-$(PROJECT).texi; \
  64. cd ..; \
  65. touch html_node.stamp
  66. html_chapter.stamp: tmp2-$(PROJECT).texi
  67. texi2html="$(TEXI2HTML)";\
  68. if ! test -d html_chapter; then mkdir html_chapter; fi; \
  69. cd html_chapter; \
  70. $$texi2html -menu -split_chapter -prefix $(PROJECT) ../tmp2-$(PROJECT).texi; \
  71. cd ..; \
  72. touch html_chapter.stamp
  73. html_mono.stamp: tmp2-$(PROJECT).texi
  74. texi2html="$(TEXI2HTML)";\
  75. if ! test -d html_mono; then mkdir html_mono; fi; \
  76. cd html_mono; \
  77. $$texi2html -menu -monolithic -prefix $(PROJECT) ../tmp2-$(PROJECT).texi; \
  78. cd ..; \
  79. touch html_mono.stamp
  80. ps: $(PROJECT).ps
  81. $(PROJECT).ps: $(PROJECT).dvi
  82. $(DVIPS) -o$(PROJECT).ps $(PROJECT).dvi
  83. # Override the default rule. The texinfo <= 4.5 is unable to cope with
  84. # tar docs.
  85. $(PROJECT).pdf: $(PROJECT).dvi
  86. $(DVIPDF) $(PROJECT).dvi
  87. text: $(PROJECT).text
  88. $(PROJECT).text: Makefile $(PROJECT).info
  89. $(INFO) --node=Top --subnodes --out $(PROJECT).text -f ./$(PROJECT).info
  90. $(PROJECT).info.tar.gz: Makefile
  91. rm -f $(PROJECT).info.tar.gz
  92. tar cf $(PROJECT).info.tar $(PROJECT).info*
  93. gzip -f $(PROJECT).info.tar
  94. $(PROJECT).dvi.gz: Makefile $(PROJECT).dvi
  95. gzip -c $(PROJECT).dvi > $(PROJECT).dvi.gz
  96. $(PROJECT).ps.gz: Makefile $(PROJECT).ps
  97. gzip -c $(PROJECT).ps > $(PROJECT).ps.gz
  98. $(PROJECT).pdf.gz: Makefile $(PROJECT).pdf
  99. gzip -c $(PROJECT).pdf > $(PROJECT).pdf.gz
  100. $(PROJECT).texi.tar.gz: Makefile $(info_TEXINFOS) $(tar_TEXINFOS)
  101. tar cfz $(PROJECT).texi.tar.gz $(info_TEXINFOS) $(tar_TEXINFOS)
  102. WEB_HTML=\
  103. html_mono\
  104. html_node\
  105. html_chapter
  106. WEB_HTML_STAMPS=$(patsubst %,%.stamp,$(WEB_HTML))
  107. WEB_BIN=\
  108. $(PROJECT).info.tar.gz\
  109. $(PROJECT).dvi.gz\
  110. $(PROJECT).pdf.gz\
  111. $(PROJECT).ps.gz\
  112. $(PROJECT).texi.tar.gz\
  113. $(PROJECT).text
  114. WEBDOC=$(WEB_HTML) $(WEB_BIN)
  115. webdocdir: $(WEB_HTML_STAMPS) $(WEB_BIN) index.html
  116. if ! test -d $(WEBDOCDIR); then mkdir $(WEBDOCDIR); fi; \
  117. here=`cd $(srcdir) && pwd`; \
  118. webdocdir=`cd $(WEBDOCDIR) && pwd`; \
  119. for file in $(WEB_HTML) index.html; do \
  120. if test -d $$here/$$file; then \
  121. cp -pr $$here/$$file $$webdocdir/$$file; \
  122. else \
  123. test -f $$webdocdir/$$file \
  124. || ln $$here/$$file $$webdocdir/$$file 2> /dev/null \
  125. || cp -p $$here/$$file $$webdocdir/$$file || :; \
  126. fi; \
  127. done; \
  128. if ! test -d $(WEBDOCDIR)/other; then mkdir $(WEBDOCDIR)/other; fi;\
  129. for file in $(WEB_BIN); do \
  130. if test -d $$here/$$file; then \
  131. cp -pr $$here/$$file $$webdocdir/other/$$file; \
  132. else \
  133. test -f $$webdocdir/other/$$file \
  134. || ln $$here/$$file $$webdocdir/other/$$file 2> /dev/null \
  135. || cp -p $$here/$$file $$webdocdir/other/$$file || :; \
  136. fi; \
  137. done
  138. index.html: index.html.in $(WEBDOC)
  139. @echo "s^%BASE_URL%^$(BASE_URL)^;" > .webdoc
  140. @echo "s/%DATE%/`date`/;" >> .webdoc
  141. @echo "s/%UPDATED%/`date +'%B, %d'`/;" >> .webdoc
  142. @echo "s/%PACKAGE_NAME%/$(PACKAGE_NAME)/" >> .webdoc
  143. @echo "s/%PACKAGE%/$(PACKAGE)/" >> .webdoc
  144. @echo "s/%VERSION%/$(VERSION)/" >> .webdoc
  145. @for file in `sed -n 's,.*"other/%PACKAGE%\(.*\)".*,$(PACKAGE)\1,pg;s,.*"\(.*\)%PACKAGE%\(.*\)".*,\1$(PACKAGE)\2,pg' index.html.in`; \
  146. do\
  147. ls -sk $$file; \
  148. done |\
  149. $(AWK) -vPACKAGE=$(PACKAGE) \
  150. 'BEGIN { len = length(PACKAGE) } \
  151. { gsub("\\.", "_", $$2); \
  152. if (match($$2,"/")) \
  153. $$2=substr($$2,RSTART+1); \
  154. print "s/%" toupper(substr($$2,len+2)) "_SIZE%/" $$1 "/;" }' >> .webdoc
  155. sed -f .webdoc index.html.in > index.html
  156. rm -f .webdoc
  157. webdocname=$(PACKAGE)-$(VERSION)-doc
  158. WEBDOCDIR=$(webdocname)
  159. webdoc:
  160. $(MAKE) RENDITION=PUBLISH WEBDOCDIR=$(top_builddir)/doc/$(webdocname) webdocdir
  161. cd $(top_builddir)/doc &&\
  162. tar cfz $(webdocname).tar.gz $(webdocname) &&\
  163. rm -r $(webdocname)
  164. ## End of webdoc