[Libreoffice-commits] .: officecfg/CustomTarget_registry.mk

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 26 04:41:09 PDT 2012


 officecfg/CustomTarget_registry.mk |   33 ++++++++++-----------------------
 1 file changed, 10 insertions(+), 23 deletions(-)

New commits:
commit 308ed5c3370cda22b61d5af4e90463df8cb83d5f
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date:   Thu Oct 11 18:51:44 2012 +0200

    simplify pattern-target by using a simple recursion…
    
    …instead of using eval to process the same rule multiple times
    Saves quoting, makes it more readable.
    (% always matches whole sub-paths, not only on Mac, see
    http://www.gnu.org/software/make/manual/html_node/Pattern-Match.html)
    
    Change-Id: I80e481d4a7e1cd62ad9916257a75c77c87d3bbdd
    Reviewed-on: https://gerrit.libreoffice.org/858
    Reviewed-by: Peter Foley <jpfoley2 at gmail.com>
    Reviewed-by: Petr Mladek <pmladek at suse.cz>
    Tested-by: Petr Mladek <pmladek at suse.cz>

diff --git a/officecfg/CustomTarget_registry.mk b/officecfg/CustomTarget_registry.mk
index e4cdd9b..c655ff3 100644
--- a/officecfg/CustomTarget_registry.mk
+++ b/officecfg/CustomTarget_registry.mk
@@ -41,27 +41,14 @@ $(call gb_CustomTarget_get_workdir,officecfg/registry)/officecfg_qa_allheaders.h
 	$(foreach file,$(officecfg_XCSFILES),\
 		&& echo "#include <officecfg/$(file).hxx>" >> $@)
 
-define officecfg_TARGET
-$(call gb_CustomTarget_get_workdir,officecfg/registry)/$(if $(1),$(1)/$(if $(2),$(2)/))%.hxx: \
-            $(SRCDIR)/officecfg/registry/schema/org/openoffice/$(if $(1),$(1)/$(if $(2),$(2)/))%.xcs \
-            $(SRCDIR)/officecfg/registry/cppheader.xsl | $(gb_XSLTPROCTARGET)
-	$$(call gb_Output_announce,$$(subst $(WORKDIR)/,,$$@),$(true),XSL,1)
-	$$(call gb_Helper_abbreviate_dirs, \
-        mkdir -p $$(dir $$@) && \
-        $$(gb_XSLTPROC) --nonet --stringparam ns1 \
-            $(if $(1), \
-                $(1) --stringparam ns2 $(if $(2),$(2) --stringparam ns3)) $$* \
-            -o $$@ $(SRCDIR)/officecfg/registry/cppheader.xsl $$<)
-
-endef
+# pass the stem as space separated path elements and get a set of --stringparam ns<level> <element> in return
+officecfg_xsltparams=$(if $(filter-out $(lastword $1),$1),$(call officecfg_xsltparams,$(filter-out $(lastword $1),$1))) --stringparam ns$(words $1) $(lastword $1)
 
-# Sort longer paths before their prefixes, as at least GNU Make 3.81 on Mac OS X
-# appears to let % span sub-directories, so that the above rule would produce
-# unexpected results; sorting this way seems to avoid the problem:
-$(eval $(call officecfg_TARGET,Office,DataAccess))
-$(eval $(call officecfg_TARGET,Office,OOoImprovement))
-$(eval $(call officecfg_TARGET,Office,UI))
-$(eval $(call officecfg_TARGET,Office))
-$(eval $(call officecfg_TARGET,TypeDetection))
-$(eval $(call officecfg_TARGET,ucb))
-$(eval $(call officecfg_TARGET))
+$(call gb_CustomTarget_get_workdir,officecfg/registry)/%.hxx: \
+            $(SRCDIR)/officecfg/registry/schema/org/openoffice/%.xcs \
+            $(SRCDIR)/officecfg/registry/cppheader.xsl | $(gb_XSLTPROCTARGET)
+	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XSL,1)
+	$(call gb_Helper_abbreviate_dirs, \
+	mkdir -p $(dir $@) && \
+	$(gb_XSLTPROC) --nonet $(call officecfg_xsltparams,$(subst /, ,$*)) \
+	    -o $@ $(SRCDIR)/officecfg/registry/cppheader.xsl $<)


More information about the Libreoffice-commits mailing list