Remove old RULE privilege completely.
[pgsql.git] / doc / src / sgml / Makefile
blob9c9bbfe375d8412cb6ad21d99a561ee027baa39a
1 #----------------------------------------------------------------------------
3 # PostgreSQL documentation makefile
5 # doc/src/sgml/Makefile
7 #----------------------------------------------------------------------------
9 # This makefile is for building and installing the documentation.
10 # In Git-based trees these files
11 # don't exist, unless explicitly built, so we skip the installation in
12 # that case.
15 # Make "html" the default target, since that is what most people tend
16 # to want to use.
17 html:
18 # Note that all is *not* the default target in this directory
19 all: html man
21 # We don't need the tree-wide headers or install support here.
22 NO_GENERATED_HEADERS=yes
23 NO_TEMP_INSTALL=yes
25 subdir = doc/src/sgml
26 top_builddir = ../../..
27 include $(top_builddir)/src/Makefile.global
31 ifndef DBTOEPUB
32 DBTOEPUB = $(missing) dbtoepub
33 endif
35 ifndef FOP
36 FOP = $(missing) fop
37 endif
39 PANDOC = pandoc
41 XMLINCLUDE = --path . --path $(srcdir)
43 ifdef XMLLINT
44 XMLLINT := $(XMLLINT) --nonet
45 else
46 XMLLINT = $(missing) xmllint
47 endif
49 ifdef XSLTPROC
50 XSLTPROC := $(XSLTPROC) --nonet
51 else
52 XSLTPROC = $(missing) xsltproc
53 endif
55 override XSLTPROCFLAGS += --stringparam pg.version '$(VERSION)'
58 GENERATED_SGML = version.sgml \
59 features-supported.sgml features-unsupported.sgml errcodes-table.sgml \
60 keywords-table.sgml targets-meson.sgml wait_event_types.sgml
62 ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) $(GENERATED_SGML)
64 ALL_IMAGES := $(wildcard $(srcdir)/images/*.svg)
67 # Run validation only once, common to all subsequent targets. While
68 # we're at it, also resolve all entities (that is, copy all included
69 # files into one big file). This helps tools that don't understand
70 # vpath builds (such as dbtoepub).
71 postgres-full.xml: postgres.sgml $(ALLSGML)
72 $(XMLLINT) $(XMLINCLUDE) --output $@ --noent --valid $<
76 ## Man pages
79 man: man-stamp
81 man-stamp: stylesheet-man.xsl postgres-full.xml
82 $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_MAN_FLAGS) $^
83 touch $@
87 ## common files
90 # Technically, this should depend on Makefile.global, but then
91 # version.sgml would need to be rebuilt after every configure run. So
92 # this is cheating a bit, but it will achieve the goal of updating the
93 # version number when it changes.
94 version.sgml: $(top_srcdir)/configure
95 { \
96 echo "<!ENTITY version \"$(VERSION)\">"; \
97 echo "<!ENTITY majorversion \"$(MAJORVERSION)\">"; \
98 } > $@
100 features-supported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
101 $(PERL) $(srcdir)/mk_feature_tables.pl YES $^ > $@
103 features-unsupported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
104 $(PERL) $(srcdir)/mk_feature_tables.pl NO $^ > $@
106 errcodes-table.sgml: $(top_srcdir)/src/backend/utils/errcodes.txt generate-errcodes-table.pl
107 $(PERL) $(srcdir)/generate-errcodes-table.pl $< > $@
109 keywords-table.sgml: $(top_srcdir)/src/include/parser/kwlist.h $(wildcard $(srcdir)/keywords/sql*.txt) generate-keywords-table.pl
110 $(PERL) $(srcdir)/generate-keywords-table.pl $(srcdir) > $@
112 wait_event_types.sgml: $(top_srcdir)/src/backend/utils/activity/wait_event_names.txt $(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl
113 $(PERL) $(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl --docs $<
115 targets-meson.sgml: targets-meson.txt $(srcdir)/generate-targets-meson.pl
116 $(PERL) $(srcdir)/generate-targets-meson.pl $^ > $@
120 ## HTML
123 ifeq ($(STYLE),website)
124 XSLTPROC_HTML_FLAGS += --param website.stylesheet 1
125 endif
127 html: html-stamp
129 html-stamp: stylesheet.xsl postgres-full.xml $(ALL_IMAGES)
130 $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $(wordlist 1,2,$^)
131 touch $@
133 # single-page HTML
134 postgres.html: stylesheet-html-nochunk.xsl postgres-full.xml $(ALL_IMAGES)
135 $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) -o $@ $(wordlist 1,2,$^)
137 # single-page text
138 postgres.txt: postgres.html
139 $(PANDOC) -t plain -o $@ $<
143 ## Print
146 postgres.pdf:
147 $(error Invalid target; use postgres-A4.pdf or postgres-US.pdf as targets)
149 XSLTPROC_FO_FLAGS += --stringparam img.src.path '$(srcdir)/'
151 %-A4.fo: stylesheet-fo.xsl %-full.xml
152 $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type A4 -o $@ $^
154 %-US.fo: stylesheet-fo.xsl %-full.xml
155 $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type USletter -o $@ $^
157 %.pdf: %.fo $(ALL_IMAGES)
158 $(FOP) -fo $< -pdf $@
162 ## EPUB
165 epub: postgres.epub
166 postgres.epub: postgres-full.xml $(ALL_IMAGES)
167 ifeq ($(vpath_build),yes)
168 $(MKDIR_P) images
169 cp $(ALL_IMAGES) images/
170 endif
171 $(DBTOEPUB) -o $@ $<
175 ## Experimental Texinfo targets
178 DB2X_TEXIXML = db2x_texixml
179 DB2X_XSLTPROC = db2x_xsltproc
180 MAKEINFO = makeinfo
182 %.texixml: %-full.xml
183 $(DB2X_XSLTPROC) -s texi -g output-file=$(basename $@) $< -o $@
185 %.texi: %.texixml
186 $(DB2X_TEXIXML) --encoding=utf-8 $< --to-stdout > $@
188 %.info: %.texi
189 $(MAKEINFO) --enable-encoding --no-split --no-validate $< -o $@
193 ## Check
196 # Quick syntax check without style processing
197 check: postgres.sgml $(ALLSGML) check-tabs
198 $(XMLLINT) $(XMLINCLUDE) --noout --valid $<
202 ## Install
205 install: install-html install-man
207 installdirs:
208 $(MKDIR_P) '$(DESTDIR)$(htmldir)'/html $(addprefix '$(DESTDIR)$(mandir)'/man, 1 3 $(sqlmansectnum))
210 # If the install used a man directory shared with other applications, this will remove all files.
211 uninstall:
212 rm -f '$(DESTDIR)$(htmldir)/html/'* $(addprefix '$(DESTDIR)$(mandir)'/man, 1/* 3/* $(sqlmansectnum)/*)
215 ## Install html
217 install-html: html installdirs
218 cp -R html '$(DESTDIR)$(htmldir)'
221 ## Install man
223 install-man: man installdirs
225 sqlmansect ?= 7
226 sqlmansectnum = $(shell expr X'$(sqlmansect)' : X'\([0-9]\)')
228 # Before we install the man pages, we massage the section numbers to
229 # follow the local conventions.
231 ifeq ($(sqlmansectnum),7)
232 install-man:
233 cp -R man1 man3 man7 '$(DESTDIR)$(mandir)'
235 else # sqlmansectnum != 7
236 fix_sqlmansectnum = sed -e '/^\.TH/s/"7"/"$(sqlmansect)"/' \
237 -e 's/\\fR(7)/\\fR($(sqlmansectnum))/g' \
238 -e '1s/^\.so man7/.so man$(sqlmansectnum)/g;1s/^\(\.so.*\)\.7$$/\1.$(sqlmansect)/g'
240 man: fixed-man-stamp
242 fixed-man-stamp: man-stamp
243 @$(MKDIR_P) $(addprefix fixedman/,man1 man3 man$(sqlmansectnum))
244 for file in man1/*.1; do $(fix_sqlmansectnum) $$file >fixedman/man1/`basename $$file` || exit; done
245 for file in man3/*.3; do $(fix_sqlmansectnum) $$file >fixedman/man3/`basename $$file` || exit; done
246 for file in man7/*.7; do $(fix_sqlmansectnum) $$file >fixedman/man$(sqlmansectnum)/`basename $$file | sed s/\.7$$/.$(sqlmansect)/` || exit; done
248 install-man:
249 cp -R $(foreach dir,man1 man3 man$(sqlmansectnum),fixedman/$(dir)) '$(DESTDIR)$(mandir)'
251 clean: clean-man
252 .PHONY: clean-man
253 clean-man:
254 rm -rf fixedman/ fixed-man-stamp
256 endif # sqlmansectnum != 7
258 # tabs are harmless, but it is best to avoid them in SGML files
259 check-tabs:
260 @( ! grep ' ' $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml $(srcdir)/*.xsl) ) || (echo "Tabs appear in SGML/XML files" 1>&2; exit 1)
263 ## Clean
266 # This allows removing some files from the distribution tarballs while
267 # keeping the dependencies satisfied.
268 .SECONDARY: $(GENERATED_SGML)
269 .SECONDARY: postgres-full.xml
270 .SECONDARY: postgres-A4.fo postgres-US.fo
272 clean:
273 # single-page output
274 rm -f postgres.html postgres.txt
275 # print
276 rm -f *.fo *.pdf
277 # generated SGML files
278 rm -f $(GENERATED_SGML)
279 rm -f postgres-full.xml
280 # EPUB
281 rm -f postgres.epub
282 # Texinfo
283 rm -f *.texixml *.texi *.info db2texi.refs
285 distclean: clean
286 # HTML
287 rm -fr html/ html-stamp
288 # man
289 rm -rf man1/ man3/ man7/ man-stamp