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))
256
271
_DOC_LC_MODULES = $(if $(DOC_MODULE), \
257
272
$(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xml))
275
## Page files in a Mallard document in all other locales
277
$(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach page,$(_DOC_C_PAGES), \
278
$(lc)/$(notdir $(page)) ))
259
280
## @ _DOC_LC_XINCLUDES
260
281
## Files included with XInclude in all other locales
261
282
_DOC_LC_INCLUDES = \
272
293
## @ _DOC_LC_DOCS
273
294
## All documentation files in all other locales
275
$(_DOC_LC_MODULES) $(_DOC_LC_INCLUDES) \
296
$(_DOC_LC_MODULES) $(_DOC_LC_INCLUDES) $(_DOC_LC_PAGES) \
276
297
$(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_LC_HTML))
278
299
## @ _DOC_LC_FIGURES
300
321
if ! test -f $@; then \
301
322
echo "(cd $(dir $@) && \
302
$(_xml2po) -e $$docs > $(notdir $@).tmp && \
323
$(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
303
324
cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)"; \
304
325
(cd $(dir $@) && \
305
$(_xml2po) -e $$docs > $(notdir $@).tmp && \
326
$(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
306
327
cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp); \
308
329
echo "(cd $(dir $@) && \
309
$(_xml2po) -e -u $(notdir $@) $$docs)"; \
330
$(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs)"; \
310
331
(cd $(dir $@) && \
311
$(_xml2po) -e -u $(notdir $@) $$docs); \
332
$(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs); \
314
335
# FIXME: fix the dependancy
317
338
$(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
318
339
if ! test -d $(dir $@); then mkdir $(dir $@); fi
319
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; \
320
343
(cd $(dir $@) && \
322
"$${d}$(dir $@)$(patsubst %/$(notdir $@),%,$@).po" \
344
$(_xml2po) -m $(_xml2po_mode) -e -p "$${po}" \
323
345
"$${d}C/$(notdir $@)" > $(notdir $@).tmp && \
324
346
cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)
372
398
rm -f "$$lc/.xml2po.mo"; \
401
clean-doc-dir: clean-doc-lc
376
402
@for lc in C $(_DOC_REAL_LINGUAS); do \
377
403
for dir in `find $$lc -depth -type d`; do \
378
404
if ! test $$dir -ef $(srcdir)/$$dir; then \
385
411
_clean_omf = $(if $(_DOC_OMF_IN),clean-doc-omf)
386
412
_clean_dsk = $(if $(_DOC_DSK_IN),clean-doc-dsk)
387
413
_clean_lc = $(if $(_DOC_REAL_LINGUAS),clean-doc-lc)
388
_clean_dir = $(if $(DOC_MODULE),clean-doc-dir)
414
_clean_dir = $(if $(DOC_MODULE)$(DOC_ID),clean-doc-dir)
391
417
$(_clean_omf) $(_clean_dsk) \
401
427
$(_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) \
431
################################################################################
434
.PHONY: dist-doc-docs dist-doc-pages dist-doc-figs dist-doc-omf dist-doc-dsk
436
$(if $(DOC_MODULE)$(DOC_ID),dist-doc-docs) \
437
$(if $(_DOC_C_FIGURES),dist-doc-figs) \
408
438
$(if $(_DOC_OMF_IN),dist-doc-omf)
409
439
# $(if $(_DOC_DSK_IN),dist-doc-dsk)
451
481
$(INSTALL_DATA) "$$d$(_DOC_DSK_IN)" "$(distdir)/$(notdir $(_DOC_DSK_IN))"
485
################################################################################
454
488
.PHONY: check-doc-docs check-doc-omf
456
490
$(if $(DOC_MODULE),check-doc-docs) \
491
$(if $(DOC_ID),check-doc-pages) \
457
492
$(if $(_DOC_OMF_IN),check-doc-omf)
459
494
check-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
469
504
xmllint --noout --noent --path "$$xmlpath" --xinclude --postvalid "$$d$$lc/$(DOC_MODULE).xml"; \
507
check-doc-pages: $(_DOC_C_PAGES) $(_DOC_LC_PAGES)
508
for lc in C $(_DOC_REAL_LINGUAS); do \
514
xmlpath="$$lc:$(srcdir)/$$lc"; \
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"; \
472
522
check-doc-omf: $(_DOC_OMF_ALL)
473
523
@list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
474
524
echo "xmllint --noout --xinclude --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf"; \
530
################################################################################
479
533
.PHONY: install-doc-docs install-doc-html install-doc-figs install-doc-omf install-doc-dsk
535
_doc_install_dir = $(if $(DOC_ID),$(DOC_ID),$(DOC_MODULE))
480
537
install-data-local: \
481
$(if $(DOC_MODULE),install-doc-docs) \
538
$(if $(DOC_MODULE)$(DOC_ID),install-doc-docs) \
482
539
$(if $(_DOC_HTML_ALL),install-doc-html) \
483
540
$(if $(_DOC_C_FIGURES),install-doc-figs) \
484
541
$(if $(_DOC_OMF_IN),install-doc-omf)
487
544
install-doc-docs:
488
545
@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; \
546
echo "$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc"; \
547
$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc; \
492
549
@list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
493
550
if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
494
551
docdir="$$lc/"`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
495
docdir="$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$docdir"; \
552
docdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$docdir"; \
496
553
if ! test -d "$$docdir"; then \
497
554
echo "$(mkinstalldirs) $$docdir"; \
498
555
$(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; \
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; \
504
561
install-doc-figs:
505
562
@list='$(patsubst C/%,%,$(_DOC_C_FIGURES))'; for fig in $$list; do \
506
563
for lc in C $(_DOC_REAL_LINGUAS); do \
507
565
if test -f "$$lc/$$fig"; then \
508
566
figfile="$$lc/$$fig"; \
509
567
elif test -f "$(srcdir)/$$lc/$$fig"; then \
510
568
figfile="$(srcdir)/$$lc/$$fig"; \
511
elif test -f "C/$$fig"; then \
514
figfile="$(srcdir)/C/$$fig"; \
516
572
figdir="$$lc/"`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
517
figdir="$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$figdir"; \
573
figdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$figdir"; \
518
574
if ! test -d "$$figdir"; then \
519
575
echo "$(mkinstalldirs) $$figdir"; \
520
576
$(mkinstalldirs) "$$figdir"; \
522
578
figbase=`echo $$fig | sed -e 's/^.*\///'`; \
523
echo "$(INSTALL_DATA) $$figfile $$figdir$$figbase"; \
524
$(INSTALL_DATA) "$$figfile" "$$figdir$$figbase"; \
579
if $$figsymlink; then \
580
echo "cd $$figdir && $(LN_S) -f ../../C/$$fig $$figbase"; \
581
( cd "$$figdir" && $(LN_S) -f "../../C/$$fig" "$$figbase" ); \
583
echo "$(INSTALL_DATA) $$figfile $$figdir$$figbase"; \
584
$(INSTALL_DATA) "$$figfile" "$$figdir$$figbase"; \
529
590
echo install-html
532
$(mkinstalldirs) $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)
593
$(mkinstalldirs) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)
533
594
@list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
534
echo "$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
535
$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf; \
595
echo "$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
596
$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf; \
537
598
@if test "x$(_ENABLE_SK)" = "xtrue"; then \
538
echo "scrollkeeper-update -p $(DESTDIR)$(_sklocalstatedir) -o $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)"; \
539
scrollkeeper-update -p "$(DESTDIR)$(_sklocalstatedir)" -o "$(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)"; \
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)"; \
608
################################################################################
546
611
.PHONY: uninstall-doc-docs uninstall-doc-html uninstall-doc-figs uninstall-doc-omf uninstall-doc-dsk
547
612
uninstall-local: \
548
$(if $(DOC_MODULE),uninstall-doc-docs) \
613
$(if $(DOC_MODULE)$(DOC_ID),uninstall-doc-docs) \
549
614
$(if $(_DOC_HTML_ALL),uninstall-doc-html) \
550
615
$(if $(_DOC_C_FIGURES),uninstall-doc-figs) \
551
616
$(if $(_DOC_OMF_IN),uninstall-doc-omf)
554
619
uninstall-doc-docs:
555
620
@list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
556
echo " rm -f $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc"; \
557
rm -f "$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc"; \
621
echo " rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
622
rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
560
625
uninstall-doc-figs:
561
626
@list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; for fig in $$list; do \
562
echo "rm -f $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$fig"; \
563
rm -f "$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$fig"; \
627
echo "rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
628
rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
566
631
uninstall-doc-omf:
567
632
@list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
568
633
if test "x$(_ENABLE_SK)" = "xtrue"; then \
569
echo "scrollkeeper-uninstall -p $(_sklocalstatedir) $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
570
scrollkeeper-uninstall -p "$(_sklocalstatedir)" "$(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
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"; \
572
echo "rm -f $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
573
rm -f "$(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
637
echo "rm -f $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
638
rm -f "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \