Fix xslt_process() to ensure that it inserts a NULL terminator after the
[PostgreSQL.git] / doc / Makefile
blob004218afaf2fb6857143222663c298a388257807
1 #----------------------------------------------------------------------------
3 # PostgreSQL documentation installation makefile
5 # Copyright (c) 1994, Regents of the University of California
7 # $PostgreSQL$
9 #----------------------------------------------------------------------------
11 # This makefile is responsible for installing the documentation. The
12 # files to be installed are prepared specially and are placed in this
13 # directory during distribution bundling. In CVS-based trees these
14 # files don't exist, so we skip the installation in that case.
16 # Before we install the man pages, we massage the section numbers to
17 # follow the local conventions.
19 # To actually build the documenation, look into the src/ and src/sgml
20 # subdirectories.
22 subdir = doc
23 top_builddir = ..
24 include $(top_builddir)/src/Makefile.global
26 .NOTPARALLEL:
28 ifneq ($(wildcard $(srcdir)/postgres.tar.gz),)
29 found_html = yes
30 endif
32 ifneq ($(wildcard $(srcdir)/man.tar.gz),)
33 # SCO OpenServer's man system is sufficiently different to not bother.
34 ifneq ($(PORTNAME), sco)
35 found_man = yes
36 endif
37 endif
40 ifdef found_man
41 ifndef sqlmansect
42 sqlmansect = 7
43 endif
44 sqlmansectnum = $(shell expr X'$(sqlmansect)' : X'\([0-9]\)')
46 fix_sqlmansectnum = sed -e '/^\.TH/s/"7"/"$(sqlmansect)"/' \
47 -e 's/\\fR(7)/\\fR($(sqlmansectnum))/g' \
48 -e '1s/^\.so man7/.so man$(sqlmansectnum)/g;1s/^\(\.so.*\)\.7$$/\1.$(sqlmansect)/g'
50 all: man1/.timestamp man$(sqlmansectnum)/.timestamp
52 man1/.timestamp: man7/.timestamp
53 @echo timestamp >$@
55 man7/.timestamp: man.tar.gz
56 gzip -d -c $< | $(TAR) xf -
57 ifneq ($(sqlmansectnum),7)
58 for file in man1/*.1; do \
59 mv $$file $$file.bak && \
60 $(fix_sqlmansectnum) $$file.bak >$$file && \
61 rm -f $$file.bak || exit; \
62 done
63 endif
64 @echo timestamp >$@
66 ifneq ($(sqlmansectnum),7)
67 man$(sqlmansectnum)/.timestamp: man7/.timestamp
68 $(mkinstalldirs) man$(sqlmansectnum)
69 for file in man7/*.7; do \
70 $(fix_sqlmansectnum) $$file >man$(sqlmansectnum)/`basename $$file | sed 's/.7$$/.$(sqlmansect)/'` || exit; \
71 done
72 @echo timestamp >$@
73 endif
74 endif # found_man
77 install: all installdirs
78 ifdef found_html
79 gzip -d -c $(srcdir)/postgres.tar.gz | ( cd $(DESTDIR)$(htmldir)/html && $(TAR) xf - )
80 endif
81 ifdef found_man
82 for file in man1/*.1 man$(sqlmansectnum)/*.$(sqlmansect) ; do \
83 $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/$$file || exit; \
84 done
85 endif
88 installdirs:
89 ifdef found_html
90 $(mkinstalldirs) '$(DESTDIR)$(htmldir)'/html
91 endif
92 ifdef found_man
93 $(mkinstalldirs) $(addprefix '$(DESTDIR)$(mandir)'/man, 1 $(sqlmansectnum))
94 endif
97 uninstall:
98 ifdef found_html
99 rm -f $(addprefix $(DESTDIR)$(htmldir)/html/, $(shell gunzip -c $(srcdir)/postgres.tar.gz | $(TAR) tf -))
100 endif
101 ifdef found_man
102 rm -f $(filter-out %/, $(addprefix $(DESTDIR)$(mandir)/, $(shell gunzip -c $(srcdir)/man.tar.gz | $(TAR) tf - | sed -e 's,man7/,man$(sqlmansectnum)/,' -e 's/.7$$/.$(sqlmansect)/')))
103 endif
106 clean distclean maintainer-clean:
107 rm -rf man1/ man7/ man$(sqlmansectnum)/
108 $(MAKE) -C src $@