[glom] Heavily cut the pyglom_reference build magic



commit 7be93d2a6f37035cdf08cf38306290bb347cfbd1
Author: Daniel Elstner <danielk openismus com>
Date:   Mon Apr 26 16:47:45 2010 +0200

    Heavily cut the pyglom_reference build magic
    
    * docs/pyglom_reference/Makefile.am: Drop the custom installation
    rules and use the GNU make $(wildcard) function for both distribution
    and installation of the generated documentation files.  Since the
    files do not undergo translation at install time, it is not necessary
    to integrate the custom installation tool from mm-common.  Pull in a
    missing GNU make function definition for computing the list of files.

 ChangeLog                         |   11 +++++
 docs/pyglom_reference/Makefile.am |   90 +++++++++----------------------------
 2 files changed, 32 insertions(+), 69 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 14aeda8..34c2da5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2010-04-26  Daniel Elstner  <danielk openismus com>
 
+	Heavily cut the pyglom_reference build magic
+
+	* docs/pyglom_reference/Makefile.am: Drop the custom installation
+	rules and use the GNU make $(wildcard) function for both distribution
+	and installation of the generated documentation files.  Since the
+	files do not undergo translation at install time, it is not necessary
+	to integrate the custom installation tool from mm-common.  Pull in a
+	missing GNU make function definition for computing the list of files.
+
+2010-04-26  Daniel Elstner  <danielk openismus com>
+
 	Temporarily disable test_document_load
 
 	* Makefile_tests.am (check_PROGRAMS), (TESTS): Temporarily remove
diff --git a/docs/pyglom_reference/Makefile.am b/docs/pyglom_reference/Makefile.am
index 5b85667..c219d01 100644
--- a/docs/pyglom_reference/Makefile.am
+++ b/docs/pyglom_reference/Makefile.am
@@ -12,87 +12,39 @@ book_name = pyglom_$(GLOM_ABI_VERSION_UNDERLINED)
 
 # The name of the sub-directory where the generated documentation
 # will be placed.
-doc_outdir ?= .
+html_outdir = html
+
+# A list of wildcard patterns matching the documentation files to distribute.
+htmlref_patterns = *.css *.gif *.html *.png *.js *.inv *.txt
 
 # Installation directories.
 libdocdir    = $(datarootdir)/doc/$(book_name)
 referencedir = $(libdocdir)/reference
 htmlrefdir   = $(referencedir)/html
+htmlref_staticdir = $(htmlrefdir)/_static
 
-if ENABLE_DOCUMENTATION
-doc_inst_targets = install-htmlref
-doc_inst_files   =
-doc_dist_files   = $(call vpath_listall,$(htmlref_patterns))
-else
-doc_inst_targets =
-doc_inst_files   =
-doc_dist_files   =
-endif
+# Function: $(call vpath_listall,PATTERN ...)
+# Get all filenames which match a PATTERN from the list.  Look for files
+# relative to either the current directory or $(srcdir).  Strip $(srcdir)/
+# again before returning and remove any duplicates.
+vpath_srclist = $(patsubst $(srcdir)/%,%,$(wildcard $(addprefix $(srcdir)/,$(1))))
+vpath_listall = $(sort $(wildcard $(1)) $(if $(srcdir:.=),$(vpath_srclist)))
 
-dist_reference_DATA = $(strip $(doc_inst_files))
-dist_noinst_DATA    = $(strip $(doc_dist_files))
+dist_htmlref_DATA = $(call vpath_listall,$(addprefix $(html_outdir)/,$(htmlref_patterns)))
+dist_htmlref_static_DATA = $(call vpath_listall,$(addprefix $(html_outdir)/_static/,$(htmlref_patterns)))
 
-#DISTCLEANFILES       = $(doc_outdir)/doxygen.log
-MAINTAINERCLEANFILES = $(doc_outdir)/html/* outdir
+MAINTAINERCLEANFILES = $(html_outdir)/_sources/* $(html_outdir)/_static/* $(html_outdir)/*
 
 html/index.html:
-	rm -rf html
-	$(SPHINX_BUILD) -b html ./ $(doc_outdir)/html/
+	-$(AM_V_at)rm -fr $(html_outdir)
+	$(AM_V_GEN)$(SPHINX_BUILD) -b html . $(html_outdir)
 
 # Explicitly depend on the files to be distributed or installed.
-all-local: $(doc_inst_files) $(doc_dist_files)
-
-# Hook up custom rules for translating references to external documentation
-# to the actual location at install time.
-install-data-local: $(doc_inst_targets)
-
-# Hook up corresponding custom uninstall rules.
-uninstall-local: $(addprefix un,$(doc_inst_targets))
-
-# A list of wildcard patterns matching the files from the HTML directory
-# generated by sphinx which should be distributed and installed.
-htmlref_patterns ?= $(addprefix $(doc_outdir)/html/*.,css gif html png js inv txt)
-htmlref_patterns_static ?= $(addprefix $(doc_outdir)/html/_static/*.,css gif html png js inv txt)
-
-# Expand to a list of -name 'PATTERN' arguments for use with 'find'.
-htmlref_find_patterns = $(patsubst %,-name '%' -o,$(notdir $(htmlref_patterns))) -false
-
-# Helper variables to replicate each pattern with a $(srcdir)/ prefix.
-# Also add quoting to prevent the shell from expanding the patterns.
-htmlref_patterns_dup   = $(foreach item,$(htmlref_patterns),'$(item)' '$(srcdir)/$(item)')
-htmlref_patterns_quote = $(patsubst %,'%',$(htmlref_patterns))
-htmlref_patterns_vpath = $(if $(srcdir:.=),$(htmlref_patterns_dup),$(htmlref_patterns_quote))
-htmlref_patterns_dup_static   = $(foreach item,$(htmlref_patterns_static),'$(item)' '$(srcdir)/$(item)')
-htmlref_patterns_quote_static = $(patsubst %,'%',$(htmlref_patterns_static))
-htmlref_patterns_vpath_static = $(if $(srcdir:.=),$(htmlref_patterns_dup_static),$(htmlref_patterns_quote_static))
-
-# TODO: Use something standard instead of this mm-common thing.
-doc_install ?= $(PERL) -- "$(MMDOCTOOLDIR)/doc-install.pl"
-doc_install_cmd = $(doc_install) --verbose --mode=0644
-
-# Install the HTML reference documentation files with just one invocation
-# of doc-install.pl to speed up the build process.  Make use of the --glob
-# option, which tells it to perform filename globbing itself, like 'find'.
-# This helps to avoid excessively long command lines, as some platforms
-# have rather restrictive limits.
-# TODO: Install the stuff under _static.
-install-htmlref: $(doc_outdir)/html/index.html html
-	@$(NORMAL_INSTALL)
-	$(MKDIR_P) '$(DESTDIR)$(htmlrefdir)'
-	$(MKDIR_P) '$(DESTDIR)$(htmlrefdir)/_static'
-	$(doc_install_cmd) -t '$(DESTDIR)$(htmlrefdir)' --glob -- $(htmlref_patterns_vpath)
-	$(doc_install_cmd) -t '$(DESTDIR)$(htmlrefdir)/_static' --glob -- $(htmlref_patterns_vpath_static)
-
-# Delete files from the html installation directory.  Avoid recursive
-# directory removal, and apply the same wildcard pattern as was used to
-# select files for installation.
-uninstall-htmlref:
-	@$(NORMAL_UNINSTALL)
-	(cd '$(DESTDIR)$(htmlrefdir)' 2>/dev/null || exit 0; \
-	 find . -type f '(' $(htmlref_find_patterns) ')' -exec rm -f '{}' '+')
-
-# Define phony (non-file) targets so things don't break if anyone creates files with these names.
-.PHONY: install-htmlref uninstall-htmlref
+if ENABLE_DOCUMENTATION
+all-local: html/index.html
+else
+all-local:
+endif
 
 # Instruct GNU make to delete the targets of a rule after it failed, in
 # order to avoid the complication of handling that situation manually.



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