[yelp-tools] yelp.m4: Use itstool, better AM_V, other tweaks



commit 42a751a41acd00e86bb5bdd4af45ca902f9dd56f
Author: Shaun McCance <shaunm gnome org>
Date:   Fri Apr 29 15:24:04 2011 -0400

    yelp.m4: Use itstool, better AM_V, other tweaks

 tools/yelp.m4 |   32 +++++++++++++++++---------------
 1 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/tools/yelp.m4 b/tools/yelp.m4
index 94ba1e6..8ee962c 100644
--- a/tools/yelp.m4
+++ b/tools/yelp.m4
@@ -16,54 +16,56 @@ HELP_EXTRA ?=
 HELP_MEDIA ?=
 HELP_LINGUAS ?=
 
-_HELP_FORMAT = $(if $(filter %.page,$(HELP_FILES)),mallard,docbook)
 _HELP_LINGUAS = $(if $(filter environment,$(origin LINGUAS)), $(filter $(LINGUAS),$(HELP_LINGUAS)), $(HELP_LINGUAS))
 _HELP_POTFILE = $(if $(HELP_ID), $(HELP_ID).pot)
 _HELP_POFILES = $(if $(HELP_ID), $(foreach lc,$(_HELP_LINGUAS),$(lc)/$(lc).po))
 _HELP_MOFILES = $(patsubst %.po,%.mo,$(_HELP_POFILES))
-_HELP_C_FILES = $(foreach f,$(HELP_FILES),$(abs_srcdir)/C/$(f))
-_HELP_C_EXTRA = $(foreach f,$(HELP_EXTRA),$(abs_srcdir)/C/$(f))
 _HELP_C_FILES = $(foreach f,$(HELP_FILES),C/$(f))
 _HELP_C_EXTRA = $(foreach f,$(HELP_EXTRA),C/$(f))
+_HELP_C_MEDIA = $(foreach f,$(HELP_MEDIA),C/$(f))
 _HELP_LC_FILES = $(foreach lc,$(_HELP_LINGUAS),$(foreach f,$(HELP_FILES),$(lc)/$(f)))
 
+_HELP_LC_VERBOSE = $(_HELP_LC_VERBOSE_$(V))
+_HELP_LC_VERBOSE_ = $(_HELP_LC_VERBOSE_$(AM_DEFAULT_VERBOSITY))
+_HELP_LC_VERBOSE_0 = @echo "  GEN    "$(dir [$]@);
+
 all: $(_HELP_C_FILES) $(_HELP_LC_FILES) $(_HELP_POFILES)
 
 .PHONY: pot
 pot: $(_HELP_POTFILE)
-$(_HELP_POTFILE): $(_HELP_C_FILES)
-	$(AM_V_GEN)xml2po -m $(_HELP_FORMAT) -e -o "[$]@" $^
+$(_HELP_POTFILE): $(_HELP_C_FILES) $(_HELP_C_EXTRA) $(_HELP_C_MEDIA)
+	$(AM_V_GEN)itstool -o "[$]@" $(_HELP_C_FILES)
 
 $(_HELP_POFILES):
 	$(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
 	$(AM_V_at)if test ! -f "[$]@" -a -f "$(srcdir)/[$]@"; then cp "$(srcdir)/[$]@" "[$]@"; fi
 	$(AM_V_GEN)if ! test -f "[$]@"; then \
 	  (cd "$(dir [$]@)" && \
-	    xml2po -m $(_HELP_FORMAT) -e $(_HELP_C_FILES) > "$(notdir [$]@).tmp" && \
-	    cp "$(notdir [$]@).tmp" "$(notdir [$]@)" && "rm -f $(notdir [$]@).tmp"); \
+	    itstool -o "$(notdir [$]@).tmp" $(_HELP_C_FILES) && \
+	    mv "$(notdir [$]@).tmp" "$(notdir [$]@)"); \
 	else \
 	  (cd "$(dir [$]@)" && \
-	    xml2po -m $(_HELP_FORMAT) -e -u "$(notdir [$]@)" $(_HELP_C_FILES)); \
+	    itstool -o "$(notdir [$]@).tmp" $(_HELP_C_FILES) && \
+	    msgmerge -o "$(notdir [$]@)" "$(notdir [$]@)" "$(notdir [$]@).tmp" && \
+	    rm "$(notdir [$]@).tmp"); \
 	fi
 
 $(_HELP_MOFILES): %.mo: %.po
 	$(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
 	$(AM_V_GEN)msgfmt -o "[$]@" "$<"
 
-$(_HELP_LC_FILES): $(_DOC_MOFILES)
-$(_HELP_LC_FILES): $(_DOC_C_DOCS)
+$(_HELP_LC_FILES): $(_HELP_MOFILES)
+$(_HELP_LC_FILES): $(_HELP_C_FILES) $(_HELP_C_EXTRA)
 	$(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
-	$(AM_V_GEN)if test -f "C/$(notdir [$]@)"; then d="../"; else d="$(abs_srcdir)/"; fi; \
+	$(_HELP_LC_VERBOSE)if test -f "C/$(notdir [$]@)"; then d="../"; else d="$(abs_srcdir)/"; fi; \
 	mo="$(dir [$]@)$(patsubst %/$(notdir [$]@),%,[$]@).mo"; \
 	if test -f "$${mo}"; then mo="../$${mo}"; else mo="$(abs_srcdir)/$${mo}"; fi; \
-	(cd "$(dir [$]@)" && \
-	  xml2po -m $(_HELP_FORMAT) -e -t "$${mo}" "$${d}C/$(notdir [$]@)" > "$(notdir [$]@).tmp" && \
-	  cp "$(notdir [$]@).tmp" "$(notdir [$]@)" && rm -f "$(notdir [$]@).tmp")
+	(cd "$(dir [$]@)" && itstool -m "$${mo}" $(foreach f,$(_HELP_C_FILES),$${d}/$(f)))
 
 .PHONY: clean-help
 mostlyclean-am: $(if $(HELP_ID),clean-help)
 clean-help:
-	rm -f $(_HELP_LC_FILES)
+	rm -f $(_HELP_LC_FILES) $(_HELP_MOFILES)
 
 EXTRA_DIST ?=
 EXTRA_DIST += $(_HELP_C_FILES) $(_HELP_LC_FILES) $(_HELP_C_EXTRA) $(_HELP_POFILES)



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