4
4
#
5
5
# Copyright (c) 1994, Regents of the University of California
6
6
#
7
- # $Header: /cvsroot/pgsql/doc/Makefile,v 1.20 2000/12/26 20:47:07 petere Exp $
7
+ # $Header: /cvsroot/pgsql/doc/Makefile,v 1.21 2001/08/29 19:14:39 petere Exp $
8
8
#
9
9
# ----------------------------------------------------------------------------
10
10
11
- # This directory doesn't build anything, it is only responsible for
12
- # installing the documenation. It is invoked automatically by the
13
- # top-level makefile. The files to be installed are prepared specially
14
- # and are placed in this directory during distribution bundling. In
15
- # CVS-based trees these files don't exist, so we skip the installation
16
- # in that case.
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.
17
18
#
18
19
# To actually build the documenation, look into the src/ and src/sgml
19
20
# subdirectories.
@@ -22,36 +23,79 @@ subdir = doc
22
23
top_builddir = ..
23
24
include $(top_builddir ) /src/Makefile.global
24
25
26
+ .NOTPARALLEL :
25
27
26
28
ifneq ($(wildcard $(srcdir ) /postgres.tar.gz) ,)
27
29
found_html := yes
28
30
endif
29
31
30
32
ifneq ($(wildcard $(srcdir ) /man.tar.gz) ,)
33
+ # SCO OpenServer's man system is sufficiently different to not bother.
34
+ ifneq ($(PORTNAME ) , sco)
31
35
found_man := yes
32
36
endif
37
+ endif
38
+
39
+
40
+ ifdef found_man
41
+ ifndef sqlmansect
42
+ sqlmansect = 7
43
+ endif
44
+ sqlmansectnum = $(shell expr X'$(sqlmansect ) ' : X'\([0-9]\) ')
45
+
46
+ all : man1/.timestamp man$(sqlmansectnum ) /.timestamp
33
47
48
+ man1/.timestamp man$(sqlmansect_dummy ) /.timestamp : man.tar.gz
49
+ gzip -d -c $< | $(TAR ) xf -
50
+ for file in man1/* .1; do \
51
+ mv $$ file $$ file.bak && \
52
+ sed -e ' s/\\fR($(sqlmansect_dummy))/\\fR($(sqlmansectnum))/' $$ file.bak > $$ file && \
53
+ rm $$ file.bak || exit ; \
54
+ done
55
+ @echo timestamp > man1/.timestamp
56
+ @echo timestamp > man$(sqlmansect_dummy ) /.timestamp
34
57
35
- all :
58
+ man$(sqlmansectnum ) /.timestamp : man$(sqlmansect_dummy ) /.timestamp
59
+ $(mkinstalldirs ) man$(sqlmansectnum )
60
+ for file in man$( sqlmansect_dummy) /* .$( sqlmansect_dummy) ; do \
61
+ sed -e ' /^\.TH/s/"$(sqlmansect_dummy)"/"$(sqlmansect)"/' \
62
+ -e 's/\\fR($(sqlmansect_dummy))/\\fR($(sqlmansectnum))/' \
63
+ $$file >man$(sqlmansectnum)/`basename $$file | sed 's/.$(sqlmansect_dummy)$$/.$(sqlmansect)/'` || exit; \
64
+ done
65
+ @echo timestamp >$@
66
+ endif # found_man
36
67
37
68
38
69
install : all installdirs
39
70
ifdef found_html
40
71
gzip -d -c postgres.tar.gz | ( cd $(DESTDIR)$(docdir)/html && $(TAR) xf - )
41
72
endif
42
73
ifdef found_man
43
- gzip -d -c man.tar.gz | ( cd $(DESTDIR)$(mandir) && $(TAR) xf - )
74
+ for file in man1/*.1 man$(sqlmansectnum)/*.$(sqlmansect) ; do \
75
+ $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/$$file || exit; \
76
+ done
44
77
endif
45
78
46
79
47
80
installdirs :
48
- $(mkinstalldirs ) $(DESTDIR )$(mandir ) $(DESTDIR )$(docdir ) /html
81
+ ifdef found_html
82
+ $(mkinstalldirs) $(DESTDIR)$(docdir)/html
83
+ endif
84
+ ifdef found_man
85
+ $(mkinstalldirs) $(addprefix $(DESTDIR)$(mandir)/man, 1 $(sqlmansectnum))
86
+ endif
49
87
50
88
51
89
uninstall :
52
90
ifdef found_html
53
91
-rm -f $(addprefix $(DESTDIR)$(docdir)/html/, $(shell gunzip -c $(srcdir)/postgres.tar.gz | tar tf -))
54
92
endif
55
93
ifdef found_man
56
- -rm -f $(addprefix $(DESTDIR)$(mandir)/, $(shell gunzip -c $(srcdir)/man.tar.gz | tar tf -))
94
+ -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)/' ))
57
95
endif
96
+
97
+
98
+ clean :
99
+ rm -rf man1/ man$(sqlmansectnum ) / man$(sqlmansect_dummy ) /
100
+
101
+ distclean maintainer-clean : clean
0 commit comments