PageRenderTime 2169ms CodeModel.GetById 36ms RepoModel.GetById 0ms app.codeStats 0ms

/doc/src/sgml/Makefile

https://github.com/adunstan/pg-cvs-mirror
Makefile | 379 lines | 187 code | 104 blank | 88 comment | 10 complexity | eb81c9a78cffb1efa5765bb115bbcef7 MD5 | raw file
Possible License(s): AGPL-3.0
  1. #----------------------------------------------------------------------------
  2. #
  3. # PostgreSQL documentation makefile
  4. #
  5. # $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.147 2010/06/12 17:17:25 momjian Exp $
  6. #
  7. #----------------------------------------------------------------------------
  8. # This makefile is for building and installing the documentation.
  9. # When a release tarball is created, the documentation files are
  10. # prepared using the distprep target. In CVS-based trees these files
  11. # don't exist, unless explicitly built, so we skip the installation in
  12. # that case.
  13. # Make "html" the default target, since that is what most people tend
  14. # to want to use.
  15. html:
  16. subdir = doc/src/sgml
  17. top_builddir = ../../..
  18. include $(top_builddir)/src/Makefile.global
  19. all: html man
  20. distprep: html distprep-man
  21. ifndef COLLATEINDEX
  22. COLLATEINDEX = $(DOCBOOKSTYLE)/bin/collateindex.pl
  23. endif
  24. ifndef JADE
  25. JADE = jade
  26. endif
  27. SGMLINCLUDE = -D . -D $(srcdir)
  28. ifndef NSGMLS
  29. NSGMLS = nsgmls
  30. endif
  31. ifndef OSX
  32. OSX = osx
  33. endif
  34. ifndef XSLTPROC
  35. XSLTPROC = xsltproc
  36. endif
  37. override XSLTPROCFLAGS += --stringparam pg.version '$(VERSION)'
  38. GENERATED_SGML = bookindex.sgml version.sgml \
  39. features-supported.sgml features-unsupported.sgml
  40. ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) $(GENERATED_SGML)
  41. # Sometimes we don't want this one.
  42. ALMOSTALLSGML := $(filter-out %bookindex.sgml,$(ALLSGML))
  43. ifdef DOCBOOKSTYLE
  44. CATALOG = -c $(DOCBOOKSTYLE)/catalog
  45. endif
  46. # Enable some extra warnings
  47. # -wfully-tagged needed to throw a warning on missing tags
  48. # for older tool chains, 2007-08-31
  49. # Note: try "make SPFLAGS=-wxml" to catch a lot of other dubious constructs,
  50. # in particular < and & that haven't been made into entities. It's far too
  51. # noisy to turn on by default, unfortunately.
  52. override SPFLAGS += -wall -wno-unused-param -wno-empty -wfully-tagged
  53. ##
  54. ## Man pages
  55. ##
  56. man distprep-man: man-stamp
  57. man-stamp: stylesheet-man.xsl postgres.xml
  58. $(XSLTPROC) $(XSLTPROCFLAGS) $(XSLTPROC_MAN_FLAGS) $^
  59. touch $@
  60. ##
  61. ## HTML
  62. ##
  63. .PHONY: draft
  64. JADE.html.call = $(JADE) $(JADEFLAGS) $(SPFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t sgml -i output-html
  65. # The draft target creates HTML output in draft mode, without index (for faster build).
  66. draft: postgres.sgml $(ALMOSTALLSGML) stylesheet.dsl
  67. $(MKDIR_P) html
  68. $(JADE.html.call) -V draft-mode $<
  69. cp $(srcdir)/stylesheet.css html/
  70. html: html-stamp
  71. html-stamp: postgres.sgml $(ALLSGML) stylesheet.dsl
  72. $(MKDIR_P) html
  73. $(JADE.html.call) -i include-index $<
  74. cp $(srcdir)/stylesheet.css html/
  75. touch $@
  76. # single-page HTML
  77. postgres.html: postgres.sgml $(ALLSGML) stylesheet.dsl
  78. $(JADE.html.call) -V nochunks -V rootchunk -V '(define %root-filename% #f)' -V '(define use-output-dir #f)' -i include-index $<
  79. # single-page text
  80. postgres.txt: postgres.html
  81. $(LYNX) -force_html -dump -nolist $< > $@
  82. HTML.index: postgres.sgml $(ALMOSTALLSGML) stylesheet.dsl
  83. @$(MKDIR_P) html
  84. $(JADE.html.call) -V html-index $<
  85. bookindex.sgml: HTML.index
  86. LC_ALL=C $(PERL) $(COLLATEINDEX) -f -g -i 'bookindex' -o $@ $<
  87. # Technically, this should depend on Makefile.global, but then
  88. # version.sgml would need to be rebuilt after every configure run,
  89. # even in distribution tarballs. So this is cheating a bit, but it
  90. # will achieve the goal of updating the version number when it
  91. # changes.
  92. version.sgml: $(top_srcdir)/configure
  93. { \
  94. echo "<!entity version \"$(VERSION)\">"; \
  95. echo "<!entity majorversion \"$(MAJORVERSION)\">"; \
  96. } > $@
  97. features-supported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
  98. $(PERL) $(srcdir)/mk_feature_tables.pl YES $^ > $@
  99. features-unsupported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
  100. $(PERL) $(srcdir)/mk_feature_tables.pl NO $^ > $@
  101. ##
  102. ## Print
  103. ##
  104. # RTF to allow minor editing for hardcopy
  105. %.rtf: %.sgml $(ALLSGML)
  106. $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print -i include-index postgres.sgml
  107. # TeX
  108. # Regular TeX and pdfTeX have slightly differing requirements, so we
  109. # need to distinguish the path we're taking.
  110. JADE.tex.call = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d $(srcdir)/stylesheet.dsl -t tex -V tex-backend -i output-print -i include-index
  111. %-A4.tex-ps: %.sgml $(ALLSGML)
  112. $(JADE.tex.call) -V texdvi-output -V '%paper-type%'=A4 -o $@ $<
  113. %-US.tex-ps: %.sgml $(ALLSGML)
  114. $(JADE.tex.call) -V texdvi-output -V '%paper-type%'=USletter -o $@ $<
  115. %-A4.tex-pdf: %.sgml $(ALLSGML)
  116. $(JADE.tex.call) -V texpdf-output -V '%paper-type%'=A4 -o $@ $<
  117. %-US.tex-pdf: %.sgml $(ALLSGML)
  118. $(JADE.tex.call) -V texpdf-output -V '%paper-type%'=USletter -o $@ $<
  119. %.dvi: %.tex-ps
  120. @rm -f $*.aux $*.log
  121. # multiple runs are necessary to create proper intra-document links
  122. jadetex $<
  123. jadetex $<
  124. jadetex $<
  125. # PostScript from TeX
  126. postgres.ps:
  127. $(error Invalid target; use postgres-A4.ps or postgres-US.ps as targets)
  128. %.ps: %.dvi
  129. dvips -o $@ $<
  130. postgres.pdf:
  131. $(error Invalid target; use postgres-A4.pdf or postgres-US.pdf as targets)
  132. %.pdf: %.tex-pdf
  133. @rm -f $*.aux $*.log $*.out
  134. # multiple runs are necessary to create proper intra-document links
  135. pdfjadetex $<
  136. pdfjadetex $<
  137. pdfjadetex $<
  138. # Cancel built-in suffix rules, interfering with PS building
  139. .SUFFIXES:
  140. # This generates an XML version of the flow-object tree. It's useful
  141. # for debugging DSSSL code, and possibly to interface to some other
  142. # tools that can make use of this.
  143. %.fot: %.sgml $(ALLSGML)
  144. $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t fot -i output-print -i include-index -o $@ $<
  145. ##
  146. ## Semi-automatic generation of some text files.
  147. ##
  148. JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-text -t sgml
  149. LYNX = lynx
  150. INSTALL HISTORY regress_README: % : %.html
  151. $(PERL) -p -e 's/<H(1|2)$$/<H\1 align=center/g' $< | $(LYNX) -force_html -dump -nolist -stdin > $@
  152. INSTALL.html: standalone-install.sgml installation.sgml version.sgml
  153. $(JADE.text) -V nochunks standalone-install.sgml installation.sgml > $@
  154. HISTORY.html: generate_history.pl $(wildcard $(srcdir)/release*.sgml)
  155. $(PERL) $< "$(srcdir)" release.sgml >tempfile_HISTORY.sgml
  156. $(JADE.text) -V nochunks tempfile_HISTORY.sgml > $@
  157. rm tempfile_HISTORY.sgml
  158. regress_README.html: regress.sgml
  159. ( echo '<!doctype chapter PUBLIC "-//OASIS//DTD DocBook V4.2//EN" ['; \
  160. echo '<!entity % standalone-ignore "IGNORE">'; \
  161. echo '<!entity % standalone-include "INCLUDE"> ]>'; \
  162. cat $< ) >tempfile_regress_README.sgml
  163. $(JADE.text) -V nochunks tempfile_regress_README.sgml > $@
  164. rm tempfile_regress_README.sgml
  165. ##
  166. ## XSLT processing
  167. ##
  168. # For obscure reasons, gmake 3.81 complains about circular dependencies
  169. # if we try to do "make all" in a VPATH build without the explicit
  170. # $(srcdir) on the postgres.sgml dependency in this rule. gmake bug?
  171. postgres.xml: $(srcdir)/postgres.sgml $(ALMOSTALLSGML)
  172. $(OSX) -D. -x lower $< >postgres.xmltmp
  173. $(PERL) -p -e 's/\[(amp|copy|egrave|gt|lt|mdash|nbsp|ouml|pi|quot|uuml) *\]/\&\1;/g;' \
  174. -e '$$_ .= qq{<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">\n} if $$. == 1;' \
  175. <postgres.xmltmp > $@
  176. rm postgres.xmltmp
  177. # ' hello Emacs
  178. xslthtml: stylesheet.xsl postgres.xml
  179. $(XSLTPROC) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $^
  180. htmlhelp: stylesheet-hh.xsl postgres.xml
  181. $(XSLTPROC) $(XSLTPROCFLAGS) $^
  182. %-A4.fo: stylesheet-fo.xsl %.xml
  183. $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam paper.type A4 -o $@ $^
  184. %-US.fo: stylesheet-fo.xsl %.xml
  185. $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam paper.type USletter -o $@ $^
  186. ##
  187. ## Experimental Texinfo targets
  188. ##
  189. DB2X_TEXIXML = db2x_texixml
  190. DB2X_XSLTPROC = db2x_xsltproc
  191. MAKEINFO = makeinfo
  192. %.texixml: %.xml
  193. $(DB2X_XSLTPROC) -s texi -g output-file=$(basename $@) $< -o $@
  194. %.texi: %.texixml
  195. $(DB2X_TEXIXML) --encoding=iso-8859-1//TRANSLIT $< --to-stdout > $@
  196. %.info: %.texi
  197. $(MAKEINFO) --enable-encoding --no-split --no-validate $< -o $@
  198. ##
  199. ## Check
  200. ##
  201. # Quick syntax check without style processing
  202. check: postgres.sgml $(ALMOSTALLSGML) check-tabs
  203. $(NSGMLS) $(SPFLAGS) $(SGMLINCLUDE) -s $<
  204. ##
  205. ## Install
  206. ##
  207. install: install-html
  208. ifneq ($(PORTNAME), sco)
  209. install: install-man
  210. endif
  211. installdirs:
  212. $(MKDIR_P) '$(DESTDIR)$(htmldir)'/html $(addprefix '$(DESTDIR)$(mandir)'/man, 1 3 $(sqlmansectnum))
  213. uninstall:
  214. rm -f '$(DESTDIR)$(htmldir)/html/'* $(addprefix '$(DESTDIR)$(mandir)'/man, 1/* 3/* $(sqlmansectnum)/*)
  215. ## Install html
  216. install-html: html installdirs
  217. cp -R $(call vpathsearch,html) '$(DESTDIR)$(htmldir)'
  218. ## Install man
  219. install-man: man installdirs
  220. sqlmansect ?= 7
  221. sqlmansectnum = $(shell expr X'$(sqlmansect)' : X'\([0-9]\)')
  222. # Before we install the man pages, we massage the section numbers to
  223. # follow the local conventions.
  224. #
  225. ifeq ($(sqlmansectnum),7)
  226. install-man:
  227. cp -R $(foreach dir,man1 man3 man7,$(call vpathsearch,$(dir))) '$(DESTDIR)$(mandir)'
  228. else # sqlmansectnum != 7
  229. fix_sqlmansectnum = sed -e '/^\.TH/s/"7"/"$(sqlmansect)"/' \
  230. -e 's/\\fR(7)/\\fR($(sqlmansectnum))/g' \
  231. -e '1s/^\.so man7/.so man$(sqlmansectnum)/g;1s/^\(\.so.*\)\.7$$/\1.$(sqlmansect)/g'
  232. man: fixed-man-stamp
  233. fixed-man-stamp: man-stamp
  234. @$(MKDIR_P) $(addprefix fixedman/,man1 man3 man$(sqlmansectnum))
  235. for file in $(call vpathsearch,man1)/*.1; do $(fix_sqlmansectnum) $$file >fixedman/man1/`basename $$file` || exit; done
  236. for file in $(call vpathsearch,man3)/*.3; do $(fix_sqlmansectnum) $$file >fixedman/man3/`basename $$file` || exit; done
  237. for file in $(call vpathsearch,man7)/*.7; do $(fix_sqlmansectnum) $$file >fixedman/man$(sqlmansectnum)/`basename $$file | sed s/\.7$$/.$(sqlmansect)/` || exit; done
  238. install-man:
  239. cp -R $(foreach dir,man1 man3 man$(sqlmansectnum),fixedman/$(dir)) '$(DESTDIR)$(mandir)'
  240. clean: clean-man
  241. .PHONY: clean-man
  242. clean-man:
  243. rm -rf fixedman/ fixed-man-stamp
  244. endif # sqlmansectnum != 7
  245. # tabs are harmless, but it is best to avoid them in SGML files
  246. check-tabs:
  247. @( ! grep ' ' $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) ) || (echo "Tabs appear in SGML files"; exit 1)
  248. ##
  249. ## Clean
  250. ##
  251. # This allows removing some files from the distribution tarballs while
  252. # keeping the dependencies satisfied.
  253. .SECONDARY: postgres.xml $(GENERATED_SGML) HTML.index
  254. .SECONDARY: INSTALL.html HISTORY.html regress_README.html
  255. .SECONDARY: %-A4.tex-ps %-US.tex-ps %-A4.tex-pdf %-US.tex-pdf
  256. clean:
  257. # text --- these are shipped, but not in this directory
  258. rm -f INSTALL HISTORY regress_README
  259. rm -f INSTALL.html HISTORY.html regress_README.html
  260. # single-page output
  261. rm -f postgres.html postgres.txt
  262. # print
  263. rm -f *.rtf *.tex-ps *.tex-pdf *.dvi *.aux *.log *.ps *.pdf *.out *.fot
  264. # index
  265. rm -f HTML.index $(GENERATED_SGML)
  266. # XSLT
  267. rm -f postgres.xml postgres.xmltmp htmlhelp.hhp toc.hhc index.hhk *.fo
  268. # Texinfo
  269. rm -f *.texixml *.texi *.info db2texi.refs
  270. distclean: clean
  271. maintainer-clean: distclean
  272. # HTML
  273. rm -fr html/ html-stamp
  274. # man
  275. rm -rf man1/ man3/ man7/ man-stamp