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))
25 gb_ScpTemplateTarget_get_source
= $(SRCDIR
)/$(1).sct
27 define gb_ScpTemplateTarget__command
28 $(call gb_Output_announce
,$(2),$(true
),SCT
,1)
29 $(call gb_Helper_abbreviate_dirs
,\
30 export COMPLETELANGISO_VAR
='$(gb_ScpTemplateTarget_LANGS)' && \
31 $(gb_ScpTemplateTarget_COMMAND
) \
32 $(call gb_ScpTemplateTarget__if_silent
,,-verbose
) \
38 $(dir $(call gb_ScpTemplateTarget_get_target
,%))%/.
dir :
39 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
41 # depend on configure output to rebuild everything
42 $(call gb_ScpTemplateTarget_get_target
,%) : \
43 $(gb_ScpTemplateTarget_TARGET
) $(BUILDDIR
)/config_
$(gb_Side
).mk
44 $(call gb_ScpTemplateTarget__command
,$@
,$*)
46 .PHONY
: $(call gb_ScpTemplateTarget_get_clean_target
,%)
47 $(call gb_ScpTemplateTarget_get_clean_target
,%) :
48 $(call gb_Output_announce
,$*,$(false
),SCT
,1)
49 rm -f
$(call gb_ScpTemplateTarget_get_target
,$*)
51 # gb_ScpTemplateTarget_ScpTemplateTarget(<target>)
52 define gb_ScpTemplateTarget_ScpTemplateTarget
53 $(call gb_ScpTemplateTarget_get_target
,$(1)) : $(call gb_ScpTemplateTarget_get_source
,$(1))
54 $(call gb_ScpTemplateTarget_get_target
,$(1)) :|
$(dir $(call gb_ScpTemplateTarget_get_target
,$(1))).
dir
55 $(call gb_ScpTemplateTarget_get_target
,$(1)) : SCP_TEMPLATE
:= $(call gb_ScpTemplateTarget_get_source
,$(1))
59 # ScpPreprocessTarget class
61 gb_ScpPreprocessTarget_DEPS
:= $(call gb_Executable_get_runtime_dependencies
,cpp)
62 gb_ScpPreprocessTarget_COMMAND
:= $(call gb_Executable_get_command
,cpp)
64 gb_ScpPreprocessTarget_get_source
= $(SRCDIR
)/$(1).scp
66 define gb_ScpPreprocessTarget__command
67 $(call gb_Output_announce
,$(2),$(true
),SPP
,2)
68 $(call gb_Helper_abbreviate_dirs
,\
69 $(gb_ScpPreprocessTarget_COMMAND
) \
71 $(SCPDEFS
) $(SCP_DEFS
) -DDLLPOSTFIX
=$(gb_Library_DLLPOSTFIX
) \
72 $(SCP_INCLUDE
) $(SCP_TEMPLATE_INCLUDE
) \
73 $(SCP_SOURCE
) > $(1) \
77 $(dir $(call gb_ScpPreprocessTarget_get_target
,%))%/.
dir :
78 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
80 # depend on configure output to rebuild everything
81 $(call gb_ScpPreprocessTarget_get_target
,%) : \
82 $(gb_ScpPreprocessTarget_DEPS
) $(BUILDDIR
)/config_
$(gb_Side
).mk
83 $(call gb_ScpPreprocessTarget__command
,$@
,$*)
85 .PHONY
: $(call gb_ScpPreprocessTarget_get_clean_target
,%)
86 $(call gb_ScpPreprocessTarget_get_clean_target
,%) :
87 $(call gb_Output_announce
,$*,$(false
),SPP
,2)
88 rm -f
$(call gb_ScpPreprocessTarget_get_target
,$*)
90 # gb_ScpPreprocessTarget_ScpPreprocessTarget(<target>)
91 define gb_ScpPreprocessTarget_ScpPreprocessTarget
92 $(call gb_ScpPreprocessTarget_get_target
,$(1)) : SCP_SOURCE
:= $(call gb_ScpPreprocessTarget_get_source
,$(1))
93 $(call gb_ScpPreprocessTarget_get_target
,$(1)) : $(call gb_ScpPreprocessTarget_get_source
,$(1))
94 $(call gb_ScpPreprocessTarget_get_target
,$(1)) :|
$(dir $(call gb_ScpPreprocessTarget_get_target
,$(1))).
dir
98 # ScpMergeTarget class
100 gb_ScpMergeTarget_DEPS
:= $(call gb_Executable_get_runtime_dependencies
,ulfex
)
101 gb_ScpMergeTarget_COMMAND
:= $(call gb_Executable_get_command
,ulfex
)
103 gb_ScpMergeTarget_get_source
= $(SRCDIR
)/$(1).ulf
105 define gb_ScpMergeTarget__command
106 $(call gb_Output_announce
,$(2),$(true
),SUM
,1)
107 MERGEINPUT
=`$(gb_MKTEMP)` && \
108 echo
$(SCP_POFILES
) > $${MERGEINPUT} && \
109 $(call gb_Helper_abbreviate_dirs
,\
110 $(gb_ScpMergeTarget_COMMAND
) -i
$(SCP_SOURCE
) -o
$(1) -m
$${MERGEINPUT} -l
all ) && \
111 rm -rf
$${MERGEINPUT}
115 $(dir $(call gb_ScpMergeTarget_get_target
,%))%/.
dir :
116 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
118 $(call gb_ScpMergeTarget_get_target
,%) : $(gb_ScpMergeTarget_DEPS
)
119 $(call gb_ScpMergeTarget__command
,$@
,$*)
121 .PHONY
: $(call gb_ScpMergeTarget_get_clean_target
,%)
122 $(call gb_ScpMergeTarget_get_clean_target
,%) :
123 $(call gb_Output_announce
,$*,$(false
),SUM
,1)
124 rm -f
$(call gb_ScpMergeTarget_get_target
,$*)
126 # gb_ScpMergeTarget_ScpMergeTarget(<target>)
127 define gb_ScpMergeTarget_ScpMergeTarget
128 $(call gb_ScpMergeTarget_get_target
,$(1)) : SCP_SOURCE
:= $(call gb_ScpMergeTarget_get_source
,$(1))
129 $(call gb_ScpMergeTarget_get_target
,$(1)) : $(call gb_ScpMergeTarget_get_source
,$(1))
130 $(call gb_ScpMergeTarget_get_target
,$(1)) :|
$(dir $(call gb_ScpMergeTarget_get_target
,$(1))).
dir
131 $(call gb_ScpMergeTarget_get_target
,$(1)) : \
132 SCP_POFILES
:= $(foreach lang
,$(gb_TRANS_LANGS
),$(gb_POLOCATION
)/$(lang
)/$(patsubst %/,%,$(dir $(1))).po
)
133 $(call gb_ScpMergeTarget_get_target
,$(1)) : \
134 $(foreach lang
,$(gb_TRANS_LANGS
),$(gb_POLOCATION
)/$(lang
)/$(patsubst %/,%,$(dir $(1))).po
)
135 $(foreach lang
,$(gb_TRANS_LANGS
),$(gb_POLOCATION
)/$(lang
)/$(patsubst %/,%,$(dir $(1))).po
) :
141 gb_ScpTarget_TARGET
:= $(SOLARENV
)/bin
/pre2par.pl
142 gb_ScpTarget_COMMAND
:= $(PERL
) $(gb_ScpTarget_TARGET
)
144 define gb_ScpTarget__command
145 $(call gb_Output_announce
,$(2),$(true
),SCP
,2)
146 $(call gb_Helper_abbreviate_dirs
,\
147 $(gb_ScpTarget_COMMAND
) -l
$(SCP_ULF
) -s
$(SCP_SOURCE
) -o
$(1) \
151 $(dir $(call gb_ScpTarget_get_target
,%))%/.
dir :
152 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
154 $(call gb_ScpTarget_get_target
,%) : $(gb_ScpTarget_TARGET
)
155 $(call gb_ScpTarget__command
,$@
,$*)
157 $(call gb_ScpTarget_get_external_target
,%) :
160 .PHONY
: $(call gb_ScpTarget_get_clean_target
,%)
161 $(call gb_ScpTarget_get_clean_target
,%) :
162 $(call gb_Output_announce
,$*,$(false
),SCP
,2)
164 $(call gb_ScpTarget_get_target
,$*) \
165 $(call gb_ScpTarget_get_external_target
,$*)
167 # gb_ScpTarget_ScpTarget(<target>)
168 define gb_ScpTarget_ScpTarget
169 $(call gb_ScpPreprocessTarget_ScpPreprocessTarget
,$(1))
171 $(call gb_ScpTarget_get_target
,$(1)) : $(call gb_ScpPreprocessTarget_get_target
,$(1))
172 $(call gb_ScpTarget_get_target
,$(1)) : $(call gb_ScpTarget_get_external_target
,$(1))
173 $(call gb_ScpTarget_get_external_target
,$(1)) :|
$(dir $(call gb_ScpTarget_get_target
,$(1))).
dir
174 $(call gb_ScpPreprocessTarget_get_target
,$(1)) : $(call gb_ScpTarget_get_external_target
,$(1))
175 $(call gb_ScpTarget_get_clean_target
,$(1)) : $(call gb_ScpPreprocessTarget_get_clean_target
,$(1))
176 $(call gb_ScpTarget_get_target
,$(1)) : SCP_SOURCE
:= $(call gb_ScpPreprocessTarget_get_target
,$(1))
177 $(call gb_ScpTarget_get_target
,$(1)) : SCP_ULF
:= $(gb_Helper_PHONY
)
181 define gb_ScpTarget_set_localized
182 ifneq ($(gb_WITH_LANG
),)
183 $(call gb_ScpMergeTarget_ScpMergeTarget
,$(1))
184 $(call gb_ScpTarget_get_target
,$(1)) : SCP_ULF
:= $(call gb_ScpMergeTarget_get_target
,$(1))
185 $(call gb_ScpTarget_get_target
,$(1)) : $(call gb_ScpMergeTarget_get_target
,$(1))
186 $(call gb_ScpTarget_get_clean_target
,$(1)) : $(call gb_ScpMergeTarget_get_clean_target
,$(1))
188 $(call gb_ScpTarget_get_target
,$(1)) : SCP_ULF
:= $(call gb_ScpMergeTarget_get_source
,$(1))
189 $(call gb_ScpTarget_get_target
,$(1)) : $(call gb_ScpMergeTarget_get_source
,$(1))
194 # InstallModuleTarget class
197 # gb_InstallModuleTarget_InstallModuleTarget_platform
199 define gb_InstallModuleTarget__command
200 $(call gb_Output_announce
,$(2),$(true
),INM
,3)
201 $(call gb_Helper_abbreviate_dirs
,\
203 $(foreach scpfile
,$(SCP_FILES
),&& echo
$(scpfile
) >> $(1)) \
207 $(dir $(call gb_InstallModuleTarget_get_target
,%))%/.
dir :
208 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
210 $(call gb_InstallModuleTarget_get_target
,%) :
211 $(call gb_InstallModuleTarget__command
,$@
,$*)
213 $(call gb_InstallModuleTarget_get_external_target
,%) :
216 .PHONY
: $(call gb_InstallModuleTarget_get_clean_target
,%)
217 $(call gb_InstallModuleTarget_get_clean_target
,%) :
218 $(call gb_Output_announce
,$*,$(false
),INM
,3)
220 $(call gb_InstallModuleTarget_get_target
,$*) \
221 $(call gb_InstallModuleTarget_get_external_target
,$*)
223 define gb_InstallModuleTarget_InstallModuleTarget
224 $(call gb_InstallModuleTarget_get_target
,$(1)) : \
225 $(call gb_InstallModuleTarget_get_external_target
,$(1))
226 $(call gb_InstallModuleTarget_get_external_target
,$(1)) :| \
227 $(dir $(call gb_InstallModuleTarget_get_target
,$(1))).
dir
229 $(call gb_InstallModuleTarget_get_target
,$(1)) : SCP_FILES
:=
230 $(call gb_InstallModuleTarget_get_target
,$(1)) : SCP_DEFS
:=
231 $(call gb_InstallModuleTarget_get_target
,$(1)) : SCP_INCLUDE
:= -I
$(SRCDIR
)/scp2
/inc
-I
$(WORKDIR
)
232 $(call gb_InstallModuleTarget_get_target
,$(1)) : SCP_TEMPLATE_INCLUDE
:=
233 $(call gb_InstallModuleTarget_use_custom_headers
,$(1),scp2
/macros
)
235 $(call gb_InstallModuleTarget_InstallModuleTarget_platform
,$(1))
239 define gb_InstallModuleTarget_add_defs
240 $(call gb_InstallModuleTarget_get_target
,$(1)) : SCP_DEFS
+= $(2)
244 define gb_InstallModuleTarget_define_if_set
245 $(call gb_InstallModuleTarget_add_defs
,$(1),\
246 $(foreach def
,$(2),$(if
$(filter TRUE YES
,$($(def
))),-D
$(def
))) \
251 define gb_InstallModuleTarget_define_value_if_set
252 $(call gb_InstallModuleTarget_add_defs
,$(1),\
253 $(foreach def
,$(2),$(if
$($(def
)),-D
$(def
)=\""$($(def))"\")) \
258 define gb_InstallModuleTarget_use_auto_install_libs
259 $(call gb_InstallModuleTarget_get_external_target
,$(1)) : $(call gb_AutoInstallLibs_get_target
,$(2))
263 define gb_InstallModuleTarget_use_custom_header
264 $(call gb_InstallModuleTarget_get_external_target
,$(1)) : $(call gb_CustomTarget_get_target
,$(2))
265 $(call gb_InstallModuleTarget_get_target
,$(1)) : SCP_INCLUDE
+= -I
$(call gb_CustomTarget_get_workdir
,$(2)) \
269 define gb_InstallModuleTarget_use_custom_headers
270 $(foreach customtarget
,$(2),$(call gb_InstallModuleTarget_use_custom_header
,$(1),$(customtarget
)))
274 define gb_InstallModuleTarget_add_scpfile
275 $(call gb_ScpTarget_ScpTarget
,$(2))
276 $(call gb_InstallModuleTarget_get_target
,$(1)) : $(call gb_ScpTarget_get_target
,$(2))
277 $(call gb_InstallModuleTarget_get_clean_target
,$(1)) : $(call gb_ScpTarget_get_clean_target
,$(2))
278 $(call gb_InstallModuleTarget_get_target
,$(1)) : SCP_FILES
+= $(call gb_ScpTarget_get_target
,$(2))
279 $(call gb_ScpTarget_get_external_target
,$(2)) : $(call gb_InstallModuleTarget_get_external_target
,$(1))
283 define gb_InstallModuleTarget_add_scpfiles
284 $(foreach scpfile
,$(2),$(call gb_InstallModuleTarget_add_scpfile
,$(1),$(scpfile
)))
288 define gb_InstallModuleTarget_add_localized_scpfile
289 $(call gb_InstallModuleTarget_add_scpfile
,$(1),$(2))
290 $(call gb_ScpTarget_set_localized
,$(2))
294 define gb_InstallModuleTarget_add_localized_scpfiles
295 $(foreach scpfile
,$(2),$(call gb_InstallModuleTarget_add_localized_scpfile
,$(1),$(scpfile
)))
299 define gb_InstallModuleTarget_add_template
300 $(call gb_ScpTemplateTarget_ScpTemplateTarget
,$(2))
301 $(call gb_InstallModuleTarget_get_external_target
,$(1)) : $(call gb_ScpTemplateTarget_get_target
,$(2))
302 $(call gb_InstallModuleTarget_get_clean_target
,$(1)) : $(call gb_ScpTemplateTarget_get_clean_target
,$(2))
303 $(call gb_InstallModuleTarget_get_target
,$(1)) : \
304 SCP_TEMPLATE_INCLUDE
:= $$(sort $$(SCP_TEMPLATE_INCLUDE
) -I
$(call gb_ScpTemplateTarget_get_dir
,$(2)))
308 define gb_InstallModuleTarget_add_templates
309 $(foreach template
,$(2),$(call gb_InstallModuleTarget_add_template
,$(1),$(template
)))
313 # vim: set shiftwidth=4 tabstop=4 noexpandtab: