[Libreoffice-commits] .: solenv/gbuild

David Tardon dtardon at kemper.freedesktop.org
Sun Apr 17 10:07:00 PDT 2011


 solenv/gbuild/AllLangResTarget.mk |   73 ++++++++++++++++++++++++++++++++++++++
 solenv/gbuild/TargetLocations.mk  |    3 +
 2 files changed, 76 insertions(+)

New commits:
commit cc10791b6ba51379fce60045826fec699323a03e
Author: David Tardon <dtardon at redhat.com>
Date:   Sun Apr 17 18:54:33 2011 +0200

    add support for resource templates
    
    That is, resource files containing localizable data that are included
    from other resource files. They have filenames like foo_tmpl.hrc
    (sometimes foo_tmpl.src) and are included as foo.hrc . They were handled
    by listing them in LOCALIZE_ME variable in the old build system.

diff --git a/solenv/gbuild/AllLangResTarget.mk b/solenv/gbuild/AllLangResTarget.mk
index 24123d1..09cd382 100644
--- a/solenv/gbuild/AllLangResTarget.mk
+++ b/solenv/gbuild/AllLangResTarget.mk
@@ -30,8 +30,11 @@
 #
 # target                task                depends on
 # SrsTarget             joining the parts   SrsPartTarget
+#                                           SrsTemplateTarget
 # SrsPartTarget         preprocessing       SrsPartMergeTarget (with l10n)
 #                                           source file (without l10n)
+# SrsTemplateTarget     handling templates  SrsTemplatePartTarget
+# SrsTemplatePartTarget handling template   SrsPartMergeTarget
 # SrsPartMergeTarget    merging/transex     source file (only needed with l10n)
 
 # Overview of dependencies and tasks of AllLangResTarget
@@ -127,6 +130,64 @@ endif
 
 endef
 
+# SrsTemplatePartTarget class
+
+define gb_SrsTemplatePartTarget_SrsTemplatePartTarget
+$(call gb_SrsTemplatePartTarget_get_target,$(1)) : $(call gb_SrsPartMergeTarget_get_target,$(1))
+	$$(call gb_Helper_abbreviate_dirs,\
+	    mkdir -p $$(dir $$@) && \
+	    cp $$< $$@)
+ifneq ($(strip $(WITH_LANG)),)
+$(call gb_SrsPartMergeTarget_get_target,$(1)) : SDF := $(realpath $(gb_SrsPartMergeTarget_SDFLOCATION)$(dir $(1))localize.sdf)
+$(call gb_SrsPartMergeTarget_get_target,$(1)) : $$(SDF)
+endif
+endef
+
+# SrsTemplateTarget class
+
+gb_SrsTemplateTarget__get_merged_target = $(call gb_SrsTemplateTarget_get_target,$(1))_merged
+gb_SrsTemplateTarget__get_unmerged_target = $(call gb_SrsTemplateTarget_get_target,$(1))_unmerged
+
+ifeq ($(strip $(WITH_LANG)),)
+gb_SrsTemplateTarget__get_target = $(call gb_SrsTemplateTarget__get_unmerged_target,$(1))
+gb_SrsTemplateTarget__get_update_target = $(call gb_SrsTemplateTarget__get_merged_target,$(1))
+else
+gb_SrsTemplateTarget__get_target = $(call gb_SrsTemplateTarget__get_merged_target,$(1))
+gb_SrsTemplateTarget__get_update_target = $(call gb_SrsTemplateTarget__get_unmerged_target,$(1))
+endif
+
+define gb_SrsTemplateTarget_SrsTemplateTarget
+$(call gb_SrsTemplateTarget_get_target,$(1)) : PARTS :=
+$(call gb_SrsTemplateTarget_get_clean_target,$(1)) : PARTS :=
+$(call gb_SrsTemplateTarget_get_target,$(1)) : $(call gb_SrsTemplateTarget__get_target,$(1))
+$(call gb_SrsTemplateTarget__get_target,$(1)) : $(call gb_SrsTemplateTarget__get_update_target,$(1))
+endef
+
+.PHONY : $(call gb_SrsTemplateTarget_get_target,%)
+$(call gb_SrsTemplateTarget_get_target,%) :
+	$(call gb_Output_announce,$*,$(true),SRT,4)
+	$(call gb_Helper_abbreviate_dirs,\
+	    mkdir -p $(dir $@) && \
+	    touch $@)
+
+.PHONY : $(call gb_SrsTemplateTarget_get_clean_target,%)
+$(call gb_SrsTemplateTarget_get_clean_target,%) :
+	$(call gb_Output_announce,$*,$(false),SRT,4)
+	-$(call gb_Helper_abbreviate_dirs,\
+	    rm -f $(call gb_SrsTemplateTarget_get_target,$*) \
+		    $(call gb_SrsTemplateTarget__get_merged_target,$*) \
+		    $(call gb_SrsTemplateTarget__get_unmerged_target,$*) \
+		    $(foreach part,$(PARTS),$(call gb_SrsTemplatePartTarget_get_target,$(part))) \
+		    $(foreach part,$(PARTS),$(call gb_SrsPartMergeTarget_get_target,$(part))))
+
+define gb_SrsTemplateTarget_add_file
+$(call gb_SrsTemplatePartTarget_SrsTemplatePartTarget,$(2))
+$(call gb_SrsTemplateTarget_get_target,$(1)) : PARTS += $(2)
+$(call gb_SrsTemplateTarget_get_clean_target,$(1)) : PARTS += $(2)
+$(call gb_SrsTemplateTarget__get_target,$(1)) : $(call gb_SrsTemplatePartTarget_get_target,$(2))
+$(call gb_SrsTemplatePartTarget_get_target,$(2)) : $(call gb_SrsTemplateTarget__get_update_target,$(1))
+$(call gb_SrsPartMergeTarget_get_target,$(2)) : $(call gb_SrsTemplateTarget__get_update_target,$(1))
+endef
 
 # SrsTarget class
 
@@ -164,10 +225,13 @@ $(call gb_SrsTarget_get_dep_target,%) :
 endif
 
 define gb_SrsTarget_SrsTarget
+$(call gb_SrsTemplateTarget_SrsTemplateTarget,$(1))
 $(call gb_SrsTarget_get_target,$(1)) : DEFS := $(gb_SrsTarget_DEFAULTDEFS)
 $(call gb_SrsTarget_get_target,$(1)) : INCLUDE := $(SOLARINC)
 $(call gb_SrsTarget_get_clean_target,$(1)) : PARTS :=
 $(call gb_SrsTarget_get_target,$(1)) : PARTS :=
+$(call gb_SrsTarget_get_target,$(1)) : $(call gb_SrsTemplateTarget_get_target,$(1))
+$(call gb_SrsTarget_get_clean_target,$(1)) : $(call gb_SrsTemplateTarget_get_clean_target,$(1))
 ifeq ($(gb_FULLDEPS),$(true))
 ifneq ($(wildcard $(call gb_SrsTarget_get_dep_target,$(1))),)
 include $(call gb_SrsTarget_get_dep_target,$(1))
@@ -200,6 +264,7 @@ $(call gb_SrsTarget_get_dep_target,$(1)) : $(call gb_SrsPartTarget_get_dep_targe
 endif
 $(call gb_SrsPartTarget_SrsPartTarget,$(2))
 $(call gb_SrsTarget_get_target,$(1)) : $(call gb_SrsPartTarget_get_target,$(2))
+$(call gb_SrsPartTarget_get_target,$(2)) :| $(call gb_SrsTemplateTarget_get_target,$(1))
 $(call gb_SrsTarget_get_clean_target,$(1)) : PARTS += $(2)
 $(call gb_SrsTarget_get_target,$(1)) : PARTS += $(2)
 
@@ -210,6 +275,14 @@ $(foreach file,$(2),$(call gb_SrsTarget_add_file,$(1),$(file)))
 
 endef
 
+define gb_SrsTarget_add_template
+$(call gb_SrsTemplateTarget_add_file,$(1),$(2))
+endef
+
+define gb_SrsTarget_add_templates
+$(foreach template,$(2),$(eval $(call gb_SrsTarget_add_template,$(1),$(template))))
+endef
+
 
 # ResTarget
 
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 486a5b6..185261c 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -82,6 +82,8 @@ gb_SdiTarget_get_target = $(WORKDIR)/SdiTarget/$(1)
 gb_SrsPartMergeTarget_get_target = $(WORKDIR)/SrsPartMergeTarget/$(1)
 gb_SrsPartTarget_get_target = $(WORKDIR)/SrsPartTarget/$(1)
 gb_SrsTarget_get_target = $(WORKDIR)/SrsTarget/$(1).srs
+gb_SrsTemplatePartTarget_get_target = $(WORKDIR)/inc/$(firstword $(subst /, ,$(1)))/$(subst _tmpl,,$(notdir $(1)))
+gb_SrsTemplateTarget_get_target = $(WORKDIR)/SrsTemplateTarget/$(1)
 
 define gb_Library_get_external_headers_target
 $(patsubst $(1):%,$(WORKDIR)/ExternalHeaders/Library/%,$(filter $(1):%,$(gb_Library_FILENAMES)))
@@ -112,6 +114,7 @@ $(eval $(call gb_Helper_make_clean_targets,\
 	ResTarget \
 	SdiTarget \
 	SrsTarget \
+	SrsTemplateTarget \
 	CppunitTest \
 	CustomTarget \
 ))


More information about the Libreoffice-commits mailing list