]> granicus.if.org Git - postgresql/blob - doc/Makefile
Replace useless uses of := by = in makefiles.
[postgresql] / doc / Makefile
1 #----------------------------------------------------------------------------
2 #
3 # PostgreSQL documentation installation makefile
4 #
5 # Copyright (c) 1994, Regents of the University of California
6 #
7 # $PostgreSQL: pgsql/doc/Makefile,v 1.29 2007/02/09 15:55:57 petere Exp $
8 #
9 #----------------------------------------------------------------------------
10
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.
15 #
16 # Before we install the man pages, we massage the section numbers to
17 # follow the local conventions.
18 #
19 # To actually build the documenation, look into the src/ and src/sgml
20 # subdirectories.
21
22 subdir = doc
23 top_builddir = ..
24 include $(top_builddir)/src/Makefile.global
25
26 .NOTPARALLEL:
27
28 ifneq ($(wildcard $(srcdir)/postgres.tar.gz),)
29 ifneq (,$(docdir))
30 found_html = yes
31 endif
32 endif
33
34 ifneq ($(wildcard $(srcdir)/man.tar.gz),)
35 # SCO OpenServer's man system is sufficiently different to not bother.
36 ifneq ($(PORTNAME), sco)
37 found_man = yes
38 endif
39 endif
40
41
42 ifdef found_man
43 ifndef sqlmansect
44 sqlmansect = 7
45 endif
46 sqlmansectnum = $(shell expr X'$(sqlmansect)' : X'\([0-9]\)')
47
48 all: man1/.timestamp man$(sqlmansectnum)/.timestamp
49
50 man1/.timestamp: man$(sqlmansect_dummy)/.timestamp
51         @echo timestamp >$@
52
53 man$(sqlmansect_dummy)/.timestamp: man.tar.gz
54         gzip -d -c $< | $(TAR) xf -
55         for file in man1/*.1; do \
56           mv $$file $$file.bak && \
57           sed -e 's/\\fR($(sqlmansect_dummy))/\\fR($(sqlmansectnum))/' $$file.bak >$$file && \
58           rm -f $$file.bak || exit; \
59         done
60         @echo timestamp >$@
61
62 man$(sqlmansectnum)/.timestamp: man$(sqlmansect_dummy)/.timestamp
63         $(mkinstalldirs) man$(sqlmansectnum)
64         for file in man$(sqlmansect_dummy)/*.$(sqlmansect_dummy); do \
65           sed -e '/^\.TH/s/"$(sqlmansect_dummy)"/"$(sqlmansect)"/'   \
66               -e 's/\\fR($(sqlmansect_dummy))/\\fR($(sqlmansectnum))/' \
67               $$file >man$(sqlmansectnum)/`basename $$file | sed 's/.$(sqlmansect_dummy)$$/.$(sqlmansect)/'` || exit; \
68         done
69         @echo timestamp >$@
70 endif # found_man
71
72
73 install: all installdirs
74 ifdef found_html
75         gzip -d -c $(srcdir)/postgres.tar.gz | ( cd $(DESTDIR)$(docdir)/html && $(TAR) xf - )
76 endif
77 ifdef found_man
78         for file in man1/*.1 man$(sqlmansectnum)/*.$(sqlmansect) ; do \
79           $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/$$file || exit; \
80         done
81 endif
82
83
84 installdirs:
85 ifdef found_html
86         $(mkinstalldirs) '$(DESTDIR)$(docdir)'/html
87 endif
88 ifdef found_man
89         $(mkinstalldirs) $(addprefix '$(DESTDIR)$(mandir)'/man, 1 $(sqlmansectnum))
90 endif
91
92
93 uninstall:
94 ifdef found_html
95         -rm -f $(addprefix $(DESTDIR)$(docdir)/html/, $(shell gunzip -c $(srcdir)/postgres.tar.gz | tar tf -))
96 endif
97 ifdef found_man
98         -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)/'))
99 endif
100
101
102 clean distclean maintainer-clean:
103         rm -rf man1/ man$(sqlmansectnum)/ man$(sqlmansect_dummy)/
104         $(MAKE) -C src $@