[gtkmm-documentation] Support Automake silent rules



commit 13db98e73f861718735556381e84e4ac5653ffd0
Author: Daniel Elstner <daniel kitta gmail com>
Date:   Sat Oct 3 07:57:20 2009 +0200

    Support Automake silent rules
    
    * configure.ac: Call the AM_SILENT_RULES macro if it is defined.
    * docs/tutorial/Makefile.am: Prefix $(AM_V_at) and $(AM_V_GEN)
    to commands of custom rules in order to suppress the echoing of
    executed commands in silent rules mode.
    * docs/FAQ/Makefile.am: Modernize build rules as already done for
    the tutorial build.  Prefix $(AM_V_at) and $(AM_V_GEN) to commands
    in order to support Automake silent rules.

 ChangeLog                 |   12 ++++++++
 configure.ac              |    1 +
 docs/FAQ/Makefile.am      |   62 ++++++++++++++++++++------------------------
 docs/tutorial/Makefile.am |   20 +++++++-------
 4 files changed, 51 insertions(+), 44 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4d1680e..da4bff2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2009-10-03  Daniel Elstner  <daniel kitta gmail com>
 
+	Support Automake silent rules
+
+	* configure.ac: Call the AM_SILENT_RULES macro if it is defined.
+	* docs/tutorial/Makefile.am: Prefix $(AM_V_at) and $(AM_V_GEN)
+	to commands of custom rules in order to suppress the echoing of
+	executed commands in silent rules mode.
+	* docs/FAQ/Makefile.am: Modernize build rules as already done for
+	the tutorial build.  Prefix $(AM_V_at) and $(AM_V_GEN) to commands
+	in order to support Automake silent rules.
+
+2009-10-03  Daniel Elstner  <daniel kitta gmail com>
+
 	Create output subdirectories automatically
 
 	* docs/tutorial/Makefile.am (all-local): Prepend the $(DOC_LINGUAS)
diff --git a/configure.ac b/configure.ac
index 2cc382d..eb3112d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,6 +11,7 @@ AC_CONFIG_MACRO_DIR([build])
 AC_CONFIG_HEADERS([build/config.h])
 
 AM_INIT_AUTOMAKE([1.9 -Wno-portability check-news dist-bzip2 no-define nostdinc tar-pax])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
 AM_MAINTAINER_MODE
 AC_ARG_VAR([ACLOCAL_FLAGS], [aclocal flags, e.g. -I <macro dir>])
 
diff --git a/docs/FAQ/Makefile.am b/docs/FAQ/Makefile.am
index c0fdb41..414e2e1 100644
--- a/docs/FAQ/Makefile.am
+++ b/docs/FAQ/Makefile.am
@@ -1,54 +1,48 @@
 ## This file is part of gtkmm-documentation.
 
 gtkmm_docdir = $(datadir)/doc/gtkmm-2.4
+faq_htmldir  = $(gtkmm_docdir)/FAQ/html
 docbook_docs = gtkmm-faq.xml
 
-EXTRA_DIST = README gtkmm-faq.xml html
-
 DOCBOOK_STYLESHEET ?= http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
+XSLTPROC = xsltproc
 
-# The new XML DocBook way:
-html/index.html: $(docbook_docs)
-	-rm -rf html
-	$(mkinstalldirs) html
-	xsltproc -o html/ --catalogs $(DOCBOOK_STYLESHEET) $<
+# 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)))
 
-#post-html: html/index.html
-#	rsync $(rsync_args) -r html $$USER $(web_host):$(gtkmm_faq_path)/
+faq_html_files = $(call vpath_listall,html/*.html)
+faq_html_inst  = $(foreach file,$(faq_html_files),$(or $(wildcard $(file)),$(srcdir)/$(file)))
 
-doc-clean:
-	-rm -rf html
+dist_noinst_DATA = $(docbook_docs) $(call vpath_listall,html/*.html)
+
+MAINTAINERCLEANFILES = html/*.html $(srcdir)/html/*.html
 
 all-local: html/index.html
 
-maintainer-clean-local: doc-clean
+install-data-local: install-faq
 
-faqdir = $(gtkmm_docdir)/FAQ/html
+uninstall-local: uninstall-faq
 
 install-faq: html/index.html
 	@$(NORMAL_INSTALL)
-	$(mkinstalldirs) $(DESTDIR)$(faqdir)
-	@dir='$(<D)'; for p in $$dir/*.html ; do \
-	  f="`echo $$p | sed -e 's|^.*/||'`"; \
-	  echo " $(INSTALL_DATA) $$p $(DESTDIR)$(faqdir)/$$f"; \
-	  $(INSTALL_DATA) $$p $(DESTDIR)$(faqdir)/$$f; \
-	done
-
-uninstall-faq: html/index.html
-	@$(NORMAL_UNINSTALL)
-	@dir='$(<D)'; for p in $$dir/*.html ; do \
-	  f="`echo $$p | sed -e 's|^.*/||'`"; \
-	  echo " rm -f $(DESTDIR)$(faqdir)/$$f"; \
-	  rm -f $(DESTDIR)$(faqdir)/$$f; \
-	done
+	$(MKDIR_P) '$(DESTDIR)$(faq_htmldir)'
+	$(INSTALL_DATA) $(faq_html_inst) '$(DESTDIR)$(faq_htmldir)/'
 
-all-local: html/index.html
-
-install-data-local: install-faq
-
-uninstall-local: uninstall-faq
+uninstall-faq:
+	@$(NORMAL_UNINSTALL)
+	rm -f '$(DESTDIR)$(faq_htmldir)'/*.html
 
-maintainer-clean-local: doc-clean
+html/index.html: $(docbook_docs)
+	$(AM_V_at)rm -fr html
+	$(AM_V_at)$(MKDIR_P) html
+	$(AM_V_GEN)$(XSLTPROC) -o html/ --catalogs $(DOCBOOK_STYLESHEET) $<
 
-.PHONY: post-html doc-clean install-faq uninstall-faq
+.PHONY: install-faq uninstall-faq
 
+# Instruct GNU make to delete the targets of a rule after it failed, in
+# order to avoid the complication of handling that situation manually.
+.DELETE_ON_ERROR:
diff --git a/docs/tutorial/Makefile.am b/docs/tutorial/Makefile.am
index 82f91df..c9d2410 100644
--- a/docs/tutorial/Makefile.am
+++ b/docs/tutorial/Makefile.am
@@ -87,8 +87,7 @@ DOC_FIGURES =					\
 
 DOC_LINGUAS = de
 
-DISTCLEANFILES = html/*.html
-MAINTAINERCLEANFILES = $(srcdir)/html/*.html
+MAINTAINERCLEANFILES = html/*.html $(srcdir)/html/*.html
 
 # Set the use.id.as.filename param so that we don't use the chapter / section
 # number as the filename, otherwise the url will change every time anything is
@@ -164,9 +163,10 @@ $(DOC_LINGUAS):
 # Create a html generation of the C locale's version of the DocBook, 
 # using our custom stylesheet and graphics:
 html/index.html: $(srcdir)/C/gtkmm-tutorial.xml
-	rm -fr html
-	$(MKDIR_P) html
-	$(XSLTPROC) $(xslt_params) -o html/ --xinclude --catalogs '$(DOCBOOK_STYLESHEET)' $<
+	$(AM_V_at)rm -fr html
+	$(AM_V_at)$(MKDIR_P) html
+	$(AM_V_GEN)$(XSLTPROC) $(xslt_params) -o html/ --xinclude --catalogs \
+		'$(DOCBOOK_STYLESHEET)' $<
 
 # Make sure that the documentation will always have been generated before
 # executing the commands of a rule that depends on files in html/.
@@ -174,7 +174,7 @@ html/chapter-%.html html/sec-%.html: | html/index.html
 
 # Create a DocBook source file that doesn't have the examples' comments blocks:
 $(srcdir)/C/gtkmm-tutorial.xml: $(srcdir)/C/gtkmm-tutorial-in.xml $(srcdir)/insert_example_code.pl
-	$(PERL) -- $(srcdir)/insert_example_code.pl $(top_srcdir)/examples/book $< >$@
+	$(AM_V_GEN)$(PERL) -- $(srcdir)/insert_example_code.pl $(top_srcdir)/examples/book $< >$@
 
 validate_original: $(srcdir)/C/gtkmm-tutorial-in.xml
 	$(XMLLINT) --xinclude --postvalid --noout $<
@@ -185,15 +185,15 @@ validate: $(srcdir)/C/gtkmm-tutorial.xml
 # we need to produce a full examples with all of the XIncludes done so that it
 # can processed for PDF
 C/programming-with-gtkmm-pdf.xml: $(srcdir)/C/gtkmm-tutorial.xml
-	$(MKDIR_P) C
-	$(XMLLINT) --xinclude --postvalid $< -o $@
+	$(AM_V_at)$(MKDIR_P) C
+	$(AM_V_GEN)$(XMLLINT) --xinclude --postvalid -o $@ $<
 
 # We have to generate the pdf in a subdirectory (e.g. pdf/) because the tutorial
 # specifies the path to the figures as '../figures' so if we build it in this
 # directory, it won't find the images.
 pdf/programming-with-gtkmm-pdf.pdf: C/programming-with-gtkmm-pdf.xml
-	$(MKDIR_P) pdf
-	$(DB2PDF) --output pdf/ $<
+	$(AM_V_at)$(MKDIR_P) pdf
+	$(AM_V_GEN)$(DB2PDF) --output pdf/ $<
 
 .PHONY: install-tutorial uninstall-tutorial
 



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