Fix small bugs, causing warnings.
[gmpc.git] / gnome-doc-utils.make
blob726c5b84fc5169f80574e99297c43e6f22d7651a
1 # gnome-doc-utils.make - make magic for building documentation
2 # Copyright (C) 2004-2005 Shaun McCance <shaunm@gnome.org>
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation,
16 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 # As a special exception to the GNU General Public License, if you
19 # distribute this file as part of a program that contains a
20 # configuration script generated by Autoconf, you may include it under
21 # the same distribution terms that you use for the rest of that program.
23 ################################################################################
24 ## @@ Generating Header Files
26 ## @ DOC_H_FILE
27 ## The name of the header file to generate
28 DOC_H_FILE ?=
30 ## @ DOC_H_DOCS
31 ## The input DocBook files for generating the header file
32 DOC_H_DOCS ?=
34 $(DOC_H_FILE): $(DOC_H_DOCS);
35 @rm -f $@.tmp; touch $@.tmp;
36 echo 'const gchar* documentation_credits[] = {' >> $@.tmp
37 list='$(DOC_H_DOCS)'; for doc in $$list; do \
38 xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`"; \
39 if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \
40 xsltproc --path "$$xmlpath" $(_credits) $$doc; \
41 done | sort | uniq \
42 | awk 'BEGIN{s=""}{n=split($$0,w,"<");if(s!=""&&s!=substr(w[1],1,length(w[1])-1)){print s};if(n>1){print $$0;s=""}else{s=$$0}};END{if(s!=""){print s}}' \
43 | sed -e 's/\\/\\\\/' -e 's/"/\\"/' -e 's/\(.*\)/\t"\1",/' >> $@.tmp
44 echo ' NULL' >> $@.tmp
45 echo '};' >> $@.tmp
46 echo >> $@.tmp
47 list='$(DOC_H_DOCS)'; for doc in $$list; do \
48 xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`"; \
49 if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \
50 docid=`echo "$$doc" | sed -e 's/.*\/\([^/]*\)\.xml/\1/' \
51 | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`; \
52 echo $$xmlpath; \
53 ids=`xsltproc --xinclude --path "$$xmlpath" $(_ids) $$doc`; \
54 for id in $$ids; do \
55 echo '#define HELP_'`echo $$docid`'_'`echo $$id \
56 | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`' "'$$id'"' >> $@.tmp; \
57 done; \
58 echo >> $@.tmp; \
59 done;
60 cp $@.tmp $@ && rm -f $@.tmp
62 dist-check-gdu:
63 if !HAVE_GNOME_DOC_UTILS
64 @echo "*** GNOME Doc Utils must be installed in order to make dist"
65 @false
66 endif
68 .PHONY: dist-doc-header
69 dist-doc-header: $(DOC_H_FILE)
70 @if test -f "$(DOC_H_FILE)"; then d=; else d="$(srcdir)/"; fi; \
71 echo "$(INSTALL_DATA) $${d}$(DOC_H_FILE) $(distdir)/$(DOC_H_FILE)"; \
72 $(INSTALL_DATA) "$${d}$(DOC_H_FILE)" "$(distdir)/$(DOC_H_FILE)";
74 doc-dist-hook: dist-check-gdu $(if $(DOC_H_FILE),dist-doc-header)
76 .PHONY: clean-doc-header
77 _clean_doc_header = $(if $(DOC_H_FILE),clean-doc-header)
78 clean-local: $(_clean_doc_header)
79 distclean-local: $(_clean_doc_header)
80 mostlyclean-local: $(_clean_doc_header)
81 maintainer-clean-local: $(_clean_doc_header)
82 clean-doc-header:
83 rm -f $(DOC_H_FILE)
85 all: $(DOC_H_FILE)
88 ################################################################################
89 ## @@ Generating Documentation Files
91 ## @ DOC_MODULE
92 ## The name of the document being built
93 DOC_MODULE ?=
95 ## @ DOC_ID
96 ## The unique identifier for a Mallard document
97 DOC_ID ?=
99 ## @ DOC_PAGES
100 ## Page files in a Mallard document
101 DOC_PAGES ?=
103 ## @ DOC_ENTITIES
104 ## Files included with a SYSTEM entity
105 DOC_ENTITIES ?=
107 ## @ DOC_INCLUDES
108 ## Files included with XInclude
109 DOC_INCLUDES ?=
111 ## @ DOC_FIGURES
112 ## Figures and other external data
113 DOC_FIGURES ?=
115 ## @ DOC_FORMATS
116 ## The default formats to be built and installed
117 DOC_FORMATS ?= docbook
118 _DOC_REAL_FORMATS = $(if $(DOC_USER_FORMATS),$(DOC_USER_FORMATS),$(DOC_FORMATS))
120 ## @ DOC_LINGUAS
121 ## The languages this document is translated into
122 DOC_LINGUAS ?=
123 _DOC_REAL_LINGUAS = $(if $(filter environment,$(origin LINGUAS)), \
124 $(filter $(LINGUAS),$(DOC_LINGUAS)), \
125 $(DOC_LINGUAS))
127 _DOC_ABS_SRCDIR = @abs_srcdir@
130 ################################################################################
131 ## Variables for Bootstrapping
133 _xml2po ?= `which xml2po`
134 _xml2po_mode = $(if $(DOC_ID),mallard,docbook)
136 _db2html ?= `$(PKG_CONFIG) --variable db2html gnome-doc-utils`
137 _db2omf ?= `$(PKG_CONFIG) --variable db2omf gnome-doc-utils`
138 _chunks ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/chunks.xsl
139 _credits ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/credits.xsl
140 _ids ?= $(shell $(PKG_CONFIG) --variable xmldir gnome-doc-utils)/gnome/xslt/docbook/utils/ids.xsl
142 if ENABLE_SK
143 _ENABLE_SK = true
144 _skpkgdatadir ?= `scrollkeeper-config --pkgdatadir`
145 _sklocalstatedir ?= `scrollkeeper-config --pkglocalstatedir`
146 _skcontentslist ?= $(_skpkgdatadir)/Templates/C/scrollkeeper_cl.xml
147 endif
150 ################################################################################
151 ## Support for automake silent-rules
152 GDU_V_XML2PO=$(GDU__v_XML2PO_$(V))
153 GDU__v_XML2PO_=$(GDU__v_XML2PO_$(AM_DEFAULT_VERBOSITY))
154 GDU__v_XML2PO_0=@echo " XML2PO" $@;
156 GDU_V_MSGFMT=$(GDU__v_MSGFMT_$(V))
157 GDU__v_MSGFMT_=$(GDU__v_MSGFMT_$(AM_DEFAULT_VERBOSITY))
158 GDU__v_MSGFMT_0=@echo " MSGFMT" $@;
160 GDU_V_DB2OMF=$(GDU__v_DB2OMF_$(V))
161 GDU__v_DB2OMF_=$(GDU__v_DB2OMF_$(AM_DEFAULT_VERBOSITY))
162 GDU__v_DB2OMF_0=@echo " DB2OMF" $@;
164 GDU_V_DB2HTM=$(GDU__v_DB2HTM_$(V))
165 GDU__v_DB2HTM_=$(GDU__v_DB2HTM_$(AM_DEFAULT_VERBOSITY))
166 GDU__v_DB2HTM_0=@echo " DB2HTM" $@;
168 ################################################################################
169 ## @@ Rules for OMF Files
171 db2omf_args = \
172 --stringparam db2omf.basename $(DOC_MODULE) \
173 --stringparam db2omf.format $(3) \
174 --stringparam db2omf.dtd \
175 $(shell xmllint --format $(2) | grep -h PUBLIC | head -n 1 \
176 | sed -e 's/.*PUBLIC \(\"[^\"]*\"\).*/\1/') \
177 --stringparam db2omf.lang $(notdir $(patsubst %/$(notdir $(2)),%,$(2))) \
178 --stringparam db2omf.omf_dir "$(OMF_DIR)" \
179 --stringparam db2omf.help_dir "$(HELP_DIR)" \
180 --stringparam db2omf.omf_in "$(_DOC_OMF_IN)" \
181 $(if $(_ENABLE_SK), \
182 --stringparam db2omf.scrollkeeper_cl "$(_skcontentslist)") \
183 $(_db2omf) $(2)
185 ## @ _DOC_OMF_IN
186 ## The OMF input file
187 _DOC_OMF_IN = $(if $(DOC_MODULE),$(wildcard $(_DOC_ABS_SRCDIR)/$(DOC_MODULE).omf.in))
189 ## @ _DOC_OMF_DB
190 ## The OMF files for DocBook output
191 _DOC_OMF_DB = $(if $(_DOC_OMF_IN), \
192 $(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-$(lc).omf))
194 $(_DOC_OMF_DB) : $(_DOC_OMF_IN)
195 $(_DOC_OMF_DB) : $(DOC_MODULE)-%.omf : %/$(DOC_MODULE).xml
196 @test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || { \
197 echo "The file '$(_skcontentslist)' does not exist." >&2; \
198 echo "Please check your ScrollKeeper installation." >&2; \
199 exit 1; }
200 $(GDU_V_DB2OMF)xsltproc -o $@ $(call db2omf_args,$@,$<,'docbook') || { rm -f "$@"; exit 1; }
202 ## @ _DOC_OMF_HTML
203 ## The OMF files for HTML output
204 _DOC_OMF_HTML = $(if $(_DOC_OMF_IN), \
205 $(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-html-$(lc).omf))
207 $(_DOC_OMF_HTML) : $(_DOC_OMF_IN)
208 $(_DOC_OMF_HTML) : $(DOC_MODULE)-html-%.omf : %/$(DOC_MODULE).xml
209 if ENABLE_SK
210 @test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || { \
211 echo "The file '$(_skcontentslist)' does not exist" >&2; \
212 echo "Please check your ScrollKeeper installation." >&2; \
213 exit 1; }
214 endif
215 $(GDU_V_DB2OMF)xsltproc -o $@ $(call db2omf_args,$@,$<,'xhtml') || { rm -f "$@"; exit 1; }
217 ## @ _DOC_OMF_ALL
218 ## All OMF output files to be built
219 # FIXME
220 _DOC_OMF_ALL = \
221 $(if $(filter docbook,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_DB)) \
222 $(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_HTML))
224 .PHONY: omf
225 omf: $(_DOC_OMF_ALL)
228 ################################################################################
229 ## @@ C Locale Documents
231 ## @ _DOC_C_MODULE
232 ## The top-level documentation file in the C locale
233 _DOC_C_MODULE = $(if $(DOC_MODULE),C/$(DOC_MODULE).xml)
235 ## @ _DOC_C_PAGES
236 ## Page files in a Mallard document in the C locale
237 _DOC_C_PAGES = $(foreach page,$(DOC_PAGES),C/$(page))
239 ## @ _DOC_C_ENTITIES
240 ## Files included with a SYSTEM entity in the C locale
241 _DOC_C_ENTITIES = $(foreach ent,$(DOC_ENTITIES),C/$(ent))
243 ## @ _DOC_C_XINCLUDES
244 ## Files included with XInclude in the C locale
245 _DOC_C_INCLUDES = $(foreach inc,$(DOC_INCLUDES),C/$(inc))
247 ## @ _DOC_C_DOCS
248 ## All documentation files in the C locale
249 _DOC_C_DOCS = \
250 $(_DOC_C_ENTITIES) $(_DOC_C_INCLUDES) \
251 $(_DOC_C_PAGES) $(_DOC_C_MODULE)
253 ## @ _DOC_C_DOCS_NOENT
254 ## All documentation files in the C locale,
255 ## except files included with a SYSTEM entity
256 _DOC_C_DOCS_NOENT = \
257 $(_DOC_C_MODULE) $(_DOC_C_INCLUDES) \
258 $(_DOC_C_PAGES)
260 ## @ _DOC_C_FIGURES
261 ## All figures and other external data in the C locale
262 _DOC_C_FIGURES = $(if $(DOC_FIGURES), \
263 $(foreach fig,$(DOC_FIGURES),C/$(fig)), \
264 $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/C/figures/*.png)))
266 ## @ _DOC_C_HTML
267 ## All HTML documentation in the C locale
268 # FIXME: probably have to shell escape to determine the file names
269 _DOC_C_HTML = $(foreach f, \
270 $(shell xsltproc --xinclude \
271 --stringparam db.chunk.basename "$(DOC_MODULE)" \
272 $(_chunks) "C/$(DOC_MODULE).xml"), \
273 C/$(f).xhtml)
275 ###############################################################################
276 ## @@ Other Locale Documentation
278 ## @ _DOC_POFILES
279 ## The .po files used for translating the document
280 _DOC_POFILES = $(if $(DOC_MODULE)$(DOC_ID), \
281 $(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(lc).po))
283 .PHONY: po
284 po: $(_DOC_POFILES)
286 ## @ _DOC_MOFILES
287 ## The .mo files used for translating the document
288 _DOC_MOFILES = $(patsubst %.po,%.mo,$(_DOC_POFILES))
290 .PHONY: mo
291 mo: $(_DOC_MOFILES)
293 ## @ _DOC_LC_MODULES
294 ## The top-level documentation files in all other locales
295 _DOC_LC_MODULES = $(if $(DOC_MODULE), \
296 $(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xml))
298 ## @ _DOC_LC_PAGES
299 ## Page files in a Mallard document in all other locales
300 _DOC_LC_PAGES = \
301 $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach page,$(_DOC_C_PAGES), \
302 $(lc)/$(notdir $(page)) ))
304 ## @ _DOC_LC_XINCLUDES
305 ## Files included with XInclude in all other locales
306 _DOC_LC_INCLUDES = \
307 $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach inc,$(_DOC_C_INCLUDES), \
308 $(lc)/$(notdir $(inc)) ))
310 ## @ _DOC_LC_HTML
311 ## All HTML documentation in all other locales
312 # FIXME: probably have to shell escape to determine the file names
313 _DOC_LC_HTML = \
314 $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach doc,$(_DOC_C_HTML), \
315 $(lc)/$(notdir $(doc)) ))
317 ## @ _DOC_LC_DOCS
318 ## All documentation files in all other locales
319 _DOC_LC_DOCS = \
320 $(_DOC_LC_MODULES) $(_DOC_LC_INCLUDES) $(_DOC_LC_PAGES) \
321 $(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_LC_HTML))
323 ## @ _DOC_LC_FIGURES
324 ## All figures and other external data in all other locales
325 _DOC_LC_FIGURES = $(foreach lc,$(_DOC_REAL_LINGUAS), \
326 $(patsubst C/%,$(lc)/%,$(_DOC_C_FIGURES)) )
328 _DOC_SRC_FIGURES = \
329 $(foreach fig,$(_DOC_C_FIGURES), $(foreach lc,C $(_DOC_REAL_LINGUAS), \
330 $(wildcard $(srcdir)/$(lc)/$(patsubst C/%,%,$(fig))) ))
332 $(_DOC_POFILES):
333 @if ! test -d $(dir $@); then \
334 echo "mkdir $(dir $@)"; \
335 mkdir "$(dir $@)"; \
337 @if test ! -f $@ -a -f $(srcdir)/$@; then \
338 echo "cp $(srcdir)/$@ $@"; \
339 cp "$(srcdir)/$@" "$@"; \
341 @docs=; \
342 list='$(_DOC_C_DOCS_NOENT)'; for doc in $$list; do \
343 docs="$$docs $(_DOC_ABS_SRCDIR)/$$doc"; \
344 done; \
345 if ! test -f $@; then \
346 echo "(cd $(dir $@) && \
347 $(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
348 cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)"; \
349 (cd $(dir $@) && \
350 $(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
351 cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp); \
352 else \
353 echo "(cd $(dir $@) && \
354 $(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs)"; \
355 (cd $(dir $@) && \
356 $(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs); \
359 $(_DOC_MOFILES): %.mo: %.po
360 $(AM_V_at)if ! test -d $(dir $@); then mkdir "$(dir $@)"; fi
361 $(GDU_V_MSGFMT)msgfmt -o $@ $<
363 # FIXME: fix the dependancy
364 # FIXME: hook xml2po up
365 $(_DOC_LC_DOCS) : $(_DOC_MOFILES)
366 $(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
367 $(AM_V_at)if ! test -d $(dir $@); then mkdir $(dir $@); fi
368 $(GDU_V_XML2PO)if [ -f "C/$(notdir $@)" ]; then d="../"; else d="$(_DOC_ABS_SRCDIR)/"; fi; \
369 mo="$(dir $@)$(patsubst %/$(notdir $@),%,$@).mo"; \
370 if [ -f "$${mo}" ]; then mo="../$${mo}"; else mo="$(_DOC_ABS_SRCDIR)/$${mo}"; fi; \
371 (cd $(dir $@) && \
372 $(_xml2po) -m $(_xml2po_mode) -e -t "$${mo}" \
373 "$${d}C/$(notdir $@)" > $(notdir $@).tmp && \
374 cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)
376 ## @ _DOC_POT
377 ## A pot file
378 _DOC_POT = $(if $(DOC_MODULE),$(DOC_MODULE).pot,$(if $(DOC_ID),$(DOC_ID).pot))
379 .PHONY: pot
380 pot: $(_DOC_POT)
381 $(_DOC_POT): $(_DOC_C_DOCS_NOENT)
382 $(GDU_V_XML2PO)$(_xml2po) -m $(_xml2po_mode) -e -o $@ $^
385 ################################################################################
386 ## @@ All Documentation
388 ## @ _DOC_HTML_ALL
389 ## All HTML documentation, only if it's built
390 _DOC_HTML_ALL = $(if $(filter html HTML,$(_DOC_REAL_FORMATS)), \
391 $(_DOC_C_HTML) $(_DOC_LC_HTML))
393 _DOC_HTML_TOPS = $(foreach lc,C $(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xhtml)
395 $(_DOC_HTML_TOPS): $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
396 $(GDU_V_DB2HTM)xsltproc -o $@ --xinclude --param db.chunk.chunk_top "false()" --stringparam db.chunk.basename "$(DOC_MODULE)" --stringparam db.chunk.extension ".xhtml" $(_db2html) $(patsubst %.xhtml,%.xml,$@)
399 ################################################################################
400 ## All
402 all: \
403 $(_DOC_C_DOCS) $(_DOC_LC_DOCS) \
404 $(_DOC_OMF_ALL) $(_DOC_DSK_ALL) \
405 $(_DOC_HTML_ALL) $(_DOC_POFILES)
408 ################################################################################
409 ## Clean
411 .PHONY: clean-doc-omf clean-doc-dsk clean-doc-lc clean-doc-dir
413 clean-doc-omf: ; rm -f $(_DOC_OMF_DB) $(_DOC_OMF_HTML)
414 clean-doc-dsk: ; rm -f $(_DOC_DSK_DB) $(_DOC_DSK_HTML)
415 clean-doc-lc:
416 rm -f $(_DOC_LC_DOCS)
417 rm -f $(_DOC_MOFILES)
418 @list='$(_DOC_POFILES)'; for po in $$list; do \
419 if ! test "$$po" -ef "$(srcdir)/$$po"; then \
420 echo "rm -f $$po"; \
421 rm -f "$$po"; \
422 fi; \
423 done
424 # .xml2.po.mo cleaning is obsolete as of 0.18.1 and could be removed in 0.20.x
425 @for lc in C $(_DOC_REAL_LINGUAS); do \
426 if test -f "$$lc/.xml2po.mo"; then \
427 echo "rm -f $$lc/.xml2po.mo"; \
428 rm -f "$$lc/.xml2po.mo"; \
429 fi; \
430 done
431 clean-doc-dir: clean-doc-lc
432 @for lc in C $(_DOC_REAL_LINGUAS); do \
433 for dir in `find $$lc -depth -type d`; do \
434 if ! test $$dir -ef $(srcdir)/$$dir; then \
435 echo "rmdir $$dir"; \
436 rmdir "$$dir"; \
437 fi; \
438 done; \
439 done
441 _clean_omf = $(if $(_DOC_OMF_IN),clean-doc-omf)
442 _clean_dsk = $(if $(_DOC_DSK_IN),clean-doc-dsk)
443 _clean_lc = $(if $(_DOC_REAL_LINGUAS),clean-doc-lc)
444 _clean_dir = $(if $(DOC_MODULE)$(DOC_ID),clean-doc-dir)
446 clean-local: \
447 $(_clean_omf) $(_clean_dsk) \
448 $(_clean_lc) $(_clean_dir)
449 distclean-local: \
450 $(_clean_omf) $(_clean_dsk) \
451 $(_clean_lc) $(_clean_dir)
452 mostlyclean-local: \
453 $(_clean_omf) $(_clean_dsk) \
454 $(_clean_lc) $(_clean_dir)
455 maintainer-clean-local: \
456 $(_clean_omf) $(_clean_dsk) \
457 $(_clean_lc) $(_clean_dir)
461 ################################################################################
462 ## Dist
464 .PHONY: dist-doc-docs dist-doc-pages dist-doc-figs dist-doc-omf dist-doc-dsk
465 doc-dist-hook: \
466 $(if $(DOC_MODULE)$(DOC_ID),dist-doc-docs) \
467 $(if $(_DOC_C_FIGURES),dist-doc-figs) \
468 $(if $(_DOC_OMF_IN),dist-doc-omf)
469 # $(if $(_DOC_DSK_IN),dist-doc-dsk)
471 dist-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES)
472 @for lc in C $(_DOC_REAL_LINGUAS); do \
473 echo " $(mkinstalldirs) $(distdir)/$$lc"; \
474 $(mkinstalldirs) "$(distdir)/$$lc"; \
475 done
476 @list='$(_DOC_C_DOCS)'; \
477 for doc in $$list; do \
478 if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
479 docdir=`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
480 if ! test -d "$(distdir)/$$docdir"; then \
481 echo "$(mkinstalldirs) $(distdir)/$$docdir"; \
482 $(mkinstalldirs) "$(distdir)/$$docdir"; \
483 fi; \
484 echo "$(INSTALL_DATA) $$d$$doc $(distdir)/$$doc"; \
485 $(INSTALL_DATA) "$$d$$doc" "$(distdir)/$$doc"; \
486 done
487 @list='$(_DOC_LC_DOCS)'; \
488 for doc in $$list; do \
489 if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
490 docdir=`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
491 if ! test -d "$(distdir)/$$docdir"; then \
492 echo "$(mkinstalldirs) $(distdir)/$$docdir"; \
493 $(mkinstalldirs) "$(distdir)/$$docdir"; \
494 fi; \
495 echo "$(INSTALL_DATA) $$d$$doc $(distdir)/$$doc"; \
496 $(INSTALL_DATA) "$$d$$doc" "$(distdir)/$$doc"; \
497 done
498 @list='$(_DOC_POFILES)'; \
499 for doc in $$list; do \
500 if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
501 docdir=`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
502 if ! test -d "$(distdir)/$$docdir"; then \
503 echo "$(mkinstalldirs) $(distdir)/$$docdir"; \
504 $(mkinstalldirs) "$(distdir)/$$docdir"; \
505 fi; \
506 echo "$(INSTALL_DATA) $$d$$doc $(distdir)/$$doc"; \
507 $(INSTALL_DATA) "$$d$$doc" "$(distdir)/$$doc"; \
508 done
510 dist-doc-figs: $(_DOC_SRC_FIGURES)
511 @list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; \
512 for fig in $$list; do \
513 if test -f "$$fig"; then d=; else d="$(srcdir)/"; fi; \
514 if test -f "$$d$$fig"; then \
515 figdir=`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
516 if ! test -d "$(distdir)/$$figdir"; then \
517 echo "$(mkinstalldirs) $(distdir)/$$figdir"; \
518 $(mkinstalldirs) "$(distdir)/$$figdir"; \
519 fi; \
520 echo "$(INSTALL_DATA) $$d$$fig $(distdir)/$$fig"; \
521 $(INSTALL_DATA) "$$d$$fig" "$(distdir)/$$fig"; \
522 fi; \
523 done;
525 dist-doc-omf:
526 @if test -f "$(_DOC_OMF_IN)"; then d=; else d="$(srcdir)/"; fi; \
527 echo "$(INSTALL_DATA) $$d$(_DOC_OMF_IN) $(distdir)/$(notdir $(_DOC_OMF_IN))"; \
528 $(INSTALL_DATA) "$$d$(_DOC_OMF_IN)" "$(distdir)/$(notdir $(_DOC_OMF_IN))"
530 dist-doc-dsk:
531 @if test -f "$(_DOC_DSK_IN)"; then d=; else d="$(srcdir)/"; fi; \
532 echo "$(INSTALL_DATA) $$d$(_DOC_DSK_IN) $(distdir)/$(notdir $(_DOC_DSK_IN))"; \
533 $(INSTALL_DATA) "$$d$(_DOC_DSK_IN)" "$(distdir)/$(notdir $(_DOC_DSK_IN))"
537 ################################################################################
538 ## Check
540 .PHONY: check-doc-docs check-doc-omf
541 check: \
542 $(if $(DOC_MODULE),check-doc-docs) \
543 $(if $(DOC_ID),check-doc-pages) \
544 $(if $(_DOC_OMF_IN),check-doc-omf)
546 check-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
547 @for lc in C $(_DOC_REAL_LINGUAS); do \
548 if test -f "$$lc"; \
549 then d=; \
550 xmlpath="$$lc"; \
551 else \
552 d="$(srcdir)/"; \
553 xmlpath="$$lc:$(srcdir)/$$lc"; \
554 fi; \
555 echo "xmllint --noout --noent --path $$xmlpath --xinclude --postvalid $$d$$lc/$(DOC_MODULE).xml"; \
556 xmllint --noout --noent --path "$$xmlpath" --xinclude --postvalid "$$d$$lc/$(DOC_MODULE).xml"; \
557 done
559 check-doc-pages: $(_DOC_C_PAGES) $(_DOC_LC_PAGES)
560 for lc in C $(_DOC_REAL_LINGUAS); do \
561 if test -f "$$lc"; \
562 then d=; \
563 xmlpath="$$lc"; \
564 else \
565 d="$(srcdir)/"; \
566 xmlpath="$$lc:$(srcdir)/$$lc"; \
567 fi; \
568 for page in $(DOC_PAGES); do \
569 echo "xmllint --noout --noent --path $$xmlpath --xinclude $$d$$lc/$$page"; \
570 xmllint --noout --noent --path "$$xmlpath" --xinclude "$$d$$lc/$$page"; \
571 done; \
572 done
574 check-doc-omf: $(_DOC_OMF_ALL)
575 @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
576 echo "xmllint --noout --xinclude --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf"; \
577 xmllint --noout --xinclude --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf; \
578 done
582 ################################################################################
583 ## Install
585 .PHONY: install-doc-docs install-doc-html install-doc-figs install-doc-omf install-doc-dsk
587 _doc_install_dir = $(if $(DOC_ID),$(DOC_ID),$(DOC_MODULE))
589 install-data-local: \
590 $(if $(DOC_MODULE)$(DOC_ID),install-doc-docs) \
591 $(if $(_DOC_HTML_ALL),install-doc-html) \
592 $(if $(_DOC_C_FIGURES),install-doc-figs) \
593 $(if $(_DOC_OMF_IN),install-doc-omf)
594 # $(if $(_DOC_DSK_IN),install-doc-dsk)
596 install-doc-docs:
597 @for lc in C $(_DOC_REAL_LINGUAS); do \
598 echo "$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc"; \
599 $(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc; \
600 done
601 @list='$(_DOC_C_DOCS)'; for doc in $$list; do \
602 if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
603 docdir="$$lc/"`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
604 docdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$docdir"; \
605 if ! test -d "$$docdir"; then \
606 echo "$(mkinstalldirs) $$docdir"; \
607 $(mkinstalldirs) "$$docdir"; \
608 fi; \
609 echo "$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
610 $(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc; \
611 done
612 @list='$(_DOC_LC_DOCS)'; for doc in $$list; do \
613 if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
614 docdir="$$lc/"`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
615 docdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$docdir"; \
616 if ! test -d "$$docdir"; then \
617 echo "$(mkinstalldirs) $$docdir"; \
618 $(mkinstalldirs) "$$docdir"; \
619 fi; \
620 echo "$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
621 $(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc; \
622 done
624 install-doc-figs:
625 @list='$(patsubst C/%,%,$(_DOC_C_FIGURES))'; for fig in $$list; do \
626 for lc in C $(_DOC_REAL_LINGUAS); do \
627 figsymlink=false; \
628 if test -f "$$lc/$$fig"; then \
629 figfile="$$lc/$$fig"; \
630 elif test -f "$(srcdir)/$$lc/$$fig"; then \
631 figfile="$(srcdir)/$$lc/$$fig"; \
632 else \
633 figsymlink=true; \
634 fi; \
635 figdir="$$lc/"`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
636 figdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$figdir"; \
637 if ! test -d "$$figdir"; then \
638 echo "$(mkinstalldirs) $$figdir"; \
639 $(mkinstalldirs) "$$figdir"; \
640 fi; \
641 figbase=`echo $$fig | sed -e 's/^.*\///'`; \
642 if $$figsymlink; then \
643 echo "cd $$figdir && $(LN_S) -f ../../C/$$fig $$figbase"; \
644 ( cd "$$figdir" && $(LN_S) -f "../../C/$$fig" "$$figbase" ); \
645 else \
646 echo "$(INSTALL_DATA) $$figfile $$figdir$$figbase"; \
647 $(INSTALL_DATA) "$$figfile" "$$figdir$$figbase"; \
648 fi; \
649 done; \
650 done
652 install-doc-html:
653 echo install-html
655 install-doc-omf:
656 $(mkinstalldirs) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)
657 @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
658 echo "$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
659 $(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf; \
660 done
661 @if test "x$(_ENABLE_SK)" = "xtrue"; then \
662 echo "scrollkeeper-update -p $(DESTDIR)$(_sklocalstatedir) -o $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
663 scrollkeeper-update -p "$(DESTDIR)$(_sklocalstatedir)" -o "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
666 install-doc-dsk:
667 echo install-dsk
671 ################################################################################
672 ## Uninstall
674 .PHONY: uninstall-doc-docs uninstall-doc-html uninstall-doc-figs uninstall-doc-omf uninstall-doc-dsk
675 uninstall-local: \
676 $(if $(DOC_MODULE)$(DOC_ID),uninstall-doc-docs) \
677 $(if $(_DOC_HTML_ALL),uninstall-doc-html) \
678 $(if $(_DOC_C_FIGURES),uninstall-doc-figs) \
679 $(if $(_DOC_OMF_IN),uninstall-doc-omf)
680 # $(if $(_DOC_DSK_IN),uninstall-doc-dsk)
682 uninstall-doc-docs:
683 @list='$(_DOC_C_DOCS)'; for doc in $$list; do \
684 echo " rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
685 rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
686 done
687 @list='$(_DOC_LC_DOCS)'; for doc in $$list; do \
688 echo " rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
689 rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
690 done
692 uninstall-doc-figs:
693 @list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; for fig in $$list; do \
694 echo "rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
695 rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
696 done;
698 uninstall-doc-omf:
699 @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
700 if test "x$(_ENABLE_SK)" = "xtrue"; then \
701 echo "scrollkeeper-uninstall -p $(_sklocalstatedir) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
702 scrollkeeper-uninstall -p "$(_sklocalstatedir)" "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
703 fi; \
704 echo "rm -f $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
705 rm -f "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
706 done