123
131
## Variables for Bootstrapping
125
133
_xml2po ?= `which xml2po`
134
_xml2po_mode = $(if $(DOC_ID),mallard,docbook)
127
136
_db2html ?= `$(PKG_CONFIG) --variable db2html gnome-doc-utils`
128
137
_db2omf ?= `$(PKG_CONFIG) --variable db2omf gnome-doc-utils`
138
_malrng ?= `$(PKG_CONFIG) --variable malrng gnome-doc-utils`
129
139
_chunks ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/chunks.xsl
130
140
_credits ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/credits.xsl
131
141
_ids ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/ids.xsl
205
215
## The top-level documentation file in the C locale
206
216
_DOC_C_MODULE = $(if $(DOC_MODULE),C/$(DOC_MODULE).xml)
219
## Page files in a Mallard document in the C locale
220
_DOC_C_PAGES = $(foreach page,$(DOC_PAGES),C/$(page))
208
222
## @ _DOC_C_ENTITIES
209
223
## Files included with a SYSTEM entity in the C locale
210
224
_DOC_C_ENTITIES = $(foreach ent,$(DOC_ENTITIES),C/$(ent))
217
231
## All documentation files in the C locale
219
233
$(_DOC_C_ENTITIES) $(_DOC_C_INCLUDES) \
234
$(_DOC_C_PAGES) $(_DOC_C_MODULE)
222
236
## @ _DOC_C_DOCS_NOENT
223
237
## All documentation files in the C locale,
224
238
## except files included with a SYSTEM entity
225
239
_DOC_C_DOCS_NOENT = \
226
$(_DOC_C_MODULE) $(_DOC_C_INCLUDES)
240
$(_DOC_C_MODULE) $(_DOC_C_INCLUDES) \
228
243
## @ _DOC_C_FIGURES
229
244
## All figures and other external data in the C locale
246
261
## @ _DOC_POFILES
247
262
## The .po files used for translating the document
248
_DOC_POFILES = $(if $(DOC_MODULE), \
263
_DOC_POFILES = $(if $(DOC_MODULE)$(DOC_ID), \
249
264
$(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(lc).po))
252
267
po: $(_DOC_POFILES)
270
## The .mo files used for translating the document
271
_DOC_MOFILES = $(patsubst %.po,%.mo,$(_DOC_POFILES))
254
276
## @ _DOC_LC_MODULES
255
277
## The top-level documentation files in all other locales
256
278
_DOC_LC_MODULES = $(if $(DOC_MODULE), \
257
279
$(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xml))
282
## Page files in a Mallard document in all other locales
284
$(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach page,$(_DOC_C_PAGES), \
285
$(lc)/$(notdir $(page)) ))
259
287
## @ _DOC_LC_XINCLUDES
260
288
## Files included with XInclude in all other locales
261
289
_DOC_LC_INCLUDES = \
272
300
## @ _DOC_LC_DOCS
273
301
## All documentation files in all other locales
275
$(_DOC_LC_MODULES) $(_DOC_LC_INCLUDES) \
303
$(_DOC_LC_MODULES) $(_DOC_LC_INCLUDES) $(_DOC_LC_PAGES) \
276
304
$(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_LC_HTML))
278
306
## @ _DOC_LC_FIGURES
300
328
if ! test -f $@; then \
301
329
echo "(cd $(dir $@) && \
302
$(_xml2po) -e $$docs > $(notdir $@).tmp && \
330
$(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
303
331
cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)"; \
304
332
(cd $(dir $@) && \
305
$(_xml2po) -e $$docs > $(notdir $@).tmp && \
333
$(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
306
334
cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp); \
308
336
echo "(cd $(dir $@) && \
309
$(_xml2po) -e -u $(notdir $@) $$docs)"; \
337
$(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs)"; \
310
338
(cd $(dir $@) && \
311
$(_xml2po) -e -u $(notdir $@) $$docs); \
339
$(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs); \
342
$(_DOC_MOFILES): %.mo: %.po
343
@if ! test -d $(dir $@); then \
344
echo "mkdir $(dir $@)"; \
314
349
# FIXME: fix the dependancy
315
350
# FIXME: hook xml2po up
316
$(_DOC_LC_DOCS) : $(_DOC_POFILES)
351
$(_DOC_LC_DOCS) : $(_DOC_MOFILES)
317
352
$(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
318
353
if ! test -d $(dir $@); then mkdir $(dir $@); fi
319
354
if [ -f "C/$(notdir $@)" ]; then d="../"; else d="$(_DOC_ABS_SRCDIR)/"; fi; \
355
mo="$(dir $@)$(patsubst %/$(notdir $@),%,$@).mo"; \
356
if [ -f "$${mo}" ]; then mo="../$${mo}"; else mo="$(_DOC_ABS_SRCDIR)/$${mo}"; fi; \
320
357
(cd $(dir $@) && \
322
"$${d}$(dir $@)$(patsubst %/$(notdir $@),%,$@).po" \
358
$(_xml2po) -m $(_xml2po_mode) -e -t "$${mo}" \
323
359
"$${d}C/$(notdir $@)" > $(notdir $@).tmp && \
324
360
cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)
354
391
$(_DOC_HTML_ALL) $(_DOC_POFILES)
394
################################################################################
357
397
.PHONY: clean-doc-omf clean-doc-dsk clean-doc-lc clean-doc-dir
359
399
clean-doc-omf: ; rm -f $(_DOC_OMF_DB) $(_DOC_OMF_HTML)
360
400
clean-doc-dsk: ; rm -f $(_DOC_DSK_DB) $(_DOC_DSK_HTML)
362
402
rm -f $(_DOC_LC_DOCS)
403
rm -f $(_DOC_MOFILES)
363
404
@list='$(_DOC_POFILES)'; for po in $$list; do \
364
405
if ! test "$$po" -ef "$(srcdir)/$$po"; then \
365
406
echo "rm -f $$po"; \
410
# .xml2.po.mo cleaning is obsolete as of 0.18.1 and could be removed in 0.20.x
369
411
@for lc in C $(_DOC_REAL_LINGUAS); do \
370
412
if test -f "$$lc/.xml2po.mo"; then \
371
413
echo "rm -f $$lc/.xml2po.mo"; \
372
414
rm -f "$$lc/.xml2po.mo"; \
417
clean-doc-dir: clean-doc-lc
376
418
@for lc in C $(_DOC_REAL_LINGUAS); do \
377
419
for dir in `find $$lc -depth -type d`; do \
378
420
if ! test $$dir -ef $(srcdir)/$$dir; then \
385
427
_clean_omf = $(if $(_DOC_OMF_IN),clean-doc-omf)
386
428
_clean_dsk = $(if $(_DOC_DSK_IN),clean-doc-dsk)
387
429
_clean_lc = $(if $(_DOC_REAL_LINGUAS),clean-doc-lc)
388
_clean_dir = $(if $(DOC_MODULE),clean-doc-dir)
430
_clean_dir = $(if $(DOC_MODULE)$(DOC_ID),clean-doc-dir)
391
433
$(_clean_omf) $(_clean_dsk) \
401
443
$(_clean_lc) $(_clean_dir)
404
.PHONY: dist-doc-docs dist-doc-figs dist-doc-omf dist-doc-dsk
406
$(if $(DOC_MODULE),dist-doc-docs) \
407
$(if $(_DOC_C_FIGURES),dist-doc-figs) \
447
################################################################################
450
.PHONY: dist-doc-docs dist-doc-pages dist-doc-figs dist-doc-omf dist-doc-dsk
452
$(if $(DOC_MODULE)$(DOC_ID),dist-doc-docs) \
453
$(if $(_DOC_C_FIGURES),dist-doc-figs) \
408
454
$(if $(_DOC_OMF_IN),dist-doc-omf)
409
455
# $(if $(_DOC_DSK_IN),dist-doc-dsk)
451
497
$(INSTALL_DATA) "$$d$(_DOC_DSK_IN)" "$(distdir)/$(notdir $(_DOC_DSK_IN))"
501
################################################################################
454
504
.PHONY: check-doc-docs check-doc-omf
456
506
$(if $(DOC_MODULE),check-doc-docs) \
507
$(if $(DOC_ID),check-doc-pages) \
457
508
$(if $(_DOC_OMF_IN),check-doc-omf)
459
510
check-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
469
520
xmllint --noout --noent --path "$$xmlpath" --xinclude --postvalid "$$d$$lc/$(DOC_MODULE).xml"; \
523
check-doc-pages: $(_DOC_C_PAGES) $(_DOC_LC_PAGES)
524
for lc in C $(_DOC_REAL_LINGUAS); do \
530
xmlpath="$$lc:$(srcdir)/$$lc"; \
532
for page in $(DOC_PAGES); do \
533
echo "xmllint --noout --noent --path $$xmlpath --xinclude --relaxng $(_malrng) $$d$$lc/$$page"; \
534
xmllint --noout --noent --path "$$xmlpath" --xinclude --relaxng "$(_malrng)" "$$d$$lc/$$page"; \
472
538
check-doc-omf: $(_DOC_OMF_ALL)
473
539
@list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
474
540
echo "xmllint --noout --xinclude --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf"; \
546
################################################################################
479
549
.PHONY: install-doc-docs install-doc-html install-doc-figs install-doc-omf install-doc-dsk
551
_doc_install_dir = $(if $(DOC_ID),$(DOC_ID),$(DOC_MODULE))
480
553
install-data-local: \
481
$(if $(DOC_MODULE),install-doc-docs) \
554
$(if $(DOC_MODULE)$(DOC_ID),install-doc-docs) \
482
555
$(if $(_DOC_HTML_ALL),install-doc-html) \
483
556
$(if $(_DOC_C_FIGURES),install-doc-figs) \
484
557
$(if $(_DOC_OMF_IN),install-doc-omf)
487
560
install-doc-docs:
488
561
@for lc in C $(_DOC_REAL_LINGUAS); do \
489
echo "$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$lc"; \
490
$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$lc; \
562
echo "$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc"; \
563
$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc; \
492
565
@list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
493
566
if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
494
567
docdir="$$lc/"`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
495
docdir="$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$docdir"; \
568
docdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$docdir"; \
496
569
if ! test -d "$$docdir"; then \
497
570
echo "$(mkinstalldirs) $$docdir"; \
498
571
$(mkinstalldirs) "$$docdir"; \
500
echo "$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc"; \
501
$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc; \
573
echo "$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
574
$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc; \
504
577
install-doc-figs:
513
586
figsymlink=true; \
515
588
figdir="$$lc/"`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
516
figdir="$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$figdir"; \
589
figdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$figdir"; \
517
590
if ! test -d "$$figdir"; then \
518
591
echo "$(mkinstalldirs) $$figdir"; \
519
592
$(mkinstalldirs) "$$figdir"; \
533
606
echo install-html
536
$(mkinstalldirs) $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)
609
$(mkinstalldirs) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)
537
610
@list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
538
echo "$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
539
$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf; \
611
echo "$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
612
$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf; \
541
614
@if test "x$(_ENABLE_SK)" = "xtrue"; then \
542
echo "scrollkeeper-update -p $(DESTDIR)$(_sklocalstatedir) -o $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)"; \
543
scrollkeeper-update -p "$(DESTDIR)$(_sklocalstatedir)" -o "$(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)"; \
615
echo "scrollkeeper-update -p $(DESTDIR)$(_sklocalstatedir) -o $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
616
scrollkeeper-update -p "$(DESTDIR)$(_sklocalstatedir)" -o "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
624
################################################################################
550
627
.PHONY: uninstall-doc-docs uninstall-doc-html uninstall-doc-figs uninstall-doc-omf uninstall-doc-dsk
551
628
uninstall-local: \
552
$(if $(DOC_MODULE),uninstall-doc-docs) \
629
$(if $(DOC_MODULE)$(DOC_ID),uninstall-doc-docs) \
553
630
$(if $(_DOC_HTML_ALL),uninstall-doc-html) \
554
631
$(if $(_DOC_C_FIGURES),uninstall-doc-figs) \
555
632
$(if $(_DOC_OMF_IN),uninstall-doc-omf)
558
635
uninstall-doc-docs:
559
636
@list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
560
echo " rm -f $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc"; \
561
rm -f "$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc"; \
637
echo " rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
638
rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
564
641
uninstall-doc-figs:
565
642
@list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; for fig in $$list; do \
566
echo "rm -f $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$fig"; \
567
rm -f "$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$fig"; \
643
echo "rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
644
rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
570
647
uninstall-doc-omf:
571
648
@list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
572
649
if test "x$(_ENABLE_SK)" = "xtrue"; then \
573
echo "scrollkeeper-uninstall -p $(_sklocalstatedir) $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
574
scrollkeeper-uninstall -p "$(_sklocalstatedir)" "$(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
650
echo "scrollkeeper-uninstall -p $(_sklocalstatedir) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
651
scrollkeeper-uninstall -p "$(_sklocalstatedir)" "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
576
echo "rm -f $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
577
rm -f "$(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
653
echo "rm -f $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
654
rm -f "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \