Update SELECT version() to show whether it is a 32 or 64-bit backend binary.
[PostgreSQL.git] / doc / Makefile
blob5a23c0b5e50d55ffb6d540dbe56e4535a0251e05
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 all: man1/.timestamp man$(sqlmansectnum)/.timestamp
48 man1/.timestamp: man7/.timestamp
49 @echo timestamp >$@
51 man7/.timestamp: man.tar.gz
52 gzip -d -c $< | $(TAR) xf -
53 ifneq ($(sqlmansectnum),7)
54 for file in man1/*.1; do \
55 mv $$file $$file.bak && \
56 sed -e 's/\\fR(7)/\\fR($(sqlmansectnum))/g' $$file.bak >$$file && \
57 rm -f $$file.bak || exit; \
58 done
59 endif
60 @echo timestamp >$@
62 ifneq ($(sqlmansectnum),7)
63 man$(sqlmansectnum)/.timestamp: man7/.timestamp
64 $(mkinstalldirs) man$(sqlmansectnum)
65 for file in man7/*.7; do \
66 sed -e '/^\.TH/s/"7"/"$(sqlmansect)"/' \
67 -e 's/\\fR(7)/\\fR($(sqlmansectnum))/g' \
68 $$file >man$(sqlmansectnum)/`basename $$file | sed 's/.7$$/.$(sqlmansect)/'` || exit; \
69 done
70 @echo timestamp >$@
71 endif
72 endif # found_man
75 install: all installdirs
76 ifdef found_html
77 gzip -d -c $(srcdir)/postgres.tar.gz | ( cd $(DESTDIR)$(htmldir)/html && $(TAR) xf - )
78 endif
79 ifdef found_man
80 for file in man1/*.1 man$(sqlmansectnum)/*.$(sqlmansect) ; do \
81 $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/$$file || exit; \
82 done
83 endif
86 installdirs:
87 ifdef found_html
88 $(mkinstalldirs) '$(DESTDIR)$(htmldir)'/html
89 endif
90 ifdef found_man
91 $(mkinstalldirs) $(addprefix '$(DESTDIR)$(mandir)'/man, 1 $(sqlmansectnum))
92 endif
95 uninstall:
96 ifdef found_html
97 rm -f $(addprefix $(DESTDIR)$(htmldir)/html/, $(shell gunzip -c $(srcdir)/postgres.tar.gz | tar tf -))
98 endif
99 ifdef found_man
100 rm -f $(addprefix $(DESTDIR)$(mandir)/, $(shell gunzip -c $(srcdir)/man.tar.gz | tar tf - | sed -e 's,man7/,man$(sqlmansectnum)/,' -e 's/.7$$/.$(sqlmansect)/'))
101 endif
104 clean distclean maintainer-clean:
105 rm -rf man1/ man7/ man$(sqlmansectnum)/
106 $(MAKE) -C src $@