From 308ed5c3370cda22b61d5af4e90463df8cb83d5f Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Thu, 11 Oct 2012 18:51:44 +0200 Subject: simplify pattern-target by using a simple recursion… MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …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 Reviewed-by: Petr Mladek Tested-by: Petr Mladek --- officecfg/CustomTarget_registry.mk | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'officecfg/CustomTarget_registry.mk') diff --git a/officecfg/CustomTarget_registry.mk b/officecfg/CustomTarget_registry.mk index e4cdd9bd34c6..c655ff3c8203 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 " >> $@) -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 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 $<) -- cgit v1.2.3