summaryrefslogtreecommitdiff
path: root/officecfg
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2012-10-11 18:51:44 +0200
committerPetr Mladek <pmladek@suse.cz>2012-10-26 11:40:49 +0000
commit308ed5c3370cda22b61d5af4e90463df8cb83d5f (patch)
tree8692fb166b5d129bca55fd5c94db7b9dfda2e328 /officecfg
parent1e925461d5371fc6cbaa9facbdf40a6c99a85549 (diff)
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@gmail.com> Reviewed-by: Petr Mladek <pmladek@suse.cz> Tested-by: Petr Mladek <pmladek@suse.cz>
Diffstat (limited to 'officecfg')
-rw-r--r--officecfg/CustomTarget_registry.mk33
1 files changed, 10 insertions, 23 deletions
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 <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 $<)