~ubuntu-branches/debian/stretch/sensors-applet/stretch

« back to all changes in this revision

Viewing changes to gnome-doc-utils.make

  • Committer: Bazaar Package Importer
  • Author(s): Sam Morris
  • Date: 2006-03-24 16:25:34 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060324162534-ve0y6abed8w8map7
Tags: 1.6.1-1
* New upstream release
  - use libsensors instead of reading directly from /sys (closes: #353899).
* Build-depend on libsensors-dev
* Add NEWS file describing how to upgrade

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
.PHONY: dist-doc-header
 
63
dist-doc-header: $(DOC_H_FILE)
 
64
        @if test -f "$(DOC_H_FILE)"; then d=; else d="$(srcdir)/"; fi; \
 
65
        echo "$(INSTALL_DATA) $${d}$(DOC_H_FILE) $(distdir)/$(DOC_H_FILE)"; \
 
66
        $(INSTALL_DATA) "$${d}$(DOC_H_FILE)" "$(distdir)/$(DOC_H_FILE)";
 
67
 
 
68
doc-dist-hook: $(if $(DOC_H_FILE),dist-doc-header)
 
69
 
 
70
.PHONY: clean-doc-header
 
71
_clean_doc_header = $(if $(DOC_H_FILE),clean-doc-header)
 
72
clean-local: $(_clean_doc_header)
 
73
distclean-local: $(_clean_doc_header)
 
74
mostlyclean-local: $(_clean_doc_header)
 
75
maintainer-clean-local: $(_clean_doc_header)
 
76
clean-doc-header:
 
77
        rm -f $(DOC_H_FILE)
 
78
 
 
79
all: $(DOC_H_FILE)
 
80
 
 
81
 
 
82
################################################################################
 
83
## @@ Generating Documentation Files
 
84
 
 
85
## @ DOC_MODULE
 
86
## The name of the document being built
 
87
DOC_MODULE ?=
 
88
 
 
89
## @ DOC_ENTITIES
 
90
## Files included with a SYSTEM entity
 
91
DOC_ENTITIES ?=
 
92
 
 
93
## @ DOC_INCLUDES
 
94
## Files included with XInclude
 
95
DOC_INCLUDES ?=
 
96
 
 
97
## @ DOC_FIGURES
 
98
## Figures and other external data
 
99
DOC_FIGURES ?=
 
100
 
 
101
## @ DOC_FORMATS
 
102
## The default formats to be built and installed
 
103
DOC_FORMATS ?= docbook
 
104
_DOC_REAL_FORMATS = $(if $(DOC_USER_FORMATS),$(DOC_USER_FORMATS),$(DOC_FORMATS))
 
105
 
 
106
## @ DOC_LINGUAS
 
107
## The languages this document is translated into
 
108
DOC_LINGUAS ?=
 
109
 
 
110
## @ RNGDOC_DIRS
 
111
## The directories containing RNG files to be documented with rngdoc
 
112
RNGDOC_DIRS ?=
 
113
 
 
114
## @ XSLDOC_DIRS
 
115
## The directories containing XSLT files to be documented with xsldoc
 
116
XSLDOC_DIRS ?=
 
117
 
 
118
 
 
119
################################################################################
 
120
## Variables for Bootstrapping
 
121
 
 
122
_xml2po ?= `which xml2po`
 
123
 
 
124
_db2html ?= `$(PKG_CONFIG) --variable db2html gnome-doc-utils`
 
125
_db2omf  ?= `$(PKG_CONFIG) --variable db2omf gnome-doc-utils`
 
126
_rngdoc  ?= `$(PKG_CONFIG) --variable rngdoc gnome-doc-utils`
 
127
_xsldoc  ?= `$(PKG_CONFIG) --variable xsldoc gnome-doc-utils`
 
128
_chunks  ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/chunks.xsl
 
129
_credits ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/credits.xsl
 
130
_ids ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/ids.xsl
 
131
 
 
132
_sklocalstatedir ?= `scrollkeeper-config --pkglocalstatedir`
 
133
 
 
134
 
 
135
################################################################################
 
136
## @@ Rules for rngdoc
 
137
 
 
138
rngdoc_args =                                                                   \
 
139
        --stringparam rngdoc.id                                                 \
 
140
        $(shell echo $(basename $(notdir $(1))) | sed -e 's/[^A-Za-z0-9_-]/_/g')\
 
141
        $(_rngdoc) $(filter %/$(basename $(notdir $(1))).rng,$(_RNGDOC_RNGS))
 
142
 
 
143
## @ _RNGDOC_RNGS
 
144
## The actual RNG files for which to generate documentation with rngdoc
 
145
_RNGDOC_RNGS = $(sort $(patsubst ./%, %, $(foreach dir,$(RNGDOC_DIRS),          \
 
146
        $(wildcard $(dir)/*.rng) $(wildcard $(srcdir)/$(dir)/*.rng))))
 
147
 
 
148
## @ _RNGDOC_C_DOCS
 
149
## The generated rngdoc documentation in the C locale
 
150
_RNGDOC_C_DOCS = $(foreach rng,$(_RNGDOC_RNGS), C/$(basename $(notdir $(rng))).xml)
 
151
 
 
152
# FIXME: Fix the dependancies
 
153
$(_RNGDOC_C_DOCS) : $(_RNGDOC_RNGS)
 
154
        if ! test -d $(dir $@); then mkdir $(dir $@); fi;
 
155
        xsltproc $(call rngdoc_args,$@,$<) | xmllint --c14n - > $@.tmp && \
 
156
          cp $@.tmp $@ && rm -f $@.tmp
 
157
 
 
158
.PHONY: rngdoc
 
159
rngdoc: $(_RNGDOC_C_DOCS)
 
160
 
 
161
 
 
162
################################################################################
 
163
## @@ Rules for xsldoc
 
164
 
 
165
# FIXME: _XSLDOC_XSLS is getting dupes with relative/absolute in some
 
166
# cases.  Right now, I'm just taking the first, but that's just a bad
 
167
# work-around.  Fix the real problem.
 
168
xsldoc_args =                                                                   \
 
169
        --stringparam xsldoc.id                                                 \
 
170
        $(shell echo $(basename $(notdir $(1))) | sed -e 's/[^A-Za-z0-9_-]/_/g')\
 
171
        $(_xsldoc)                                                              \
 
172
        $(word 1,$(filter %/$(basename $(notdir $(1))).xsl,$(_XSLDOC_XSLS)))
 
173
 
 
174
## @ _XSLDOC_XSLS
 
175
## The actual XSLT files for which to generate documentation with xsldoc
 
176
_XSLDOC_XSLS = $(sort $(patsubst ./%, %, $(foreach dir,$(XSLDOC_DIRS),          \
 
177
        $(wildcard $(dir)/*.xsl) $(wildcard $(srcdir)/$(dir)/*.xsl))))
 
178
 
 
179
## @ _XSLDOC_C_DOCS
 
180
## The generated xsldoc documentation in the C locale
 
181
_XSLDOC_C_DOCS = $(foreach xsl,$(_XSLDOC_XSLS), C/$(basename $(notdir $(xsl))).xml)
 
182
 
 
183
# FIXME: Fix the dependancies
 
184
$(_XSLDOC_C_DOCS) : $(_XSLDOC_XSLS)
 
185
        if ! test -d $(dir $@); then mkdir $(dir $@); fi;
 
186
        xsltproc $(call xsldoc_args,$@,$<) | xmllint --c14n - > $@.tmp && \
 
187
          cp $@.tmp $@ && rm -f $@.tmp
 
188
 
 
189
.PHONY: xsldoc
 
190
xsldoc: $(_XSLDOC_C_DOCS)
 
191
 
 
192
 
 
193
################################################################################
 
194
## @@ Rules for OMF Files
 
195
 
 
196
db2omf_args =                                                                   \
 
197
        --stringparam db2omf.basename $(DOC_MODULE)                             \
 
198
        --stringparam db2omf.format $(3)                                        \
 
199
        --stringparam db2omf.dtd                                                \
 
200
        $(shell xmllint --format $(2) | grep -h PUBLIC | head -n 1              \
 
201
                | sed -e 's/.*PUBLIC \(\"[^\"]*\"\).*/\1/')                     \
 
202
        --stringparam db2omf.lang $(notdir $(patsubst %/$(notdir $(2)),%,$(2))) \
 
203
        --stringparam db2omf.omf_dir "$(OMF_DIR)"                               \
 
204
        --stringparam db2omf.help_dir "$(HELP_DIR)"                             \
 
205
        --stringparam db2omf.omf_in "`pwd`/$(_DOC_OMF_IN)"                      \
 
206
        $(_db2omf) $(2)
 
207
 
 
208
## @ _DOC_OMF_IN
 
209
## The OMF input file
 
210
_DOC_OMF_IN = $(if $(DOC_MODULE),$(wildcard $(srcdir)/$(DOC_MODULE).omf.in))
 
211
 
 
212
## @ _DOC_OMF_DB
 
213
## The OMF files for DocBook output
 
214
_DOC_OMF_DB = $(if $(_DOC_OMF_IN),                                              \
 
215
        $(foreach lc,C $(DOC_LINGUAS),$(DOC_MODULE)-$(lc).omf))
 
216
 
 
217
$(_DOC_OMF_DB) : $(_DOC_OMF_IN)
 
218
$(_DOC_OMF_DB) : $(DOC_MODULE)-%.omf : %/$(DOC_MODULE).xml
 
219
        xsltproc -o $@ $(call db2omf_args,$@,$<,'docbook')
 
220
 
 
221
## @ _DOC_OMF_HTML
 
222
## The OMF files for HTML output
 
223
_DOC_OMF_HTML = $(if $(_DOC_OMF_IN),                                            \
 
224
        $(foreach lc,C $(DOC_LINGUAS),$(DOC_MODULE)-html-$(lc).omf))
 
225
 
 
226
$(_DOC_OMF_HTML) : $(_DOC_OMF_IN)
 
227
$(_DOC_OMF_HTML) : $(DOC_MODULE)-html-%.omf : %/$(DOC_MODULE).xml
 
228
        xsltproc -o $@ $(call db2omf_args,$@,$<,'html')
 
229
 
 
230
## @ _DOC_OMF_ALL
 
231
## All OMF output files to be built
 
232
# FIXME
 
233
_DOC_OMF_ALL =                                                                  \
 
234
        $(if $(findstring docbook,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_DB))         \
 
235
        $(if $(findstring html,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_HTML))
 
236
 
 
237
.PHONY: omf
 
238
omf: $(_DOC_OMF_ALL)
 
239
 
 
240
 
 
241
################################################################################
 
242
## @@ Rules for Desktop Entry Files
 
243
 
 
244
## @ _DOC_DSK_IN
 
245
## The desktop entry input file
 
246
_DOC_DSK_IN = $(if $(DOC_MODULE),$(wildcard $(srcdir)/$(DOC_MODULE).desktop.in))
 
247
 
 
248
## @ _DOC_DSK_DB
 
249
## The desktop entry files for DocBook output
 
250
_DOC_DSK_DB = $(if $(_DOC_DSK_IN),                                              \
 
251
        $(foreach lc,C $(DOC_LINGUAS),$(DOC_MODULE).db.$(lc).desktop))
 
252
 
 
253
# FIXME
 
254
$(_DOC_DSK_DB) : $(_DOC_DSK_IN)
 
255
$(_DOC_DSK_DB) : $(DOC_MODULE).db.%.desktop : %/$(DOC_MODULE).xml
 
256
        cp $(_DOC_DSK_IN) $@
 
257
 
 
258
## @ _DOC_DSK_HTML
 
259
## The desktop entry files for HTML output
 
260
_DOC_DSK_HTML = $(if $(_DOC_DSK_IN),                                            \
 
261
        $(foreach lc,C $(DOC_LINGUAS),$(DOC_MODULE).html.$(lc).desktop))
 
262
 
 
263
$(_DOC_DSK_HTML) : $(_DOC_DSK_IN)
 
264
$(_DOC_DSK_HTML) : $(DOC_MODULE).html.%.desktop : %/$(DOC_MODULE).xml
 
265
        cp $(_DOC_DSK_IN) $@
 
266
 
 
267
## @ _DOC_DSK_ALL
 
268
## All desktop entry output files to be built
 
269
# FIXME
 
270
_DOC_DSK_ALL =                                                                  \
 
271
        $(if $(findstring docbook,$(_DOC_REAL_FORMATS)),$(_DOC_DSK_DB))         \
 
272
        $(if $(findstring html,$(_DOC_REAL_FORMATS)),$(_DOC_DSK_HTML))
 
273
 
 
274
.PHONY: dsk
 
275
dsk: $(_DOC_DSK_ALL)
 
276
 
 
277
 
 
278
################################################################################
 
279
## @@ Rules for .cvsignore Files
 
280
 
 
281
## @ _CVSIGNORE_TOP
 
282
## The .cvsignore file in the top directory
 
283
_CVSIGNORE_TOP = $(if $(DOC_MODULE), .cvsignore)
 
284
 
 
285
## @ _CVSIGNORE_C
 
286
## The .cvsignore file in the C directory
 
287
_CVSIGNORE_C = $(if $(DOC_MODULE), C/.cvsignore)
 
288
 
 
289
## @ _CVSIGNORE_LC
 
290
## The .cvsignore files in other locale directories
 
291
_CVSIGNORE_LC = $(if $(DOC_MODULE),$(foreach lc,$(DOC_LINGUAS),$(lc)/.cvsignore))
 
292
 
 
293
## @ _CVSIGNORE_TOP_FILES
 
294
## The list of files to be listed in the top-level .cvsignore file
 
295
_CVSIGNORE_TOP_FILES = $(_DOC_OMF_ALL) $(_DOC_DSK_ALL)
 
296
 
 
297
## @ _CVSIGNORE_C_FILES
 
298
## The list of files to be listed in the .cvsignore file in the C directory
 
299
_CVSIGNORE_C_FILES = $(_RNGDOC_C_DOCS) $(_XSLDOC_C_DOCS)
 
300
 
 
301
## @ _CVSIGNORE_C_FILES
 
302
## The list of files to be listed in the .cvsignore files in other
 
303
## locale directories
 
304
_CVSIGNORE_LC_FILES = $(_DOC_LC_DOCS)
 
305
 
 
306
$(_CVSIGNORE_TOP) : $(_CVSIGNORE_TOP_FILES)
 
307
        if ! test -f $@; then touch $@; fi
 
308
        cat $@ > $@.tmp
 
309
        list='$^'; for file in $$list; do \
 
310
          echo $$file >> $@.tmp; \
 
311
        done
 
312
        cat $@.tmp | sort | uniq > $@
 
313
        rm $@.tmp
 
314
 
 
315
$(_CVSIGNORE_C) : $(_CVSIGNORE_C_FILES)
 
316
        if ! test -f $@; then touch $@; fi
 
317
        cat $@ > $@.tmp
 
318
        list='$^'; for file in $$list; do \
 
319
          echo $$file | sed -e 's/.*\///' >> $@.tmp; \
 
320
        done
 
321
        cat $@.tmp | sort | uniq > $@
 
322
        rm $@.tmp
 
323
 
 
324
$(_CVSIGNORE_LC) : $(_CVSIGNORE_LC_FILES)
 
325
        if ! test -f $@; then touch $@; fi
 
326
        cat $@ > $@.tmp
 
327
        list='$(wildcard $(_CVSIGNORE_LC_FILES),$(dir $@)/*)'; \
 
328
        for file in $$list; do \
 
329
          echo $$file | sed -e 's/.*\///' >> $@.tmp; \
 
330
        done
 
331
        cat $@.tmp | sort | uniq > $@
 
332
        rm $@.tmp
 
333
 
 
334
.PHONY: cvsignore
 
335
cvsignore: $(_CVSIGNORE_TOP) $(_CVSIGNROE_C) $(_CVSIGNORE_LC)
 
336
 
 
337
 
 
338
################################################################################
 
339
## @@ C Locale Documents
 
340
 
 
341
## @ _DOC_C_MODULE
 
342
## The top-level documentation file in the C locale
 
343
_DOC_C_MODULE = $(if $(DOC_MODULE),C/$(DOC_MODULE).xml)
 
344
 
 
345
## @ _DOC_C_ENTITIES
 
346
## Files included with a SYSTEM entity in the C locale
 
347
_DOC_C_ENTITIES = $(foreach ent,$(DOC_ENTITIES),C/$(ent))
 
348
 
 
349
## @ _DOC_C_XINCLUDES
 
350
## Files included with XInclude in the C locale
 
351
_DOC_C_INCLUDES = $(foreach inc,$(DOC_INCLUDES),C/$(inc))
 
352
 
 
353
## @ _DOC_C_DOCS
 
354
## All documentation files in the C locale
 
355
_DOC_C_DOCS =                                                           \
 
356
        $(_DOC_C_ENTITIES)      $(_DOC_C_INCLUDES)                      \
 
357
        $(_RNGDOC_C_DOCS)       $(_XSLDOC_C_DOCS)                       \
 
358
        $(_DOC_C_MODULE)
 
359
 
 
360
## @ _DOC_C_DOCS_NOENT
 
361
## All documentation files in the C locale,
 
362
## except files included with a SYSTEM entity
 
363
_DOC_C_DOCS_NOENT =                                                     \
 
364
        $(_DOC_C_MODULE)        $(_DOC_C_INCLUDES)                      \
 
365
        $(_RNGDOC_C_DOCS)       $(_XSLDOC_C_DOCS)
 
366
 
 
367
## @ _DOC_C_FIGURES
 
368
## All figures and other external data in the C locale
 
369
_DOC_C_FIGURES = $(if $(DOC_FIGURES),                                   \
 
370
        $(foreach fig,$(DOC_FIGURES),C/$(fig)),                         \
 
371
        $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/C/figures/*.png)))
 
372
 
 
373
## @ _DOC_C_HTML
 
374
## All HTML documentation in the C locale
 
375
# FIXME: probably have to shell escape to determine the file names
 
376
_DOC_C_HTML = $(shell xsltproc --xinclude                               \
 
377
        --stringparam db.chunk.basename "$(DOC_MODULE)"                 \
 
378
        $(_chunks) "C/$(DOC_MODULE).xml")
 
379
 
 
380
###############################################################################
 
381
## @@ Other Locale Documentation
 
382
 
 
383
## @ _DOC_POFILES
 
384
## The .po files used for translating the document
 
385
_DOC_POFILES = $(if $(DOC_MODULE),                                      \
 
386
        $(foreach lc,$(DOC_LINGUAS),$(lc)/$(lc).po))
 
387
 
 
388
.PHONY: po
 
389
po: $(_DOC_POFILES)
 
390
 
 
391
## @ _DOC_LC_MODULES
 
392
## The top-level documentation files in all other locales
 
393
_DOC_LC_MODULES = $(if $(DOC_MODULE),                                   \
 
394
        $(foreach lc,$(DOC_LINGUAS),$(lc)/$(DOC_MODULE).xml))
 
395
 
 
396
## @ _DOC_LC_XINCLUDES
 
397
## Files included with XInclude in all other locales
 
398
_DOC_LC_INCLUDES =                                                      \
 
399
        $(foreach lc,$(DOC_LINGUAS),$(foreach inc,$(_DOC_C_INCLUDES),   \
 
400
                $(lc)/$(notdir $(inc)) ))
 
401
 
 
402
## @ _RNGDOC_LC_DOCS
 
403
## The generated rngdoc documentation in all other locales
 
404
_RNGDOC_LC_DOCS =                                                       \
 
405
        $(foreach lc,$(DOC_LINGUAS),$(foreach doc,$(_RNGDOC_C_DOCS),    \
 
406
                $(lc)/$(notdir $(doc)) ))
 
407
 
 
408
## @ _XSLDOC_LC_DOCS
 
409
## The generated xsldoc documentation in all other locales
 
410
_XSLDOC_LC_DOCS =                                                       \
 
411
        $(foreach lc,$(DOC_LINGUAS),$(foreach doc,$(_XSLDOC_C_DOCS),    \
 
412
                $(lc)/$(notdir $(doc)) ))
 
413
 
 
414
## @ _DOC_LC_HTML
 
415
## All HTML documentation in all other locales
 
416
# FIXME: probably have to shell escape to determine the file names
 
417
_DOC_LC_HTML =                                                          \
 
418
        $(foreach lc,$(DOC_LINGUAS),$(foreach doc,$(_DOC_C_HTML),       \
 
419
                $(lc)/$(notdir $(doc)) ))
 
420
 
 
421
## @ _DOC_LC_DOCS
 
422
## All documentation files in all other locales
 
423
_DOC_LC_DOCS =                                                          \
 
424
        $(_DOC_LC_MODULES)      $(_DOC_LC_INCLUDES)                     \
 
425
        $(_RNGDOC_LC_DOCS)      $(_XSLDOC_LC_DOCS)                      \
 
426
        $(if $(findstring html,$(_DOC_REAL_FORMATS)),$(_DOC_LC_HTML))
 
427
 
 
428
## @ _DOC_LC_FIGURES
 
429
## All figures and other external data in all other locales
 
430
_DOC_LC_FIGURES = $(foreach lc,$(DOC_LINGUAS),                          \
 
431
        $(patsubst C/%,$(lc)/%,$(_DOC_C_FIGURES)) )
 
432
 
 
433
_DOC_SRC_FIGURES =                                                      \
 
434
        $(foreach fig,$(_DOC_C_FIGURES), $(foreach lc,C $(DOC_LINGUAS), \
 
435
                $(wildcard $(srcdir)/$(lc)/$(patsubst C/%,%,$(fig))) ))
 
436
 
 
437
$(_DOC_POFILES): $(_DOC_C_DOCS)
 
438
        @if ! test -d $(dir $@); then \
 
439
          echo "mkdir $(dir $@)"; \
 
440
          mkdir "$(dir $@)"; \
 
441
        fi
 
442
        @if test ! -f $@ -a -f $(srcdir)/$@; then \
 
443
          echo "cp $(srcdir)/$@ $@"; \
 
444
          cp "$(srcdir)/$@" "$@"; \
 
445
        fi;
 
446
        @docs=; \
 
447
        list='$(_DOC_C_DOCS_NOENT)'; for doc in $$list; do \
 
448
          if test -f $$doc; then \
 
449
            docs="$$docs ../$$doc"; \
 
450
          else \
 
451
            docs="$$docs ../$(srcdir)/$$doc"; \
 
452
          fi; \
 
453
        done; \
 
454
        if ! test -f $@; then \
 
455
          echo "(cd $(dir $@) && \
 
456
            $(_xml2po) -e $$docs > $(notdir $@).tmp && \
 
457
            cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)"; \
 
458
          (cd $(dir $@) && \
 
459
            $(_xml2po) -e $$docs > $(notdir $@).tmp && \
 
460
            cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp); \
 
461
        else \
 
462
          echo "(cd $(dir $@) && \
 
463
            $(_xml2po) -e -u $(notdir $@) $$docs)"; \
 
464
          (cd $(dir $@) && \
 
465
            $(_xml2po) -e -u $(notdir $@) $$docs); \
 
466
        fi
 
467
 
 
468
# FIXME: fix the dependancy
 
469
# FIXME: hook xml2po up
 
470
$(_DOC_LC_DOCS) : $(_DOC_POFILES)
 
471
$(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
 
472
        if ! test -d $(dir $@); then mkdir $(dir $@); fi
 
473
        case "$(srcdir)" in /*) sd="$(srcdir)";; *) sd="../$(srcdir)";; esac; \
 
474
        if [ -f "C/$(notdir $@)" ]; then d="../"; else d="$sd/"; fi; \
 
475
        (cd $(dir $@) && \
 
476
          $(_xml2po) -e -p \
 
477
            "$${d}$(dir $@)$(patsubst %/$(notdir $@),%,$@).po" \
 
478
            "$${d}C/$(notdir $@)" > $(notdir $@).tmp && \
 
479
            cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)
 
480
 
 
481
## @ _DOC_POT
 
482
## A pot file
 
483
_DOC_POT = $(if $(DOC_MODULE),$(DOC_MODULE).pot)
 
484
.PHONY: pot
 
485
pot: $(_DOC_POT)
 
486
$(_DOC_POT): $(_DOC_C_DOCS_NOENT)
 
487
        $(_xml2po) -e -o $@ $^
 
488
 
 
489
 
 
490
################################################################################
 
491
## @@ All Documentation
 
492
 
 
493
## @ _DOC_HTML_ALL
 
494
## All HTML documentation, only if it's built
 
495
_DOC_HTML_ALL = $(if $(findstring html,$(_DOC_REAL_FORMATS)), \
 
496
        $(_DOC_C_HTML) $(_DOC_LC_HTML))
 
497
 
 
498
_DOC_HTML_TOPS = $(foreach lc,C $(DOC_LINGUAS),$(lc)/$(DOC_MODULE).html)
 
499
 
 
500
$(_DOC_HTML_TOPS): $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
 
501
        xsltproc -o $@ --xinclude --param db.chunk.chunk_top "false()" --stringparam db.chunk.basename "$(DOC_MODULE)" --stringparam db.chunk.extension ".html" $(_db2html) $(patsubst %.html,%.xml,$@)
 
502
 
 
503
 
 
504
################################################################################
 
505
 
 
506
if ENABLE_SK
 
507
_ENABLE_SK = true
 
508
else
 
509
_ENABLE_SK = false
 
510
endif
 
511
 
 
512
all:                                                    \
 
513
        $(_DOC_C_DOCS)          $(_DOC_LC_DOCS)         \
 
514
        $(_DOC_OMF_ALL)         $(_DOC_DSK_ALL)         \
 
515
        $(_DOC_HTML_ALL)        $(_DOC_POFILES)
 
516
 
 
517
 
 
518
.PHONY: clean-doc-rngdoc clean-doc-xsldoc clean-doc-omf clean-doc-dsk clean-doc-lc clean-doc-dir
 
519
 
 
520
clean-doc-rngdoc: ; rm -f $(_RNGDOC_C_DOCS) $(_RNGDOC_LC_DOCS)
 
521
clean-doc-xsldoc: ; rm -f $(_XSLDOC_C_DOCS) $(_XSLDOC_LC_DOCS)
 
522
clean-doc-omf: ; rm -f $(_DOC_OMF_DB) $(_DOC_OMF_HTML)
 
523
clean-doc-dsk: ; rm -f $(_DOC_DSK_DB) $(_DOC_DSK_HTML)
 
524
clean-doc-lc:
 
525
        rm -f $(_DOC_LC_DOCS)
 
526
        @list='$(_DOC_POFILES)'; for po in $$list; do \
 
527
          if ! test "$$po" -ef "$(srcdir)/$$po"; then \
 
528
            echo "rm -f $$po"; \
 
529
            rm -f "$$po"; \
 
530
          fi; \
 
531
        done
 
532
        @for lc in C $(DOC_LINGUAS); do \
 
533
          if test -f "$$lc/.xml2po.mo"; then \
 
534
            echo "rm -f $$lc/.xml2po.mo"; \
 
535
            rm -f "$$lc/.xml2po.mo"; \
 
536
          fi; \
 
537
        done
 
538
clean-doc-dir:
 
539
        @for lc in C $(DOC_LINGUAS); do \
 
540
          for dir in `find $$lc -depth -type d`; do \
 
541
            if ! test $$dir -ef $(srcdir)/$$dir; then \
 
542
              echo "rmdir $$dir"; \
 
543
              rmdir "$$dir"; \
 
544
           fi; \
 
545
          done; \
 
546
        done
 
547
 
 
548
_clean_rngdoc = $(if $(RNGDOC_DIRS),clean-doc-rngdoc)
 
549
_clean_xsldoc = $(if $(XSLDOC_DIRS),clean-doc-xsldoc)
 
550
_clean_omf = $(if $(_DOC_OMF_IN),clean-doc-omf)
 
551
_clean_dsk = $(if $(_DOC_DSK_IN),clean-doc-dsk)
 
552
_clean_lc  = $(if $(DOC_LINGUAS),clean-doc-lc)
 
553
_clean_dir = $(if $(DOC_MODULE),clean-doc-dir)
 
554
 
 
555
clean-local:                                            \
 
556
        $(_clean_rngdoc)        $(_clean_xsldoc)        \
 
557
        $(_clean_omf)           $(_clean_dsk)           \
 
558
        $(_clean_lc)            $(_clean_dir)
 
559
distclean-local:                                        \
 
560
        $(_clean_rngdoc)        $(_clean_xsldoc)        \
 
561
        $(_clean_omf)           $(_clean_dsk)           \
 
562
        $(_clean_lc)            $(_clean_dir)
 
563
mostlyclean-local:                                      \
 
564
        $(_clean_rngdoc)        $(_clean_xsldoc)        \
 
565
        $(_clean_omf)           $(_clean_dsk)           \
 
566
        $(_clean_lc)            $(_clean_dir)
 
567
maintainer-clean-local:                                 \
 
568
        $(_clean_rngdoc)        $(_clean_xsldoc)        \
 
569
        $(_clean_omf)           $(_clean_dsk)           \
 
570
        $(_clean_lc)            $(_clean_dir)
 
571
 
 
572
 
 
573
.PHONY: dist-doc-docs dist-doc-figs dist-doc-omf dist-doc-dsk
 
574
doc-dist-hook:                                  \
 
575
        $(if $(DOC_MODULE),dist-doc-docs)       \
 
576
        $(if $(_DOC_C_FIGURES),dist-doc-figs)   \
 
577
        $(if $(_DOC_OMF_IN),dist-doc-omf)
 
578
#       $(if $(_DOC_DSK_IN),dist-doc-dsk)
 
579
 
 
580
dist-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES)
 
581
        @for lc in C $(DOC_LINGUAS); do \
 
582
          echo " $(mkinstalldirs) $(distdir)/$$lc"; \
 
583
          $(mkinstalldirs) "$(distdir)/$$lc"; \
 
584
        done
 
585
        @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES)'; \
 
586
        for doc in $$list; do \
 
587
          if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
 
588
          echo "$(INSTALL_DATA) $$d$$doc $(distdir)/$$doc"; \
 
589
          $(INSTALL_DATA) "$$d$$doc" "$(distdir)/$$doc"; \
 
590
        done
 
591
 
 
592
dist-doc-figs: $(_DOC_SRC_FIGURES)
 
593
        @list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; \
 
594
        for fig in $$list; do \
 
595
          if test -f "$$fig"; then d=; else d="$(srcdir)/"; fi; \
 
596
          if test -f "$$d$$fig"; then \
 
597
            figdir=`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
 
598
            if ! test -d "$(distdir)/$$figdir"; then \
 
599
              echo "$(mkinstalldirs) $(distdir)/$$figdir"; \
 
600
              $(mkinstalldirs) "$(distdir)/$$figdir"; \
 
601
            fi; \
 
602
            echo "$(INSTALL_DATA) $$d$$fig $(distdir)/$$fig"; \
 
603
            $(INSTALL_DATA) "$$d$$fig" "$(distdir)/$$fig"; \
 
604
          fi; \
 
605
        done;
 
606
 
 
607
dist-doc-omf:
 
608
        @if test -f "$(_DOC_OMF_IN)"; then d=; else d="$(srcdir)/"; fi; \
 
609
        echo "$(INSTALL_DATA) $$d$(_DOC_OMF_IN) $(distdir)/$(notdir $(_DOC_OMF_IN))"; \
 
610
        $(INSTALL_DATA) "$$d$(_DOC_OMF_IN)" "$(distdir)/$(notdir $(_DOC_OMF_IN))"
 
611
 
 
612
dist-doc-dsk:
 
613
        @if test -f "$(_DOC_DSK_IN)"; then d=; else d="$(srcdir)/"; fi; \
 
614
        echo "$(INSTALL_DATA) $$d$(_DOC_DSK_IN) $(distdir)/$(notdir $(_DOC_DSK_IN))"; \
 
615
        $(INSTALL_DATA) "$$d$(_DOC_DSK_IN)" "$(distdir)/$(notdir $(_DOC_DSK_IN))"
 
616
 
 
617
 
 
618
.PHONY: check-doc-docs check-doc-omf
 
619
check:                                                  \
 
620
        $(if $(DOC_MODULE),check-doc-docs)              \
 
621
        $(if $(_DOC_OMF_IN),check-doc-omf)
 
622
 
 
623
check-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
 
624
        @for lc in C $(DOC_LINGUAS); do \
 
625
          if test -f "$$lc"; \
 
626
            then d=; \
 
627
            xmlpath="$$lc"; \
 
628
          else \
 
629
            d="$(srcdir)/"; \
 
630
            xmlpath="$$lc:$(srcdir)/$$lc"; \
 
631
          fi; \
 
632
          echo "xmllint --noout --noent --path $$xmlpath --xinclude --postvalid $$d$$lc/$(DOC_MODULE).xml"; \
 
633
          xmllint --noout --noent --path "$$xmlpath" --xinclude --postvalid "$$d$$lc/$(DOC_MODULE).xml"; \
 
634
        done
 
635
 
 
636
check-doc-omf: $(_DOC_OMF_ALL)
 
637
        @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
 
638
          echo "xmllint --noout --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf"; \
 
639
          xmllint --noout --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf; \
 
640
        done
 
641
 
 
642
 
 
643
.PHONY: install-doc-docs install-doc-html install-doc-figs install-doc-omf install-doc-dsk
 
644
install-data-local:                                     \
 
645
        $(if $(DOC_MODULE),install-doc-docs)            \
 
646
        $(if $(_DOC_HTML_ALL),install-doc-html)         \
 
647
        $(if $(_DOC_C_FIGURES),install-doc-figs)        \
 
648
        $(if $(_DOC_OMF_IN),install-doc-omf)
 
649
#       $(if $(_DOC_DSK_IN),install-doc-dsk)
 
650
 
 
651
install-doc-docs:
 
652
        @for lc in C $(DOC_LINGUAS); do \
 
653
          echo "$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$lc"; \
 
654
          $(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$lc; \
 
655
        done
 
656
        @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
 
657
          if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
 
658
          echo "$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc"; \
 
659
          $(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc; \
 
660
        done
 
661
 
 
662
install-doc-figs:
 
663
        @list='$(patsubst C/%,%,$(_DOC_C_FIGURES))'; for fig in $$list; do \
 
664
          for lc in C $(DOC_LINGUAS); do \
 
665
            if test -f "$$lc/$$fig"; then \
 
666
              figfile="$$lc/$$fig"; \
 
667
            elif test -f "$(srcdir)/$$lc/$$fig"; then \
 
668
              figfile="$(srcdir)/$$lc/$$fig"; \
 
669
            elif test -f "C/$$fig"; then \
 
670
              figfile="C/$$fig"; \
 
671
            else \
 
672
              figfile="$(srcdir)/C/$$fig"; \
 
673
            fi; \
 
674
            figdir="$$lc/"`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
 
675
            figdir="$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$figdir"; \
 
676
            if ! test -d "$$figdir"; then \
 
677
              echo "$(mkinstalldirs) $$figdir"; \
 
678
              $(mkinstalldirs) "$$figdir"; \
 
679
            fi; \
 
680
            figbase=`echo $$fig | sed -e 's/^.*\///'`; \
 
681
            echo "$(INSTALL_DATA) $$figfile $$figdir$$figbase"; \
 
682
            $(INSTALL_DATA) "$$figfile" "$$figdir$$figbase"; \
 
683
          done; \
 
684
        done
 
685
 
 
686
install-doc-html:
 
687
        echo install-html
 
688
 
 
689
install-doc-omf:
 
690
        $(mkinstalldirs) $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)
 
691
        @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
 
692
          echo "$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
 
693
          $(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf; \
 
694
        done
 
695
        @if test "x$(_ENABLE_SK)" = "xtrue"; then \
 
696
          echo "scrollkeeper-update -p $(DESTDIR)$(_sklocalstatedir) -o $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)"; \
 
697
          scrollkeeper-update -p "$(DESTDIR)$(_sklocalstatedir)" -o "$(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)"; \
 
698
        fi;
 
699
 
 
700
install-doc-dsk:
 
701
        echo install-dsk
 
702
 
 
703
 
 
704
.PHONY: uninstall-doc-docs uninstall-doc-html uninstall-doc-figs uninstall-doc-omf uninstall-doc-dsk
 
705
uninstall-local:                                        \
 
706
        $(if $(DOC_MODULE),uninstall-doc-docs)          \
 
707
        $(if $(_DOC_HTML_ALL),uninstall-doc-html)       \
 
708
        $(if $(DOC_FIGURES),uninstall-doc-figs)         \
 
709
        $(if $(_DOC_OMF_IN),uninstall-doc-omf)
 
710
#       $(if $(_DOC_DSK_IN),uninstall-doc-dsk)
 
711
 
 
712
uninstall-doc-docs:
 
713
        @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
 
714
          echo " rm -f $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc"; \
 
715
          rm -f "$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc"; \
 
716
        done
 
717
 
 
718
uninstall-doc-figs:
 
719
        @list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; for fig in $$list; do \
 
720
          echo "rm -f $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$fig"; \
 
721
          rm -f "$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$fig"; \
 
722
        done;
 
723
 
 
724
uninstall-doc-omf:
 
725
        @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
 
726
          if test "x$(_ENABLE_SK)" == "xtrue"; then \
 
727
            echo "scrollkeeper-uninstall -p $(_sklocalstatedir) $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
 
728
            scrollkeeper-uninstall -p "$(_sklocalstatedir)" "$(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
 
729
          fi; \
 
730
          echo "rm -f $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
 
731
          rm -f "$(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
 
732
        done