Improve CREATE/DROP/RENAME DATABASE so that when failing because the source
[PostgreSQL.git] / doc / Makefile
blob2e2884e60137d188259e57fa85269b319117a69d
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: man$(sqlmansect_dummy)/.timestamp
49 @echo timestamp >$@
51 man$(sqlmansect_dummy)/.timestamp: man.tar.gz
52 gzip -d -c $< | $(TAR) xf -
53 for file in man1/*.1; do \
54 mv $$file $$file.bak && \
55 sed -e 's/\\fR($(sqlmansect_dummy))/\\fR($(sqlmansectnum))/' $$file.bak >$$file && \
56 rm -f $$file.bak || exit; \
57 done
58 @echo timestamp >$@
60 man$(sqlmansectnum)/.timestamp: man$(sqlmansect_dummy)/.timestamp
61 $(mkinstalldirs) man$(sqlmansectnum)
62 for file in man$(sqlmansect_dummy)/*.$(sqlmansect_dummy); do \
63 sed -e '/^\.TH/s/"$(sqlmansect_dummy)"/"$(sqlmansect)"/' \
64 -e 's/\\fR($(sqlmansect_dummy))/\\fR($(sqlmansectnum))/' \
65 $$file >man$(sqlmansectnum)/`basename $$file | sed 's/.$(sqlmansect_dummy)$$/.$(sqlmansect)/'` || exit; \
66 done
67 @echo timestamp >$@
68 endif # found_man
71 install: all installdirs
72 ifdef found_html
73 gzip -d -c $(srcdir)/postgres.tar.gz | ( cd $(DESTDIR)$(htmldir)/html && $(TAR) xf - )
74 endif
75 ifdef found_man
76 for file in man1/*.1 man$(sqlmansectnum)/*.$(sqlmansect) ; do \
77 $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/$$file || exit; \
78 done
79 endif
82 installdirs:
83 ifdef found_html
84 $(mkinstalldirs) '$(DESTDIR)$(htmldir)'/html
85 endif
86 ifdef found_man
87 $(mkinstalldirs) $(addprefix '$(DESTDIR)$(mandir)'/man, 1 $(sqlmansectnum))
88 endif
91 uninstall:
92 ifdef found_html
93 rm -f $(addprefix $(DESTDIR)$(htmldir)/html/, $(shell gunzip -c $(srcdir)/postgres.tar.gz | tar tf -))
94 endif
95 ifdef found_man
96 rm -f $(addprefix $(DESTDIR)$(mandir)/, $(shell gunzip -c $(srcdir)/man.tar.gz | tar tf - | sed -e 's,man$(sqlmansect_dummy)/,man$(sqlmansectnum)/,' -e 's/.$(sqlmansect_dummy)$$/.$(sqlmansect)/'))
97 endif
100 clean distclean maintainer-clean:
101 rm -rf man1/ man$(sqlmansectnum)/ man$(sqlmansect_dummy)/
102 $(MAKE) -C src $@