Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / solenv / gbuild / InstallModuleTarget.mk
blob3ae5f67e0839f90277d794ad7bd7b3e1e5240747
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # Overview of dependencies and tasks of InstallModuleTarget
11 # target task depends on
13 # ScpTemplateTarget class
15 gb_ScpTemplateTarget_TARGET := $(SRCDIR)/scp2/source/templates/modules.pl
16 gb_ScpTemplateTarget_COMMAND := $(PERL) -w $(gb_ScpTemplateTarget_TARGET)
18 gb_ScpTemplateTarget_LANGS := $(sort $(ALL_LANGS))
20 # Pass first arg if make is running in silent mode, second arg otherwise
21 define gb_ScpTemplateTarget__if_silent
22 $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),$(1),$(2))
23 endef
25 gb_ScpTemplateTarget_get_source = $(SRCDIR)/$(1).sct
27 define gb_ScpTemplateTarget__command
28 $(call gb_Helper_abbreviate_dirs,\
29 export COMPLETELANGISO_VAR='$(gb_ScpTemplateTarget_LANGS)' && \
30 $(gb_ScpTemplateTarget_COMMAND) \
31 $(call gb_ScpTemplateTarget__if_silent,,-verbose) \
32 -i $(SCP_TEMPLATE) \
33 -o $(1) \
35 endef
37 $(dir $(call gb_ScpTemplateTarget_get_target,%))%/.dir :
38 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
40 # depend on configure output to rebuild everything
41 $(call gb_ScpTemplateTarget_get_target,%) : \
42 $(gb_ScpTemplateTarget_TARGET) $(BUILDDIR)/config_$(gb_Side).mk
43 $(call gb_Output_announce,$*,$(true),SCT,1)
44 $(call gb_Trace_StartRange,$*,SCT)
45 $(call gb_ScpTemplateTarget__command,$@,$*)
46 $(call gb_Trace_EndRange,$*,SCT)
48 .PHONY : $(call gb_ScpTemplateTarget_get_clean_target,%)
49 $(call gb_ScpTemplateTarget_get_clean_target,%) :
50 $(call gb_Output_announce,$*,$(false),SCT,1)
51 rm -f $(call gb_ScpTemplateTarget_get_target,$*)
53 # gb_ScpTemplateTarget_ScpTemplateTarget(<target>)
54 define gb_ScpTemplateTarget_ScpTemplateTarget
55 $(call gb_ScpTemplateTarget_get_target,$(1)) : $(call gb_ScpTemplateTarget_get_source,$(1))
56 $(call gb_ScpTemplateTarget_get_target,$(1)) :| $(dir $(call gb_ScpTemplateTarget_get_target,$(1))).dir
57 $(call gb_ScpTemplateTarget_get_target,$(1)) : SCP_TEMPLATE := $(call gb_ScpTemplateTarget_get_source,$(1))
59 endef
61 # ScpPreprocessTarget class
63 gb_ScpPreprocessTarget_DEPS := $(call gb_Executable_get_runtime_dependencies,cpp)
64 gb_ScpPreprocessTarget_COMMAND := $(call gb_Executable_get_command,cpp)
66 gb_ScpPreprocessTarget_get_source = $(SRCDIR)/$(1).scp
68 define gb_ScpPreprocessTarget__command
69 $(call gb_Helper_abbreviate_dirs,\
70 $(gb_ScpPreprocessTarget_COMMAND) \
71 -+ -P \
72 $(SCPDEFS) $(SCP_DEFS) \
73 $(SCP_INCLUDE) $(SCP_TEMPLATE_INCLUDE) \
74 $(if $(ENABLE_JAVA),-DENABLE_JAVA) \
75 $(SCP_SOURCE) > $(1) \
77 endef
79 $(dir $(call gb_ScpPreprocessTarget_get_target,%))%/.dir :
80 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
82 # depend on configure output to rebuild everything
83 $(call gb_ScpPreprocessTarget_get_target,%) : \
84 $(gb_ScpPreprocessTarget_DEPS) $(BUILDDIR)/config_$(gb_Side).mk
85 $(call gb_Output_announce,$*,$(true),SPP,2)
86 $(call gb_Trace_StartRange,$*,SPP)
87 $(call gb_ScpPreprocessTarget__command,$@,$*)
88 $(call gb_Trace_EndRange,$*,SPP)
90 .PHONY : $(call gb_ScpPreprocessTarget_get_clean_target,%)
91 $(call gb_ScpPreprocessTarget_get_clean_target,%) :
92 $(call gb_Output_announce,$*,$(false),SPP,2)
93 rm -f $(call gb_ScpPreprocessTarget_get_target,$*)
95 # gb_ScpPreprocessTarget_ScpPreprocessTarget(<target>)
96 define gb_ScpPreprocessTarget_ScpPreprocessTarget
97 $(call gb_ScpPreprocessTarget_get_target,$(1)) : SCP_SOURCE := $(call gb_ScpPreprocessTarget_get_source,$(1))
98 $(call gb_ScpPreprocessTarget_get_target,$(1)) : $(call gb_ScpPreprocessTarget_get_source,$(1))
99 $(call gb_ScpPreprocessTarget_get_target,$(1)) :| $(dir $(call gb_ScpPreprocessTarget_get_target,$(1))).dir
101 endef
103 # ScpMergeTarget class
105 gb_ScpMergeTarget_get_source = $(SRCDIR)/$(1).ulf
107 $(dir $(call gb_ScpMergeTarget_get_target,%)).dir :
108 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
110 $(dir $(call gb_ScpMergeTarget_get_target,%))%/.dir :
111 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
113 $(eval $(call gb_CustomTarget_ulfex_rule,\
114 $(call gb_ScpMergeTarget_get_target,%),\
115 $(call gb_ScpMergeTarget_get_source,%),\
116 $$(SCP_POFILES)))
118 .PHONY : $(call gb_ScpMergeTarget_get_clean_target,%)
119 $(call gb_ScpMergeTarget_get_clean_target,%) :
120 $(call gb_Output_announce,$*,$(false),SUM,1)
121 rm -f $(call gb_ScpMergeTarget_get_target,$*)
123 # gb_ScpMergeTarget_ScpMergeTarget(<target>)
124 define gb_ScpMergeTarget_ScpMergeTarget
125 $(call gb_ScpMergeTarget_get_target,$(1)) :| $(dir $(call gb_ScpMergeTarget_get_target,$(1))).dir
126 $(call gb_ScpMergeTarget_get_target,$(1)) : \
127 SCP_POFILES := $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(1))).po)
128 $(call gb_ScpMergeTarget_get_target,$(1)) : \
129 $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(1))).po)
130 $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(1))).po) :
132 endef
134 # ScpTarget class
136 gb_ScpTarget_TARGET := $(SRCDIR)/solenv/bin/pre2par.pl
137 gb_ScpTarget_COMMAND := $(PERL) $(gb_ScpTarget_TARGET)
139 define gb_ScpTarget__command
140 $(call gb_Helper_abbreviate_dirs,\
141 $(gb_ScpTarget_COMMAND) -l $(SCP_ULF) -s $(SCP_SOURCE) -o $(1) \
143 endef
145 $(dir $(call gb_ScpTarget_get_target,%))%/.dir :
146 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
148 $(call gb_ScpTarget_get_target,%) : $(gb_ScpTarget_TARGET)
149 $(call gb_Output_announce,$*,$(true),SCP,2)
150 $(call gb_Trace_StartRange,$*,SCP)
151 $(call gb_ScpTarget__command,$@,$*)
152 $(call gb_Trace_EndRange,$*,SCP)
154 $(call gb_ScpTarget_get_external_target,%) :
155 touch $@
157 .PHONY : $(call gb_ScpTarget_get_clean_target,%)
158 $(call gb_ScpTarget_get_clean_target,%) :
159 $(call gb_Output_announce,$*,$(false),SCP,2)
160 rm -f \
161 $(call gb_ScpTarget_get_target,$*) \
162 $(call gb_ScpTarget_get_external_target,$*)
164 # gb_ScpTarget_ScpTarget(<target>)
165 define gb_ScpTarget_ScpTarget
166 $(call gb_ScpPreprocessTarget_ScpPreprocessTarget,$(1))
168 $(call gb_ScpTarget_get_target,$(1)) : $(call gb_ScpPreprocessTarget_get_target,$(1))
169 $(call gb_ScpTarget_get_target,$(1)) : $(call gb_ScpTarget_get_external_target,$(1))
170 $(call gb_ScpTarget_get_external_target,$(1)) :| $(dir $(call gb_ScpTarget_get_target,$(1))).dir
171 $(call gb_ScpPreprocessTarget_get_target,$(1)) : $(call gb_ScpTarget_get_external_target,$(1))
172 $(call gb_ScpTarget_get_clean_target,$(1)) : $(call gb_ScpPreprocessTarget_get_clean_target,$(1))
173 $(call gb_ScpTarget_get_target,$(1)) : SCP_SOURCE := $(call gb_ScpPreprocessTarget_get_target,$(1))
174 $(call gb_ScpTarget_get_target,$(1)) : SCP_ULF := $(gb_Helper_PHONY)
176 endef
178 define gb_ScpTarget_set_localized
179 ifneq ($(gb_WITH_LANG),)
180 $(call gb_ScpMergeTarget_ScpMergeTarget,$(1))
181 $(call gb_ScpTarget_get_target,$(1)) : SCP_ULF := $(call gb_ScpMergeTarget_get_target,$(1))
182 $(call gb_ScpTarget_get_target,$(1)) : $(call gb_ScpMergeTarget_get_target,$(1))
183 $(call gb_ScpTarget_get_clean_target,$(1)) : $(call gb_ScpMergeTarget_get_clean_target,$(1))
184 else
185 $(call gb_ScpTarget_get_target,$(1)) : SCP_ULF := $(call gb_ScpMergeTarget_get_source,$(1))
186 $(call gb_ScpTarget_get_target,$(1)) : $(call gb_ScpMergeTarget_get_source,$(1))
187 endif
189 endef
191 # InstallModuleTarget class
193 # platform:
194 # gb_InstallModuleTarget_InstallModuleTarget_platform
196 define gb_InstallModuleTarget__command
197 $(call gb_Helper_abbreviate_dirs,\
198 rm -f $(1) \
199 $(foreach scpfile,$(SCP_FILES),&& echo $(scpfile) >> $(1)) \
201 endef
203 $(dir $(call gb_InstallModuleTarget_get_target,%))%/.dir :
204 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
206 $(call gb_InstallModuleTarget_get_target,%) :
207 $(call gb_Output_announce,$*,$(true),INM,3)
208 $(call gb_Trace_StartRange,$*,INM)
209 $(call gb_InstallModuleTarget__command,$@,$*)
210 $(call gb_Trace_EndRange,$*,INM)
212 $(call gb_InstallModuleTarget_get_external_target,%) :
213 touch $@
215 .PHONY : $(call gb_InstallModuleTarget_get_clean_target,%)
216 $(call gb_InstallModuleTarget_get_clean_target,%) :
217 $(call gb_Output_announce,$*,$(false),INM,3)
218 rm -rf \
219 $(call gb_InstallModuleTarget_get_target,$*) \
220 $(call gb_InstallModuleTarget_get_external_target,$*)
222 define gb_InstallModuleTarget_InstallModuleTarget
223 $(call gb_InstallModuleTarget_get_target,$(1)) : \
224 $(call gb_InstallModuleTarget_get_external_target,$(1))
225 $(call gb_InstallModuleTarget_get_external_target,$(1)) :| \
226 $(dir $(call gb_InstallModuleTarget_get_target,$(1))).dir
228 $(call gb_InstallModuleTarget_get_target,$(1)) : SCP_FILES :=
229 $(call gb_InstallModuleTarget_get_target,$(1)) : SCP_DEFS :=
230 $(call gb_InstallModuleTarget_get_target,$(1)) : SCP_INCLUDE := -I$(SRCDIR)/scp2/inc -I$(WORKDIR) -I$(BUILDDIR)/config_$(gb_Side)
231 $(call gb_InstallModuleTarget_get_target,$(1)) : SCP_TEMPLATE_INCLUDE :=
232 $(call gb_InstallModuleTarget_use_custom_headers,$(1),scp2/macros)
234 $(call gb_InstallModuleTarget_InstallModuleTarget_platform,$(1))
236 endef
238 define gb_InstallModuleTarget_add_defs
239 $(call gb_InstallModuleTarget_get_target,$(1)) : SCP_DEFS += $(2)
241 endef
243 define gb_InstallModuleTarget_define_if_set
244 $(call gb_InstallModuleTarget_add_defs,$(1),\
245 $(foreach def,$(2),$(if $(filter TRUE YES,$($(def))),-D$(def))) \
248 endef
250 define gb_InstallModuleTarget_define_value_if_set
251 $(call gb_InstallModuleTarget_add_defs,$(1),\
252 $(foreach def,$(2),$(if $($(def)),-D$(def)=\""$($(def))"\")) \
255 endef
257 define gb_InstallModuleTarget_use_auto_install_libs
258 $(call gb_InstallModuleTarget_get_external_target,$(1)) : $(foreach ai,$(2),$(call gb_AutoInstall_get_target,$(ai)))
260 endef
262 define gb_InstallModuleTarget_use_custom_header
263 $(call gb_InstallModuleTarget_get_external_target,$(1)) : $(call gb_CustomTarget_get_target,$(2))
264 $(call gb_InstallModuleTarget_get_target,$(1)) : SCP_INCLUDE += -I$(call gb_CustomTarget_get_workdir,$(2)) \
266 endef
268 define gb_InstallModuleTarget_use_custom_headers
269 $(foreach customtarget,$(2),$(call gb_InstallModuleTarget_use_custom_header,$(1),$(customtarget)))
271 endef
273 define gb_InstallModuleTarget_add_scpfile
274 $(call gb_ScpTarget_ScpTarget,$(2))
275 $(call gb_InstallModuleTarget_get_target,$(1)) : $(call gb_ScpTarget_get_target,$(2))
276 $(call gb_InstallModuleTarget_get_clean_target,$(1)) : $(call gb_ScpTarget_get_clean_target,$(2))
277 $(call gb_InstallModuleTarget_get_target,$(1)) : SCP_FILES += $(call gb_ScpTarget_get_target,$(2))
278 $(call gb_ScpTarget_get_external_target,$(2)) : $(call gb_InstallModuleTarget_get_external_target,$(1))
280 endef
282 define gb_InstallModuleTarget_add_scpfiles
283 $(foreach scpfile,$(2),$(call gb_InstallModuleTarget_add_scpfile,$(1),$(scpfile)))
285 endef
287 define gb_InstallModuleTarget_add_localized_scpfile
288 $(call gb_InstallModuleTarget_add_scpfile,$(1),$(2))
289 $(call gb_ScpTarget_set_localized,$(2))
291 endef
293 define gb_InstallModuleTarget_add_localized_scpfiles
294 $(foreach scpfile,$(2),$(call gb_InstallModuleTarget_add_localized_scpfile,$(1),$(scpfile)))
296 endef
298 define gb_InstallModuleTarget_add_template
299 $(call gb_ScpTemplateTarget_ScpTemplateTarget,$(2))
300 $(call gb_InstallModuleTarget_get_external_target,$(1)) : $(call gb_ScpTemplateTarget_get_target,$(2))
301 $(call gb_InstallModuleTarget_get_clean_target,$(1)) : $(call gb_ScpTemplateTarget_get_clean_target,$(2))
302 $(call gb_InstallModuleTarget_get_target,$(1)) : \
303 SCP_TEMPLATE_INCLUDE := $$(sort $$(SCP_TEMPLATE_INCLUDE) -I$(call gb_ScpTemplateTarget_get_dir,$(2)))
305 endef
307 define gb_InstallModuleTarget_add_templates
308 $(foreach template,$(2),$(call gb_InstallModuleTarget_add_template,$(1),$(template)))
310 endef
312 # vim: set shiftwidth=4 tabstop=4 noexpandtab: