gimp-help-2 r2775 - in trunk: . stylesheets



Author: ulfehlert
Date: Thu Mar  5 20:31:45 2009
New Revision: 2775
URL: http://svn.gnome.org/viewvc/gimp-help-2?rev=2775&view=rev

Log:
2009-03-05  Ulf-D. Ehlert  <ulfehlert svn gnome org>

	* Makefile.am: return error if making pot file fails; do not
	format translated XMLs with xmllint (problems with entities and
	xincludes); new target for forced updating of po files; fixed
	link error in xml/%/images; do not skip loading DTDs when making
	previews; some minor changes
	* Makefile.GNU: return error if making pot file fails; do not
	format translated XMLs with xmllint by default (problems with
	entities and xincludes); try to update pot files when forcing
	po file update; fixed link error in xml/%/images; do not skip
	loading DTDs when making previews; enhanced help target using
	new file "make.help"; some minor changes
	* make.help: new (used by "make -f Makefile.GNU help")

	* stylesheets/plainhtml.xsl.in: sort glossary entries


Added:
   trunk/make.help
Modified:
   trunk/ChangeLog
   trunk/Makefile.GNU
   trunk/Makefile.am
   trunk/stylesheets/plainhtml.xsl.in

Modified: trunk/Makefile.GNU
==============================================================================
--- trunk/Makefile.GNU	(original)
+++ trunk/Makefile.GNU	Thu Mar  5 20:31:45 2009
@@ -1,4 +1,4 @@
-#########################################################################
+########################################################################
 ####            Preliminaries: Variables and Functions              ####
 ########################################################################
 
@@ -97,9 +97,15 @@
 AUTHORS_DOCBOOK_XML = src/preface/authors.xml
 
 # Files & directories
+ifneq "$(MAKECMDGOALS)" "help"
 SRC_DIRS  := $(shell cd $(srcdir) && find src $(src_dir_predicates))
 SRC_FILES := $(shell cd $(srcdir) && find src $(xml_file_predicates)) \
-	    $(AUTHORS_DOCBOOK_XML)
+             $(AUTHORS_DOCBOOK_XML)
+else
+SRC_DIRS   = $(shell cd $(srcdir) && find src $(src_dir_predicates))
+SRC_FILES  = $(shell cd $(srcdir) && find src $(xml_file_predicates)) \
+             $(AUTHORS_DOCBOOK_XML)
+endif
 
 # XXX: requires that "plainhtml.xsl" has been renamed to "html.xsl"
 HTML_STYLESHEETS = stylesheets/html*.xsl
@@ -153,7 +159,9 @@
 xml2pot = ($(XML2PO) --output='-' $(1) \
           | $(MSGUNIQ) $(MSGUNIQFLAGS) \
           | $(MSGCAT) $(MSGCATFLAGS) - > "$(2)") 2>&1 \
-          | $(SED) -e '/image file .* not found/d'
+          | $(SED) -e '/image file .* not found/d'; \
+          test -s "$(2)" || rm -f "$(2)"; \
+          test -s "$(2)"
 
 # Merge template (pot) and message catalog (po) or create a new catalog
 #
@@ -163,19 +171,28 @@
 #     $1 - input POT file
 #     $2 - translation language
 #     $3 - output PO file
-pot2po = if [ -s $(3) ]; then \
-             with_compendium="$(shell $(call get_compendium,$3))"; \
-             tmpfile=$(3).tmp; \
+pot2po = with_compendium="$(shell $(call get_compendium,$3))"; \
+         tmpfile=$(3).tmp; \
+         if [ -s $(3) ]; then \
              $(MSGFMT) $(MSGFMTFLAGS) $(3); \
              rm -f messages.po messages.gmo; \
-             $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} $(3) $(1) \
-             > $${tmpfile}; \
-             test -s  $${tmpfile} && mv -f $${tmpfile} $(3) || rm -f $${tmpfile}; \
+             $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} \
+                 --output-file $${tmpfile} $(3) $(1); \
          else \
-             $(MSGINIT) $(MSGINITFLAGS) --input $(1) --locale=$(2) --output=- \
-             | $(SED) -e '/Plural-Forms:/d' \
-             > $(3); \
-         fi
+             $(MSGINIT) $(MSGINITFLAGS) --input $(1) --locale=$(2) --output=$(3); \
+             pofile=$(3); \
+             if [ -s $${pofile%/*}.po ]; then \
+                 $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} \
+                     --output-file $${tmpfile} $${pofile%/*}.po $(3); \
+             elif [ -n "$${with_compendium}" ]; then \
+                 $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} \
+	             --output-file $${tmpfile} $(3) $(1); \
+             else \
+                 $(SED) -e '/Plural-Forms:/d' $(3) > $${tmpfile}; \
+             fi; \
+         fi; \
+         test -s $${tmpfile} && mv -f $${tmpfile} $(3) || rm -f $${tmpfile}; \
+         test -s $(3)
 
 # Merge PO file into (translated) XML file
 #
@@ -186,7 +203,7 @@
 #     $2 - PO file containing translations
 #     $3 - translation language
 #     $4 - resulting (translated) XML file
-ifeq ("$(XMLLINT)", "")
+ifneq ("$(FORMAT_XML_WITH_XMLLINT)", "1")
 po2xml = $(XML2PO) --po-file=$(2) --language=$(3) --output=$(4) $(1) 2>&1 \
          | $(SED) -e '/Warning: image file .* not found./d'
 else
@@ -223,7 +240,7 @@
 ####            Main targets                                        ####
 ########################################################################
 
-first: all
+.PHONY: all
 all: html index AUTHORS
 
 
@@ -232,14 +249,33 @@
 ########################################################################
 
 .PHONY: help
-help:
-	@echo 'Common targets:'
-	@printf '  %s\t- %s.\n' \
-	'html-<LANG>' 'Build HTML for language <LANG> (implies xml-<LANG>)' \
-	'xml-<LANG> ' 'Create/update XML files for language <LANG> (implies po-<LANG>)' \
-	'po-<LANG>  ' 'Create/update PO files for language <LANG> (implies pot)' \
-	'pot        ' 'Create/update POT files'
-	@echo '(where <LANG> is one of' $(shell echo $(LANGUAGES) | $(SED) -e 's/ /,&/g')')'
+make.help:
+	@echo >&2 'ERROR: cannot find the help file "$@"!'
+	@exit 66
+# TODO: replace with a "real" script tools/what-ever(?)
+#   (probably "yes" if more features are needed...)
+help: make.help
+	$(cmd) $(SED) \
+	    -e '### skip comments ###' \
+	    -e '/^#/d' \
+	    -e '### print if no "make" variable found ###' \
+	    -e '/@/!b' \
+	    -e '### replace "make" variables ###' \
+	    -e 's/@LANGUAGES@/@$(LANGUAGES)@/' \
+	    -e 's/@LINGUAS@/@$(LINGUAS)@/' \
+	    -e 's/@ALL_LINGUAS@/@$(ALL_LINGUAS)@/' \
+	    -e '### add commas ###' \
+	    -e 'tloop' \
+	    -e ':loop' \
+	    -e '    ### mark value of variable (@@...@@) ###' \
+	    -e '    s/@\([^ ]*\)@/@@\1@@/' \
+	    -e '    twhile' \
+	    -e '    :while' \
+	    -e '        s/\(@@[^,@]*\) \([^ ]*@@\)/\1, \2/' \
+	    -e '    twhile' \
+	    -e '    s/@@\([^ ]*\)@@/\1/' \
+	    -e 'tloop' \
+	$<
 
 
 ########################################################################
@@ -318,8 +354,9 @@
 
 # Force updating po file(s)
 update-po/%.po:
-	$(cmd) pot=`echo $* | $(SED) -e 's|[^/]*|pot|; s/$$/.pot/'`; \
-	$(RMAKE) -W $${pot} po/$*.po
+	$(cmd) po=$@; pot=pot/$${po#update-po/*/}t; \
+	$(RMAKE) $${pot} && touch $${pot} && \
+	$(RMAKE) po/$*.po
 
 force-po/%:
 	$(cmd) for po in po/$*/*.po; do \
@@ -331,9 +368,11 @@
 ####            Generate XML prerequisites                          ####
 ########################################################################
 
-ifneq "$(UPDATE)" "nodeps"
+#ifneq "$(MAKECMDGOALS)" "help"
+#ifneq "$(UPDATE)" "nodeps"
 include $(foreach LANG,$(PO_LANGS),xml/$(LANG)/.deps.mk)
-endif
+#endif
+#endif
 
 # The dynamically generated and updated ".deps.mk" files contain
 # rules to register the po prereqisite for every xml file, e.g.
@@ -388,7 +427,9 @@
 $(foreach LANG,$(PO_LANGS),$(eval $(call MAKE_XML_RULES,$(LANG))))
 
 # TODO: test new image files structure;
-#       use (~1500) image files as prerequisites?
+#   how to ensure that $@ is up-to-date without forcing
+#   rebuild (which will also force e.g. html-% to be rebuilt)
+#   -- use (~1500) image files as prerequisites?
 xml/%/images: FORCE
 	$(cmd) if test -L $@; then rm -v $@; fi
 	$(cmd) if test -L xml/$*; then rm -v xml/$*; fi
@@ -449,12 +490,12 @@
 		echo "*** Validating XML ($(1)) ... "; \
 		$$(XMLLINT) $$(XMLLINTFLAGS) --xinclude xml/$(1)/gimp.xml \
 		| $$(SED) -e 's,xmlns:xi="http://www.w3.org/2001/XInclude";,,' \
-		| $$(XMLLINT) $$(XMLLINTFLAGS) --nonet --valid \
+		| $$(XMLLINT) $$(XMLLINTFLAGS) --valid \
 			--output log/$(1).xml - 2>$$(@); \
 		if test -s $$(@); then \
 			echo "(You will find log and xml files in log/.)"; \
 		else \
-			echo "No errors."; \
+			echo "$(1): no errors."; \
 			rm -f  log/$(1).xml; \
 		fi >> $$(@); \
 	else \
@@ -478,7 +519,7 @@
 #         html/%/gimp-xrefs.xml  -->  html/%/index.html
 html-%: index-% ;
 
-html/%/index.html: xml/% $(HTML_STYLESHEETS) html/images html/%/images
+html/%/index.html: xml/% $(HTML_STYLESHEETS) html/%/images
 	$(msg) "*** Making html for $* ... "
 	$(cmd) rm -f html/$*/*.*
 
@@ -500,12 +541,9 @@
 	done
 
 # TODO: check/enhance new image files structure
-html/images: FORCE
-	$(cmd) if test -L $@; then rm -v $@; fi
-
 html/%/images: xml/%/images
 	$(cmd) test -d html/$* || $(mkdir_p) html/$*
-	$(cmd) $(ln_s) ../../xml/$*/images $@
+	$(cmd) test -e $@ || $(ln_s) ../../$< $@
 
 # The xrefs file is a side effect of the HTML build
 html/%/gimp-xrefs.xml: html/%/index.html
@@ -551,7 +589,6 @@
 	    $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
 	    --xinclude \
 	    --stringparam l10n.gentext.default.language $${lang} \
-	    --novalid \
 	    --output $${destfile} \
 	    $(srcdir)/stylesheets/drafthtml.xsl \
 	    $<
@@ -742,3 +779,4 @@
 	fi
 
 
+.NOEXPORT:

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Thu Mar  5 20:31:45 2009
@@ -223,7 +223,9 @@
 xml2pot = ($(XML2PO) --output='-' $(1) \
           | $(MSGUNIQ) $(MSGUNIQFLAGS) \
           | $(MSGCAT) $(MSGCATFLAGS) - > "$(2)") 2>&1 \
-          | $(SED) -e '/image file .* not found/d'
+          | $(SED) -e '/image file .* not found/d'; \
+          test -s "$(2)" || rm -f "$(2)"; \
+          test -s "$(2)"
 
 # Merge template (pot) and message catalog (po) or create a new catalog
 #
@@ -233,19 +235,28 @@
 #     $1 - input POT file
 #     $2 - translation language
 #     $3 - output PO file
-pot2po = if [ -s $(3) ]; then \
-             with_compendium="$(shell $(call get_compendium,$3))"; \
-             tmpfile=$(3).tmp; \
+pot2po = with_compendium="$(shell $(call get_compendium,$3))"; \
+         tmpfile=$(3).tmp; \
+         if [ -s $(3) ]; then \
              $(MSGFMT) $(MSGFMTFLAGS) $(3); \
              rm -f messages.po messages.gmo; \
-             $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} $(3) $(1) \
-             > $${tmpfile}; \
-             test -s  $${tmpfile} && mv -f $${tmpfile} $(3) || rm -f $${tmpfile}; \
+             $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} \
+                 --output-file $${tmpfile} $(3) $(1); \
          else \
-             $(MSGINIT) $(MSGINITFLAGS) --input $(1) --locale=$(2) --output=- \
-             | $(SED) -e '/Plural-Forms:/d' \
-             > $(3); \
-         fi
+             $(MSGINIT) $(MSGINITFLAGS) --input $(1) --locale=$(2) --output=$(3); \
+             pofile=$(3); \
+             if [ -s $${pofile%/*}.po ]; then \
+                 $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} \
+                     --output-file $${tmpfile} $${pofile%/*}.po $(3); \
+             elif [ -n "$${with_compendium}" ]; then \
+                 $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} \
+	             --output-file $${tmpfile} $(3) $(1); \
+             else \
+                 $(SED) -e '/Plural-Forms:/d' $(3) > $${tmpfile}; \
+             fi; \
+         fi; \
+         test -s $${tmpfile} && mv -f $${tmpfile} $(3) || rm -f $${tmpfile}; \
+         test -s $(3)
 
 # Merge PO file into (translated) XML file
 #
@@ -256,14 +267,8 @@
 #     $2 - PO file containing translations
 #     $3 - translation language
 #     $4 - resulting (translated) XML file
-if HAVE_XMLLINT
-po2xml = ($(XML2PO) --po-file=$(2) --language=$(3) --output='-' $(1) \
-         | $(XMLLINT) $(XMLLINTFLAGS) --format --output $(4) -) 2>&1 \
-         | $(SED) -e '/Warning: image file .* not found./d'
-else
 po2xml = $(XML2PO) --po-file=$(2) --language=$(3) --output=$(4) $(1) 2>&1 \
          | $(SED) -e '/Warning: image file .* not found./d'
-endif
 
 
 #--------------------------------------------------------------#
@@ -362,6 +367,12 @@
 		perl tools/get_po_status.pl --nofiles --nosummary $${podir} || break; \
 	done
 
+# Force updating po file
+update-po/%.po:
+	$(cmd) po=$@; pot=pot/$${po#update-po/*/}t; \
+	$(RMAKE) $${pot} && touch $${pot} && \
+	$(RMAKE) po/$*.po
+
 
 ########################################################################
 ####            Generate XML prerequisites                          ####
@@ -422,7 +433,9 @@
 # HIDE FROM AUTOMAKE #$(foreach LANG,$(PO_LANGS),$(eval $(call MAKE_XML_RULES,$(LANG))))
 
 # TODO: test new image files structure;
-#       use (~1500) image files as prerequisites?
+#   how to ensure that $@ is up-to-date without forcing
+#   rebuild (which will also force e.g. html-% to be rebuilt 
+#   -- use (~1500) image files as prerequisites?
 xml/%/images: FORCE
 	$(cmd) if test -L $@; then rm -v $@; fi
 	$(cmd) if test -L xml/$*; then rm -v xml/$*; fi
@@ -483,12 +496,12 @@
 # HIDE FROM AUTOMAKE #		echo "*** Validating XML ($(1)) ... "; \
 # HIDE FROM AUTOMAKE #		$$(XMLLINT) $$(XMLLINTFLAGS) --xinclude xml/$(1)/gimp.xml \
 # HIDE FROM AUTOMAKE #		| $(SED) -e 's,xmlns:xi="http://www.w3.org/2001/XInclude";,,' \
-# HIDE FROM AUTOMAKE #		| $$(XMLLINT) $$(XMLLINTFLAGS) --nonet --valid \
+# HIDE FROM AUTOMAKE #		| $$(XMLLINT) $$(XMLLINTFLAGS) --valid \
 # HIDE FROM AUTOMAKE #			--output log/$(1).xml - 2>$$(@); \
 # HIDE FROM AUTOMAKE #		if test -s $$(@); then \
 # HIDE FROM AUTOMAKE #			echo "(You will find log and xml files in log/.)"; \
 # HIDE FROM AUTOMAKE #		else \
-# HIDE FROM AUTOMAKE #			echo "No errors."; \
+# HIDE FROM AUTOMAKE #			echo "$(1): no errors."; \
 # HIDE FROM AUTOMAKE #			rm -f  log/$(1).xml; \
 # HIDE FROM AUTOMAKE #		fi >> $$(@); \
 # HIDE FROM AUTOMAKE #	else \
@@ -513,7 +526,7 @@
 #         html/%/gimp-xrefs.xml  -->  html/%/index.html
 html-%: index-% ;
 
-html/%/index.html: xml/% $(HTML_STYLESHEETS) html/images html/%/images
+html/%/index.html: xml/% $(HTML_STYLESHEETS) html/%/images
 	$(msg) "*** Making html for $* ... "
 	$(cmd) rm -f html/$*/*.*
 
@@ -535,12 +548,9 @@
 	done
 
 # TODO: check/enhance new image files structure
-html/images: FORCE
-	$(cmd) if test -L $@; then rm -v $@; fi
-
 html/%/images: xml/%/images
 	$(cmd) test -d html/$* || $(MKDIR_P) html/$*
-	$(cmd) $(LN_S) ../../xml/$*/images $@
+	$(cmd) test -e $@ || $(LN_S) ../../$< $@
 
 # The xrefs file is a side effect of the HTML build
 html/%/gimp-xrefs.xml: html/%/index.html
@@ -653,7 +663,6 @@
 	    $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
 	    --xinclude \
 	    --stringparam l10n.gentext.default.language $${lang} \
-	    --novalid \
 	    --output $${destfile} \
 	    $(srcdir)/stylesheets/drafthtml.xsl \
 	    $<
@@ -682,7 +691,7 @@
 ####        Language-specific HTML tarballs for distribution        ####
 ########################################################################
 
-# HIDE FROM AUTOMAKE #tarball_prefix := gimp-help-2-html
+tarball_prefix := gimp-help-2-html
 
 .SECONDARY: $(tarball_prefix)-%.tar
 $(tarball_prefix)-%.tar: html/%/index.html html/%/gimp-help.xml

Added: trunk/make.help
==============================================================================
--- (empty file)
+++ trunk/make.help	Thu Mar  5 20:31:45 2009
@@ -0,0 +1,62 @@
+# Help text for the GIMP-manual build system.
+# 
+# This text will be printed when you type
+#	make [...] help
+# where @LANGUAGES@ (and @ALL_LINGUAS@ & @LINGUAS@) are
+# replaced with the value of the respective 'make' variable
+# and lines starting with '#' (comments) are skipped.
+# 
+# Feel free to enhance this text... :-)
+#
+
+Default (main) targets:
+  all              Create/update AUTHORS file and HTML
+                     (same as "make [..] html AUTHORS" or just "make [..]")
+  html             Create/update HTML for all languages
+                     (@LANGUAGES@)
+  AUTHORS          Create/update AUTHORS file
+
+GIMP-manual targets:
+  html-LANG        Build HTML for language LANG (implies xml-LANG)
+  pdf-LANG         Build  PDF for language LANG (implies xml-LANG)
+  odf-LANG         Build  ODF for language LANG (implies xml-LANG)
+#    (LANG is one of @LANGUAGES@)
+
+  Omitting LANG (e.g."make [..] html") is equivalent to making target
+  for all languages: @LANGUAGES@
+
+  WARNING: Making HTML (or PDF, ODF, XML) will automatically update
+  -------  po files if necessary. This may lead to unintended commits
+           when working directly on an SVN sandbox.
+
+Internal targets (intermediate stages):
+  pot              Create/update POT files
+  po-LANG          Create/update  PO files for language LANG (implies pot)
+  xml-LANG         Create/update XML files for language LANG (implies po-LANG)
+#    (LANG is one of @LANGUAGES@)
+
+Special (helper) targets for documenters and translators:
+  status-LANG      Show translation progress for language LANG
+  update-po/LANG/path/to/pofile.po
+                   Force re-making of pofile (useful if you updated
+                   the Compendium.po)
+  preview-xml/LANG/path/to/xmlfile.xml
+                   Make a single draft HTML file
+
+Checks:
+  validate-LANG    Validate XML for language LANG via 'xmllint'
+  validate         Same as "validate-en"
+  check-images-LANG
+                   Find broken image references and orphaned image files
+                   for language LANG
+  check-images     Same as "check-images-en"
+
+Special (helper) targets for build-system development:
+  dot              Create a visualized version of the Makefile dependencies
+                   (this is not up-to-date!)
+
+Make variables (can be overriden at command-line):
+  LANGUAGES="..."  Space-separated list of manual languages (e.g. "en de fr")
+  VERBOSE=0|1|2    Controls the amount of output messages:
+                     1 = "beauty" (default), 2 = all, 0 = silent (more or less)
+

Modified: trunk/stylesheets/plainhtml.xsl.in
==============================================================================
--- trunk/stylesheets/plainhtml.xsl.in	(original)
+++ trunk/stylesheets/plainhtml.xsl.in	Thu Mar  5 20:31:45 2009
@@ -51,6 +51,7 @@
          <xsl:param name="id.warnings" select="0" />
          <xsl:param name="make.valid.html" select="1" />
          <xsl:param name="segmentedlist.as.table" select="1" />
+         <xsl:param name="glossary.sort" select="1" />
 
          <xsl:param name="navig.showtitles" select="1" />
          <xsl:param name="navig.graphics" select="1" />



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