Updated Danish translation
[banshee.git] / build / gnome-doc-utils.make
blob1f0fe5c037abdac54dace665534504b9a93ff297
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, see <http://www.gnu.org/licenses/>.
17 # As a special exception to the GNU General Public License, if you
18 # distribute this file as part of a program that contains a
19 # configuration script generated by Autoconf, you may include it under
20 # the same distribution terms that you use for the rest of that program.
22 ################################################################################
23 ## @@ Generating Header Files
25 ## @ DOC_H_FILE
26 ## The name of the header file to generate
27 DOC_H_FILE ?=
29 ## @ DOC_H_DOCS
30 ## The input DocBook files for generating the header file
31 DOC_H_DOCS ?=
33 $(DOC_H_FILE): $(DOC_H_DOCS);
34 @rm -f $@.tmp; touch $@.tmp;
35 echo 'const gchar* documentation_credits[] = {' >> $@.tmp
36 list='$(DOC_H_DOCS)'; for doc in $$list; do \
37 xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`"; \
38 if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \
39 xsltproc --path "$$xmlpath" $(_credits) $$doc; \
40 done | sort | uniq \
41 | 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}}' \
42 | sed -e 's/\\/\\\\/' -e 's/"/\\"/' -e 's/\(.*\)/\t"\1",/' >> $@.tmp
43 echo ' NULL' >> $@.tmp
44 echo '};' >> $@.tmp
45 echo >> $@.tmp
46 list='$(DOC_H_DOCS)'; for doc in $$list; do \
47 xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`"; \
48 if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \
49 docid=`echo "$$doc" | sed -e 's/.*\/\([^/]*\)\.xml/\1/' \
50 | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`; \
51 echo $$xmlpath; \
52 ids=`xsltproc --xinclude --path "$$xmlpath" $(_ids) $$doc`; \
53 for id in $$ids; do \
54 echo '#define HELP_'`echo $$docid`'_'`echo $$id \
55 | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`' "'$$id'"' >> $@.tmp; \
56 done; \
57 echo >> $@.tmp; \
58 done;
59 cp $@.tmp $@ && rm -f $@.tmp
61 dist-check-gdu:
62 if !HAVE_GNOME_DOC_UTILS
63 @echo "*** GNOME Doc Utils must be installed in order to make dist"
64 @false
65 endif
67 .PHONY: dist-doc-header
68 dist-doc-header: $(DOC_H_FILE)
69 @if test -f "$(DOC_H_FILE)"; then d=; else d="$(srcdir)/"; fi; \
70 echo "$(INSTALL_DATA) $${d}$(DOC_H_FILE) $(distdir)/$(DOC_H_FILE)"; \
71 $(INSTALL_DATA) "$${d}$(DOC_H_FILE)" "$(distdir)/$(DOC_H_FILE)";
73 doc-dist-hook: dist-check-gdu $(if $(DOC_H_FILE),dist-doc-header)
75 .PHONY: clean-doc-header
76 _clean_doc_header = $(if $(DOC_H_FILE),clean-doc-header)
77 clean-local: $(_clean_doc_header)
78 distclean-local: $(_clean_doc_header)
79 mostlyclean-local: $(_clean_doc_header)
80 maintainer-clean-local: $(_clean_doc_header)
81 clean-doc-header:
82 rm -f $(DOC_H_FILE)
84 all: $(DOC_H_FILE)
87 ################################################################################
88 ## @@ Generating Documentation Files
90 ## @ DOC_MODULE
91 ## The name of the document being built
92 DOC_MODULE ?=
94 ## @ DOC_ID
95 ## The unique identifier for a Mallard document
96 DOC_ID ?=
98 ## @ DOC_PAGES
99 ## Page files in a Mallard document
100 DOC_PAGES ?=
102 ## @ DOC_ENTITIES
103 ## Files included with a SYSTEM entity
104 DOC_ENTITIES ?=
106 ## @ DOC_INCLUDES
107 ## Files included with XInclude
108 DOC_INCLUDES ?=
110 ## @ DOC_FIGURES
111 ## Figures and other external data
112 DOC_FIGURES ?=
114 ## @ DOC_FORMATS
115 ## The default formats to be built and installed
116 DOC_FORMATS ?= docbook
117 _DOC_REAL_FORMATS = $(if $(DOC_USER_FORMATS),$(DOC_USER_FORMATS),$(DOC_FORMATS))
119 ## @ DOC_LINGUAS
120 ## The languages this document is translated into
121 DOC_LINGUAS ?=
122 _DOC_REAL_LINGUAS = $(if $(filter environment,$(origin LINGUAS)), \
123 $(filter $(LINGUAS),$(DOC_LINGUAS)), \
124 $(DOC_LINGUAS))
126 _DOC_ABS_SRCDIR = @abs_srcdir@
129 ################################################################################
130 ## Variables for Bootstrapping
132 _xml2po ?= `which xml2po`
133 _xml2po_mode = $(if $(DOC_ID),mallard,docbook)
135 _db2html ?= `$(PKG_CONFIG) --variable db2html gnome-doc-utils`
136 _db2omf ?= `$(PKG_CONFIG) --variable db2omf gnome-doc-utils`
137 _malrng ?= `$(PKG_CONFIG) --variable malrng 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 ?= `$(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 ## @@ Rules for OMF Files
153 db2omf_args = \
154 --stringparam db2omf.basename $(DOC_MODULE) \
155 --stringparam db2omf.format $(3) \
156 --stringparam db2omf.dtd \
157 $(shell xmllint --format $(2) | grep -h PUBLIC | head -n 1 \
158 | sed -e 's/.*PUBLIC \(\"[^\"]*\"\).*/\1/') \
159 --stringparam db2omf.lang $(notdir $(patsubst %/$(notdir $(2)),%,$(2))) \
160 --stringparam db2omf.omf_dir "$(OMF_DIR)" \
161 --stringparam db2omf.help_dir "$(HELP_DIR)" \
162 --stringparam db2omf.omf_in "$(_DOC_OMF_IN)" \
163 $(if $(_ENABLE_SK), \
164 --stringparam db2omf.scrollkeeper_cl "$(_skcontentslist)") \
165 $(_db2omf) $(2)
167 ## @ _DOC_OMF_IN
168 ## The OMF input file
169 _DOC_OMF_IN = $(if $(DOC_MODULE),$(wildcard $(_DOC_ABS_SRCDIR)/$(DOC_MODULE).omf.in))
171 ## @ _DOC_OMF_DB
172 ## The OMF files for DocBook output
173 _DOC_OMF_DB = $(if $(_DOC_OMF_IN), \
174 $(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-$(lc).omf))
176 $(_DOC_OMF_DB) : $(_DOC_OMF_IN)
177 $(_DOC_OMF_DB) : $(DOC_MODULE)-%.omf : %/$(DOC_MODULE).xml
178 @test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || { \
179 echo "The file '$(_skcontentslist)' does not exist." >&2; \
180 echo "Please check your ScrollKeeper installation." >&2; \
181 exit 1; }
182 xsltproc -o $@ $(call db2omf_args,$@,$<,'docbook') || { rm -f "$@"; exit 1; }
184 ## @ _DOC_OMF_HTML
185 ## The OMF files for HTML output
186 _DOC_OMF_HTML = $(if $(_DOC_OMF_IN), \
187 $(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-html-$(lc).omf))
189 $(_DOC_OMF_HTML) : $(_DOC_OMF_IN)
190 $(_DOC_OMF_HTML) : $(DOC_MODULE)-html-%.omf : %/$(DOC_MODULE).xml
191 if ENABLE_SK
192 @test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || { \
193 echo "The file '$(_skcontentslist)' does not exist" >&2; \
194 echo "Please check your ScrollKeeper installation." >&2; \
195 exit 1; }
196 endif
197 xsltproc -o $@ $(call db2omf_args,$@,$<,'xhtml') || { rm -f "$@"; exit 1; }
199 ## @ _DOC_OMF_ALL
200 ## All OMF output files to be built
201 # FIXME
202 _DOC_OMF_ALL = \
203 $(if $(filter docbook,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_DB)) \
204 $(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_HTML))
206 .PHONY: omf
207 omf: $(_DOC_OMF_ALL)
210 ################################################################################
211 ## @@ C Locale Documents
213 ## @ _DOC_C_MODULE
214 ## The top-level documentation file in the C locale
215 _DOC_C_MODULE = $(if $(DOC_MODULE),C/$(DOC_MODULE).xml)
217 ## @ _DOC_C_PAGES
218 ## Page files in a Mallard document in the C locale
219 _DOC_C_PAGES = $(foreach page,$(DOC_PAGES),C/$(page))
221 ## @ _DOC_C_ENTITIES
222 ## Files included with a SYSTEM entity in the C locale
223 _DOC_C_ENTITIES = $(foreach ent,$(DOC_ENTITIES),C/$(ent))
225 ## @ _DOC_C_XINCLUDES
226 ## Files included with XInclude in the C locale
227 _DOC_C_INCLUDES = $(foreach inc,$(DOC_INCLUDES),C/$(inc))
229 ## @ _DOC_C_DOCS
230 ## All documentation files in the C locale
231 _DOC_C_DOCS = \
232 $(_DOC_C_ENTITIES) $(_DOC_C_INCLUDES) \
233 $(_DOC_C_PAGES) $(_DOC_C_MODULE)
235 ## @ _DOC_C_DOCS_NOENT
236 ## All documentation files in the C locale,
237 ## except files included with a SYSTEM entity
238 _DOC_C_DOCS_NOENT = \
239 $(_DOC_C_MODULE) $(_DOC_C_INCLUDES) \
240 $(_DOC_C_PAGES)
242 ## @ _DOC_C_FIGURES
243 ## All figures and other external data in the C locale
244 _DOC_C_FIGURES = $(if $(DOC_FIGURES), \
245 $(foreach fig,$(DOC_FIGURES),C/$(fig)), \
246 $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/C/figures/*.png)))
248 ## @ _DOC_C_HTML
249 ## All HTML documentation in the C locale
250 # FIXME: probably have to shell escape to determine the file names
251 _DOC_C_HTML = $(foreach f, \
252 $(shell xsltproc --xinclude \
253 --stringparam db.chunk.basename "$(DOC_MODULE)" \
254 $(_chunks) "C/$(DOC_MODULE).xml"), \
255 C/$(f).xhtml)
257 ###############################################################################
258 ## @@ Other Locale Documentation
260 ## @ _DOC_POFILES
261 ## The .po files used for translating the document
262 _DOC_POFILES = $(if $(DOC_MODULE)$(DOC_ID), \
263 $(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(lc).po))
265 .PHONY: po
266 po: $(_DOC_POFILES)
268 ## @ _DOC_MOFILES
269 ## The .mo files used for translating the document
270 _DOC_MOFILES = $(patsubst %.po,%.mo,$(_DOC_POFILES))
272 .PHONY: mo
273 mo: $(_DOC_MOFILES)
275 ## @ _DOC_LC_MODULES
276 ## The top-level documentation files in all other locales
277 _DOC_LC_MODULES = $(if $(DOC_MODULE), \
278 $(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xml))
280 ## @ _DOC_LC_PAGES
281 ## Page files in a Mallard document in all other locales
282 _DOC_LC_PAGES = \
283 $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach page,$(_DOC_C_PAGES), \
284 $(lc)/$(notdir $(page)) ))
286 ## @ _DOC_LC_XINCLUDES
287 ## Files included with XInclude in all other locales
288 _DOC_LC_INCLUDES = \
289 $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach inc,$(_DOC_C_INCLUDES), \
290 $(lc)/$(notdir $(inc)) ))
292 ## @ _DOC_LC_HTML
293 ## All HTML documentation in all other locales
294 # FIXME: probably have to shell escape to determine the file names
295 _DOC_LC_HTML = \
296 $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach doc,$(_DOC_C_HTML), \
297 $(lc)/$(notdir $(doc)) ))
299 ## @ _DOC_LC_DOCS
300 ## All documentation files in all other locales
301 _DOC_LC_DOCS = \
302 $(_DOC_LC_MODULES) $(_DOC_LC_INCLUDES) $(_DOC_LC_PAGES) \
303 $(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_LC_HTML))
305 ## @ _DOC_LC_FIGURES
306 ## All figures and other external data in all other locales
307 _DOC_LC_FIGURES = $(foreach lc,$(_DOC_REAL_LINGUAS), \
308 $(patsubst C/%,$(lc)/%,$(_DOC_C_FIGURES)) )
310 _DOC_SRC_FIGURES = \
311 $(foreach fig,$(_DOC_C_FIGURES), $(foreach lc,C $(_DOC_REAL_LINGUAS), \
312 $(wildcard $(srcdir)/$(lc)/$(patsubst C/%,%,$(fig))) ))
314 $(_DOC_POFILES):
315 @if ! test -d $(dir $@); then \
316 echo "mkdir $(dir $@)"; \
317 mkdir "$(dir $@)"; \
319 @if test ! -f $@ -a -f $(srcdir)/$@; then \
320 echo "cp $(srcdir)/$@ $@"; \
321 cp "$(srcdir)/$@" "$@"; \
323 @docs=; \
324 list='$(_DOC_C_DOCS_NOENT)'; for doc in $$list; do \
325 docs="$$docs $(_DOC_ABS_SRCDIR)/$$doc"; \
326 done; \
327 if ! test -f $@; then \
328 echo "(cd $(dir $@) && \
329 $(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
330 cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)"; \
331 (cd $(dir $@) && \
332 $(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
333 cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp); \
334 else \
335 echo "(cd $(dir $@) && \
336 $(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs)"; \
337 (cd $(dir $@) && \
338 $(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs); \
341 $(_DOC_MOFILES): %.mo: %.po
342 @if ! test -d $(dir $@); then \
343 echo "mkdir $(dir $@)"; \
344 mkdir "$(dir $@)"; \
346 msgfmt -o $@ $<
348 # FIXME: fix the dependancy
349 # FIXME: hook xml2po up
350 $(_DOC_LC_DOCS) : $(_DOC_MOFILES)
351 $(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
352 if ! test -d $(dir $@); then mkdir $(dir $@); fi
353 if [ -f "C/$(notdir $@)" ]; then d="../"; else d="$(_DOC_ABS_SRCDIR)/"; fi; \
354 mo="$(dir $@)$(patsubst %/$(notdir $@),%,$@).mo"; \
355 if [ -f "$${mo}" ]; then mo="../$${mo}"; else mo="$(_DOC_ABS_SRCDIR)/$${mo}"; fi; \
356 (cd $(dir $@) && \
357 $(_xml2po) -m $(_xml2po_mode) -e -t "$${mo}" \
358 "$${d}C/$(notdir $@)" > $(notdir $@).tmp && \
359 cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)
361 ## @ _DOC_POT
362 ## A pot file
363 _DOC_POT = $(if $(DOC_MODULE),$(DOC_MODULE).pot)
364 .PHONY: pot
365 pot: $(_DOC_POT)
366 $(_DOC_POT): $(_DOC_C_DOCS_NOENT)
367 $(_xml2po) -m $(_xml2po_mode) -e -o $@ $^
370 ################################################################################
371 ## @@ All Documentation
373 ## @ _DOC_HTML_ALL
374 ## All HTML documentation, only if it's built
375 _DOC_HTML_ALL = $(if $(filter html HTML,$(_DOC_REAL_FORMATS)), \
376 $(_DOC_C_HTML) $(_DOC_LC_HTML))
378 _DOC_HTML_TOPS = $(foreach lc,C $(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xhtml)
380 $(_DOC_HTML_TOPS): $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
381 xsltproc -o $@ --xinclude --param db.chunk.chunk_top "false()" --stringparam db.chunk.basename "$(DOC_MODULE)" --stringparam db.chunk.extension ".xhtml" $(_db2html) $(patsubst %.xhtml,%.xml,$@)
384 ################################################################################
385 ## All
387 all: \
388 $(_DOC_C_DOCS) $(_DOC_LC_DOCS) \
389 $(_DOC_OMF_ALL) $(_DOC_DSK_ALL) \
390 $(_DOC_HTML_ALL) $(_DOC_POFILES)
393 ################################################################################
394 ## Clean
396 .PHONY: clean-doc-omf clean-doc-dsk clean-doc-lc clean-doc-dir
398 clean-doc-omf: ; rm -f $(_DOC_OMF_DB) $(_DOC_OMF_HTML)
399 clean-doc-dsk: ; rm -f $(_DOC_DSK_DB) $(_DOC_DSK_HTML)
400 clean-doc-lc:
401 rm -f $(_DOC_LC_DOCS)
402 rm -f $(_DOC_MOFILES)
403 @list='$(_DOC_POFILES)'; for po in $$list; do \
404 if ! test "$$po" -ef "$(srcdir)/$$po"; then \
405 echo "rm -f $$po"; \
406 rm -f "$$po"; \
407 fi; \
408 done
409 # .xml2.po.mo cleaning is obsolete as of 0.18.1 and could be removed in 0.20.x
410 @for lc in C $(_DOC_REAL_LINGUAS); do \
411 if test -f "$$lc/.xml2po.mo"; then \
412 echo "rm -f $$lc/.xml2po.mo"; \
413 rm -f "$$lc/.xml2po.mo"; \
414 fi; \
415 done
416 clean-doc-dir: clean-doc-lc
417 @for lc in C $(_DOC_REAL_LINGUAS); do \
418 for dir in `find $$lc -depth -type d`; do \
419 if ! test $$dir -ef $(srcdir)/$$dir; then \
420 echo "rmdir $$dir"; \
421 rmdir "$$dir"; \
422 fi; \
423 done; \
424 done
426 _clean_omf = $(if $(_DOC_OMF_IN),clean-doc-omf)
427 _clean_dsk = $(if $(_DOC_DSK_IN),clean-doc-dsk)
428 _clean_lc = $(if $(_DOC_REAL_LINGUAS),clean-doc-lc)
429 _clean_dir = $(if $(DOC_MODULE)$(DOC_ID),clean-doc-dir)
431 clean-local: \
432 $(_clean_omf) $(_clean_dsk) \
433 $(_clean_lc) $(_clean_dir)
434 distclean-local: \
435 $(_clean_omf) $(_clean_dsk) \
436 $(_clean_lc) $(_clean_dir)
437 mostlyclean-local: \
438 $(_clean_omf) $(_clean_dsk) \
439 $(_clean_lc) $(_clean_dir)
440 maintainer-clean-local: \
441 $(_clean_omf) $(_clean_dsk) \
442 $(_clean_lc) $(_clean_dir)
446 ################################################################################
447 ## Dist
449 .PHONY: dist-doc-docs dist-doc-pages dist-doc-figs dist-doc-omf dist-doc-dsk
450 doc-dist-hook: \
451 $(if $(DOC_MODULE)$(DOC_ID),dist-doc-docs) \
452 $(if $(_DOC_C_FIGURES),dist-doc-figs) \
453 $(if $(_DOC_OMF_IN),dist-doc-omf)
454 # $(if $(_DOC_DSK_IN),dist-doc-dsk)
456 dist-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES)
457 @for lc in C $(_DOC_REAL_LINGUAS); do \
458 echo " $(mkinstalldirs) $(distdir)/$$lc"; \
459 $(mkinstalldirs) "$(distdir)/$$lc"; \
460 done
461 @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES)'; \
462 for doc in $$list; do \
463 if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
464 docdir=`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
465 if ! test -d "$(distdir)/$$docdir"; then \
466 echo "$(mkinstalldirs) $(distdir)/$$docdir"; \
467 $(mkinstalldirs) "$(distdir)/$$docdir"; \
468 fi; \
469 echo "$(INSTALL_DATA) $$d$$doc $(distdir)/$$doc"; \
470 $(INSTALL_DATA) "$$d$$doc" "$(distdir)/$$doc"; \
471 done
473 dist-doc-figs: $(_DOC_SRC_FIGURES)
474 @list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; \
475 for fig in $$list; do \
476 if test -f "$$fig"; then d=; else d="$(srcdir)/"; fi; \
477 if test -f "$$d$$fig"; then \
478 figdir=`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
479 if ! test -d "$(distdir)/$$figdir"; then \
480 echo "$(mkinstalldirs) $(distdir)/$$figdir"; \
481 $(mkinstalldirs) "$(distdir)/$$figdir"; \
482 fi; \
483 echo "$(INSTALL_DATA) $$d$$fig $(distdir)/$$fig"; \
484 $(INSTALL_DATA) "$$d$$fig" "$(distdir)/$$fig"; \
485 fi; \
486 done;
488 dist-doc-omf:
489 @if test -f "$(_DOC_OMF_IN)"; then d=; else d="$(srcdir)/"; fi; \
490 echo "$(INSTALL_DATA) $$d$(_DOC_OMF_IN) $(distdir)/$(notdir $(_DOC_OMF_IN))"; \
491 $(INSTALL_DATA) "$$d$(_DOC_OMF_IN)" "$(distdir)/$(notdir $(_DOC_OMF_IN))"
493 dist-doc-dsk:
494 @if test -f "$(_DOC_DSK_IN)"; then d=; else d="$(srcdir)/"; fi; \
495 echo "$(INSTALL_DATA) $$d$(_DOC_DSK_IN) $(distdir)/$(notdir $(_DOC_DSK_IN))"; \
496 $(INSTALL_DATA) "$$d$(_DOC_DSK_IN)" "$(distdir)/$(notdir $(_DOC_DSK_IN))"
500 ################################################################################
501 ## Check
503 .PHONY: check-doc-docs check-doc-omf
504 check: \
505 $(if $(DOC_MODULE),check-doc-docs) \
506 $(if $(DOC_ID),check-doc-pages) \
507 $(if $(_DOC_OMF_IN),check-doc-omf)
509 check-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
510 @for lc in C $(_DOC_REAL_LINGUAS); do \
511 if test -f "$$lc"; \
512 then d=; \
513 xmlpath="$$lc"; \
514 else \
515 d="$(srcdir)/"; \
516 xmlpath="$$lc:$(srcdir)/$$lc"; \
517 fi; \
518 echo "xmllint --noout --noent --path $$xmlpath --xinclude --postvalid $$d$$lc/$(DOC_MODULE).xml"; \
519 xmllint --noout --noent --path "$$xmlpath" --xinclude --postvalid "$$d$$lc/$(DOC_MODULE).xml"; \
520 done
522 check-doc-pages: $(_DOC_C_PAGES) $(_DOC_LC_PAGES)
523 for lc in C $(_DOC_REAL_LINGUAS); do \
524 if test -f "$$lc"; \
525 then d=; \
526 xmlpath="$$lc"; \
527 else \
528 d="$(srcdir)/"; \
529 xmlpath="$$lc:$(srcdir)/$$lc"; \
530 fi; \
531 for page in $(DOC_PAGES); do \
532 echo "xmllint --noout --noent --path $$xmlpath --xinclude --relaxng $(_malrng) $$d$$lc/$$page"; \
533 xmllint --noout --noent --path "$$xmlpath" --xinclude --relaxng "$(_malrng)" "$$d$$lc/$$page"; \
534 done; \
535 done
537 check-doc-omf: $(_DOC_OMF_ALL)
538 @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
539 echo "xmllint --noout --xinclude --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf"; \
540 xmllint --noout --xinclude --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf; \
541 done
545 ################################################################################
546 ## Install
548 .PHONY: install-doc-docs install-doc-html install-doc-figs install-doc-omf install-doc-dsk
550 _doc_install_dir = $(if $(DOC_ID),$(DOC_ID),$(DOC_MODULE))
552 install-data-local: \
553 $(if $(DOC_MODULE)$(DOC_ID),install-doc-docs) \
554 $(if $(_DOC_HTML_ALL),install-doc-html) \
555 $(if $(_DOC_C_FIGURES),install-doc-figs) \
556 $(if $(_DOC_OMF_IN),install-doc-omf)
557 # $(if $(_DOC_DSK_IN),install-doc-dsk)
559 install-doc-docs:
560 @for lc in C $(_DOC_REAL_LINGUAS); do \
561 echo "$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc"; \
562 $(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc; \
563 done
564 @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
565 if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
566 docdir="$$lc/"`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
567 docdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$docdir"; \
568 if ! test -d "$$docdir"; then \
569 echo "$(mkinstalldirs) $$docdir"; \
570 $(mkinstalldirs) "$$docdir"; \
571 fi; \
572 echo "$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
573 $(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc; \
574 done
576 install-doc-figs:
577 @list='$(patsubst C/%,%,$(_DOC_C_FIGURES))'; for fig in $$list; do \
578 for lc in C $(_DOC_REAL_LINGUAS); do \
579 figsymlink=false; \
580 if test -f "$$lc/$$fig"; then \
581 figfile="$$lc/$$fig"; \
582 elif test -f "$(srcdir)/$$lc/$$fig"; then \
583 figfile="$(srcdir)/$$lc/$$fig"; \
584 else \
585 figsymlink=true; \
586 fi; \
587 figdir="$$lc/"`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
588 figdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$figdir"; \
589 if ! test -d "$$figdir"; then \
590 echo "$(mkinstalldirs) $$figdir"; \
591 $(mkinstalldirs) "$$figdir"; \
592 fi; \
593 figbase=`echo $$fig | sed -e 's/^.*\///'`; \
594 if $$figsymlink; then \
595 echo "cd $$figdir && $(LN_S) -f ../../C/$$fig $$figbase"; \
596 ( cd "$$figdir" && $(LN_S) -f "../../C/$$fig" "$$figbase" ); \
597 else \
598 echo "$(INSTALL_DATA) $$figfile $$figdir$$figbase"; \
599 $(INSTALL_DATA) "$$figfile" "$$figdir$$figbase"; \
600 fi; \
601 done; \
602 done
604 install-doc-html:
605 echo install-html
607 install-doc-omf:
608 $(mkinstalldirs) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)
609 @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
610 echo "$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
611 $(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf; \
612 done
613 @if test "x$(_ENABLE_SK)" = "xtrue"; then \
614 echo "scrollkeeper-update -p $(DESTDIR)$(_sklocalstatedir) -o $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
615 scrollkeeper-update -p "$(DESTDIR)$(_sklocalstatedir)" -o "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
618 install-doc-dsk:
619 echo install-dsk
623 ################################################################################
624 ## Uninstall
626 .PHONY: uninstall-doc-docs uninstall-doc-html uninstall-doc-figs uninstall-doc-omf uninstall-doc-dsk
627 uninstall-local: \
628 $(if $(DOC_MODULE)$(DOC_ID),uninstall-doc-docs) \
629 $(if $(_DOC_HTML_ALL),uninstall-doc-html) \
630 $(if $(_DOC_C_FIGURES),uninstall-doc-figs) \
631 $(if $(_DOC_OMF_IN),uninstall-doc-omf)
632 # $(if $(_DOC_DSK_IN),uninstall-doc-dsk)
634 uninstall-doc-docs:
635 @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
636 echo " rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
637 rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
638 done
640 uninstall-doc-figs:
641 @list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; for fig in $$list; do \
642 echo "rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
643 rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
644 done;
646 uninstall-doc-omf:
647 @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
648 if test "x$(_ENABLE_SK)" = "xtrue"; then \
649 echo "scrollkeeper-uninstall -p $(_sklocalstatedir) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
650 scrollkeeper-uninstall -p "$(_sklocalstatedir)" "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
651 fi; \
652 echo "rm -f $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
653 rm -f "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
654 done