|
1 | 1 | #----------------------------------------------------------------------------
|
2 | 2 | #
|
3 |
| -# Makefile |
4 |
| -# Postgres documentation installation makefile |
5 |
| -# Thomas Lockhart |
| 3 | +# PostgreSQL documentation installation makefile |
6 | 4 | #
|
7 | 5 | # Copyright (c) 1994, Regents of the University of California
|
8 | 6 | #
|
9 |
| -# |
10 |
| -# IDENTIFICATION |
11 |
| -# $Header: /cvsroot/pgsql/doc/Makefile,v 1.17 2000/07/16 14:50:32 petere Exp $ |
| 7 | +# $Header: /cvsroot/pgsql/doc/Makefile,v 1.18 2000/07/17 22:31:57 petere Exp $ |
12 | 8 | #
|
13 | 9 | #----------------------------------------------------------------------------
|
14 | 10 |
|
15 |
| -PGDOCS= $(POSTGRESDIR)/doc |
16 |
| -SRCDIR= ../src |
17 |
| - |
18 |
| -TAR= tar |
| 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. |
| 17 | +# |
| 18 | +# To actually build the documenation, look into the src/ and src/sgml |
| 19 | +# subdirectories. |
19 | 20 |
|
20 |
| -# Pick up Makefile.global from the source area |
21 |
| -# This is the only resource from the code source area and is optional. |
22 |
| -# Actually, we want this to get Makefile.custom - thomas 1998-03-01 |
| 21 | +subdir = doc |
| 22 | +top_builddir = .. |
| 23 | +include $(top_builddir)/src/Makefile.global |
23 | 24 |
|
24 |
| -ifneq ($(wildcard $(SRCDIR)/Makefile.global), ) |
25 |
| -include $(SRCDIR)/Makefile.global |
26 |
| -endif |
27 |
| - |
28 |
| -# Hmm, made this optional but jade _really_ doesn't like them missing |
29 |
| -# - thomas 1998-03-01 |
30 |
| -ifneq ($(HDSL), ) |
31 |
| -HTMLOPTS= -d $(HDSL) |
32 |
| -endif |
33 |
| -ifneq ($(PDSL), ) |
34 |
| -PRINTOPTS= -d $(PDSL) |
35 |
| -endif |
36 | 25 |
|
37 |
| -MODULES= admin postgres programmer tutorial user |
38 |
| -TARGETS= $(MODULES:%=%.html) |
| 26 | +MODULES := admin postgres programmer tutorial user |
39 | 27 |
|
40 |
| -.PRECIOUS: postgres.tex postgres.dvi |
41 |
| -.PHONY: beforeinstall install all clean distclean |
| 28 | +found_MODULES := $(foreach module, $(MODULES), $(shell test -f $(srcdir)/$(module).tar.gz && echo $(module))) |
42 | 29 |
|
43 |
| -beforeinstall: |
44 |
| - -@if [ ! -d $(PGDOCS) ]; then mkdir $(PGDOCS); fi |
| 30 | +ifneq ($(wildcard $(srcdir)/man.tar.gz),) |
| 31 | +found_man := yes |
| 32 | +endif |
45 | 33 |
|
46 |
| -install: |
47 |
| - $(MAKE) all |
48 |
| - $(MAKE) man |
49 | 34 |
|
50 |
| -all: beforeinstall $(MODULES) |
| 35 | +all: |
51 | 36 |
|
52 |
| -clean: |
53 |
| - rm -rf $(MODULES) |
54 | 37 |
|
55 |
| -distclean: |
56 |
| - $(MAKE) clean |
| 38 | +install: all installdirs |
| 39 | +ifneq ($(strip $(found_MODULES)),) |
| 40 | + for module in $(found_MODULES); do \ |
| 41 | + gunzip -c $${module}.tar.gz | ( cd $(docdir)/$$module && $(TAR) xf - ) || \ |
| 42 | + exit; \ |
| 43 | + done |
| 44 | +endif |
| 45 | +ifdef found_man |
| 46 | + gunzip -c man.tar.gz | ( cd $(mandir) && $(TAR) xf - ) |
| 47 | +endif |
57 | 48 |
|
58 |
| -man: |
59 |
| - -@if test ! -d $(POSTMANDIR) ; then mkdir $(POSTMANDIR) ; fi |
60 |
| - gunzip -c man.tar.gz | (cd $(POSTMANDIR) ; $(TAR) xf - ) |
61 | 49 |
|
62 |
| -# |
63 |
| -# Generic production rules |
64 |
| -# |
| 50 | +installdirs: |
| 51 | + $(mkinstalldirs) $(mandir) $(addprefix $(docdir)/, . $(found_MODULES)) |
65 | 52 |
|
66 |
| -# Unpack tar file |
67 |
| -# Put into area pointed to by $(PGDOCS). |
68 |
| -## Make a local file to keep track of dependencies, |
69 |
| -## if $(PGDOCS) points somewhere else. |
70 |
| -## Disable this for now - thomas 1998-03-01 |
71 |
| -# Remove the contents of the target directory |
72 |
| -# to replace symlinks - thomas 1998-03-01 |
73 | 53 |
|
74 |
| -%: %.tar.gz |
75 |
| - rm -rf ./$@ $(PGDOCS)/$* |
76 |
| - if test ! -d $(PGDOCS)/$* ; then mkdir $(PGDOCS)/$* ; fi |
77 |
| - gunzip -c $< | (cd $(PGDOCS)/$* ; $(TAR) xf - ) |
78 |
| -# touch ./$* |
| 54 | +uninstall: |
| 55 | + -rm -rf $(addprefix $(docdir)/, $(MODULES)) |
| 56 | +ifdef found_man |
| 57 | + -rm -f $(addprefix $(mandir)/, $(shell gunzip -c man.tar.gz | tar tf -)) |
| 58 | +endif |
0 commit comments