[gimp-help-2] [make] Clean up Makefiles



commit fc8e25a7cf5237e530b1bd5b5400681182d8d97b
Author: Ulf-D. Ehlert <ulfehlert svn gnome org>
Date:   Sat Jan 23 14:24:02 2010 +0100

    [make] Clean up Makefiles
    
    Minor changes (like comments, resorting targets, etc.), especially to
    synchronize Makefile.GNU with Makefile.am.

 Makefile.GNU |  129 ++++++++++++++++++++++++++++++++----------------------
 Makefile.am  |  139 +++++++++++++++++++++++++++++++++-------------------------
 2 files changed, 156 insertions(+), 112 deletions(-)
---
diff --git a/Makefile.GNU b/Makefile.GNU
index 08edd33..40615e1 100644
--- a/Makefile.GNU
+++ b/Makefile.GNU
@@ -1,8 +1,7 @@
 ########################################################################
-####            Preliminaries: Variables and Functions              ####
+####            The GIMP manual languages                           ####
 ########################################################################
 
-# The GIMP manual languages
 ALL_LINGUAS = de en es fr it ja ko nl nn pl ru sv zh_CN
 LANGUAGES = $(if $(LINGUAS),$(filter $(ALL_LINGUAS),$(LINGUAS)),$(ALL_LINGUAS))
 ifneq ($(DOC_LINGUAS),)
@@ -19,7 +18,11 @@ endif
 XML_LANG = en
 PO_LANGS = $(filter-out $(XML_LANG), $(LANGUAGES))
 
-# Essential external programs and their default options
+
+########################################################################
+####            External programs                                   ####
+########################################################################
+
 XSLTPROC  = xsltproc
 XSLTFLAGS = --nonet
 
@@ -65,10 +68,11 @@ builddir = .
 abs_srcdir   := $(shell cd $(srcdir) && pwd)
 abs_builddir := $(shell pwd)
 
-# Directory names like 'xmldir', 'potdir' ,etc. have been removed;
-# IMHO we don't need them and they make the Makefile less readable.
 
-# Find files and directories
+########################################################################
+####            Files and directories                               ####
+########################################################################
+
 src_file_predicates = \
 	-name '*.xml' \
 	-not -name '$(notdir $(AUTHORS_DOCBOOK_XML))'
@@ -83,7 +87,7 @@ AUTHORS_SOURCE_XML = stylesheets/authors.xml
 AUTHORS_DOCBOOK_XML      = src/preface/authors.xml
 AUTHORS_DOCBOOK_DIRNAME  = $(dir $(AUTHORS_DOCBOOK_XML))
 AUTHORS_DOCBOOK_FILENAME = $(notdir $(AUTHORS_DOCBOOK_XML))
-# Stylesheets generating AUTHORS 
+# Stylesheets generating AUTHORS
 AUTHORS_TEXT_STYLESHEETS = \
 	stylesheets/authors_text.xsl \
 	stylesheets/authors_common.xsl
@@ -113,8 +117,10 @@ HTML_STYLESHEETS = stylesheets/html*.xsl
 # use empty variable to disable the compendium option
 COMPENDIUM = Compendium.po
 
-# To talk or not to talk, that is the question!
-VERBOSE ?= 1
+
+########################################################################
+####            Control the amount of output messages               ####
+########################################################################
 
 # Usage of the "msg" and "cmd" variables:
 # In the command lines of the make rules, use
@@ -123,7 +129,9 @@ VERBOSE ?= 1
 # then
 #     messages will be suppressed if VERBOSE=0,
 #     commands will be printed if VERBOSE=2.
-#
+
+VERBOSE = 1
+
 ifeq ("$(VERBOSE)", "0")
 msg = @:
 cmd = @
@@ -138,6 +146,10 @@ endif
 endif
 
 
+########################################################################
+####            Functions                                           ####
+########################################################################
+
 #--------------------------------------------------------------#
 #       The main functions used to transform                   #
 #               (a) XML files to POT files                     #
@@ -153,8 +165,8 @@ endif
 #     $1 - input:  original (untranslated) XML files
 #     $2 - output: POT template file containing translatable tags
 #
-# Hint: Better don't use 'grep' for filtering-out the warning
-# messages, since grep's exit status is 1 if there is no match.
+# Hint: Don't use 'grep' for filtering-out the warning messages,
+#       since grep's exit status is 1 if there is no match.
 ifeq ("$(findstring gimphelp,$(XML2POFLAGS))","")
 xml2pot = ($(XML2PO) $(XML2POFLAGS) --output='-' $(1) \
           | $(MSGUNIQ) $(MSGUNIQFLAGS) \
@@ -289,7 +301,7 @@ all: html index AUTHORS
 make.help:
 	@echo >&2 'ERROR: cannot find the help file "$@"!'
 	@exit 66
-# TODO: replace with a "real" script tools/what-ever(?)
+# TODO?: replace with a "real" script (e.g. tools/make-help.sed)
 #   (probably "yes" if more features are needed...)
 help: make.help
 	$(cmd) $(SED) \
@@ -316,6 +328,28 @@ help: make.help
 
 
 ########################################################################
+####            Make AUTHORS file                                   ####
+########################################################################
+
+AUTHORS: $(AUTHORS_SOURCE_XML) $(AUTHORS_TEXT_STYLESHEETS)
+	$(msg) "[DOC] $@"
+	$(cmd) $(XSLTPROC) \
+	  $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
+	  $(srcdir)/stylesheets/authors_text.xsl \
+	  $< \
+	  > $@
+
+$(AUTHORS_DOCBOOK_XML): $(AUTHORS_SOURCE_XML) $(AUTHORS_DOCBOOK_STYLESHEETS)
+	$(msg) "[SRC] $@"
+	$(cmd) $(call make_target_dir,$@)
+	$(cmd) $(XSLTPROC) \
+	  $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
+	  $(srcdir)/stylesheets/authors_docbook.xsl \
+	  $< \
+	  > $@
+
+
+########################################################################
 ####            Make pot files:  XML(en) --> POT                    ####
 ########################################################################
 
@@ -354,7 +388,7 @@ endif
 	$(msg) "[POT] $@"
 	$(cmd) $(call xml2pot,$(filter-out FORCE,$^),$@)
 
-# Remove left over po files
+# Remove left over pot files
 cleanup-pot:
 	$(msg) "Cleaning up pot files ..."
 	$(cmd) $(find_l) pot/ $(pot_file_predicates) | \
@@ -387,7 +421,7 @@ endif
 po-$(1): $$($(1)_PO_FILES) cleanup-po-$(1)
 	$$(cmd) if test -e messages.mo; then rm -f messages.mo; fi
 cleanup-po-$(1):
-	$$(msg) "Cleaning up po files ..."
+	$$(msg) "Cleaning up '$(1)' po files ..."
 	$$(cmd) $(find_l) po/$(1)/ $$(po_file_predicates) | \
 	while read pofile; do \
 		potfile=pot/$$$${pofile#po/$(1)/}t; \
@@ -416,13 +450,14 @@ po-todo-%: po-%
 	$(cmd) perl tools/get_po_status.pl --todo po/$*
 
 # Force updating po file(s)
-update-po/%.po:
-	$(msg) "Deprecated, use 'make po/$*.po instead'"
-	$(cmd) false
-
 force-po/%:
 	$(cmd) $(RMAKE) po/$*/*.po
 
+# Main commandline target
+po: $(foreach LANG,$(PO_LANGS),po-$(LANG)) ;
+
+.PHONY: po po-% cleanup-po-% po-todo-% po-status-%
+
 
 ########################################################################
 ####            Generate XML prerequisites                          ####
@@ -516,21 +551,23 @@ xml/%/images: $(IMAGE_PREREQ)
 	$(cmd) perl tools/make_image_links.pl -v images/{common,C} xml/$*
 	$(cmd) touch $@
 
-# remove stale xml files
+# Remove left over xml files
 cleanup-xml-%:
-	$(msg) "Cleaning up xml files ..."
+	$(msg) "Cleaning up '$*' xml files ..."
 	$(cmd) $(find_l) xml/$*/ $(xml_file_predicates) | \
 	while read xmlfile; do \
 		test -e src/$${xmlfile#xml/$*/} || rm -vf $${xmlfile}; \
 	done
 
 # Target suitable for command line
-xml-images-%: xml/%/images ;
 images-%: xml-images-% html-images-% ;
+xml-images-%: xml/%/images ;
+
+# Main commandline target
+xml: $(foreach LANG,$(LANGUAGES),xml-$(LANG)) ;
 
 .PRECIOUS: xml/%/images
-.PHONY: FORCE
-FORCE: ;
+.PHONY: xml xml-% xml-images-% images-%
 
 
 ########################################################################
@@ -612,11 +649,13 @@ html/%/gimp-xrefs.xml: html/%/index.html
 	$(cmd) touch $@
 
 ###  HTML images  ###
-html-images-%: html/%/images ;
 html/%/images: xml/%/images
 	$(cmd) test -d html/$* || $(mkdir_p) html/$*
 	$(cmd) test -e $@ || $(ln_s) ../../$< $@
 
+# Target suitable for command line
+html-images-%: html/%/images ;
+
 .PRECIOUS: \
 	html/%/index.html \
 	html/%/gimp-help.xml \
@@ -710,7 +749,7 @@ ifneq ("$(DOCBOOK2ODF)","")
 odf: $(foreach lang,$(LANGUAGES),odf-$(lang)) ;
 odf-%: odf/%/gimp.odt ;
 
-# TODO: images; prerequisites
+# TODO?: images
 odf/%/gimp.odt: xml/%/gimp-alldocs.xml xml/%/images
 	$(cmd) if test -f odf/%.odt; then rm -f odf/%.odt; fi
 	$(cmd) test -d odf/$* || $(mkdir_p) odf/$*
@@ -719,9 +758,10 @@ odf/%/gimp.odt: xml/%/gimp-alldocs.xml xml/%/images
 	    --debug -v \
 	    --output-dir=`pwd` \
 	    --output-file=$@ \
-	    $< 
+	    $<
 
 # make temporary XML source file with all Xincludes resolved
+# TODO: find out how to avoid this
 xml/%/gimp-alldocs.xml: xml/%/gimp.xml
 	$(msg) "*** Merging XML ..."
 	$(cmd) $(XMLLINT) $(XMLLINTFLAGS) --xinclude --output $@ $<
@@ -738,28 +778,6 @@ endif
 
 
 ########################################################################
-####            Make AUTHORS file                                   ####
-########################################################################
-
-AUTHORS: $(AUTHORS_SOURCE_XML) $(AUTHORS_TEXT_STYLESHEETS)
-	$(msg) "[DOC] $@"
-	$(cmd) $(XSLTPROC) \
-	  $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
-	  $(srcdir)/stylesheets/authors_text.xsl \
-	  $< \
-	  > $@
-	
-$(AUTHORS_DOCBOOK_XML): $(AUTHORS_SOURCE_XML) $(AUTHORS_DOCBOOK_STYLESHEETS)
-	$(msg) "[SRC] $@"
-	$(cmd) $(call make_target_dir,$@)
-	$(cmd) $(XSLTPROC) \
-	  $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
-	  $(srcdir)/stylesheets/authors_docbook.xsl \
-	  $< \
-	  > $@
-
-
-########################################################################
 ####            Make language-specific HTML tarballs                ####
 ########################################################################
 
@@ -767,8 +785,6 @@ tarball_prefix = gimp-help-2-html
 tarball_dir    = gimp-help-2
 HTMLMETAFILES  = README AUTHORS COPYING MAINTAINERS
 
-#.SECONDARY: $(tarball_prefix)-%.tar
-
 $(tarball_prefix)-%.tar: html/%/index.html html/%/gimp-help.xml \
 		$(HTMLMETAFILES) tools/Makefile.html-package
 	$(msg) "Making $@ ..."
@@ -875,4 +891,13 @@ dot: build-system.svg
 	fi
 
 
-.NOEXPORT:
+########################################################################
+####            Special targets                                     ####
+########################################################################
+
+FORCE: ;
+
+.PHONY: FORCE
+
+# Delete the default suffix rules
+.SUFFIXES:
diff --git a/Makefile.am b/Makefile.am
index c0f4b24..e6eef90 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,6 +5,7 @@ SUBDIRS = quickreference
 # used for creating the ChangeLog
 LAST_RELEASE_TAG = GIMP_HELP_2_4_2
 
+
 ########################################################################
 ####            The GIMP manual languages                           ####
 ########################################################################
@@ -62,8 +63,6 @@ DOCBOOK2ODFFLAGS =
 
 # Standard shell commands
 find_l = find -L
-
-# Standard shell commands
 echo_n = echo $(ECHO_N)
 
 # Calling make recursively
@@ -219,8 +218,8 @@ if HAVE_I18N_TOOLS
 #     $1 - input:  original (untranslated) XML files
 #     $2 - output: POT template file containing translatable tags
 #
-# Hint: Better don't use 'grep' for filtering-out the warning
-# messages, since grep's exit status is 1 if there is no match.
+# Hint: Don't use 'grep' for filtering-out the warning messages,
+#       since grep's exit status is 1 if there is no match.
 xml2pot = ($(XML2PO) --output='-' $(1) \
           | $(MSGUNIQ) $(MSGUNIQFLAGS) \
           | $(MSGCAT) $(MSGCATFLAGS) - > "$(2)") 2>&1 \
@@ -418,7 +417,7 @@ AUTHORS_POT = $(AUTHORS_DOCBOOK_XML:src/%/$(AUTHORS_DOCBOOK_FILENAME)=pot/%.pot)
 # HIDE FROM AUTOMAKE #	$(msg) "[POT] $@"
 # HIDE FROM AUTOMAKE #	$(cmd) $(call xml2pot,$(filter-out FORCE,$^),$@)
 
-# Remove left over po files
+# Remove left over pot files
 cleanup-pot:
 	$(msg) "Cleaning up pot files ..."
 	$(cmd) $(find_l) pot/ $(pot_file_predicates) | \
@@ -451,7 +450,7 @@ potfiles: $(POT_FILES) ;
 # HIDE FROM AUTOMAKE #po-$(1): $$($(1)_PO_FILES) cleanup-po-$(1)
 # HIDE FROM AUTOMAKE #	$$(cmd) if test -e messages.mo; then rm -f messages.mo; fi
 # HIDE FROM AUTOMAKE #cleanup-po-$(1):
-# HIDE FROM AUTOMAKE #	$$(msg) "Cleaning up po files ..."
+# HIDE FROM AUTOMAKE #	$$(msg) "Cleaning up '$(1)' po files ..."
 # HIDE FROM AUTOMAKE #	$$(cmd) $(find_l) po/$(1)/ $$(po_file_predicates) | \
 # HIDE FROM AUTOMAKE #	while read pofile; do \
 # HIDE FROM AUTOMAKE #		potfile=pot/$$$${pofile#po/$(1)/}t; \
@@ -482,6 +481,11 @@ todo-%: po-todo-% ;
 po-todo-%: po-%
 	$(cmd) perl $(srcdir)/tools/get_po_status.pl --todo po/$*
 
+# Main commandline target
+po: $(foreach LANG,$(PO_LANGS),po-$(LANG)) ;
+
+.PHONY: po po-% cleanup-po-% po-todo-% po-status-%
+
 
 ########################################################################
 ####            Generate XML prerequisites                          ####
@@ -595,20 +599,23 @@ else
 	           $(srcdir)/images/{common,C} $@
 endif
 
-# remove stale xml files
+# Remove left over xml files
 cleanup-xml-%:
-	$(msg) "Cleaning up xml files ..."
+	$(msg) "Cleaning up '$*' xml files ..."
 	$(cmd) $(find_l) xml/$*/ $(xml_file_predicates) | \
 	while read xmlfile; do \
 		test -e src/$${xmlfile#xml/$*/} || rm -vf $${xmlfile}; \
 	done
 
 # Target suitable for command line
-xml-images-%: xml/%/images ;
 images-%: xml-images-% html-images-% ;
+xml-images-%: xml/%/images ;
 
-.PHONY: FORCE
-FORCE: ;
+# Main commandline target
+xml: $(foreach LANG,$(LANGUAGES),xml-$(LANG)) ;
+
+.PRECIOUS: xml/%/images
+.PHONY: xml xml-% xml-images-%
 
 
 ########################################################################
@@ -712,6 +719,51 @@ endif
 
 
 ########################################################################
+####            Make HTML draft (single page preview)               ####
+########################################################################
+
+preview-xml/%.xml: xml/%.xml stylesheets/drafthtml.xsl
+	$(cmd) id=`$(SED) -e 's/.*id=.//' -e tmatch \
+	                  -e d -e :match \
+			  -e 's/["'"'"'].*//' \
+			  -e q $<`; \
+	test -n "$${id}" || id=noname; \
+	lang=$(shell echo $< | $(SED) -e 's,^xml/,,; s,/.*,,'); \
+	destdir=html/$${lang}; \
+	test -d $${destdir}/images || $(RMAKE) $${destdir}/images; \
+	cp -f $(srcdir)/stylesheets/*.css $(srcdir)/stylesheets/$${lang}/*.css\
+	    $${destdir} 2>/dev/null; \
+	destfile="$${destdir}/$${id}-draft.html"; \
+	echo "Making $${destfile} (ignore any XSLT complaints) ..."; \
+	$(XSLTPROC) \
+	    $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
+	    --xinclude \
+	    --stringparam l10n.gentext.default.language $${lang} \
+	    --output $${destfile} \
+	    $(srcdir)/stylesheets/drafthtml.xsl \
+	    $<
+
+preview-src/%.xml: $(foreach lang,$(LANGUAGES),preview-xml/$(lang)/%.xml)
+	$(msg) "(Remember that links won't work in a draft file.)"
+
+preview-po/%.po:
+	@echo >&2 "After merging pofiles this feature does not work any more."
+	@echo >&2 "Use 'make ... preview-xml/$*.xml'."
+
+# For backward compatibility:
+
+xml/%.draft: preview-xml/%.xml
+	$(msg) "(Remember that links won't work in a draft file.)"
+
+src/%.draft: preview-src/%.xml ;
+
+# Synonyms
+draft-xml/%.xml: preview-xml/%.xml ;
+draft-src/%.xml: preview-src/%.xml ;
+draft-po/%.po:   preview-po/%.po   ;
+
+
+########################################################################
 ####            Make PDF files:  XML --> PDF                        ####
 ########################################################################
 if HAVE_DBLATEX
@@ -780,59 +832,13 @@ endif
 
 
 ########################################################################
-####            Make HTML draft (single page preview)               ####
-########################################################################
-
-preview-xml/%.xml: xml/%.xml stylesheets/drafthtml.xsl
-	$(cmd) id=`$(SED) -e 's/.*id=.//' -e tmatch \
-	                  -e d -e :match \
-			  -e 's/["'"'"'].*//' \
-			  -e q $<`; \
-	test -n "$${id}" || id=noname; \
-	lang=$(shell echo $< | $(SED) -e 's,^xml/,,; s,/.*,,'); \
-	destdir=html/$${lang}; \
-	test -d $${destdir}/images || $(RMAKE) $${destdir}/images; \
-	cp -f $(srcdir)/stylesheets/*.css $(srcdir)/stylesheets/$${lang}/*.css\
-	    $${destdir} 2>/dev/null; \
-	destfile="$${destdir}/$${id}-draft.html"; \
-	echo "Making $${destfile} (ignore any XSLT complaints) ..."; \
-	$(XSLTPROC) \
-	    $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
-	    --xinclude \
-	    --stringparam l10n.gentext.default.language $${lang} \
-	    --output $${destfile} \
-	    $(srcdir)/stylesheets/drafthtml.xsl \
-	    $<
-
-preview-src/%.xml: $(foreach lang,$(LANGUAGES),preview-xml/$(lang)/%.xml)
-	$(msg) "(Remember that links won't work in a draft file.)"
-
-preview-po/%.po:
-	@echo >&2 "After merging pofiles this feature does not work any more."
-	@echo >&2 "Use 'make ... preview-xml/$*.xml'."
-
-# For backward compatibility:
-
-xml/%.draft: preview-xml/%.xml
-	$(msg) "(Remember that links won't work in a draft file.)"
-
-src/%.draft: preview-src/%.xml ;
-
-# Synonyms
-draft-xml/%.xml: preview-xml/%.xml ;
-draft-src/%.xml: preview-src/%.xml ;
-draft-po/%.po:   preview-po/%.po   ;
-
-
-########################################################################
-####        Language-specific HTML tarballs for distribution        ####
+####            Make language-specific HTML tarballs                ####
 ########################################################################
 
 tarball_prefix = gimp-help-2-html
 tarball_dir    = gimp-help-2
 HTMLMETAFILES  = README AUTHORS COPYING MAINTAINERS HACKING INSTALL
 
-.SECONDARY: $(tarball_prefix)-%.tar
 $(tarball_prefix)-%.tar: html/%/index.html html/%/gimp-help.xml \
 		$(HTMLMETAFILES) tools/Makefile.html-package
 	$(msg) "Making $@ ..."
@@ -932,7 +938,7 @@ check-image-resolutions-en: check-image-resolutions-C ;
 
 if HAVE_DOT
 ########################################################################
-####            Build system development                            ####
+####            Build system development & debugging                ####
 ########################################################################
 
 build-system.svg: tools/build-system.dot
@@ -1013,6 +1019,18 @@ $(top_builddir)/config.status: $(top_srcdir)/configure ;
 
 $(top_srcdir)/configure: $(top_srcdir)/configure.ac ;
 
+
+########################################################################
+####            Special targets                                     ####
+########################################################################
+
+FORCE: ;
+
+.PHONY: FORCE
+
+# Delete the default suffixes (we don't compile C files)
+SUFFIXES =
+
 # GNU Make, please don't delete these targets when a target that depends
 # on them fails, 'kay?
 #			TODO: check: seems that xml/%/gimp.xml can be removed
@@ -1021,9 +1039,10 @@ $(top_srcdir)/configure: $(top_srcdir)/configure.ac ;
 	xml/%/images \
 	pdf/%/gimp.pdf \
 	odf/%/gimp.odt \
+	html/%/index.html \
 	html/%/gimp-xrefs.xml \
 	html/%/gimp-help.xml \
-	html/%/index.html
+	html/%/images
 
 .DELETE_ON_ERROR:
 



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