fix .desktop file
[gconf-editor] / gnome-doc-utils.make
1 # gnome-doc-utils.make - make magic for building documentation
2 # Copyright (C) 2004-2005 Shaun McCance <shaunm@gnome.org>
3 #
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.
8 #
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.
13 #
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.
17 #
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.
22
23 ################################################################################
24 ## @@ Generating Header Files
25
26 ## @ DOC_H_FILE
27 ## The name of the header file to generate
28 DOC_H_FILE ?=
29
30 ## @ DOC_H_DOCS
31 ## The input DocBook files for generating the header file
32 DOC_H_DOCS ?=
33
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
61
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
67
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)";
73
74 doc-dist-hook: dist-check-gdu $(if $(DOC_H_FILE),dist-doc-header)
75
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)
84
85 all: $(DOC_H_FILE)
86
87
88 ################################################################################
89 ## @@ Generating Documentation Files
90
91 ## @ DOC_MODULE
92 ## The name of the document being built
93 DOC_MODULE ?=
94
95 ## @ DOC_ID
96 ## The unique identifier for a Mallard document
97 DOC_ID ?=
98
99 ## @ DOC_PAGES
100 ## Page files in a Mallard document
101 DOC_PAGES ?=
102
103 ## @ DOC_ENTITIES
104 ## Files included with a SYSTEM entity
105 DOC_ENTITIES ?=
106
107 ## @ DOC_INCLUDES
108 ## Files included with XInclude
109 DOC_INCLUDES ?=
110
111 ## @ DOC_FIGURES
112 ## Figures and other external data
113 DOC_FIGURES ?=
114
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))
119
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))
126
127 _DOC_ABS_SRCDIR = @abs_srcdir@
128
129
130 ################################################################################
131 ## Variables for Bootstrapping
132
133 _xml2po ?= `which xml2po`
134 _xml2po_mode = $(if $(DOC_ID),mallard,docbook)
135
136 _db2html ?= `$(PKG_CONFIG) --variable db2html gnome-doc-utils`
137 _db2omf  ?= `$(PKG_CONFIG) --variable db2omf gnome-doc-utils`
138 _malrng  ?= `$(PKG_CONFIG) --variable malrng gnome-doc-utils`
139 _chunks  ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/chunks.xsl
140 _credits ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/credits.xsl
141 _ids ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/ids.xsl
142
143 if ENABLE_SK
144 _ENABLE_SK = true
145 _skpkgdatadir ?= `scrollkeeper-config --pkgdatadir`
146 _sklocalstatedir ?= `scrollkeeper-config --pkglocalstatedir`
147 _skcontentslist ?= $(_skpkgdatadir)/Templates/C/scrollkeeper_cl.xml
148 endif
149
150
151 ################################################################################
152 ## @@ Rules for OMF Files
153
154 db2omf_args =                                                                   \
155         --stringparam db2omf.basename $(DOC_MODULE)                             \
156         --stringparam db2omf.format $(3)                                        \
157         --stringparam db2omf.dtd                                                \
158         $(shell xmllint --format $(2) | grep -h PUBLIC | head -n 1              \
159                 | sed -e 's/.*PUBLIC \(\"[^\"]*\"\).*/\1/')                     \
160         --stringparam db2omf.lang $(notdir $(patsubst %/$(notdir $(2)),%,$(2))) \
161         --stringparam db2omf.omf_dir "$(OMF_DIR)"                               \
162         --stringparam db2omf.help_dir "$(HELP_DIR)"                             \
163         --stringparam db2omf.omf_in "$(_DOC_OMF_IN)"                            \
164         $(if $(_ENABLE_SK),                                                     \
165           --stringparam db2omf.scrollkeeper_cl "$(_skcontentslist)")            \
166         $(_db2omf) $(2)
167
168 ## @ _DOC_OMF_IN
169 ## The OMF input file
170 _DOC_OMF_IN = $(if $(DOC_MODULE),$(wildcard $(_DOC_ABS_SRCDIR)/$(DOC_MODULE).omf.in))
171
172 ## @ _DOC_OMF_DB
173 ## The OMF files for DocBook output
174 _DOC_OMF_DB = $(if $(_DOC_OMF_IN),                                              \
175         $(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-$(lc).omf))
176
177 $(_DOC_OMF_DB) : $(_DOC_OMF_IN)
178 $(_DOC_OMF_DB) : $(DOC_MODULE)-%.omf : %/$(DOC_MODULE).xml
179         @test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || {       \
180           echo "The file '$(_skcontentslist)' does not exist." >&2;             \
181           echo "Please check your ScrollKeeper installation." >&2;              \
182           exit 1; }
183         xsltproc -o $@ $(call db2omf_args,$@,$<,'docbook') || { rm -f "$@"; exit 1; }
184
185 ## @ _DOC_OMF_HTML
186 ## The OMF files for HTML output
187 _DOC_OMF_HTML = $(if $(_DOC_OMF_IN),                                            \
188         $(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-html-$(lc).omf))
189
190 $(_DOC_OMF_HTML) : $(_DOC_OMF_IN)
191 $(_DOC_OMF_HTML) : $(DOC_MODULE)-html-%.omf : %/$(DOC_MODULE).xml
192 if ENABLE_SK
193         @test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || {       \
194           echo "The file '$(_skcontentslist)' does not exist" >&2;              \
195           echo "Please check your ScrollKeeper installation." >&2;              \
196           exit 1; }
197 endif
198         xsltproc -o $@ $(call db2omf_args,$@,$<,'xhtml') || { rm -f "$@"; exit 1; }
199
200 ## @ _DOC_OMF_ALL
201 ## All OMF output files to be built
202 # FIXME
203 _DOC_OMF_ALL =                                                                  \
204         $(if $(filter docbook,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_DB))             \
205         $(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_HTML))
206
207 .PHONY: omf
208 omf: $(_DOC_OMF_ALL)
209
210
211 ################################################################################
212 ## @@ C Locale Documents
213
214 ## @ _DOC_C_MODULE
215 ## The top-level documentation file in the C locale
216 _DOC_C_MODULE = $(if $(DOC_MODULE),C/$(DOC_MODULE).xml)
217
218 ## @ _DOC_C_PAGES
219 ## Page files in a Mallard document in the C locale
220 _DOC_C_PAGES = $(foreach page,$(DOC_PAGES),C/$(page))
221
222 ## @ _DOC_C_ENTITIES
223 ## Files included with a SYSTEM entity in the C locale
224 _DOC_C_ENTITIES = $(foreach ent,$(DOC_ENTITIES),C/$(ent))
225
226 ## @ _DOC_C_XINCLUDES
227 ## Files included with XInclude in the C locale
228 _DOC_C_INCLUDES = $(foreach inc,$(DOC_INCLUDES),C/$(inc))
229
230 ## @ _DOC_C_DOCS
231 ## All documentation files in the C locale
232 _DOC_C_DOCS =                                                           \
233         $(_DOC_C_ENTITIES)      $(_DOC_C_INCLUDES)                      \
234         $(_DOC_C_PAGES)         $(_DOC_C_MODULE)
235
236 ## @ _DOC_C_DOCS_NOENT
237 ## All documentation files in the C locale,
238 ## except files included with a SYSTEM entity
239 _DOC_C_DOCS_NOENT =                                                     \
240         $(_DOC_C_MODULE)        $(_DOC_C_INCLUDES)                      \
241         $(_DOC_C_PAGES)
242
243 ## @ _DOC_C_FIGURES
244 ## All figures and other external data in the C locale
245 _DOC_C_FIGURES = $(if $(DOC_FIGURES),                                   \
246         $(foreach fig,$(DOC_FIGURES),C/$(fig)),                         \
247         $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/C/figures/*.png)))
248
249 ## @ _DOC_C_HTML
250 ## All HTML documentation in the C locale
251 # FIXME: probably have to shell escape to determine the file names
252 _DOC_C_HTML = $(foreach f,                                              \
253         $(shell xsltproc --xinclude                                     \
254           --stringparam db.chunk.basename "$(DOC_MODULE)"               \
255           $(_chunks) "C/$(DOC_MODULE).xml"),                            \
256         C/$(f).xhtml)
257
258 ###############################################################################
259 ## @@ Other Locale Documentation
260
261 ## @ _DOC_POFILES
262 ## The .po files used for translating the document
263 _DOC_POFILES = $(if $(DOC_MODULE)$(DOC_ID),                                     \
264         $(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(lc).po))
265
266 .PHONY: po
267 po: $(_DOC_POFILES)
268
269 ## @ _DOC_LC_MODULES
270 ## The top-level documentation files in all other locales
271 _DOC_LC_MODULES = $(if $(DOC_MODULE),                                           \
272         $(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xml))
273
274 ## @ _DOC_LC_PAGES
275 ## Page files in a Mallard document in all other locales
276 _DOC_LC_PAGES =                                                                 \
277         $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach page,$(_DOC_C_PAGES),       \
278                 $(lc)/$(notdir $(page)) ))
279
280 ## @ _DOC_LC_XINCLUDES
281 ## Files included with XInclude in all other locales
282 _DOC_LC_INCLUDES =                                                              \
283         $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach inc,$(_DOC_C_INCLUDES),     \
284                 $(lc)/$(notdir $(inc)) ))
285
286 ## @ _DOC_LC_HTML
287 ## All HTML documentation in all other locales
288 # FIXME: probably have to shell escape to determine the file names
289 _DOC_LC_HTML =                                                                  \
290         $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach doc,$(_DOC_C_HTML),         \
291                 $(lc)/$(notdir $(doc)) ))
292
293 ## @ _DOC_LC_DOCS
294 ## All documentation files in all other locales
295 _DOC_LC_DOCS =                                                                  \
296         $(_DOC_LC_MODULES)      $(_DOC_LC_INCLUDES)     $(_DOC_LC_PAGES)        \
297         $(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_LC_HTML))
298
299 ## @ _DOC_LC_FIGURES
300 ## All figures and other external data in all other locales
301 _DOC_LC_FIGURES = $(foreach lc,$(_DOC_REAL_LINGUAS),                            \
302         $(patsubst C/%,$(lc)/%,$(_DOC_C_FIGURES)) )
303
304 _DOC_SRC_FIGURES =                                                              \
305         $(foreach fig,$(_DOC_C_FIGURES), $(foreach lc,C $(_DOC_REAL_LINGUAS),   \
306                 $(wildcard $(srcdir)/$(lc)/$(patsubst C/%,%,$(fig))) ))
307
308 $(_DOC_POFILES):
309         @if ! test -d $(dir $@); then \
310           echo "mkdir $(dir $@)"; \
311           mkdir "$(dir $@)"; \
312         fi
313         @if test ! -f $@ -a -f $(srcdir)/$@; then \
314           echo "cp $(srcdir)/$@ $@"; \
315           cp "$(srcdir)/$@" "$@"; \
316         fi;
317         @docs=; \
318         list='$(_DOC_C_DOCS_NOENT)'; for doc in $$list; do \
319           docs="$$docs $(_DOC_ABS_SRCDIR)/$$doc"; \
320         done; \
321         if ! test -f $@; then \
322           echo "(cd $(dir $@) && \
323             $(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
324             cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)"; \
325           (cd $(dir $@) && \
326             $(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
327             cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp); \
328         else \
329           echo "(cd $(dir $@) && \
330             $(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs)"; \
331           (cd $(dir $@) && \
332             $(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs); \
333         fi
334
335 # FIXME: fix the dependancy
336 # FIXME: hook xml2po up
337 $(_DOC_LC_DOCS) : $(_DOC_POFILES)
338 $(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
339         if ! test -d $(dir $@); then mkdir $(dir $@); fi
340         if [ -f "C/$(notdir $@)" ]; then d="../"; else d="$(_DOC_ABS_SRCDIR)/"; fi; \
341         po="$(dir $@)$(patsubst %/$(notdir $@),%,$@).po"; \
342         if [ -f "$${po}" ]; then po="../$${po}"; else po="$(_DOC_ABS_SRCDIR)/$${po}"; fi; \
343         (cd $(dir $@) && \
344           $(_xml2po) -m $(_xml2po_mode) -e -p "$${po}" \
345             "$${d}C/$(notdir $@)" > $(notdir $@).tmp && \
346             cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)
347
348 ## @ _DOC_POT
349 ## A pot file
350 _DOC_POT = $(if $(DOC_MODULE),$(DOC_MODULE).pot)
351 .PHONY: pot
352 pot: $(_DOC_POT)
353 $(_DOC_POT): $(_DOC_C_DOCS_NOENT)
354         $(_xml2po) -m $(_xml2po_mode) -e -o $@ $^
355
356
357 ################################################################################
358 ## @@ All Documentation
359
360 ## @ _DOC_HTML_ALL
361 ## All HTML documentation, only if it's built
362 _DOC_HTML_ALL = $(if $(filter html HTML,$(_DOC_REAL_FORMATS)), \
363         $(_DOC_C_HTML) $(_DOC_LC_HTML))
364
365 _DOC_HTML_TOPS = $(foreach lc,C $(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xhtml)
366
367 $(_DOC_HTML_TOPS): $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
368         xsltproc -o $@ --xinclude --param db.chunk.chunk_top "false()" --stringparam db.chunk.basename "$(DOC_MODULE)" --stringparam db.chunk.extension ".xhtml" $(_db2html) $(patsubst %.xhtml,%.xml,$@)
369
370
371 ################################################################################
372 ## All
373
374 all:                                                    \
375         $(_DOC_C_DOCS)          $(_DOC_LC_DOCS)         \
376         $(_DOC_OMF_ALL)         $(_DOC_DSK_ALL)         \
377         $(_DOC_HTML_ALL)        $(_DOC_POFILES)
378
379
380 ################################################################################
381 ## Clean
382
383 .PHONY: clean-doc-omf clean-doc-dsk clean-doc-lc clean-doc-dir
384
385 clean-doc-omf: ; rm -f $(_DOC_OMF_DB) $(_DOC_OMF_HTML)
386 clean-doc-dsk: ; rm -f $(_DOC_DSK_DB) $(_DOC_DSK_HTML)
387 clean-doc-lc:
388         rm -f $(_DOC_LC_DOCS)
389         @list='$(_DOC_POFILES)'; for po in $$list; do \
390           if ! test "$$po" -ef "$(srcdir)/$$po"; then \
391             echo "rm -f $$po"; \
392             rm -f "$$po"; \
393           fi; \
394         done
395         @for lc in C $(_DOC_REAL_LINGUAS); do \
396           if test -f "$$lc/.xml2po.mo"; then \
397             echo "rm -f $$lc/.xml2po.mo"; \
398             rm -f "$$lc/.xml2po.mo"; \
399           fi; \
400         done
401 clean-doc-dir:
402         @for lc in C $(_DOC_REAL_LINGUAS); do \
403           for dir in `find $$lc -depth -type d`; do \
404             if ! test $$dir -ef $(srcdir)/$$dir; then \
405               echo "rmdir $$dir"; \
406               rmdir "$$dir"; \
407            fi; \
408           done; \
409         done
410
411 _clean_omf = $(if $(_DOC_OMF_IN),clean-doc-omf)
412 _clean_dsk = $(if $(_DOC_DSK_IN),clean-doc-dsk)
413 _clean_lc  = $(if $(_DOC_REAL_LINGUAS),clean-doc-lc)
414 _clean_dir = $(if $(DOC_MODULE)$(DOC_ID),clean-doc-dir)
415
416 clean-local:                                            \
417         $(_clean_omf)           $(_clean_dsk)           \
418         $(_clean_lc)            $(_clean_dir)
419 distclean-local:                                        \
420         $(_clean_omf)           $(_clean_dsk)           \
421         $(_clean_lc)            $(_clean_dir)
422 mostlyclean-local:                                      \
423         $(_clean_omf)           $(_clean_dsk)           \
424         $(_clean_lc)            $(_clean_dir)
425 maintainer-clean-local:                                 \
426         $(_clean_omf)           $(_clean_dsk)           \
427         $(_clean_lc)            $(_clean_dir)
428
429
430
431 ################################################################################
432 ## Dist
433
434 .PHONY: dist-doc-docs dist-doc-pages dist-doc-figs dist-doc-omf dist-doc-dsk
435 doc-dist-hook:                                          \
436         $(if $(DOC_MODULE)$(DOC_ID),dist-doc-docs)      \
437         $(if $(_DOC_C_FIGURES),dist-doc-figs)           \
438         $(if $(_DOC_OMF_IN),dist-doc-omf)
439 #       $(if $(_DOC_DSK_IN),dist-doc-dsk)
440
441 dist-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES)
442         @for lc in C $(_DOC_REAL_LINGUAS); do \
443           echo " $(mkinstalldirs) $(distdir)/$$lc"; \
444           $(mkinstalldirs) "$(distdir)/$$lc"; \
445         done
446         @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES)'; \
447         for doc in $$list; do \
448           if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
449             docdir=`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
450             if ! test -d "$(distdir)/$$docdir"; then \
451               echo "$(mkinstalldirs) $(distdir)/$$docdir"; \
452               $(mkinstalldirs) "$(distdir)/$$docdir"; \
453             fi; \
454           echo "$(INSTALL_DATA) $$d$$doc $(distdir)/$$doc"; \
455           $(INSTALL_DATA) "$$d$$doc" "$(distdir)/$$doc"; \
456         done
457
458 dist-doc-figs: $(_DOC_SRC_FIGURES)
459         @list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; \
460         for fig in $$list; do \
461           if test -f "$$fig"; then d=; else d="$(srcdir)/"; fi; \
462           if test -f "$$d$$fig"; then \
463             figdir=`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
464             if ! test -d "$(distdir)/$$figdir"; then \
465               echo "$(mkinstalldirs) $(distdir)/$$figdir"; \
466               $(mkinstalldirs) "$(distdir)/$$figdir"; \
467             fi; \
468             echo "$(INSTALL_DATA) $$d$$fig $(distdir)/$$fig"; \
469             $(INSTALL_DATA) "$$d$$fig" "$(distdir)/$$fig"; \
470           fi; \
471         done;
472
473 dist-doc-omf:
474         @if test -f "$(_DOC_OMF_IN)"; then d=; else d="$(srcdir)/"; fi; \
475         echo "$(INSTALL_DATA) $$d$(_DOC_OMF_IN) $(distdir)/$(notdir $(_DOC_OMF_IN))"; \
476         $(INSTALL_DATA) "$$d$(_DOC_OMF_IN)" "$(distdir)/$(notdir $(_DOC_OMF_IN))"
477
478 dist-doc-dsk:
479         @if test -f "$(_DOC_DSK_IN)"; then d=; else d="$(srcdir)/"; fi; \
480         echo "$(INSTALL_DATA) $$d$(_DOC_DSK_IN) $(distdir)/$(notdir $(_DOC_DSK_IN))"; \
481         $(INSTALL_DATA) "$$d$(_DOC_DSK_IN)" "$(distdir)/$(notdir $(_DOC_DSK_IN))"
482
483
484
485 ################################################################################
486 ## Check
487
488 .PHONY: check-doc-docs check-doc-omf
489 check:                                                  \
490         $(if $(DOC_MODULE),check-doc-docs)              \
491         $(if $(DOC_ID),check-doc-pages)                 \
492         $(if $(_DOC_OMF_IN),check-doc-omf)
493
494 check-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
495         @for lc in C $(_DOC_REAL_LINGUAS); do \
496           if test -f "$$lc"; \
497             then d=; \
498             xmlpath="$$lc"; \
499           else \
500             d="$(srcdir)/"; \
501             xmlpath="$$lc:$(srcdir)/$$lc"; \
502           fi; \
503           echo "xmllint --noout --noent --path $$xmlpath --xinclude --postvalid $$d$$lc/$(DOC_MODULE).xml"; \
504           xmllint --noout --noent --path "$$xmlpath" --xinclude --postvalid "$$d$$lc/$(DOC_MODULE).xml"; \
505         done
506
507 check-doc-pages: $(_DOC_C_PAGES) $(_DOC_LC_PAGES)
508         for lc in C $(_DOC_REAL_LINGUAS); do \
509           if test -f "$$lc"; \
510             then d=; \
511             xmlpath="$$lc"; \
512           else \
513             d="$(srcdir)/"; \
514             xmlpath="$$lc:$(srcdir)/$$lc"; \
515           fi; \
516           for page in $(DOC_PAGES); do \
517             echo "xmllint --noout --noent --path $$xmlpath --xinclude --relaxng $(_malrng) $$d$$lc/$$page"; \
518             xmllint --noout --noent --path "$$xmlpath" --xinclude --relaxng "$(_malrng)" "$$d$$lc/$$page"; \
519           done; \
520         done
521
522 check-doc-omf: $(_DOC_OMF_ALL)
523         @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
524           echo "xmllint --noout --xinclude --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf"; \
525           xmllint --noout --xinclude --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf; \
526         done
527
528
529
530 ################################################################################
531 ## Install
532
533 .PHONY: install-doc-docs install-doc-html install-doc-figs install-doc-omf install-doc-dsk
534
535 _doc_install_dir = $(if $(DOC_ID),$(DOC_ID),$(DOC_MODULE))
536
537 install-data-local:                                     \
538         $(if $(DOC_MODULE)$(DOC_ID),install-doc-docs)   \
539         $(if $(_DOC_HTML_ALL),install-doc-html)         \
540         $(if $(_DOC_C_FIGURES),install-doc-figs)        \
541         $(if $(_DOC_OMF_IN),install-doc-omf)
542 #       $(if $(_DOC_DSK_IN),install-doc-dsk)
543
544 install-doc-docs:
545         @for lc in C $(_DOC_REAL_LINGUAS); do \
546           echo "$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc"; \
547           $(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc; \
548         done
549         @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
550           if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
551           docdir="$$lc/"`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
552           docdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$docdir"; \
553           if ! test -d "$$docdir"; then \
554             echo "$(mkinstalldirs) $$docdir"; \
555             $(mkinstalldirs) "$$docdir"; \
556           fi; \
557           echo "$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
558           $(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc; \
559         done
560
561 install-doc-figs:
562         @list='$(patsubst C/%,%,$(_DOC_C_FIGURES))'; for fig in $$list; do \
563           for lc in C $(_DOC_REAL_LINGUAS); do \
564             figsymlink=false; \
565             if test -f "$$lc/$$fig"; then \
566               figfile="$$lc/$$fig"; \
567             elif test -f "$(srcdir)/$$lc/$$fig"; then \
568               figfile="$(srcdir)/$$lc/$$fig"; \
569             else \
570               figsymlink=true; \
571             fi; \
572             figdir="$$lc/"`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
573             figdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$figdir"; \
574             if ! test -d "$$figdir"; then \
575               echo "$(mkinstalldirs) $$figdir"; \
576               $(mkinstalldirs) "$$figdir"; \
577             fi; \
578             figbase=`echo $$fig | sed -e 's/^.*\///'`; \
579             if $$figsymlink; then \
580               echo "cd $$figdir && $(LN_S) -f ../../C/$$fig $$figbase"; \
581               ( cd "$$figdir" && $(LN_S) -f "../../C/$$fig" "$$figbase" ); \
582             else \
583               echo "$(INSTALL_DATA) $$figfile $$figdir$$figbase"; \
584               $(INSTALL_DATA) "$$figfile" "$$figdir$$figbase"; \
585             fi; \
586           done; \
587         done
588
589 install-doc-html:
590         echo install-html
591
592 install-doc-omf:
593         $(mkinstalldirs) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)
594         @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
595           echo "$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
596           $(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf; \
597         done
598         @if test "x$(_ENABLE_SK)" = "xtrue"; then \
599           echo "scrollkeeper-update -p $(DESTDIR)$(_sklocalstatedir) -o $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
600           scrollkeeper-update -p "$(DESTDIR)$(_sklocalstatedir)" -o "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
601         fi;
602
603 install-doc-dsk:
604         echo install-dsk
605
606
607
608 ################################################################################
609 ## Uninstall
610
611 .PHONY: uninstall-doc-docs uninstall-doc-html uninstall-doc-figs uninstall-doc-omf uninstall-doc-dsk
612 uninstall-local:                                        \
613         $(if $(DOC_MODULE)$(DOC_ID),uninstall-doc-docs) \
614         $(if $(_DOC_HTML_ALL),uninstall-doc-html)       \
615         $(if $(_DOC_C_FIGURES),uninstall-doc-figs)      \
616         $(if $(_DOC_OMF_IN),uninstall-doc-omf)
617 #       $(if $(_DOC_DSK_IN),uninstall-doc-dsk)
618
619 uninstall-doc-docs:
620         @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
621           echo " rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
622           rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
623         done
624
625 uninstall-doc-figs:
626         @list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; for fig in $$list; do \
627           echo "rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
628           rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
629         done;
630
631 uninstall-doc-omf:
632         @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
633           if test "x$(_ENABLE_SK)" = "xtrue"; then \
634             echo "scrollkeeper-uninstall -p $(_sklocalstatedir) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
635             scrollkeeper-uninstall -p "$(_sklocalstatedir)" "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
636           fi; \
637           echo "rm -f $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
638           rm -f "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
639         done