Avoid potential negative array index access to cached text.
[LibreOffice.git] / solenv / gbuild / Module.mk
blobf3224179fbe86b660abada3e4b9cef705bc0075b
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/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 # Overview of dependencies and tasks of Module
23 # target task depends on
24 # Module build the product all product targets
25 # excluding tests recursive Modules
26 # Module/unitcheck run unit tests all unit tests
27 # recursive Module/checks
28 # Module/slowcheck run all slow unit tests
29 # Module/screenshot create all screenshots
30 # Module/coverage run all feature coverage tests
31 # Module/subsequentcheck run system tests all system tests
32 # Module/uicheck run uitests all uitests
33 # recursive Module/subsequentchecks
34 # build (global) build the product top-level Module
35 # unitcheck (global) run unit tests top-level Module/unitcheck
36 # slowcheck (global) run slow unit tests top-level Module/slowcheck
37 # coverage (global) run feature coverage tests top-level Module/coverage
38 # screenshot (global) create all screenshots top-level Module/screenshot
39 # subsequentcheck (global) run system tests top-level Module/subsequentcheck
40 # perfcheck (global) run performance unit tests top-level Module/perfcheck
41 # uicheck (global) run the uitests run all uitests
44 # Module class
46 gb_Module_ALLMODULES :=
47 gb_Module_MODULELOCATIONS :=
48 gb_Module_TARGETSTACK :=
49 gb_Module_L10NTARGETSTACK :=
50 gb_Module_CHECKTARGETSTACK :=
51 gb_Module_SLOWCHECKTARGETSTACK :=
52 gb_Module_SCREENSHOTTARGETSTACK :=
53 gb_Module_COVERAGETARGETSTACK :=
54 gb_Module_SUBSEQUENTCHECKTARGETSTACK :=
55 gb_Module_PERFCHECKTARGETSTACK :=
56 gb_Module_UICHECKTARGETSTACK :=
57 gb_Module_CLEANTARGETSTACK :=
59 # The currently read gbuild makefile.
61 # gbuild classes should use this if they need to depend on their makefile
62 # (e.g., to make sure a zip file is rebuilt if files are removed from it).
63 # Because makefiles may include other makefiles, it is not safe to rely
64 # on $(MAKEFILE_LIST).
65 gb_Module_CURRENTMAKEFILE :=
67 $(call gb_Module_get_nonl10n_target,%) :
68 $(call gb_Output_announce,$*,$(true),BIN,5)
69 $(call gb_Trace_MakeMark,$*,BIN)
70 -$(call gb_Helper_abbreviate_dirs,\
71 mkdir -p $(dir $@) && \
72 touch $@)
74 .PHONY : $(call gb_Module_get_clean_target,%)
75 $(call gb_Module_get_clean_target,%) :
76 $(call gb_Output_announce,$*,$(false),MOD,5)
77 $(call gb_Output_announce_title,module $* cleared.)
78 -$(call gb_Helper_abbreviate_dirs,\
79 rm -f $(call gb_Module_get_target,$*) $(call gb_Module_get_nonl10n_target,$*) $(call gb_Module_get_l10n_target,$*) $(call gb_Module_get_check_target,$*) $(call gb_Module_get_slowcheck_target,$*) $(call gb_Module_get_screenshot_target,$*) $(call gb_Module_get_coverage_target,$*) $(call gb_Module_get_subsequentcheck_target,$*) $(call gb_Module_get_perfcheck_target,$*) $(call gb_Module_get_uicheck,$*))
81 $(call gb_Module_get_l10n_target,%) :
82 $(call gb_Output_announce,$*,$(true),LOC,5)
83 $(call gb_Trace_MakeMark,$*,LOC)
84 $(call gb_Output_announce_title,module $* done.)
85 -$(call gb_Helper_abbreviate_dirs,\
86 mkdir -p $(dir $@) && \
87 touch $@)
89 $(call gb_Module_get_check_target,%) :
90 $(call gb_Output_announce,$*,$(true),CHK,5)
91 $(call gb_Trace_MakeMark,$*,CHK)
92 $(call gb_Output_announce_title,module $* checks done.)
93 -$(call gb_Helper_abbreviate_dirs,\
94 mkdir -p $(dir $@) && \
95 touch $@)
97 $(call gb_Module_get_slowcheck_target,%) :
98 $(call gb_Output_announce,$*,$(true),SLC,5)
99 $(call gb_Trace_MakeMark,$*,SLC)
100 $(call gb_Output_announce_title,module $* slowchecks done.)
101 -$(call gb_Helper_abbreviate_dirs,\
102 mkdir -p $(dir $@) && \
103 touch $@)
105 $(call gb_Module_get_screenshot_target,%) :
106 $(call gb_Output_announce,$*,$(true),SCR,5)
107 $(call gb_Trace_MakeMark,$*,SCR)
108 $(call gb_Output_announce_title,module $* screenshots done.)
109 -$(call gb_Helper_abbreviate_dirs,\
110 mkdir -p $(dir $@) && \
111 touch $@)
113 $(call gb_Module_get_coverage_target,%) :
114 $(call gb_Output_announce,$*,$(true),SCR,5)
115 $(call gb_Trace_MakeMark,$*,SCR)
116 $(call gb_Output_announce_title,module $* coverage done.)
117 -$(call gb_Helper_abbreviate_dirs,\
118 mkdir -p $(dir $@) && \
119 touch $@)
121 $(call gb_Module_get_subsequentcheck_target,%) :
122 $(call gb_Output_announce,$*,$(true),SCK,5)
123 $(call gb_Trace_MakeMark,$*,SCK)
124 $(call gb_Output_announce_title,module $* subsequentchecks done.)
125 -$(call gb_Helper_abbreviate_dirs,\
126 mkdir -p $(dir $@) && \
127 touch $@)
129 $(call gb_Module_get_perfcheck_target,%) :
130 $(call gb_Output_announce,$*,$(true),PFC,5)
131 $(call gb_Trace_MakeMark,$*,PFC)
132 $(call gb_Output_announce_title,module $* perfchecks done.)
133 -$(call gb_Helper_abbreviate_dirs,\
134 mkdir -p $(dir $@) && \
135 touch $@)
137 $(call gb_Module_get_uicheck_target,%) :
138 $(call gb_Output_announce,$*,$(true),UIT,5)
139 $(call gb_Trace_MakeMark,$*,UIT)
140 $(call gb_Output_announce_title,module $* uicheck done.)
141 -$(call gb_Helper_abbreviate_dirs,\
142 mkdir -p $(dir $@) && \
143 touch $@)
145 $(call gb_Module_get_target,%) :
146 $(call gb_Output_announce,$*,$(true),MOD,5)
147 $(call gb_Trace_MakeMark,$*,MOD)
148 $(call gb_Output_announce_title,module $* done.)
149 -$(call gb_Helper_abbreviate_dirs,\
150 mkdir -p $(dir $@) && \
151 touch $@)
153 .PHONY : build build-l10n-only build-non-l10n-only coverage unitcheck slowcheck screenshot subsequentcheck perfcheck uicheck clean check debugrun help showmodules translations
154 .DEFAULT_GOAL := build
156 ifeq ($(gb_Side),build)
157 build-tools : $(gb_BUILD_TOOLS)
158 $(call gb_Output_announce,loaded tools: $(gb_BUILD_TOOLS),$(true),ALL,6)
159 $(call gb_Trace_MakeMark,$(gb_BUILD_TOOLS),ALL)
160 $(call gb_Output_announce_title,build-tools done.)
161 $(call gb_Output_announce_bell)
162 endif
164 build :
165 $(call gb_Output_announce,top level modules: $(foreach module,$(filter-out deliverlog $(WORKDIR)/bootstrap,$^),$(notdir $(module))),$(true),ALL,6)
166 $(call gb_Trace_MakeMark,top level modules: $(foreach module,$(filter-out deliverlog $(WORKDIR)/bootstrap,$^),$(notdir $(module))),ALL)
167 $(if $(gb_VERBOSE),$(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),ALL,6))
168 $(call gb_Output_announce_title,build done.)
169 $(call gb_Output_announce_bell)
171 build-l10n-only :
172 $(call gb_Output_announce,top level modules: $(foreach module,$(filter-out deliverlog $(WORKDIR)/bootstrap,$^),$(notdir $(module))),$(true),LOC,6)
173 $(call gb_Trace_MakeMark,top level modules: $(foreach module,$(filter-out deliverlog $(WORKDIR)/bootstrap,$^),$(notdir $(module))),LOC)
174 $(if $(gb_VERBOSE),$(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),LOC,6))
175 $(call gb_Output_announce_title,l10n done.)
176 $(call gb_Output_announce_bell)
178 build-non-l10n-only :
179 $(call gb_Output_announce,top level modules: $(foreach module,$(filter-out deliverlog $(WORKDIR)/bootstrap,$^),$(notdir $(module))),$(true),BIN,6)
180 $(call gb_Trace_MakeMark,top level modules: $(foreach module,$(filter-out deliverlog $(WORKDIR)/bootstrap,$^),$(notdir $(module))),BIN)
181 $(if $(gb_VERBOSE),$(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),BIN,6))
182 $(call gb_Output_announce_title,non-l10n done.)
183 $(call gb_Output_announce_bell)
185 unitcheck :
186 $(if $(gb_VERBOSE),$(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),CHK,6))
187 $(call gb_Output_announce_title,all unittests checked.)
188 $(call gb_Output_announce_bell)
190 slowcheck :
191 $(if $(gb_VERBOSE),$(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),SLC,6))
192 $(call gb_Output_announce_title,all slowtests checked.)
193 $(call gb_Output_announce_bell)
195 screenshot :
196 $(if $(gb_VERBOSE),$(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),SCR,6))
197 $(call gb_Output_announce_title,all screenshots checked.)
198 $(call gb_Output_announce_bell)
200 coverage :
201 $(if $(gb_VERBOSE),$(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),COV,6))
202 $(call gb_Output_announce_title,all coverage checked.)
203 $(call gb_Output_announce_bell)
205 # removing the dependency on build for now until we can make a full build with gbuild
206 #subsequentcheck : build
207 subsequentcheck :
208 $(if $(gb_VERBOSE),$(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),SCK,6))
209 $(call gb_Output_announce_title,all subsequent tests checked.)
210 $(call gb_Output_announce_bell)
212 perfcheck :
213 $(if $(gb_VERBOSE),$(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),PFC,6))
214 $(call gb_Output_announce_title,all perftests checked.)
215 $(call gb_Output_announce_bell)
217 uicheck : build
218 $(if $(gb_VERBOSE),$(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),UIT,6))
219 $(call gb_Output_announce_title,all uicheck checked.)
220 $(call gb_Output_announce_bell)
222 clean :
223 $(if $(gb_VERBOSE),$(call gb_Output_announce,top level modules: $(foreach module,$^,$(notdir $(module))),$(false),ALL,6))
224 $(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(false),ALL,6)
225 $(call gb_Output_announce_title,all cleared.)
226 $(call gb_Output_announce_bell)
228 check : unitcheck slowcheck
229 $(call gb_Output_announce_title,all tests checked.)
230 $(call gb_Output_announce_bell)
232 debugrun :
233 $(call gb_Module_DEBUGRUNCOMMAND)
235 help :
236 @cat $(SRCDIR)/solenv/gbuild/gbuild.help.txt
238 showmodules :
239 $(info $(strip $(gb_Module_ALLMODULES)))
240 @true
242 translations : $(WORKDIR)/pot.done
244 $(WORKDIR)/pot.done : $(foreach exec,cfgex helpex localize propex ulfex xrmex treex, \
245 $(call gb_Executable_get_target_for_build,$(exec)))
246 $(call gb_Output_announce,$(subst .pot,,$(subst $(WORKDIR)/,,$@)),$(true),POT,1)
247 $(call gb_Trace_MakeMark,$(subst .pot,,$(subst $(WORKDIR)/,,$@)),POT)
248 $(call gb_Helper_abbreviate_dirs,\
249 mkdir -p $(dir $@) && $(call gb_Helper_execute,localize) $(SRCDIR) $(dir $@)pot \
250 $(gb_Helper_LIBRARY_PATH_VAR)"$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$(gb_Helper_LIBRARY_PATH_VAR)}" \
251 && $(FIND) $(dir $@)pot -type f -printf "%P\n" | sed -e "s/\.pot/.po/" | LC_ALL=C $(SORT) > $(dir $@)LIST \
252 && touch $@)
254 # enable if: no "-MODULE/" defined AND ["all" defined OR "MODULE/" defined]
255 # $(1) is module name, $(2) is directory name two levels up (for externals it's 'external')
256 gb_Module__symbols_enabled = \
257 $(and $(if $(filter -$(1)/,$(gb_ENABLE_SYMBOLS_FOR)),,$(true)),\
258 $(if $(filter -$(2)/,$(gb_ENABLE_SYMBOLS_FOR)),,$(true)),\
259 $(filter all $(1)/,$(gb_ENABLE_SYMBOLS_FOR)))
260 # enable if: no "-MODULE/" defined AND ["all" defined OR "MODULE/" defined]
261 # $(1) is module name, $(2) is directory name two levels up (for externals it's 'external')
262 gb_Module__force_compile = \
263 $(and $(if $(filter -$(1)/,$(FORCE_COMPILE)),,$(true)),\
264 $(if $(filter -$(2)/,$(FORCE_COMPILE)),,$(true)),\
265 $(filter all $(1)/,$(FORCE_COMPILE)))
267 define gb_Module_Module
268 gb_Module_ALLMODULES += $(1)
269 gb_Module_MODULELOCATIONS += $(1):$(dir $(realpath $(lastword $(MAKEFILE_LIST))))
270 gb_Module_TARGETSTACK := $(call gb_Module_get_target,$(1)) $(gb_Module_TARGETSTACK)
271 gb_Module_L10NTARGETSTACK := $(call gb_Module_get_l10n_target,$(1)) $(gb_Module_L10NTARGETSTACK)
272 gb_Module_CHECKTARGETSTACK := $(call gb_Module_get_check_target,$(1)) $(gb_Module_CHECKTARGETSTACK)
273 gb_Module_SLOWCHECKTARGETSTACK := $(call gb_Module_get_slowcheck_target,$(1)) $(gb_Module_SLOWCHECKTARGETSTACK)
274 gb_Module_SCREENSHOTTARGETSTACK := $(call gb_Module_get_screenshot_target,$(1)) $(gb_Module_SCREENSHOTTARGETSTACK)
275 gb_Module_COVERAGETARGETSTACK := $(call gb_Module_get_coverage_target,$(1)) $(gb_Module_COVERAGETARGETSTACK)
276 gb_Module_UICHECKTARGETSTACK := $(call gb_Module_get_uicheck_target,$(1)) $(gb_Module_UICHECKTARGETSTACK)
277 gb_Module_SUBSEQUENTCHECKTARGETSTACK := $(call gb_Module_get_subsequentcheck_target,$(1)) $(gb_Module_SUBSEQUENTCHECKTARGETSTACK)
278 gb_Module_PERFCHECKTARGETSTACK := $(call gb_Module_get_perfcheck_target,$(1)) $(gb_Module_PERFCHECKTARGETSTACK)
279 gb_Module_CLEANTARGETSTACK := $(call gb_Module_get_clean_target,$(1)) $(gb_Module_CLEANTARGETSTACK)
280 gb_Module_CURRENTMODULE_SYMBOLS_ENABLED := $(call gb_Module__symbols_enabled,$(1),$(notdir $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))../)))
281 gb_Module_CURRENTMODULE_FORCE_COMPILE := $(call gb_Module__force_compile,$(1),$(notdir $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))../)))
282 gb_Module_CURRENTMODULE_NAME := $(1)
283 $(call gb_Helper_make_userfriendly_targets,$(1),Module)
284 $(if $(filter-out libreoffice instsetoo_native android ios,$(1)),\
285 $(call gb_Postprocess_register_target,AllModulesButInstsetNative,Module,$(1)))
287 $(call gb_Postprocess_get_target,AllModuleTests) : $(call gb_Module_get_check_target,$(1))
288 $(call gb_Postprocess_get_target,AllModuleSlowtests) : $(call gb_Module_get_slowcheck_target,$(1))
289 $(call gb_Postprocess_get_target,AllModuleScreenshots) : $(call gb_Module_get_screenshot_target,$(1))
290 $(call gb_Postprocess_get_target,AllModuleCoverage) : $(call gb_Module_get_coverage_target,$(1))
291 $(call gb_Postprocess_get_target,AllModuleUITest) : $(call gb_Module_get_uicheck_target,$(1))
293 endef
295 # This is called inside the included file and pushes one target on each stack.
296 # This has to be called with full late evaluation ($$(eval $$(call ))) and
297 # should never be inlined ($(call )) as the calls defining it might be sourced
298 # before gb_Module.
299 define gb_Module_register_target
300 gb_Module_CURRENTTARGET := $(1)
301 gb_Module_CURRENTCLEANTARGET := $(2)
303 endef
305 # Here we include the file (in it there will be a call to gb_Module_register_target)
306 define gb_Module__read_targetfile
307 gb_Module_CURRENTTARGET :=
308 gb_Module_CURRENTCLEANTARGET :=
309 gb_Module_CURRENTMAKEFILE := $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS)))$(2).mk
310 include $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS)))$(2).mk
311 gb_Module_CURRENTMAKEFILE :=
312 ifneq ($$(words $$(gb_Module_CURRENTTARGET)) $$(words $$(gb_Module_CURRENTCLEANTARGET)),1 1)
313 $$(eval $$(call gb_Output_error,No $(3) registered while reading $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS)))$(2).mk!))
314 endif
316 endef
318 define gb_Module_add_target
319 $(if $(filter AllLang% Dictionary% Package_registry,$(2)),$(warning target $(2) should be a l10n target))
320 $(call gb_Module__read_targetfile,$(1),$(2),target)
322 $(call gb_Module_get_nonl10n_target,$(1)) : $$(gb_Module_CURRENTTARGET)
323 $(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET)
325 endef
327 define gb_Module_add_l10n_target
328 $(if $(filter AllLang% CustomTarget_autotextshare Dictionary% Package_registry,$(2)),,$(warning target $(2) should not be a l10n target))
329 $(call gb_Module__read_targetfile,$(1),$(2),target)
331 $(call gb_Module_get_l10n_target,$(1)) : $$(gb_Module_CURRENTTARGET)
332 $(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET)
334 endef
336 define gb_Module_add_check_target
337 $(call gb_Module__read_targetfile,$(1),$(2),check target)
339 $(call gb_Module_get_check_target,$(1)) : $$(gb_Module_CURRENTTARGET)
340 $(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET)
342 endef
344 define gb_Module_add_slowcheck_target
345 $(call gb_Module__read_targetfile,$(1),$(2),slowcheck target)
347 $(call gb_Module_get_slowcheck_target,$(1)) : $$(gb_Module_CURRENTTARGET)
348 $(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET)
350 endef
352 define gb_Module_add_screenshot_target
353 $(call gb_Module__read_targetfile,$(1),$(2),screenshot target)
355 $(call gb_Module_get_screenshot_target,$(1)) : $$(gb_Module_CURRENTTARGET)
356 $(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET)
358 endef
360 define gb_Module_add_coverage_target
361 $(call gb_Module__read_targetfile,$(1),$(2),coverage target)
363 $(call gb_Module_get_coverage_target,$(1)) : $$(gb_Module_CURRENTTARGET)
364 $(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET)
366 endef
368 # has order dependency on AllModulesButInstsetNative to be able to run
369 # subsequentcheck in the same make process on "make check"
370 define gb_Module_add_subsequentcheck_target
371 $(call gb_Module__read_targetfile,$(1),$(2),subsequentcheck target)
373 $(call gb_Module_get_subsequentcheck_target,$(1)) : $$(gb_Module_CURRENTTARGET)
374 $$(gb_Module_CURRENTTARGET) :| \
375 $(call gb_Postprocess_get_target,AllModulesButInstsetNative) \
376 $(call gb_Package_get_target,instsetoo_native_setup) \
377 $(call gb_Package_get_target,instsetoo_native_setup_ure)
378 $(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET)
380 endef
382 define gb_Module_add_perfcheck_target
383 $(call gb_Module__read_targetfile,$(1),$(2),perfcheck target)
385 $(call gb_Module_get_perfcheck_target,$(1)) : $$(gb_Module_CURRENTTARGET)
386 $(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET)
388 endef
390 define gb_Module_add_uicheck_target
391 $(call gb_Module__read_targetfile,$(1),$(2),uicheck target)
393 $(call gb_Module_get_uicheck_target,$(1)) : $$(gb_Module_CURRENTTARGET)
394 $$(gb_Module_CURRENTTARGET) :| \
395 $(call gb_Postprocess_get_target,AllModulesButInstsetNative) \
396 $(call gb_Package_get_target,instsetoo_native_setup) \
397 $(call gb_Package_get_target,instsetoo_native_setup_ure)
398 $(call gb_Module_get_uicheck_target,$(1)) : $$(gb_Module_CURRENTTARGET)
399 $(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET)
401 endef
403 define gb_Module__modulefile
404 $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS)))/$(2)/Module_$(2).mk
405 endef
407 define gb_Module_add_moduledir
408 $(if $(wildcard $(call gb_Module__modulefile,$(1),$(2))),,$(call gb_Output_error,Module does not exist: $(call gb_Module__modulefile,$(1),$(2))))
409 include $(call gb_Module__modulefile,$(1),$(2))
410 $(call gb_Module_get_target,$(1)) : $$(firstword $$(gb_Module_TARGETSTACK))
411 $(call gb_Module_get_l10n_target,$(1)) : $$(firstword $$(gb_Module_L10NTARGETSTACK))
412 $(call gb_Module_get_check_target,$(1)) : $$(firstword $$(gb_Module_CHECKTARGETSTACK))
413 $(call gb_Module_get_slowcheck_target,$(1)) : $$(firstword $$(gb_Module_SLOWCHECKTARGETSTACK))
414 $(call gb_Module_get_screenshot_target,$(1)) : $$(firstword $$(gb_Module_SCREENSHOTTARGETSTACK))
415 $(call gb_Module_get_coverage_target,$(1)) : $$(firstword $$(gb_Module_COVERAGETARGETSTACK))
416 $(call gb_Module_get_subsequentcheck_target,$(1)) : $$(firstword $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK))
417 $(call gb_Module_get_perfcheck_target,$(1)) : $$(firstword $$(gb_Module_PERFCHECKTARGETSTACK))
418 $(call gb_Module_get_uicheck_target,$(1)) : $$(firstword $$(gb_Module_UICHECKTARGETSTACK))
419 $(call gb_Module_get_clean_target,$(1)) : $$(firstword $$(gb_Module_CLEANTARGETSTACK))
420 gb_Module_TARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_TARGETSTACK)),$$(gb_Module_TARGETSTACK))
421 gb_Module_L10NTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_L10NTARGETSTACK)),$$(gb_Module_L10NTARGETSTACK))
422 gb_Module_CHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_CHECKTARGETSTACK)),$$(gb_Module_CHECKTARGETSTACK))
423 gb_Module_SLOWCHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_SLOWCHECKTARGETSTACK)),$$(gb_Module_SLOWCHECKTARGETSTACK))
424 gb_Module_SCREENSHOTTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_SCREENSHOTTARGETSTACK)),$$(gb_Module_SCREENSHOTTARGETSTACK))
425 gb_Module_COVERAGETARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_COVERAGETARGETSTACK)),$$(gb_Module_COVERAGETARGETSTACK))
426 gb_Module_SUBSEQUENTCHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK)),$$(gb_Module_SUBSEQUENTCHECKTARGETSTACK))
427 gb_Module_PERFCHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_PERFCHECKTARGETSTACK)),$$(gb_Module_PERFCHECKTARGETSTACK))
428 gb_Module_UICHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_UICHECKTARGETSTACK)),$$(gb_Module_UICHECKTARGETSTACK))
429 gb_Module_CLEANTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_CLEANTARGETSTACK)),$$(gb_Module_CLEANTARGETSTACK))
431 endef
433 define gb_Module_add_targets
434 $(call gb_Module_get_target,$(1)) : $(call gb_Module_get_nonl10n_target,$(1))
435 $(foreach target,$(2),$(call gb_Module_add_target,$(1),$(target)))
437 endef
439 define gb_Module_add_l10n_targets
440 $(call gb_Module_get_target,$(1)) : $(call gb_Module_get_l10n_target,$(1))
441 $(foreach target,$(2),$(call gb_Module_add_l10n_target,$(1),$(target)))
443 endef
445 gb_Module_add_targets_for_build = $(call gb_Module_add_targets,$(1),$(2))
447 define gb_Module_add_check_targets
448 $(foreach target,$(2),$(call gb_Module_add_check_target,$(1),$(target)))
450 endef
452 define gb_Module_add_slowcheck_targets
453 $(foreach target,$(2),$(call gb_Module_add_slowcheck_target,$(1),$(target)))
455 endef
457 define gb_Module_add_screenshot_targets
458 $(foreach target,$(2),$(call gb_Module_add_screenshot_target,$(1),$(target)))
460 endef
462 define gb_Module_add_coverage_targets
463 $(foreach target,$(2),$(call gb_Module_add_coverage_target,$(1),$(target)))
465 endef
467 define gb_Module_add_subsequentcheck_targets
468 $(foreach target,$(2),$(call gb_Module_add_subsequentcheck_target,$(1),$(target)))
470 endef
472 define gb_Module_add_perfcheck_targets
473 $(foreach target,$(2),$(call gb_Module_add_perfcheck_target,$(1),$(target)))
475 endef
477 define gb_Module_add_moduledirs
478 $(foreach target,$(sort $(2)),$(call gb_Module_add_moduledir,$(1),$(target)))
480 endef
482 define gb_Module_add_uicheck_targets
483 $(foreach target,$(2),$(call gb_Module_add_uicheck_target,$(1),$(target)))
485 endef
487 define gb_Module_make_global_targets
488 ifneq ($$(gb_Module_TARGETSTACK),)
489 $$(eval $$(call gb_Output_error,Corrupted module target stack!1))
490 endif
492 include $(1)
494 build : build-non-l10n-only build-l10n-only
495 build-non-l10n-only : $$(firstword $$(gb_Module_TARGETSTACK))
496 build-l10n-only : $$(firstword $$(gb_Module_L10NTARGETSTACK))
497 coverage : $$(firstword $$(gb_Module_COVERAGETARGETSTACK))
498 unitcheck : $$(firstword $$(gb_Module_CHECKTARGETSTACK))
499 slowcheck : $$(firstword $$(gb_Module_SLOWCHECKTARGETSTACK))
500 screenshot : $$(firstword $$(gb_Module_SCREENSHOTTARGETSTACK))
501 ifeq ($(WINDOWS_BUILD_SIGNING),TRUE)
502 screenshot : $(call gb_CustomTarget_get_workdir,postprocess/signing)/signing.done
503 endif
504 subsequentcheck : $$(firstword $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK))
505 perfcheck : $$(firstword $$(gb_Module_PERFCHECKTARGETSTACK))
506 uicheck : build $$(firstword $$(gb_Module_UICHECKTARGETSTACK))
507 clean : $$(firstword $$(gb_Module_CLEANTARGETSTACK))
509 ifneq ($$(words $$(gb_Module_TARGETSTACK)),1)
510 $$(eval $$(call gb_Output_error,Corrupted module target stack! $(gb_Module_TARGETSTACK)))
511 endif
513 gb_Module_TARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_TARGETSTACK)),$$(gb_Module_TARGETSTACK))
514 gb_Module_L10NTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_L10NTARGETSTACK)),$$(gb_Module_L10NTARGETSTACK))
515 gb_Module_CHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_CHECKTARGETSTACK)),$$(gb_Module_CHECKTARGETSTACK))
516 gb_Module_SLOWCHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_SLOWCHECKTARGETSTACK)),$$(gb_Module_SLOWCHECKTARGETSTACK))
517 gb_Module_SCREENSHOTTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_SCREENSHOTTARGETSTACK)),$$(gb_Module_SCREENSHOTTARGETSTACK))
518 gb_Module_COVERAGETARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_COVERAGETARGETSTACK)),$$(gb_Module_COVERAGETARGETSTACK))
519 gb_Module_SUBSEQUENTCHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK)),$$(gb_Module_SUBSEQUENTCHECKTARGETSTACK))
520 gb_Module_UICHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_UICHECKTARGETSTACK)),$$(gb_Module_UICHECKTARGETSTACK))
521 gb_Module_PERFCHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_PERFCHECKTARGETSTACK)),$$(gb_Module_PERFCHECKTARGETSTACK))
522 gb_Module_CLEANTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_CLEANTARGETSTACK)),$$(gb_Module_CLEANTARGETSTACK))
524 ifneq ($$(and $$(gb_Module_TARGETSTACK),$$(gb_Module_CHECKTARGETSTACK),$$(gb_Module_SLOWCHECKTARGETSTACK),$$(gb_Module_COVERAGETARGETSTACK),$$(gb_Module_SCREENSHOTTARGETSTACK),$$(gb_Module_SUBSEQUENTCHECKTARGETSTACK),$$(gb_Module_UICHECKTARGETSTACK),$$(gb_Module_PERFCHECKTARGETSTACK),$$(gb_Module_L10NTARGETSTACK)),)
525 $$(eval $$(call gb_Output_error,Corrupted module target stack!3))
526 endif
528 $$(eval $$(gb_Extensions_final_hook))
529 endef
531 # vim: set noet sw=4: