|
2 | 2 | # |
3 | 3 | # PostgreSQL documentation makefile |
4 | 4 | # |
5 | | -# $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.87 2007/01/07 08:49:31 petere Exp $ |
| 5 | +# $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.88 2007/01/09 22:19:36 momjian Exp $ |
6 | 6 | # |
7 | 7 | #---------------------------------------------------------------------------- |
8 | 8 |
|
@@ -65,7 +65,7 @@ override SPFLAGS += -wall -wno-unused-param -wno-empty |
65 | 65 | ## Man pages |
66 | 66 | ## |
67 | 67 |
|
68 | | -.PHONY: man |
| 68 | +.PHONY: man draft |
69 | 69 |
|
70 | 70 | DEFAULTSECTION :=$(sqlmansect_dummy) |
71 | 71 |
|
@@ -95,21 +95,38 @@ html: postgres.sgml $(ALLSGML) stylesheet.dsl |
95 | 95 | ifeq ($(vpath_build), yes) |
96 | 96 | @cp $(srcdir)/stylesheet.css . |
97 | 97 | endif |
| 98 | +ifndefDRAFT |
| 99 | +@cmp -s HTML.index.start HTML.index || $(MAKE) $* |
| 100 | +endif |
98 | 101 |
|
99 | 102 |
|
100 | 103 | COLLATEINDEX := LC_ALL=C$(PERL)$(COLLATEINDEX) -f -g |
101 | 104 |
|
102 | | -# If HTML.index does not exist, create a dummy bookindex.sgml. During the |
103 | | -# next build, create bookindex.sgml with the proper index contents. A proper |
104 | | -# bookindex.sgml is required to have an index in the output. |
105 | | -ifeq (,$(wildcard HTML.index)) |
106 | | -bookindex.sgml: |
107 | | -$(COLLATEINDEX) -o$@ -N |
| 105 | +draft: |
| 106 | +ifndefDRAFT |
| 107 | +ifneq ($(MAKECMDGOALS), draft) |
| 108 | +# Call ourselves with the DRAFT value set. This seems to be the only |
| 109 | +# way to set gmake variables in a rule. |
| 110 | +@$(MAKE) DRAFT="Y" $(MAKECMDGOALS)) |
108 | 111 | else |
109 | | -bookindex.sgml: HTML.index |
110 | | -$(COLLATEINDEX) -i'bookindex' -o$@$< |
| 112 | +# run default 'all' rule |
| 113 | +@$(MAKE) DRAFT="Y" all |
| 114 | +endif |
111 | 115 | endif |
112 | 116 |
|
| 117 | +bookindex.sgml: HTML.index |
| 118 | +# create a dummy bookindex.html |
| 119 | +test -s HTML.index || $(COLLATEINDEX) -o $@ -N |
| 120 | +# If HTML.index is valid, create a valid bookindex.sgml. This |
| 121 | +# is required so the output has a proper index. |
| 122 | +test ! -s HTML.index || $(COLLATEINDEX) -i 'bookindex' -o $@ $< |
| 123 | +# save copy of HTML.index for later comparison |
| 124 | +@cp HTML.index HTML.index.start |
| 125 | + |
| 126 | +HTML.index: |
| 127 | +# create HTML.index if it does not exist |
| 128 | +@$(if $(wildcard HTML.index), , touch HTML.index) |
| 129 | + |
113 | 130 | version.sgml:$(top_builddir)/src/Makefile.global |
114 | 131 | { \ |
115 | 132 | echo"<!entity version\"$(VERSION)\">";\ |
@@ -141,15 +158,27 @@ JADE.tex.call = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d $(srcdir)/styl |
141 | 158 |
|
142 | 159 | %-A4.tex-ps:%.sgml$(ALLSGML) stylesheet.dsl bookindex.sgml |
143 | 160 | $(JADE.tex.call) -V texdvi-output -V'%paper-type%'=A4 -o$@$< |
| 161 | +ifndefDRAFT |
| 162 | +@cmp -s HTML.index.start HTML.index || $(MAKE) $* |
| 163 | +endif |
144 | 164 |
|
145 | 165 | %-US.tex-ps:%.sgml$(ALLSGML) stylesheet.dsl bookindex.sgml |
146 | 166 | $(JADE.tex.call) -V texdvi-output -V'%paper-type%'=USletter -o$@$< |
| 167 | +ifndefDRAFT |
| 168 | +@cmp -s HTML.index.start HTML.index || $(MAKE) $* |
| 169 | +endif |
147 | 170 |
|
148 | 171 | %-A4.tex-pdf:%.sgml$(ALLSGML) stylesheet.dsl bookindex.sgml |
149 | 172 | $(JADE.tex.call) -V texpdf-output -V'%paper-type%'=A4 -o$@$< |
| 173 | +ifndefDRAFT |
| 174 | +@cmp -s HTML.index.start HTML.index || $(MAKE) $* |
| 175 | +endif |
150 | 176 |
|
151 | 177 | %-US.tex-pdf:%.sgml$(ALLSGML) stylesheet.dsl bookindex.sgml |
152 | 178 | $(JADE.tex.call) -V texpdf-output -V'%paper-type%'=USletter -o$@$< |
| 179 | +ifndefDRAFT |
| 180 | +@cmp -s HTML.index.start HTML.index || $(MAKE) $* |
| 181 | +endif |
153 | 182 |
|
154 | 183 | %.dvi:%.tex-ps |
155 | 184 | @rm -f$*.aux$*.log |
@@ -291,7 +320,7 @@ clean distclean maintainer-clean: |
291 | 320 | # print |
292 | 321 | rm -f *.rtf *.tex-ps *.tex-pdf *.dvi *.aux *.log *.ps *.pdf *.out *.eps *.fot |
293 | 322 | # index |
294 | | -rm -f HTML.index $(GENERATED_SGML) |
| 323 | +rm -f HTML.indexHTML.index.start$(GENERATED_SGML) |
295 | 324 | # text |
296 | 325 | rm -f INSTALL HISTORY regress_README |
297 | 326 | # XSLT |
|