[nautilus-actions] docs/nact/Makefile.am: fully review the NACT User's Manual build



commit aaca7478637c02e08dfc32cadecdf61f91519ca1
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Nov 25 23:29:38 2011 +0100

    docs/nact/Makefile.am: fully review the NACT User's Manual build

 ChangeLog             |    2 +
 docs/nact/Makefile.am |  342 +++++++++++++++++++++++++++++--------------------
 2 files changed, 206 insertions(+), 138 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4e74c5a..001b9bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2011-11-25 Pierre Wieser <pwieser trychlos org>
 
+	* docs/nact/Makefile.am: Fully review the NACT User's Manual build.
+
 	* configure.ac: gtk-doc and gnome-doc-utils are no more mandatory packages.
 
 	* Makefile.am:
diff --git a/docs/nact/Makefile.am b/docs/nact/Makefile.am
index 983f892..f3a8f7d 100644
--- a/docs/nact/Makefile.am
+++ b/docs/nact/Makefile.am
@@ -48,26 +48,48 @@
 # files in <datadir>/gnome/help/nautilus-actions-config-tool/<lang>.
 # At install time, missing tranlated images are replace with symlinks to
 # ../../C/figures/<image.png>.
+#
+# Also, do not confuse gnome-doc-utils which targets the help documentation
+# of the Gnome (i.e. gui) applications, and that we are using here to
+# generate html and pdf NACT user's manuals, with gtk-doc which rather
+# targets the developer documentation (see docs/reference).
+
+if HAVE_GNOME_DOC_UTILS
 
 include $(top_srcdir)/gnome-doc-utils.make
 
 DOC_MODULE = nautilus-actions-config-tool
 
-DOC_ENTITIES = $(patsubst C/%,%,$(shell \ls -1 C/*.xml | $(GREP) -v $(DOC_MODULE)))
+DOC_ENTITIES = $(patsubst $(srcdir)/C/%,%,$(shell \ls -1 $(srcdir)/C/*.xml | $(GREP) -v $(DOC_MODULE)))
+#DOC_ENTITIES = "appendix-gnu-fdl-1.3.xml articleinfo.xml ... nact-where.xml"
 
 DOC_INCLUDES =
 
-DOC_FIGURES = $(patsubst C/%,%,$(shell \ls -1 C/figures/*))
+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
 
-pkgdocdir = $(datarootdir)/doc/@PACKAGE -@VERSION@
+# _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)
 
-nactdir := docs/nact
+# just an empty value to be able to add something for html and pdf manuals
+MAINTAINERCLEANFILES =
+
+pkgdocdir = $(datarootdir)/doc/@PACKAGE -@VERSION@
 
-all-local: all-manuals
+all-local: all-manuals all-html-manuals all-pdf-manuals
 
-.PHONY: all-manuals
+.PHONY: \
+	all-manuals install-manuals uninstall-manuals dist-manuals-hook \
+	all-html-manuals install-html-manuals install-html-figs install-html-admon \
+	uninstall-html-manuals dist-html-manuals-hook dist-html-admon dist-html-doc \
+	distclean-html maintainer-clean-html \
+	all-pdf-manuals install-pdf-manuals \
+	uninstall-pdf-manuals dist-pdf-manuals-hook \
+	distclean-pdf maintainer-clean-pdf
 
 all-manuals: all-html-manuals all-pdf-manuals
 
@@ -79,9 +101,15 @@ uninstall-local: uninstall-manuals
 
 uninstall-manuals: uninstall-html-manuals uninstall-pdf-manuals
 
-dist-hook: doc-dist-hook dist-html-manuals-hook dist-pdf-manuals-hook dist-manuals-hooks
+# doc-dist-hook is the dist hook from gnome-doc-utils.make
+# 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
 
-# Build HTML manuals as <lang>/html/<module>.html
+dist-manuals-hook: dist-html-manuals-hook dist-pdf-manuals-hook
+
+# Build HTML manuals as $(srcdir)/<lang>/<module>.html
 #
 # We have two alternative for generating HTML manual:
 # - gnome-doc-tool (from gnome-doc-utils package)
@@ -91,11 +119,10 @@ dist-hook: doc-dist-hook dist-html-manuals-hook dist-pdf-manuals-hook dist-manua
 #
 # gnome-doc-tool <format> -o <dir> -d0 nautilus-actions-config-tool.xml
 # - format: output format (html)
-# - dir: if this does not name an existing directory in which *.html
-#   files will be created, then is considered as the output filename
+# - dir: output directory
 # -d0: nochunks
 # The produced output is very close of what Yelp gives, with in particular
-# a summary in each chapter while db2html does not produce them.
+# a summary in each chapter while db2html does not produce it.
 # As of v 0.20.1:
 # - there is no icon for notes and tips (see #636175).
 # - does not produce the legal and abstract sections in top of the document
@@ -105,57 +132,69 @@ dist-hook: doc-dist-hook dist-html-manuals-hook dist-pdf-manuals-hook dist-manua
 # and the summary in top of the chapters.
 #
 # db2html --nochunks nautilus-actions-config-tool.xml
-# Generate the html document(s) in a nautilus-actions-config-tool/
-# subdirectory. 
+# Generate the html document(s). 
 # As of 0.6.14:
-# - creates a stylesheet-images subdirectory
+# - does produce the legal and abstract sections in top of the document
+# - creates a nautilus-actions-config-tool/stylesheet-images subdirectory
 # - does not honor external links: they are converted to simple links
-#   which target the same frame window.
+#   which target the same frame window
+# - may create docbook2html-dir(.junk) subdirectories
+
+MANUALS_HTML = $(MANUALS_XML:%.xml=%.html)
+
+MAINTAINERCLEANFILES += $(MANUALS_HTML)
 
 if ENABLE_HTML_MANUALS
-all-html-manuals: html.stamp
+all-html-manuals: $(MANUALS_HTML)
 else
 all-html-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)
-#
 # - do not use '--copy_graphics' here (see #636175)
 # - admon-* icons will be installed in admon/ subdir
-html.stamp: $(_DOC_LC_DOCS)
-	@-for i in C $(_DOC_REAL_LINGUAS); do \
-		(cd $$i; \
-		 if test "x$(WITH_DB2HTML)" = "xyes"; then \
-			echo "Generating $$i/html/$(DOC_MODULE).html ..."; \
-			rm -fr $(DOC_MODULE).junk; \
-			rm -fr html; \
-			cmd="db2html --nochunks $(DOC_MODULE).xml"; \
-			echo "$$cmd"; \
-			$$cmd; \
-			mv -v $(DOC_MODULE) html; \
-		 fi; \
-		 if test "x$(WITH_GDT)" = "xyes"; then \
-			echo "Generating $$i/html/$(DOC_MODULE).html ..."; \
-			rm -fr html; \
-		 	$(MKDIR_P) html; \
-			cmd="gnome-doc-tool html -o html -d0 $(DOC_MODULE).xml"; \
-			echo "$$cmd"; \
-			$$cmd; \
-			sed -i -e 's?url("admon?url("admon/admon?' html/$(DOC_MODULE).html; \
-		 fi; \
-		 chmod -R u+w html; \
+#
+# The rule here is: only rebuild html/ files if corresponding xml has changed
+# .xml themselves are distributed, so are not modified when compiling from a
+# distribution
+#
+# current=/home/pierre/data/eclipse/nautilus-actions/nautilus-actions-3.1.5/_build/docs/nact
+# srcdir=../../../docs/nact
+# top_srcdir=../../..
+#
+# db2html 0.6.14 bugs and work-arounds:
+# - '*.junk' and 'docbook2html-dir/' are subdirectories left by db2html when
+#   it is run without argument (see https://bugzilla.redhat.com/show_bug.cgi?id=756930)
+# - stylesheet-images directory is not created in the output directory
+#   (see https://bugzilla.redhat.com/show_bug.cgi?id=756928)
+#
+# gnome-doc-tool 0.20 bugs and work-arounds:
+# - g-d-t does not honor the base directory of the source document, only
+#   searching for extern entities in the current working directory
+#   (see https://bugzilla.gnome.org/show_bug.cgi?id=664784)
+
+$(MANUALS_HTML): %.html: %.xml
+	@echo "Generating $@ ..."; \
+	lc=$<; lc=$${lc%/*}; \
+	if test "x$(WITH_DB2HTML)" = "xyes"; then \
+		cmd="db2html --output $$lc --nochunks $<"; echo "$$cmd"; (eval $$cmd); \
+	    (cd $$lc; mv -v $(DOC_MODULE)/stylesheet-images .; rmdir -v $(DOC_MODULE)); \
+	    find . -type d -name '*.junk' | xargs rm -fr; \
+	    find . -type d -name 'docbook2html-dir' | xargs rm -fr; \
+	fi; \
+	if test "x$(WITH_GDT)" = "xyes"; then \
+		(cd $$lc; \
+		 fhtml=$@; fhtml=$${fhtml##*/}; \
+		 fxml=$<; fxml=$${fxml##*/}; \
+		 cmd="gnome-doc-tool html -o . -d0 $$fxml"; echo "$$cmd"; (eval $$cmd); \
+		 sed -i -e 's?url("admon?url("admon/admon?' $$fhtml; \
 		); \
-	done
-	touch html.stamp
+	fi
 
 # Install HTML manuals if they exist (do not try to rebuild them)
 # in <htmldir>/<lang>/nact/ subdirectory; htmldir defaulting
 # to <pkgdocdir>/html
 #
-# Note that we do not honor here the --with-html-dir gtk-doc option,
-# but the --htmldir autotools one
+# Note that we do honor here --htmldir autotools configuration option.
 install-html-manuals: all-html-manuals install-html-figs install-html-admon
 	for lc in C $(_DOC_REAL_LINGUAS); do \
 		if test "x$(htmldir)" = "x$(docdir)"; then \
@@ -163,10 +202,11 @@ install-html-manuals: all-html-manuals install-html-figs install-html-admon
 		else \
 			_instdir="$(DESTDIR)$(htmldir)/$$lc/nact"; \
 		fi; \
-		_srcdir="$(top_builddir)/$(nactdir)/$$lc/html"; \
-		echo "_srcdir=$$_srcdir"; \
-		if test -f "$$_srcdir/$(DOC_MODULE).html"; then \
-			cp -vrp $$_srcdir/* $$_instdir/; \
+		if test -f "$(srcdir)/$$lc/$(DOC_MODULE).html"; then \
+			cp -vp "$(srcdir)/$$lc/$(DOC_MODULE).html" $$_instdir/; \
+			if test -d "$(srcdir)/$$lc/stylesheet-images"; then \
+				cmd="cp -vrp \"$(srcdir)/$$lc/stylesheet-images\" $$_instdir/"; echo $$cmd; (eval $$cmd); \
+			fi; \
 		fi; \
 	done
 
@@ -178,48 +218,55 @@ install-html-figs:
 	else \
 		_instdir="$(DESTDIR)$(htmldir)"; \
 	fi; \
-	_srcdir="$(top_srcdir)/$(nactdir)"; \
 	list='$(patsubst C/%,%,$(_DOC_C_FIGURES))'; \
 	for lc in C $(_DOC_REAL_LINGUAS); do \
-	  if test -f "$(top_builddir)/$(nactdir)/$$lc/html/$(DOC_MODULE).html"; then \
+	  if test -f "$(srcdir)/$$lc/$(DOC_MODULE).html"; then \
 		for fig in $$list; do \
 			figsymlink=false; \
-			if test -f "$$_srcdir/$$lc/$$fig" -a ! -h "$$_srcdir/$$lc/$$fig"; then \
-				figfile="$$_srcdir/$$lc/$$fig"; \
+			if test -f "$(srcdir)/$$lc/$$fig" -a ! -h "$(srcdir)/$$lc/$$fig"; then \
+				figfile="$(srcdir)/$$lc/$$fig"; \
 			else \
 				figsymlink=true; \
 			fi; \
 			figdir=`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
 			figdir="$$_instdir/$$lc/nact/$$figdir"; \
-			if ! test -d "$$figdir"; then echo "$(mkinstalldirs) $$figdir"; $(mkinstalldirs) "$$figdir"; fi; \
+			if ! test -d "$$figdir"; then cmd="$(mkinstalldirs) $$figdir"; echo $$cmd; (eval $$cmd); fi; \
 			if $$figsymlink; then \
 				cmd="cd $$figdir && $(LN_S) -f ../../../C/nact/$$fig"; \
 			else \
 				cmd="$(INSTALL_DATA) $$figfile $$figdir/"; \
 			fi; \
-			echo $$cmd; ( eval $$cmd ); \
+			echo $$cmd; (eval $$cmd); \
 		done; \
 	  fi; \
 	done
 
 # A workaround against the bug #636175 (do not install admon-* icons)
-# Only works when gnome-doc-utils is installed on the station
-# Install icons in the html/ dir
-admon_dir := /usr/share/gnome-doc-utils/icons/hicolor/48x48/status
-admon_png := $(wildcard $(admon_dir)/*.png)
+# Install admon icons as a admon/ subdirectory for C language
+# other languages are symlinked to this one
 install-html-admon:
-	if test -d "$(admon_dir)"; then \
+	admon_dir=/usr/share/gnome-doc-utils/icons/hicolor/48x48/status; \
+	if test -d $$admon_dir; then \
+		admon_src=$$admon_dir; \
+	else \
+		admon_src=$(srcdir)/C/admon; \
+	fi; \
+	echo "admon_src=$$admon_src"; \
+	if test -d "$$admon_src"; then \
 		if test "x$(htmldir)" = "x$(docdir)"; then \
 			_instdir="$(DESTDIR)$(pkgdocdir)/html"; \
 		else \
 			_instdir="$(DESTDIR)$(htmldir)"; \
 		fi; \
-		for lc in C $(_DOC_REAL_LINGUAS); do \
-			if test -f "$(top_builddir)/$(nactdir)/$$lc/html/$(DOC_MODULE).html"; then \
-				$(mkinstalldirs) "$$_instdir/$$lc/nact/admon"; \
-				cp -v $(admon_png) "$$_instdir/$$lc/nact/admon/"; \
-			fi; \
-		done; \
+		if test -f "$(srcdir)/C/$(DOC_MODULE).html"; then \
+			cmd="$(mkinstalldirs) \"$$_instdir/C/nact/admon\""; echo $$cmd; (eval $$cmd); \
+			cmd="cp -v $$admon_src/*.png \"$$_instdir/C/nact/admon/\""; echo $$cmd; (eval $$cmd); \
+			for lc in $(_DOC_REAL_LINGUAS); do \
+				if test -f "$(srcdir)/$$lc/$(DOC_MODULE).html"; then \
+					cmd="cd \"$$_instdir/$$lc/nact\"; $(LN_S) -f ../../C/nact/admon"; echo $$cmd; (eval $$cmd); \
+				fi; \
+			done; \
+		fi; \
 	fi
 
 uninstall-html-manuals:
@@ -228,29 +275,53 @@ uninstall-html-manuals:
 	else \
 		_instdir="$(DESTDIR)$(htmldir)"; \
 	fi; \
-	rm -fr $$_instdir
+	find $$_instdir -type d -name 'admon' | xargs rm -vfr; \
+	find $$_instdir -type l -name 'admon' | xargs rm -vf; \
+	find $$_instdir -type d -name 'figures' | xargs rm -vfr; \
+	find $$_instdir -type d -name 'stylesheet-images' | xargs rm -vfr; \
+	find $$_instdir -type f -name '*.html' | xargs rm -vf; \
+	find $$_instdir -type d | sort -r | xargs rmdir -v
 
 # locale figures (_DOC_LC_FIGURES) are distributed by gnome-doc-utils
 # when they exist
-#
-# - distribute admon-* icons
-dist-html-manuals-hook: all-html-manuals
-	for lc in C $(_DOC_REAL_LINGUAS); do \
-		if test -f $(top_builddir)/$(nactdir)/$$lc/html/$(DOC_MODULE).html; then \
-			cp -rpv $(top_builddir)/$(nactdir)/$$lc/html $(distdir)/$$lc/; \
+# - distribute admon-* icons as a C/ subdirectory
+# - distribute *.html manuals
+# This obviously suppose that gnome-doc-utils package is installed
+dist-html-manuals-hook: all-html-manuals dist-html-admon dist-html-doc
+
+dist-html-admon:
+	admon_dir=/usr/share/gnome-doc-utils/icons/hicolor/48x48/status; \
+	if test -d $$admon_dir; then \
+		if test -f $(srcdir)/C/$(DOC_MODULE).html; then \
+			cmd="$(mkinstalldirs) \"$(distdir)/C/admon\""; echo $$cmd; (eval $$cmd); \
+			cmd="cp -vp $$admon_dir/*.png $(distdir)/C/admon/"; echo $$cmd; (eval $$cmd); \
 		fi; \
-		if test -d "$(admon_dir)"; then \
-			$(mkinstalldirs) "$(distdir)/$$lc/html/admon"; \
-			cp -v $(admon_png) "$(distdir)/$$lc/html/admon/"; \
+	fi
+
+dist-html-doc:
+	for lc in C $(_DOC_REAL_LINGUAS); do \
+		if test -f "$(srcdir)/$$lc/$(DOC_MODULE).html"; then \
+			cmd="cp $(srcdir)/$$lc/$(DOC_MODULE).html $(distdir)/$$lc/"; echo $$cmd; (eval $$cmd); \
+			if test -d "$(srcdir)/$$lc/stylesheet-images"; then \
+				cmd="cp -vrp \"$(srcdir)/$$lc/stylesheet-images\" $(distdir)/$$lc/"; echo $$cmd; (eval $$cmd); \
+			fi; \
 		fi; \
 	done
 
-# Build pdf manuals as <lang>/<module>.pdf
+# Build pdf manuals as $(srcdir)/<lang>/<module>.pdf
+#
+# The rule here is: only rebuild .pdf files if corresponding xml has changed
+# .xml themselves are distributed, so are not modified when compiling from a
+# distribution
 #
 # We only use dblatex for now
 
+MANUALS_PDF = $(MANUALS_XML:%.xml=%.pdf)
+
+MAINTAINERCLEANFILES += $(MANUALS_PDF)
+
 if ENABLE_PDF_MANUALS
-all-pdf-manuals: pdf.stamp
+all-pdf-manuals: $(MANUALS_PDF)
 else
 all-pdf-manuals:
 endif
@@ -258,46 +329,36 @@ 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)
-pdf.stamp: $(_DOC_LC_DOCS)
-	@-for lc in C $(_DOC_REAL_LINGUAS); do \
-		_target=$$lc/$(DOC_MODULE).pdf; \
-		echo "Generating $$_target ..."; \
-		if [ "$$lc" != "C" ]; then \
-		  list='$(patsubst C/%,%,$(_DOC_C_FIGURES))'; \
-		  for fig in $$list; do \
-	        figdir="$$lc/"`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
-	        figdir="$(builddir)/$$figdir"; \
-	        if ! test -d "$$figdir"; then echo "$(MKDIR_P) $$figdir"; $(MKDIR_P) "$$figdir"; fi; \
-	        figbase=`echo $$fig | sed -e 's/^.*\///'`; \
-	        if ! test -f "$$lc/$$fig"; then \
-	          echo "cd $$figdir && $(LN_S) -f ../../C/$$fig $$figbase"; \
-	          ( cd "$$figdir" && $(LN_S) -f "../../C/$$fig" "$$figbase" ); \
-	        fi; \
-	      done; \
-	    fi; \
-		echo "dblatex --output $$_target $(top_srcdir)/$(nactdir)/$$lc/$(DOC_MODULE).xml"; \
-		dblatex --output $$_target $(top_srcdir)/$(nactdir)/$$lc/$(DOC_MODULE).xml; \
-		if [ "$$lc" != "C" ]; then \
-		  for i in `find $$lc/figures -type l`; do rm -f $$i; done; \
+$(MANUALS_PDF): %.pdf: %.xml
+	@lc=$<; \
+	lc=$${lc%/*}; \
+	echo "Generating $@ ..."; \
+	if ! test -d "$$lc/figures"; then cmd="$(MKDIR_P) $$lc/figures"; (eval $$cmd); fi; \
+	list='$(patsubst C/%,%,$(_DOC_C_FIGURES))'; \
+	for fig in $$list; do \
+		if ! test -f "$$lc/$$fig"; then \
+			cmd="(cd $$lc/figures && $(LN_S) -f ../../$(srcdir)/C/$$fig)"; (eval $$cmd); \
 		fi; \
-	done
-	touch pdf.stamp
+	done; \
+	cmd="dblatex --output $@ $<"; echo $$cmd; (eval $$cmd); \
+	find $$lc/figures -type l | xargs rm -f; \
+	rmdir $$lc/figures 2>/dev/null || :
 
 # if --pdfdir has not been specified, then we default to PKGDOCDIR/pdf
 # in all case, we append the locale as a subdirectory level
 #
 # as pdf are monobloc documents, we do not create a per-document subdir
 install-pdf-manuals: all-pdf-manuals
-	@-for lc in C $(_DOC_REAL_LINGUAS); do \
-		_srcdir=$(top_builddir)/$(nactdir)/$$lc; \
-		if test "$(pdfdir)" = "$(docdir)"; then \
-			_instdir=$(DESTDIR)$(pkgdocdir)/pdf/$$lc; \
-		else \
-			_instdir=$(DESTDIR)$(pdfdir)/$$lc; \
+	if test "$(pdfdir)" = "$(docdir)"; then \
+		_instdir=$(DESTDIR)$(pkgdocdir)/pdf; \
+	else \
+		_instdir=$(DESTDIR)$(pdfdir); \
+	fi; \
+	for lc in C $(_DOC_REAL_LINGUAS); do \
+		if test -f $(srcdir)/$$lc/$(DOC_MODULE).pdf; then \
+			if ! test -d $$_instdir/$$lc; then cmd="$(MKDIR_P) $$_instdir/$$lc"; echo $$cmd; (eval $$cmd); fi; \
+			cmd="$(INSTALL_DATA) \"$(srcdir)/$$lc/$(DOC_MODULE).pdf\" \"$$_instdir/$$lc/\""; echo $$cmd; (eval $$cmd); \
 		fi; \
-		if ! test -d $$_instdir; then $(MKDIR_P) $$_instdir; fi; \
-		echo $(INSTALL_DATA) "$$_srcdir/$(DOC_MODULE).pdf" "$$_instdir/"; \
-		$(INSTALL_DATA) "$$_srcdir/$(DOC_MODULE).pdf" "$$_instdir/"; \
 	done
 
 uninstall-pdf-manuals:
@@ -306,39 +367,44 @@ uninstall-pdf-manuals:
 	else \
 		_instdir=$(DESTDIR)$(pdfdir); \
 	fi; \
-	rm -fr $$_instdir
+	find $$_instdir -name '*.pdf' | xargs rm -vf; \
+	find $$_instdir -type d | sort -r | xargs rmdir -v
 
-dist-pdf-manuals-hook: all-pdf-manuals
-	for _lc in C $(_DOC_REAL_LINGUAS); do \
-		cp -v $(top_builddir)/$(nactdir)/$$_lc/$(DOC_MODULE).pdf $(distdir)/$$_lc/ || :; \
+dist-pdf-manuals-hook:
+	for lc in C $(_DOC_REAL_LINGUAS); do \
+		if test -f "$(srcdir)/$$lc/$(DOC_MODULE).pdf"; then \
+			cmd="cp $(srcdir)/$$lc/$(DOC_MODULE).pdf $(distdir)/$$lc/"; echo $$cmd; (eval $$cmd); \
+		fi; \
 	done
 
-dist-manuals-hooks:
-	find $(distdir) -type d -exec chmod 755 {} \;
-	find $(distdir) -type f -exec chmod 644 {} \;
-
-# According to GNU Make manual (Â 14.6 Standard Targets for Users),
-# clean (and distclean) should not remove distributed files, but
-# make distcheck does not 'know' that we have dynamic extra dist
-# (these manuals)
-clean-local: local-clean-html local-clean-pdf local-clean-figs
+# According to GNU Make manual (Â 13 What Gets Cleaned):
+#
+# - mostlyclean deletes files we typically want to rebuild
+# - clean deletes other files built with make
+# - distclean deletes files built by configure (none here)
+##
+##  none of these target should delete any distributed file
+##
+# - maintainer-clean should delete other files
+clean-local:
 	rm -f *~
-
-distclean-local: local-clean-figs
 	rm -f *.stamp
 
-local-clean-local: local-clean-html local-clean-pdf local-clean-figs
+distclean-local: distclean-html distclean-pdf
 
-local-clean-html:
-	for lc in C $(_DOC_REAL_LINGUAS); do rm -fr $$lc/html; done
+distclean-html:
+	find $(srcdir) -type l -name 'admon' | xargs rm -vf; \
+	for d in `find $(srcdir) -type d -name 'figures'`; do find $$d -type l | xargs rm -vf; done
 
-local-clean-pdf:
-	for lc in C $(_DOC_REAL_LINGUAS); do rm -f $$lc/*.pdf; done
+distclean-pdf:
 
-local-clean-figs:
-	for lc in $(_DOC_REAL_LINGUAS); do \
-		if test -d $$lc/figures; then \
-			for l in `find $$lc/figures -type l`; do rm -vf $$l; done; \
-			(rmdir $$lc/figures 2>/dev/null && echo "rmdir $$lc/figures"); \
-		fi; \
-	done
+maintainer-clean-local: maintainer-clean-html maintainer-clean-pdf
+
+maintainer-clean-html:
+	find $(srcdir) -type f -name 'admon/*.png' | xargs rm -vf; \
+	rmdir -v $(srcdir)/C/admon; \
+	find $(srcdir) -type d -name 'stylesheet-images' | xargs rm -vfr
+
+maintainer-clean-pdf:
+
+endif



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