[nautilus-actions] Include a hacked version of gnome-doc-utils.make



commit b26ebb8ca0fd97bdaad8e6ec09686f6ddb164d0e
Author: Pierre Wieser <pwieser trychlos org>
Date:   Tue Oct 16 23:26:09 2012 +0200

    Include a hacked version of gnome-doc-utils.make
    
    Fix #672269 - Add check for xml2po (gnome-doc-utils) in configure
    reported by Robert Waters.
    See rationale in docs/nact/gnome-doc-utils-na.make.

 INSTALL                           |    9 +-
 Makefile.am                       |   13 +-
 autogen.sh                        |    7 +
 docs/nact/Makefile.am             |  116 ++++---
 docs/nact/gnome-doc-utils-na.make |  769 +++++++++++++++++++++++++++++++++++++
 m4/na-enable-manuals.m4           |    3 +-
 6 files changed, 854 insertions(+), 63 deletions(-)
---
diff --git a/INSTALL b/INSTALL
index 7d1c323..a1e89e1 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,8 +1,8 @@
 Installation Instructions
 *************************
 
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
+Inc.
 
    Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
@@ -226,6 +226,11 @@ order to use an ANSI C compiler:
 
 and if that doesn't work, install pre-built binaries of GCC for HP-UX.
 
+   HP-UX `make' updates targets which have the same time stamps as
+their prerequisites, which makes it generally unusable when shipped
+generated files such as `configure' are involved.  Use GNU `make'
+instead.
+
    On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
 parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
 a workaround.  If GNU CC is not installed, it is therefore recommended
diff --git a/Makefile.am b/Makefile.am
index a881941..777d7ff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,7 +41,8 @@ SUBDIRS = \
 #   which is prefixed with a make variable, instead of hardcoded as returned
 #   by pkg-config
 # - do not try to install schemas when making distcheck
-# - do not rebuild manuals
+# - do not rebuild NACT manuals
+# - gtk-doc requires to be enabled when making dist
 # - GNOME_DOC_DEFINES tries to disable scrollkeeper, but the set is
 #   overriden but this one
 DISTCHECK_CONFIGURE_FLAGS = \
@@ -57,8 +58,6 @@ DISTCHECK_CONFIGURE_FLAGS = \
 	$(NULL)
 
 EXTRA_DIST = \
-	gnome-doc-utils.make				\
-	gtk-doc.make						\
 	intltool-extract.in					\
 	intltool-merge.in					\
 	intltool-update.in					\
@@ -70,14 +69,6 @@ DISTCLEANFILES = \
 	intltool-update						\
 	$(NULL)
 
-# Though the Gnome doc says to add these files to DISTCLEANFILES, the
-# Automake manual states that distclean target should not remove any
-# distributed files (but leave a clean distribution)  
-MAINTAINERCLEANFILES = \
-	gnome-doc-utils.make				\
-	gtk-doc.make						\
-	$(NULL)
-
 pkgdocdir = $(datarootdir)/doc/@PACKAGE -@VERSION@
 
 dist_pkgdoc_DATA = \
diff --git a/autogen.sh b/autogen.sh
index fac9b6e..44aebca 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -21,3 +21,10 @@ which gnome-autogen.sh || {
 }
 
 USE_GNOME2_MACROS=1 . gnome-autogen.sh
+
+# pwi 2012-10-12
+# starting with NA 3.2.3, we let the GNOME-DOC-PREPARE do its stuff, but
+# get rid of the gnome-doc-utils.make standard file, as we are using our
+# own hacked version
+# (see full rationale in docs/nact/gnome-doc-utils-na.make)
+rm -f gnome-doc-utils.make
diff --git a/docs/nact/Makefile.am b/docs/nact/Makefile.am
index 7e095eb..f0248b8 100644
--- a/docs/nact/Makefile.am
+++ b/docs/nact/Makefile.am
@@ -51,7 +51,7 @@
 # to correctly generate POT files (cf. mail of Claude Paroz 2010-08-29
 # http://mail.gnome.org/archives/gnome-i18n/2010-August/msg00229.html).
 
-include $(top_srcdir)/gnome-doc-utils.make
+include $(srcdir)/gnome-doc-utils-na.make
 
 DOC_MODULE = nautilus-actions-config-tool
 
@@ -63,24 +63,32 @@ DOC_INCLUDES =
 DOC_FIGURES = $(patsubst $(srcdir)/C/%,%,$(shell \ls -1 $(srcdir)/C/figures/*.png))
 #DOC_FIGURES = "figures/add.png figures/nact-action-tab.png ... figures/stock-icon-about.png"
 
-DOC_LINGUAS = de es fr sl
+DOC_LINGUAS = $(patsubst $(srcdir)/%,%,$(shell find $(srcdir) -mindepth 1 -maxdepth 1 -type d | $(GREP) -v $(srcdir)/C))
+#DOC_LINGUAS = "de es fr sl"
 
+if ENABLE_MANUALS
 # _DOC_LC_DOCS is the list of the translated (not C) DOC_MODULE.xml files
 # we so are sure that they exist and are up to date
 # (path is .po ->[msgfmt]-> .mo ->[xml2po]-> .xml)
 MANUALS_XML = C/$(DOC_MODULE).xml $(_DOC_LC_DOCS)
+endif
+
+EXTRA_DIST = \
+	gnome-doc-utils-na.make				\
+	$(NULL)
 
-# just an empty value to be able to add something for html and pdf manuals
-MAINTAINERCLEANFILES =
+MAINTAINERCLEANFILES = \
+	gnome-doc-utils-na.make				\
+	$(NULL)
 
 pkgdocdir = $(datarootdir)/doc/@PACKAGE -@VERSION@
 
 # set to '-v' to be verbose (much verbose!)
 opt_verbose =
 
-all-local: all-manuals all-html-manuals all-pdf-manuals
+all-local: all-manuals
 
-all-manuals: all-html-manuals all-pdf-manuals
+all-manuals: install-C-xml all-html-manuals all-pdf-manuals
 
 install-data-local: install-manuals
 
@@ -94,10 +102,29 @@ uninstall-manuals: uninstall-html-manuals uninstall-pdf-manuals
 # it distributes both C (original) and generated (translated) .xml files,
 # but not generated .omf files which so will have to be re-generated from
 # the distributed .omf.in file
-dist-hook: doc-dist-hook dist-manuals-hook
+dist-hook: doc-dist-hook dist-manuals-hook dist-omf-hook
 
 dist-manuals-hook: dist-html-manuals-hook dist-pdf-manuals-hook
 
+# when building the manuals, C source files are in srcdir, while all
+# other xml files are in builddir - installing C xml sources in builddir
+# so that all rules apply
+install-C-xml:
+if ENABLE_MANUALS
+	@if test ! -f C/$(DOC_MODULE).xml; then \
+		echo "Installing C xml source files in $(abs_builddir)"; \
+		$(MKDIR_P) C; cp -v $(srcdir)/C/*.xml C/; \
+	fi
+endif
+
+remove-C-xml:
+if ENABLE_MANUALS
+	@echo "Removing C xml source files from $(abs_builddir)"
+	@if test "$(abs_srcdir)" != "$(abs_builddir)"; then \
+		rm -vf C/*.xml; \
+	fi
+endif
+
 # Build HTML manuals as $(builddir)/<lang>/<module>.html
 #
 # We have two alternative for generating HTML manual:
@@ -148,39 +175,33 @@ dist-manuals-hook: dist-html-manuals-hook dist-pdf-manuals-hook
 # .xml documents default to be read from <srcdir> for the C version,
 # and from <builddir> for translated ones.
 
+if ENABLE_HTML_MANUALS
 MANUALS_HTML = $(MANUALS_XML:%.xml=%.html)
 
 MAINTAINERCLEANFILES += $(MANUALS_HTML)
 
-if ENABLE_HTML_MANUALS
 all-html-manuals: $(MANUALS_HTML)
 else
 all-html-manuals:
 endif
 
 # The rule here is: only rebuild html/ files if corresponding xml has changed
-# .xml themselves are distributed, so are not modified when building a
-# distribution.
-#
-# 'bis' (Build In Source) variable is set to 'yes' if builddir = srcdir.
+# .xml themselves are distributed, so are not modified when building from a
+# distributed package.
 
 $(MANUALS_HTML): %.html: %.xml
 	@ftarget=$@; \
 	if test "$(opt_verbose)" = ""; then echo "  HTML   $$ftarget"; fi; \
-	if test "$(abs_srcdir)" = "$(abs_builddir)"; then bis="yes"; else bis="no"; fi; \
 	lc=$${ftarget%/*}; \
-	if test "x$(WITH_DB2HTML)" = "xyes"; then $(call exec_db2html,$$ftarget,$$lc,$$bis); fi; \
-	if test "x$(WITH_GDT)" = "xyes"; then $(call exec_g_d_t,$$ftarget,$$lc,$$bis); fi; \
+	if test "x$(WITH_DB2HTML)" = "xyes"; then $(call exec_db2html,$$lc); fi; \
+	if test "x$(WITH_GDT)" = "xyes"; then $(call exec_g_d_t,$$lc); fi; \
 	if test "$(opt_verbose)" = ""; then echo "  HTML   $$ftarget done"; fi
 
 # execute gnome-doc-tool
-# 1. make target
-# 2. locale
-# 3. "yes" if build in source
+# 1. locale
 exec_g_d_t = \
-	$(call install_xml,$(2),$(3)); \
 	fxml=$(DOC_MODULE).xml; \
-	(cd $(2); \
+	(cd $(1); \
 	 cmd="gnome-doc-tool html -o . -d0 $$fxml"; \
 	 if test "$(opt_verbose)" != ""; then echo "$$cmd"; fi; \
 	 eval $$cmd >/dev/null; \
@@ -193,22 +214,14 @@ exec_g_d_t = \
 			cmd="cp $(opt_verbose) $$admon_dir/*.png admon/"; eval $$cmd; \
 		fi; \
 	 fi; \
-	); \
-	$(call remove_xml,$(2),$(3))
+	)
 
 # execute db2html
-# 1. make target
-# 2. locale
-# 3. "yes" if build in source
+# 1. locale
 exec_db2html = \
-	cddir="$(2)"; \
+	cddir="$(1)"; \
 	output="."; \
 	fxml=$(DOC_MODULE).xml; \
-	if test "$(2)" = "C" -a "$(3)" = "no"; then \
-		cddir="."; \
-		output="C"; \
-		fxml=$(srcdir)/C/$$fxml; \
-	fi; \
 	cmd="(cd $$cddir && db2html --output $$output --nochunks $$fxml)"; \
 	if test "$(opt_verbose)" != ""; then echo "$$cmd"; fi; \
 	eval $$cmd >/dev/null; \
@@ -217,14 +230,14 @@ exec_db2html = \
 # install source .xml docs in builddir to be able to build C locale
 # 1. locale
 # 2. "yes" if build in source
-install_xml = \
-	if test "$(1)" = "C" -a "$(2)" = "no"; then $(MKDIR_P) C; cp $(srcdir)/C/*.xml C/; fi
+#install_xml = \
+#	if test "$(1)" = "C" -a "$(2)" = "no"; then $(MKDIR_P) C; cp $(srcdir)/C/*.xml C/; fi
 
 # remove .xml docs from builddir after having built C locale
 # 1. locale
 # 2. "yes" if build in source
-remove_xml = \
-	if test "$(1)" = "C" -a "$(2)" = "no"; then rm -f C/*.xml; fi
+#remove_xml = \
+#	if test "$(1)" = "C" -a "$(2)" = "no"; then rm -f C/*.xml; fi
 
 # Install HTML manuals in <htmldir>/<lang>/nact/ subdirectory;
 # where <htmldir> defaults to <pkgdocdir>/html
@@ -241,7 +254,7 @@ install-html-manuals:
 		_instd="$(DESTDIR)$(htmldir)"; \
 	fi; \
 	echo "  Installing in $$_instd ..."; \
-	for lc in C $(_DOC_REAL_LINGUAS); do \
+	for lc in C $(DOC_LINGUAS); do \
 		_instdir="$$_instd/$$lc/nact"; \
 		if test -f "$(builddir)/$$lc/$(DOC_MODULE).html"; then \
 			d="$(builddir)"; \
@@ -321,7 +334,7 @@ uninstall-html-manuals:
 # - distribute *.html manuals
 
 dist-html-manuals-hook:
-	@for lc in C $(_DOC_REAL_LINGUAS); do \
+	@for lc in C $(DOC_LINGUAS); do \
 		if test -f "$(builddir)/$$lc/$(DOC_MODULE).html"; then d=$(builddir); \
 		elif test -f "$(srcdir)/$$lc/$(DOC_MODULE).html"; then d=$(srcdir); fi; \
 		if test -f "$$d/$$lc/$(DOC_MODULE).html"; then \
@@ -362,10 +375,6 @@ else
 all-pdf-manuals:
 endif
 
-# _DOC_LC_DOCS is the list of the translated (not C) DOC_MODULE.xml files
-# we so are sure that they exist and are up to date
-# (path is .po ->[msgfmt]-> .mo ->[xml2po]-> .xml)
-#
 # workaround against l10n bug #664768
 # pdflatex cannot generate some localized pdf
 #
@@ -373,15 +382,11 @@ endif
 # - always create the output pdf in the same directory that the
 #   source xml
 #   (but we need to cd $$lc to mkdir figures)
-#
-# 'bis' (Build In Source) variable is set to 'yes' if builddir = srcdir.
 
 $(MANUALS_PDF): %.pdf: %.xml
 	@ftarget=$@; \
 	if test "$(opt_verbose)" = ""; then echo "  PDF    $$ftarget"; fi; \
-	if test "$(abs_srcdir)" = "$(abs_builddir)"; then bis="yes"; else bis="no"; fi; \
 	lc=$${ftarget%/*}; \
-	$(call install_xml,$$lc,$$bis); \
 	list='$(patsubst C/%,%,$(_DOC_C_FIGURES))'; \
 	(cd $$lc; \
 	 $(MKDIR_P) figures; \
@@ -401,7 +406,6 @@ $(MANUALS_PDF): %.pdf: %.xml
 	 find figures -type l | xargs rm -f; \
 	 rmdir figures 2>/dev/null || :; \
 	); \
-	$(call remove_xml,$$lc,$$bis); \
 	if test "$(opt_verbose)" = ""; then echo "  PDF    $$ftarget done"; fi
 
 # if --pdfdir has not been specified, then we default to PKGDOCDIR/pdf
@@ -416,7 +420,7 @@ install-pdf-manuals:
 		_instdir=$(DESTDIR)$(pdfdir); \
 	fi; \
 	echo "  Installing in $$_instdir ... "; \
-	for lc in C $(_DOC_REAL_LINGUAS); do \
+	for lc in C $(DOC_LINGUAS); do \
 		if test -f $(srcdir)/$$lc/$(DOC_MODULE).pdf; then d=$(srcdir); fi; \
 		if test -f $(builddir)/$$lc/$(DOC_MODULE).pdf; then d=$(builddir); fi; \
 		if test -f $$d/$$lc/$(DOC_MODULE).pdf; then \
@@ -440,7 +444,7 @@ uninstall-pdf-manuals:
 	fi
 
 dist-pdf-manuals-hook:
-	@for lc in C $(_DOC_REAL_LINGUAS); do \
+	@for lc in C $(DOC_LINGUAS); do \
 		if test -f $(builddir)/$$lc/$(DOC_MODULE).pdf; then d=$(builddir); \
 		elif test -f $(srcdir)/$$lc/$(DOC_MODULE).pdf; then d=$(srcdir); fi; \
 		if test -f "$$d/$$lc/$(DOC_MODULE).pdf"; then \
@@ -450,6 +454,20 @@ dist-pdf-manuals-hook:
 		fi; \
 	done
 
+# Distributing .omf files is required if we want the user be able to
+# get rid of gnome-doc-utils
+dist-omf-hook:
+	@for lc in C $(DOC_LINGUAS); do \
+		omf="$(DOC_MODULE)-$$lc.omf"; \
+		if test -f $(builddir)/$$omf; then d=$(builddir); \
+		elif test -f $(srcdir)/$$lc/$$omf; then d=$(srcdir)/$$lc; fi; \
+		if test -f "$$d/$$omf"; then \
+			if test "$(opt_verbose)" = ""; then echo "  Distributing $$omf"; fi; \
+			cmd="cp $$d/$$omf $(distdir)/$$lc/"; eval $$cmd; \
+			if test "$(opt_verbose)" != ""; then echo $$cmd; fi; \
+		fi; \
+	done
+
 # According to GNU Make manual (Â 13 What Gets Cleaned):
 #
 # - mostlyclean deletes files we typically want to rebuild
@@ -459,7 +477,7 @@ dist-pdf-manuals-hook:
 ##  None of these target should delete any distributed file
 ##
 # - maintainer-clean should delete other files
-clean-local:
+clean-local: remove-C-xml
 	rm -f *~
 	rm -f *.stamp
 
diff --git a/docs/nact/gnome-doc-utils-na.make b/docs/nact/gnome-doc-utils-na.make
new file mode 100644
index 0000000..8a1624e
--- /dev/null
+++ b/docs/nact/gnome-doc-utils-na.make
@@ -0,0 +1,769 @@
+# gnome-doc-utils.make - make magic for building documentation
+# Copyright (C) 2004-2005 Shaun McCance <shaunm gnome org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# pwi 2012-10-12
+# starting with NA 3.2.3, we are using this hacked version of
+# gnome-doc-utils.make rather than the standard one.
+#
+# Rationale:
+# - I, as a maitainer, have chosen to build myself and distribute all
+#   manuals and documentation, so preventing the user or the packager
+#   which would build from sources, to have the pain to install all the
+#   documentation machinery (gnome-doc-utils, gtk-doc, dblatex, and so
+#   on)
+# - I think this is a rather rationale choice, as these files are
+#   nonetheless architecture-independant data, and can be so safey used
+#   as is by users and packagers
+# - I surely not be the only maintainer which have made this choice..
+#
+# But:
+# - gnome-doc-utils.make does not have any conditionals which would
+#   only *build* or only *install* the documents
+# - this is so a pain for the maintainer to include gnome-doc-utils.make,
+#   and then hack its Makefile to only build and dist, or build and install,
+#   or just install from sources or from dist.
+#
+# Basically, we would need:
+# a/ build in builddir
+# b/ dist from srcdir (sources) and builddir (built docs)
+# c/ install from srcdir (if dist) or from builddir (if built)
+#
+# But, as gnome-doc-utils is deprecated to the profit of yelp-tools,
+# there is very little chance for the developper to accept a new RFE :(
+# So this dirty hack!
+#
+# What is the hack ?
+# Just distinguish between build and install phases, so that we are not
+# required to have gnome-doc-utils when just building from sources.
+# Note that this also distributing generated .omf files.
+
+################################################################################
+## @@ Generating Header Files
+
+## @ DOC_H_FILE
+## The name of the header file to generate
+DOC_H_FILE ?=
+
+## @ DOC_H_DOCS
+## The input DocBook files for generating the header file
+DOC_H_DOCS ?=
+
+$(DOC_H_FILE): $(DOC_H_DOCS);
+	@rm -f $  tmp; touch $  tmp;
+	echo 'const gchar* documentation_credits[] = {' >> $  tmp
+	list='$(DOC_H_DOCS)'; for doc in $$list; do \
+	  xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`"; \
+	  if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \
+	  xsltproc --path "$$xmlpath" $(_credits) $$doc; \
+	done | sort | uniq \
+	  | 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}}' \
+	  | sed -e 's/\\/\\\\/' -e 's/"/\\"/' -e 's/\(.*\)/\t"\1",/' >> $  tmp
+	echo '	NULL' >> $  tmp
+	echo '};' >> $  tmp
+	echo >> $  tmp
+	list='$(DOC_H_DOCS)'; for doc in $$list; do \
+	  xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`"; \
+	  if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \
+	  docid=`echo "$$doc" | sed -e 's/.*\/\([^/]*\)\.xml/\1/' \
+	    | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`; \
+	  echo $$xmlpath; \
+	  ids=`xsltproc --xinclude --path "$$xmlpath" $(_ids) $$doc`; \
+	  for id in $$ids; do \
+	    echo '#define HELP_'`echo $$docid`'_'`echo $$id \
+	      | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`' "'$$id'"' >> $  tmp; \
+	  done; \
+	  echo >> $  tmp; \
+	done;
+	cp $  tmp $@ && rm -f $  tmp
+
+dist-check-gdu:
+if !HAVE_GNOME_DOC_UTILS
+	@echo "*** GNOME Doc Utils must be installed in order to make dist"
+	@false
+endif
+
+.PHONY: dist-doc-header
+dist-doc-header: $(DOC_H_FILE)
+	@if test -f "$(DOC_H_FILE)"; then d=; else d="$(srcdir)/"; fi; \
+	echo "$(INSTALL_DATA) $${d}$(DOC_H_FILE) $(distdir)/$(DOC_H_FILE)"; \
+	$(INSTALL_DATA) "$${d}$(DOC_H_FILE)" "$(distdir)/$(DOC_H_FILE)";
+
+doc-dist-hook: dist-check-gdu $(if $(DOC_H_FILE),dist-doc-header)
+
+.PHONY: clean-doc-header
+_clean_doc_header = $(if $(DOC_H_FILE),clean-doc-header)
+clean-local: $(_clean_doc_header)
+distclean-local: $(_clean_doc_header)
+mostlyclean-local: $(_clean_doc_header)
+maintainer-clean-local: $(_clean_doc_header)
+clean-doc-header:
+	rm -f $(DOC_H_FILE)
+
+all: $(DOC_H_FILE)
+
+
+################################################################################
+## @@ Generating Documentation Files
+
+## @ DOC_MODULE
+## The name of the document being built
+DOC_MODULE ?=
+
+## @ DOC_ID
+## The unique identifier for a Mallard document
+DOC_ID ?=
+
+## @ DOC_PAGES
+## Page files in a Mallard document
+DOC_PAGES ?=
+
+## @ DOC_ENTITIES
+## Files included with a SYSTEM entity
+DOC_ENTITIES ?=
+
+## @ DOC_INCLUDES
+## Files included with XInclude
+DOC_INCLUDES ?=
+
+## @ DOC_FIGURES
+## Figures and other external data
+DOC_FIGURES ?=
+
+## @ DOC_FORMATS
+## The default formats to be built and installed
+DOC_FORMATS ?= docbook
+_DOC_REAL_FORMATS = $(if $(DOC_USER_FORMATS),$(DOC_USER_FORMATS),$(DOC_FORMATS))
+
+## @ DOC_LINGUAS
+## The languages this document is translated into
+DOC_LINGUAS ?=
+_DOC_REAL_LINGUAS = $(if $(filter environment,$(origin LINGUAS)),		\
+	$(filter $(LINGUAS),$(DOC_LINGUAS)),					\
+	$(DOC_LINGUAS))
+
+_DOC_ABS_SRCDIR = @abs_srcdir@
+
+
+################################################################################
+## Variables for Bootstrapping
+
+_xml2po ?= `which xml2po`
+_xml2po_mode = $(if $(DOC_ID),mallard,docbook)
+
+_db2html ?= `$(PKG_CONFIG) --variable db2html gnome-doc-utils`
+_db2omf  ?= `$(PKG_CONFIG) --variable db2omf gnome-doc-utils`
+_chunks  ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/chunks.xsl
+_credits ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/credits.xsl
+_ids ?= $(shell $(PKG_CONFIG) --variable xmldir gnome-doc-utils)/gnome/xslt/docbook/utils/ids.xsl
+
+if ENABLE_SK
+_ENABLE_SK = true
+_skpkgdatadir ?= `scrollkeeper-config --pkgdatadir`
+_sklocalstatedir ?= `scrollkeeper-config --pkglocalstatedir`
+_skcontentslist ?= $(_skpkgdatadir)/Templates/C/scrollkeeper_cl.xml
+endif
+
+
+################################################################################
+## Support for automake silent-rules
+GDU_V_XML2PO=$(GDU__v_XML2PO_$(V))
+GDU__v_XML2PO_=$(GDU__v_XML2PO_$(AM_DEFAULT_VERBOSITY))
+GDU__v_XML2PO_0= echo "  XML2PO" $@;
+
+GDU_V_MSGFMT=$(GDU__v_MSGFMT_$(V))
+GDU__v_MSGFMT_=$(GDU__v_MSGFMT_$(AM_DEFAULT_VERBOSITY))
+GDU__v_MSGFMT_0= echo "  MSGFMT" $@;
+
+GDU_V_DB2OMF=$(GDU__v_DB2OMF_$(V))
+GDU__v_DB2OMF_=$(GDU__v_DB2OMF_$(AM_DEFAULT_VERBOSITY))
+GDU__v_DB2OMF_0= echo "  DB2OMF" $@;
+
+GDU_V_DB2HTM=$(GDU__v_DB2HTM_$(V))
+GDU__v_DB2HTM_=$(GDU__v_DB2HTM_$(AM_DEFAULT_VERBOSITY))
+GDU__v_DB2HTM_0= echo "  DB2HTM" $@;
+
+################################################################################
+## @@ Rules for OMF Files
+
+db2omf_args =									\
+	--stringparam db2omf.basename $(DOC_MODULE)				\
+	--stringparam db2omf.format $(3)					\
+	--stringparam db2omf.dtd						\
+	$(shell xmllint --format $(2) | grep -h PUBLIC | head -n 1 		\
+		| sed -e 's/.*PUBLIC \(\"[^\"]*\"\).*/\1/')			\
+	--stringparam db2omf.lang $(notdir $(patsubst %/$(notdir $(2)),%,$(2)))	\
+	--stringparam db2omf.omf_dir "$(OMF_DIR)"				\
+	--stringparam db2omf.help_dir "$(HELP_DIR)"				\
+	--stringparam db2omf.omf_in "$(_DOC_OMF_IN)"				\
+	$(if $(_ENABLE_SK),							\
+	  --stringparam db2omf.scrollkeeper_cl "$(_skcontentslist)")		\
+	$(_db2omf) $(2)
+
+## @ _DOC_OMF_IN
+## The OMF input file
+_DOC_OMF_IN = $(if $(DOC_MODULE),$(wildcard $(_DOC_ABS_SRCDIR)/$(DOC_MODULE).omf.in))
+
+## @ _DOC_OMF_DB
+## The OMF files for DocBook output
+_DOC_OMF_DB = $(if $(_DOC_OMF_IN),						\
+	$(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-$(lc).omf))
+
+$(_DOC_OMF_DB) : $(_DOC_OMF_IN)
+$(_DOC_OMF_DB) : $(DOC_MODULE)-%.omf : %/$(DOC_MODULE).xml
+if ENABLE_MANUALS
+	@test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || {	\
+	  echo "The file '$(_skcontentslist)' does not exist." >&2;		\
+	  echo "Please check your ScrollKeeper installation." >&2;		\
+	  exit 1; }
+	$(GDU_V_DB2OMF)xsltproc -o $@ $(call db2omf_args,$@,$<,'docbook') || { rm -f "$@"; exit 1; }
+endif
+
+## @ _DOC_OMF_HTML
+## The OMF files for HTML output
+_DOC_OMF_HTML = $(if $(_DOC_OMF_IN),						\
+	$(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-html-$(lc).omf))
+
+$(_DOC_OMF_HTML) : $(_DOC_OMF_IN)
+$(_DOC_OMF_HTML) : $(DOC_MODULE)-html-%.omf : %/$(DOC_MODULE).xml
+if ENABLE_SK
+	@test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || {	\
+	  echo "The file '$(_skcontentslist)' does not exist" >&2;		\
+	  echo "Please check your ScrollKeeper installation." >&2;		\
+	  exit 1; }
+endif
+	$(GDU_V_DB2OMF)xsltproc -o $@ $(call db2omf_args,$@,$<,'xhtml') || { rm -f "$@"; exit 1; }
+
+## @ _DOC_OMF_ALL
+## All OMF output files to be built
+# FIXME
+_DOC_OMF_ALL =									\
+	$(if $(filter docbook,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_DB))		\
+	$(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_HTML))
+
+.PHONY: omf
+omf: $(_DOC_OMF_ALL)
+
+
+################################################################################
+## @@ C Locale Documents
+
+## @ _DOC_C_MODULE
+## The top-level documentation file in the C locale
+_DOC_C_MODULE = $(if $(DOC_MODULE),C/$(DOC_MODULE).xml)
+
+## @ _DOC_C_PAGES
+## Page files in a Mallard document in the C locale
+_DOC_C_PAGES = $(foreach page,$(DOC_PAGES),C/$(page))
+
+## @ _DOC_C_ENTITIES
+## Files included with a SYSTEM entity in the C locale
+_DOC_C_ENTITIES = $(foreach ent,$(DOC_ENTITIES),C/$(ent))
+
+## @ _DOC_C_XINCLUDES
+## Files included with XInclude in the C locale
+_DOC_C_INCLUDES = $(foreach inc,$(DOC_INCLUDES),C/$(inc))
+
+## @ _DOC_C_DOCS
+## All documentation files in the C locale
+_DOC_C_DOCS =								\
+	$(_DOC_C_ENTITIES)	$(_DOC_C_INCLUDES)			\
+	$(_DOC_C_PAGES)		$(_DOC_C_MODULE)
+
+## @ _DOC_C_DOCS_NOENT
+## All documentation files in the C locale,
+## except files included with a SYSTEM entity
+_DOC_C_DOCS_NOENT =							\
+	$(_DOC_C_MODULE)	$(_DOC_C_INCLUDES)			\
+	$(_DOC_C_PAGES)
+
+## @ _DOC_C_FIGURES
+## All figures and other external data in the C locale
+_DOC_C_FIGURES = $(if $(DOC_FIGURES),					\
+	$(foreach fig,$(DOC_FIGURES),C/$(fig)),				\
+	$(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/C/figures/*.png)))
+
+## @ _DOC_C_HTML
+## All HTML documentation in the C locale
+# FIXME: probably have to shell escape to determine the file names
+_DOC_C_HTML = $(foreach f,						\
+	$(shell xsltproc --xinclude 					\
+	  --stringparam db.chunk.basename "$(DOC_MODULE)"		\
+	  $(_chunks) "C/$(DOC_MODULE).xml"),				\
+	C/$(f).xhtml)
+
+###############################################################################
+## @@ Other Locale Documentation
+
+## @ _DOC_POFILES
+## The .po files used for translating the document
+_DOC_POFILES = $(if $(DOC_MODULE)$(DOC_ID),					\
+	$(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(lc).po))
+
+.PHONY: po
+po: $(_DOC_POFILES)
+
+## @ _DOC_MOFILES
+## The .mo files used for translating the document
+_DOC_MOFILES = $(patsubst %.po,%.mo,$(_DOC_POFILES))
+
+.PHONY: mo
+mo: $(_DOC_MOFILES)
+
+## @ _DOC_LC_MODULES
+## The top-level documentation files in all other locales
+_DOC_LC_MODULES = $(if $(DOC_MODULE),						\
+	$(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xml))
+
+## @ _DOC_LC_PAGES
+## Page files in a Mallard document in all other locales
+_DOC_LC_PAGES =									\
+	$(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach page,$(_DOC_C_PAGES),	\
+		$(lc)/$(notdir $(page)) ))
+
+## @ _DOC_LC_XINCLUDES
+## Files included with XInclude in all other locales
+_DOC_LC_INCLUDES =								\
+	$(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach inc,$(_DOC_C_INCLUDES),	\
+		$(lc)/$(notdir $(inc)) ))
+
+## @ _DOC_LC_HTML
+## All HTML documentation in all other locales
+# FIXME: probably have to shell escape to determine the file names
+_DOC_LC_HTML =									\
+	$(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach doc,$(_DOC_C_HTML),		\
+		$(lc)/$(notdir $(doc)) ))
+
+## @ _DOC_LC_DOCS
+## All documentation files in all other locales
+_DOC_LC_DOCS =									\
+	$(_DOC_LC_MODULES)	$(_DOC_LC_INCLUDES)	$(_DOC_LC_PAGES)	\
+	$(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_LC_HTML))
+
+## @ _DOC_LC_FIGURES
+## All figures and other external data in all other locales
+_DOC_LC_FIGURES = $(foreach lc,$(_DOC_REAL_LINGUAS),				\
+	$(patsubst C/%,$(lc)/%,$(_DOC_C_FIGURES)) )
+
+_DOC_SRC_FIGURES =								\
+	$(foreach fig,$(_DOC_C_FIGURES), $(foreach lc,C $(_DOC_REAL_LINGUAS),	\
+		$(wildcard $(srcdir)/$(lc)/$(patsubst C/%,%,$(fig))) ))
+
+$(_DOC_POFILES):
+	@if ! test -d $(dir $@); then \
+	  echo "mkdir $(dir $@)"; \
+	  mkdir "$(dir $@)"; \
+	fi
+	@if test ! -f $@ -a -f $(srcdir)/$@; then \
+	  echo "cp $(srcdir)/$@ $@"; \
+	  cp "$(srcdir)/$@" "$@"; \
+	fi;
+	@docs=; \
+	list='$(_DOC_C_DOCS_NOENT)'; for doc in $$list; do \
+	  docs="$$docs $(_DOC_ABS_SRCDIR)/$$doc"; \
+	done; \
+	if ! test -f $@; then \
+	  echo "(cd $(dir $@) && \
+	    $(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
+	    cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)"; \
+	  (cd $(dir $@) && \
+	    $(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
+	    cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp); \
+	else \
+	  echo "(cd $(dir $@) && \
+	    $(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs)"; \
+	  (cd $(dir $@) && \
+	    $(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs); \
+	fi
+
+$(_DOC_MOFILES): %.mo: %.po
+	$(AM_V_at)if ! test -d $(dir $@); then mkdir "$(dir $@)"; fi
+	$(GDU_V_MSGFMT)msgfmt -o $@ $<
+
+if ENABLE_MANUALS
+# FIXME: fix the dependancy
+# FIXME: hook xml2po up
+$(_DOC_LC_DOCS) : $(_DOC_MOFILES)
+$(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
+	$(AM_V_at)if ! test -d $(dir $@); then mkdir $(dir $@); fi
+	$(GDU_V_XML2PO)if [ -f "C/$(notdir $@)" ]; then d="../"; else d="$(_DOC_ABS_SRCDIR)/"; fi; \
+	mo="$(dir $@)$(patsubst %/$(notdir $@),%,$@).mo"; \
+	if [ -f "$${mo}" ]; then mo="../$${mo}"; else mo="$(_DOC_ABS_SRCDIR)/$${mo}"; fi; \
+	(cd $(dir $@) && \
+	  $(_xml2po) -m $(_xml2po_mode) -e -t "$${mo}" \
+	    "$${d}C/$(notdir $@)" > $(notdir $@).tmp && \
+	    cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)
+endif
+
+## @ _DOC_POT
+## A pot file
+_DOC_POT = $(if $(DOC_MODULE),$(DOC_MODULE).pot,$(if $(DOC_ID),$(DOC_ID).pot))
+.PHONY: pot
+pot: $(_DOC_POT)
+$(_DOC_POT): $(_DOC_C_DOCS_NOENT)
+	$(GDU_V_XML2PO)$(_xml2po) -m $(_xml2po_mode) -e -o $@ $^
+
+
+################################################################################
+## @@ All Documentation
+
+## @ _DOC_HTML_ALL
+## All HTML documentation, only if it's built
+_DOC_HTML_ALL = $(if $(filter html HTML,$(_DOC_REAL_FORMATS)), \
+	$(_DOC_C_HTML) $(_DOC_LC_HTML))
+
+_DOC_HTML_TOPS = $(foreach lc,C $(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xhtml)
+
+$(_DOC_HTML_TOPS): $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
+	$(GDU_V_DB2HTM)xsltproc -o $@ --xinclude --param db.chunk.chunk_top "false()" --stringparam db.chunk.basename "$(DOC_MODULE)" --stringparam db.chunk.extension ".xhtml" $(_db2html) $(patsubst %.xhtml,%.xml,$@)
+
+
+################################################################################
+## All
+
+all:							\
+	$(_DOC_C_DOCS)		$(_DOC_LC_DOCS)		\
+	$(_DOC_OMF_ALL)		$(_DOC_DSK_ALL)		\
+	$(_DOC_HTML_ALL)	$(_DOC_POFILES)
+
+
+################################################################################
+## Clean
+
+.PHONY: clean-doc-omf clean-doc-dsk clean-doc-lc clean-doc-dir
+
+clean-doc-omf: ; rm -f $(_DOC_OMF_DB) $(_DOC_OMF_HTML)
+clean-doc-dsk: ; rm -f $(_DOC_DSK_DB) $(_DOC_DSK_HTML)
+clean-doc-lc:
+	rm -f $(_DOC_LC_DOCS)
+	rm -f $(_DOC_MOFILES)
+	@list='$(_DOC_POFILES)'; for po in $$list; do \
+	  if ! test "$$po" -ef "$(srcdir)/$$po"; then \
+	    echo "rm -f $$po"; \
+	    rm -f "$$po"; \
+	  fi; \
+	done
+#	.xml2.po.mo cleaning is obsolete as of 0.18.1 and could be removed in 0.20.x
+	@for lc in C $(_DOC_REAL_LINGUAS); do \
+	  if test -f "$$lc/.xml2po.mo"; then \
+	    echo "rm -f $$lc/.xml2po.mo"; \
+	    rm -f "$$lc/.xml2po.mo"; \
+	  fi; \
+	done
+
+#clean-doc-dir: clean-doc-lc
+#	@for lc in C $(_DOC_REAL_LINGUAS); do \
+#	  for dir in `find $$lc -depth -type d`; do \
+#	    if ! test $$dir -ef $(srcdir)/$$dir; then \
+#	      echo "rmdir $$dir"; \
+#	      rmdir "$$dir"; \
+#	   fi; \
+#	  done; \
+#	done
+
+_clean_omf = $(if $(_DOC_OMF_IN),clean-doc-omf)
+_clean_dsk = $(if $(_DOC_DSK_IN),clean-doc-dsk)
+_clean_lc  = $(if $(_DOC_REAL_LINGUAS),clean-doc-lc)
+_clean_dir = $(if $(DOC_MODULE)$(DOC_ID),clean-doc-dir)
+
+clean-local:						\
+	$(_clean_omf)		$(_clean_dsk)		\
+	$(_clean_lc)		$(_clean_dir)
+distclean-local:					\
+	$(_clean_omf)		$(_clean_dsk)		\
+	$(_clean_lc)		$(_clean_dir)
+mostlyclean-local:					\
+	$(_clean_omf)		$(_clean_dsk)		\
+	$(_clean_lc)		$(_clean_dir)
+maintainer-clean-local:					\
+	$(_clean_omf)		$(_clean_dsk)		\
+	$(_clean_lc)		$(_clean_dir)
+
+
+
+################################################################################
+## Dist
+
+.PHONY: dist-doc-docs dist-doc-pages dist-doc-figs dist-doc-omf dist-doc-dsk
+doc-dist-hook: 						\
+	$(if $(DOC_MODULE)$(DOC_ID),dist-doc-docs)	\
+	$(if $(_DOC_C_FIGURES),dist-doc-figs)		\
+	$(if $(_DOC_OMF_IN),dist-doc-omf)
+#	$(if $(_DOC_DSK_IN),dist-doc-dsk)
+
+dist-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES)
+	@for lc in C $(_DOC_REAL_LINGUAS); do \
+	  echo " $(mkinstalldirs) $(distdir)/$$lc"; \
+	  $(mkinstalldirs) "$(distdir)/$$lc"; \
+	done
+	@list='$(_DOC_C_DOCS)'; \
+	for doc in $$list; do \
+	  if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
+	    docdir=`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
+	    if ! test -d "$(distdir)/$$docdir"; then \
+	      echo "$(mkinstalldirs) $(distdir)/$$docdir"; \
+	      $(mkinstalldirs) "$(distdir)/$$docdir"; \
+	    fi; \
+	  echo "$(INSTALL_DATA) $$d$$doc $(distdir)/$$doc"; \
+	  $(INSTALL_DATA) "$$d$$doc" "$(distdir)/$$doc"; \
+	done
+	@list='$(_DOC_LC_DOCS)'; \
+	for doc in $$list; do \
+	  if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
+	    docdir=`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
+	    if ! test -d "$(distdir)/$$docdir"; then \
+	      echo "$(mkinstalldirs) $(distdir)/$$docdir"; \
+	      $(mkinstalldirs) "$(distdir)/$$docdir"; \
+	    fi; \
+	  echo "$(INSTALL_DATA) $$d$$doc $(distdir)/$$doc"; \
+	  $(INSTALL_DATA) "$$d$$doc" "$(distdir)/$$doc"; \
+	done
+	@list='$(_DOC_POFILES)'; \
+	for doc in $$list; do \
+	  if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
+	    docdir=`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
+	    if ! test -d "$(distdir)/$$docdir"; then \
+	      echo "$(mkinstalldirs) $(distdir)/$$docdir"; \
+	      $(mkinstalldirs) "$(distdir)/$$docdir"; \
+	    fi; \
+	  echo "$(INSTALL_DATA) $$d$$doc $(distdir)/$$doc"; \
+	  $(INSTALL_DATA) "$$d$$doc" "$(distdir)/$$doc"; \
+	done
+
+dist-doc-figs: $(_DOC_SRC_FIGURES)
+	@list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; \
+	for fig in $$list; do \
+	  if test -f "$$fig"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f "$$d$$fig"; then \
+	    figdir=`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
+	    if ! test -d "$(distdir)/$$figdir"; then \
+	      echo "$(mkinstalldirs) $(distdir)/$$figdir"; \
+	      $(mkinstalldirs) "$(distdir)/$$figdir"; \
+	    fi; \
+	    echo "$(INSTALL_DATA) $$d$$fig $(distdir)/$$fig"; \
+	    $(INSTALL_DATA) "$$d$$fig" "$(distdir)/$$fig"; \
+	  fi; \
+	done;
+
+dist-doc-omf:
+	@if test -f "$(_DOC_OMF_IN)"; then d=; else d="$(srcdir)/"; fi; \
+	echo "$(INSTALL_DATA) $$d$(_DOC_OMF_IN) $(distdir)/$(notdir $(_DOC_OMF_IN))"; \
+	$(INSTALL_DATA) "$$d$(_DOC_OMF_IN)" "$(distdir)/$(notdir $(_DOC_OMF_IN))"
+
+dist-doc-dsk:
+	@if test -f "$(_DOC_DSK_IN)"; then d=; else d="$(srcdir)/"; fi; \
+	echo "$(INSTALL_DATA) $$d$(_DOC_DSK_IN) $(distdir)/$(notdir $(_DOC_DSK_IN))"; \
+	$(INSTALL_DATA) "$$d$(_DOC_DSK_IN)" "$(distdir)/$(notdir $(_DOC_DSK_IN))"
+
+
+
+################################################################################
+## Check
+
+.PHONY: check-doc-docs check-doc-omf
+check:							\
+	$(if $(DOC_MODULE),check-doc-docs)		\
+	$(if $(DOC_ID),check-doc-pages)			\
+	$(if $(_DOC_OMF_IN),check-doc-omf)
+
+check-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
+	@for lc in C $(_DOC_REAL_LINGUAS); do \
+	  if test -f "$$lc"; \
+	    then d=; \
+	    xmlpath="$$lc"; \
+	  else \
+	    d="$(srcdir)/"; \
+	    xmlpath="$$lc:$(srcdir)/$$lc"; \
+	  fi; \
+	  echo "xmllint --noout --noent --path $$xmlpath --xinclude --postvalid $$d$$lc/$(DOC_MODULE).xml"; \
+	  xmllint --noout --noent --path "$$xmlpath" --xinclude --postvalid "$$d$$lc/$(DOC_MODULE).xml"; \
+	done
+
+check-doc-pages: $(_DOC_C_PAGES) $(_DOC_LC_PAGES)
+	for lc in C $(_DOC_REAL_LINGUAS); do \
+	  if test -f "$$lc"; \
+	    then d=; \
+	    xmlpath="$$lc"; \
+	  else \
+	    d="$(srcdir)/"; \
+	    xmlpath="$$lc:$(srcdir)/$$lc"; \
+	  fi; \
+	  for page in $(DOC_PAGES); do \
+	    echo "xmllint --noout --noent --path $$xmlpath --xinclude $$d$$lc/$$page"; \
+	    xmllint --noout --noent --path "$$xmlpath" --xinclude "$$d$$lc/$$page"; \
+	  done; \
+	done
+
+check-doc-omf: $(_DOC_OMF_ALL)
+	@list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
+		lc=`echo $$omf | sed -e 's/$(DOC_MODULE)-//' -e 's/\.omf//'`; \
+		if test -f $(builddir)/$$omf; then d=$(builddir); \
+		elif test -f $(srcdir)/$$lc/$$omf; then d=$(srcdir)/$$lc; fi; \
+		cmd="xmllint --noout --xinclude --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$d/$$omf"; \
+		echo $$cmf; eval $$cmd; \
+	done
+
+
+
+################################################################## ##############
+## Install
+
+.PHONY: install-doc-docs install-doc-html install-doc-figs install-doc-omf install-doc-dsk
+
+_doc_install_dir = $(if $(DOC_ID),$(DOC_ID),$(DOC_MODULE))
+
+install-data-local:					\
+	$(if $(DOC_MODULE)$(DOC_ID),install-doc-docs)	\
+	$(if $(_DOC_HTML_ALL),install-doc-html)		\
+	$(if $(_DOC_C_FIGURES),install-doc-figs)	\
+	$(if $(_DOC_OMF_IN),install-doc-omf)
+#	$(if $(_DOC_DSK_IN),install-doc-dsk)
+
+install-doc-docs:
+	@for lc in C $(_DOC_REAL_LINGUAS); do \
+	  echo "$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc"; \
+	  $(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc; \
+	done
+	@list='$(_DOC_C_DOCS)'; for doc in $$list; do \
+	  if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
+	  docdir="$$lc/"`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
+	  docdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$docdir"; \
+	  if ! test -d "$$docdir"; then \
+	    echo "$(mkinstalldirs) $$docdir"; \
+	    $(mkinstalldirs) "$$docdir"; \
+	  fi; \
+	  echo "$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
+	  $(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc; \
+	done
+	@list='$(_DOC_LC_DOCS)'; for doc in $$list; do \
+	  if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
+	  docdir="$$lc/"`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
+	  docdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$docdir"; \
+	  if ! test -d "$$docdir"; then \
+	    echo "$(mkinstalldirs) $$docdir"; \
+	    $(mkinstalldirs) "$$docdir"; \
+	  fi; \
+	  echo "$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
+	  $(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc; \
+	done
+
+install-doc-figs:
+	@list='$(patsubst C/%,%,$(_DOC_C_FIGURES))'; for fig in $$list; do \
+	  for lc in C $(_DOC_REAL_LINGUAS); do \
+	    figsymlink=false; \
+	    if test -f "$$lc/$$fig"; then \
+	      figfile="$$lc/$$fig"; \
+	    elif test -f "$(srcdir)/$$lc/$$fig"; then \
+	      figfile="$(srcdir)/$$lc/$$fig"; \
+	    else \
+	      figsymlink=true; \
+	    fi; \
+	    figdir="$$lc/"`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
+	    figdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$figdir"; \
+	    if ! test -d "$$figdir"; then \
+	      echo "$(mkinstalldirs) $$figdir"; \
+	      $(mkinstalldirs) "$$figdir"; \
+	    fi; \
+	    figbase=`echo $$fig | sed -e 's/^.*\///'`; \
+	    if $$figsymlink; then \
+	      echo "cd $$figdir && $(LN_S) -f ../../C/$$fig $$figbase"; \
+	      ( cd "$$figdir" && $(LN_S) -f "../../C/$$fig" "$$figbase" ); \
+	    else \
+	      echo "$(INSTALL_DATA) $$figfile $$figdir$$figbase"; \
+	      $(INSTALL_DATA) "$$figfile" "$$figdir$$figbase"; \
+	    fi; \
+	  done; \
+	done
+
+install-doc-html:
+	echo install-html
+
+# install omf files from srcdir/lc or from builddir
+install-doc-omf:
+	$(mkinstalldirs) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)
+	@for lc in C $(DOC_LINGUAS); do \
+		omf="$(DOC_MODULE)-$$lc.omf"; \
+		if test -f $(builddir)/$$omf; then d=$(builddir); \
+		elif test -f $(srcdir)/$$lc/$$omf; then d=$(srcdir)/$$lc; fi; \
+		if test -f "$$d/$$omf"; then \
+			destomf="$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
+			cmd="$(INSTALL_DATA) $$d/$$omf $$destomf"; \
+			echo "$$cmd"; eval "$$cmd"; \
+			sed -i -e 's?^\(.*identifier url="\).*\("/>.*\)?\1$(HELP_DIR)\2?' $$destomf; \
+		fi; \
+	done
+	@if test "x$(_ENABLE_SK)" = "xtrue"; then \
+	  echo "scrollkeeper-update -p $(DESTDIR)$(_sklocalstatedir) -o $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
+	  scrollkeeper-update -p "$(DESTDIR)$(_sklocalstatedir)" -o "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
+	fi;
+
+#install-doc-omf:
+#	$(mkinstalldirs) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)
+#	@list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
+#	  echo "$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
+#	  $(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf; \
+#	done
+#	@if test "x$(_ENABLE_SK)" = "xtrue"; then \
+#	  echo "scrollkeeper-update -p $(DESTDIR)$(_sklocalstatedir) -o $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
+#	  scrollkeeper-update -p "$(DESTDIR)$(_sklocalstatedir)" -o "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
+#	fi;
+
+install-doc-dsk:
+	echo install-dsk
+
+
+
+################################################################################
+## Uninstall
+
+.PHONY: uninstall-doc-docs uninstall-doc-html uninstall-doc-figs uninstall-doc-omf uninstall-doc-dsk
+uninstall-local:					\
+	$(if $(DOC_MODULE)$(DOC_ID),uninstall-doc-docs)	\
+	$(if $(_DOC_HTML_ALL),uninstall-doc-html)	\
+	$(if $(_DOC_C_FIGURES),uninstall-doc-figs)	\
+	$(if $(_DOC_OMF_IN),uninstall-doc-omf)
+#	$(if $(_DOC_DSK_IN),uninstall-doc-dsk)
+
+uninstall-doc-docs:
+	@list='$(_DOC_C_DOCS)'; for doc in $$list; do \
+	  echo " rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
+	  rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
+	done
+	@list='$(_DOC_LC_DOCS)'; for doc in $$list; do \
+	  echo " rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
+	  rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
+	done
+
+uninstall-doc-figs:
+	@list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; for fig in $$list; do \
+	  echo "rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
+	  rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
+	done;
+
+uninstall-doc-omf:
+	@list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
+	  if test "x$(_ENABLE_SK)" = "xtrue"; then \
+	    echo "scrollkeeper-uninstall -p $(_sklocalstatedir) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
+	    scrollkeeper-uninstall -p "$(_sklocalstatedir)" "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
+	  fi; \
+	  echo "rm -f $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
+	  rm -f "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
+	done
diff --git a/m4/na-enable-manuals.m4 b/m4/na-enable-manuals.m4
index cde9839..b394350 100644
--- a/m4/na-enable-manuals.m4
+++ b/m4/na-enable-manuals.m4
@@ -25,7 +25,7 @@
 #   Pierre Wieser <pwieser trychlos org>
 #   ... and many others (see AUTHORS)
 
-# serial 3 add 'msg_' prefixed messages
+# serial 4 define ENABLE_MANUALS conditional
 
 dnl --enable-html-manuals[=gdt|db2html]
 dnl   generates HTML manuals for all locales
@@ -50,6 +50,7 @@ AC_DEFUN([NA_ENABLE_MANUALS],[
 	
 	_CHECK_FOR_HTML_MANUALS
 	_CHECK_FOR_PDF_MANUALS
+	AM_CONDITIONAL([ENABLE_MANUALS], [test "x${enable_html_manuals}" != "xno" || test "x${enable_pdf_manuals}" != "xno"])
 ])
 
 AC_DEFUN([_AC_ARG_NA_ENABLE_HTML_MANUALS],[



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]