[Libreoffice-commits] core.git: oox/CustomTarget_generated.mk oox/source solenv/bin solenv/gbuild

Daniel Sikeler d.sikeler94 at gmail.com
Mon Dec 22 04:23:03 PST 2014


 oox/CustomTarget_generated.mk |   40 +++----------------------
 oox/source/token/tokens.pl    |   65 ------------------------------------------
 solenv/bin/generate-tokens.pl |   65 ++++++++++++++++++++++++++++++++++++++++++
 solenv/gbuild/CustomTarget.mk |   50 ++++++++++++++++++++++++++++++++
 4 files changed, 120 insertions(+), 100 deletions(-)

New commits:
commit 2116f511bd97b4e7ee3137735f3937db1f2e97ab
Author: Daniel Sikeler <d.sikeler94 at gmail.com>
Date:   Wed Dec 17 12:43:06 2014 +0000

    Refactor building perfect hash tabels for tokens
    
    moved the defines to be usable in more modules
    moved perl-script to be usable in more modules
    
    Change-Id: If893e4b7e9dc670646bdf097cb6fa5710e45f1ac

diff --git a/oox/CustomTarget_generated.mk b/oox/CustomTarget_generated.mk
index 640f4e4..462aef2 100644
--- a/oox/CustomTarget_generated.mk
+++ b/oox/CustomTarget_generated.mk
@@ -9,10 +9,7 @@
 
 $(eval $(call gb_CustomTarget_CustomTarget,oox/generated))
 
-oox_SRC := $(SRCDIR)/oox/source/token
 oox_MISC := $(call gb_CustomTarget_get_workdir,oox/generated)/misc
-oox_INC := $(call gb_CustomTarget_get_workdir,oox/generated)
-oox_GENHEADERPATH := $(oox_INC)/oox/token
 
 $(oox_MISC)/vml-shape-types : \
 		$(SRCDIR)/oox/source/export/preset-definitions-to-shape-types.pl \
@@ -32,42 +29,15 @@ $(oox_MISC)/oox-drawingml-adj-names : \
 	mkdir -p $(dir $@)
 	perl $< --drawingml-adj-names-data $(filter-out $<,$^) > $@.in_progress 2> $@.log && mv $@.in_progress $@
 
-$(oox_INC)/tokenhash.inc : $(oox_MISC)/tokenhash.gperf
-	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,GPF,1)
-	$(GPERF) --compare-strncmp --switch=2 --readonly-tables $< | sed -e 's/(char\*)0/(char\*)0, 0/g' | grep -v '^#line' > $@
+# Generate tokens for oox
+$(eval $(call gb_CustomTarget_token_hash,oox/generated,tokenhash.inc,tokenhash.gperf))
 
-define oox_GenTarget
-$(oox_MISC)/$(2)ids.inc $(oox_INC)/$(2)names.inc $(if $(3),$(oox_MISC)/$(3)) $(if $(4),$(oox_INC)/$(4)names.inc) : \
-		$(oox_GENHEADERPATH)/$(1).hxx
-	@touch $$@
-
-$(oox_GENHEADERPATH)/$(1).hxx : $(oox_SRC)/$(1).pl $(oox_SRC)/$(1).txt \
-		$(oox_SRC)/$(1).hxx.head $(oox_SRC)/$(1).hxx.tail
-	$$(call gb_Output_announce,$$(subst $(WORKDIR)/,,$$@),build,PRL,1)
-	mkdir -p $(oox_MISC) $(oox_INC) $(oox_GENHEADERPATH)
-	perl $(oox_SRC)/$(1).pl $(oox_SRC)/$(1).txt $(oox_MISC)/$(2)ids.inc \
-			$(oox_INC)/$(2)names.inc $(if $(3),$(oox_MISC)/$(3)) \
-			$(if $(4),$(oox_SRC)/$(4).txt $(oox_INC)/$(4)names.inc) \
-		&& cat $(oox_SRC)/$(1).hxx.head $(oox_MISC)/$(2)ids.inc \
-			   $(oox_SRC)/$(1).hxx.tail > $(oox_GENHEADERPATH)/$(1).hxx \
-		&& touch $$@
-endef
-
-$(eval $(call oox_GenTarget,namespaces,namespace,namespaces.txt,namespaces-strict))
-$(eval $(call oox_GenTarget,properties,property,))
-$(eval $(call oox_GenTarget,tokens,token,tokenhash.gperf))
+$(eval $(call gb_CustomTarget_generate_tokens,oox/generated,oox,oox/source/token,namespaces,namespace,namespaces.txt,namespaces-strict,namespaces.pl))
+$(eval $(call gb_CustomTarget_generate_tokens,oox/generated,oox,oox/source/token,properties,property,,,properties.pl))
+$(eval $(call gb_CustomTarget_generate_tokens,oox/generated,oox,oox/source/token,tokens,token,tokenhash.gperf))
 
 $(call gb_CustomTarget_get_target,oox/generated) : \
 	$(oox_MISC)/oox-drawingml-adj-names \
 	$(oox_MISC)/vml-shape-types \
-	$(oox_INC)/tokenhash.inc \
-	$(oox_INC)/tokennames.inc \
-	$(oox_INC)/namespacenames.inc \
-	$(oox_INC)/namespaces-strictnames.inc \
-	$(oox_INC)/propertynames.inc \
-	$(oox_GENHEADERPATH)/tokens.hxx \
-	$(oox_GENHEADERPATH)/namespaces.hxx \
-	$(oox_GENHEADERPATH)/properties.hxx \
-	$(oox_MISC)/namespaces.txt \
 
 # vim: set noet sw=4 ts=4:
diff --git a/oox/source/token/tokens.pl b/solenv/bin/generate-tokens.pl
similarity index 100%
rename from oox/source/token/tokens.pl
rename to solenv/bin/generate-tokens.pl
diff --git a/solenv/gbuild/CustomTarget.mk b/solenv/gbuild/CustomTarget.mk
index f68d7da..8f5ef05 100644
--- a/solenv/gbuild/CustomTarget.mk
+++ b/solenv/gbuild/CustomTarget.mk
@@ -76,4 +76,54 @@ $(1) : $(2) $(if $(WITH_LANG),$(call gb_Executable_get_runtime_dependencies,ulfe
 
 endef
 
+#$(call gb_CustomTarget_token_hash,oox/generated,tokenhash.inc,tokenhash.gperf)
+define gb_CustomTarget_token_hash
+$(call gb_CustomTarget_get_target,$(1)) : $(call gb_CustomTarget_get_workdir,$(1))/$(2)
+$(call gb_CustomTarget_get_workdir,$(1))/$(2) : $(call gb_CustomTarget_get_workdir,$(1))/misc/$(3)
+	$$(call gb_Output_announce,$$(subst $(WORKDIR)/,,$$@),build,GPF,1)
+	$(GPERF) --compare-strncmp --switch=2 --readonly-tables $$< \
+		| sed -e 's/char\*)0/(char\*)0, 0/g' | grep -v '^#line' > $$@
+
+endef
+
+#$(call gb_CustomTarget_generate_tokens,oox/generated,oox,oox/source/token,
+#namespaces,namespace,namespaces.txt,namespaces-strict,namespaces.pl)
+define gb_CustomTarget_generate_tokens
+$(call gb_CustomTarget_get_workdir,$(1))/misc/$(5)ids.inc \
+$(call gb_CustomTarget_get_workdir,$(1))/$(5)names.inc \
+$(if $(6),$(call gb_CustomTarget_get_workdir,$(1))/misc/$(6)) \
+$(if $(7),$(call gb_CustomTarget_get_workdir,$(1))/$(7)names.inc) : \
+	$(call gb_CustomTarget_get_workdir,$(1))/$(2)/token/$(4).hxx
+	touch $$@
+
+$(call gb_CustomTarget_get_workdir,$(1))/$(2)/token/$(4).hxx : \
+	$(if $(8),$(SRCDIR)/$(3)/$(8),$(SRCDIR)/solenv/bin/generate-tokens.pl) \
+	$(SRCDIR)/$(3)/$(4).txt \
+	$(SRCDIR)/$(3)/$(4).hxx.head \
+	$(SRCDIR)/$(3)/$(4).hxx.tail
+	$$(call gb_Output_announce,$$(subst $(WORKDIR)/,,$$@),build,PRL,1)
+	mkdir -p $(call gb_CustomTarget_get_workdir,$(1))/misc \
+	    	$(call gb_CustomTarget_get_workdir,$(1)) \
+		$(call gb_CustomTarget_get_workdir,$(1))/$(2)/token
+	perl $(if $(8),$(SRCDIR)/$(3)/$(8),$(SRCDIR)/solenv/bin/generate-tokens.pl) \
+	    	$(SRCDIR)/$(3)/$(4).txt \
+		$(call gb_CustomTarget_get_workdir,$(1))/misc/$(5)ids.inc \
+		$(call gb_CustomTarget_get_workdir,$(1))/$(5)names.inc \
+		$(if $(6), $(call gb_CustomTarget_get_workdir,$(1))/misc/$(6)) \
+		$(if $(7), $(SRCDIR)/$(3)/$(7).txt \
+			$(call gb_CustomTarget_get_workdir,$(1))/$(7)names.inc) \
+	&& cat $(SRCDIR)/$(3)/$(4).hxx.head \
+		$(call gb_CustomTarget_get_workdir,$(1))/misc/$(5)ids.inc \
+		$(SRCDIR)/$(3)/$(4).hxx.tail \
+		> $(call gb_CustomTarget_get_workdir,$(1))/$(2)/token/$(4).hxx \
+	&& touch $$@
+
+$(call gb_CustomTarget_get_target,$(1)) : \
+    $(call gb_CustomTarget_get_workdir,$(1))/$(5)names.inc \
+    $(if $(7),$(call gb_CustomTarget_get_workdir,$(1))/$(7)names.inc) \
+    $(call gb_CustomTarget_get_workdir,$(1))/$(2)/token/$(4).hxx \
+    $(if $(6),$(call gb_CustomTarget_get_workdir,$(1))/misc/$(6)) \
+
+endef
+
 # vim: set noet sw=4:


More information about the Libreoffice-commits mailing list