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/subsequentcheck run system tests all system tests
30 # recursive Module/subsequentchecks
31 # build (global) build the product top-level Module
32 # unitcheck (global) run unit tests top-level Module/unitcheck
33 # slowcheck (global) run slow unit tests top-level Module/slowcheck
34 # subsequentcheck (global) run system tests top-level Module/subsequentcheck
35 # perfcheck (global) run performance unit tests top-level Module/perfcheck
36 # all (global) default goal build unitcheck
41 gb_Module_ALLMODULES
:=
42 gb_Module_MODULELOCATIONS
:=
43 gb_Module_TARGETSTACK
:=
44 gb_Module_L10NTARGETSTACK
:=
45 gb_Module_CHECKTARGETSTACK
:=
46 gb_Module_SLOWCHECKTARGETSTACK
:=
47 gb_Module_SUBSEQUENTCHECKTARGETSTACK
:=
48 gb_Module_PERFCHECKTARGETSTACK
:=
49 gb_Module_CLEANTARGETSTACK
:=
51 # The currently read gbuild makefile.
53 # gbuild classes should use this if they need to depend on their makefile
54 # (e.g., to make sure a zip file is rebuilt if files are removed from it).
55 # Because makefiles may include other makefiles, it is not safe to rely
56 # on $(MAKEFILE_LIST).
57 gb_Module_CURRENTMAKEFILE
:=
59 $(call gb_Module_get_nonl10n_target
,%) :
60 $(call gb_Output_announce
,$*,$(true
),BIN
,5)
61 -$(call gb_Helper_abbreviate_dirs
,\
62 mkdir
-p
$(dir $@
) && \
65 .PHONY
: $(call gb_Module_get_clean_target
,%)
66 $(call gb_Module_get_clean_target
,%) :
67 $(call gb_Output_announce
,$*,$(false
),MOD
,5)
68 $(call gb_Output_announce_title
,module
$* cleared.
)
69 -$(call gb_Helper_abbreviate_dirs
,\
70 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_subsequentcheck_target
,$*) $(call gb_Module_get_perfcheck_target
,$*))
72 $(call gb_Module_get_l10n_target
,%) :
73 $(call gb_Output_announce
,$*,$(true
),LOC
,5)
74 $(call gb_Output_announce_title
,module
$* done.
)
75 -$(call gb_Helper_abbreviate_dirs
,\
76 mkdir
-p
$(dir $@
) && \
79 $(call gb_Module_get_check_target
,%) :
80 $(call gb_Output_announce
,$*,$(true
),CHK
,5)
81 $(call gb_Output_announce_title
,module
$* checks done.
)
82 -$(call gb_Helper_abbreviate_dirs
,\
83 mkdir
-p
$(dir $@
) && \
86 $(call gb_Module_get_slowcheck_target
,%) :
87 $(call gb_Output_announce
,$*,$(true
),SLC
,5)
88 $(call gb_Output_announce_title
,module
$* slowchecks done.
)
89 -$(call gb_Helper_abbreviate_dirs
,\
90 mkdir
-p
$(dir $@
) && \
93 $(call gb_Module_get_subsequentcheck_target
,%) :
94 $(call gb_Output_announce
,$*,$(true
),SCK
,5)
95 $(call gb_Output_announce_title
,module
$* subsequentchecks done.
)
96 -$(call gb_Helper_abbreviate_dirs
,\
97 mkdir
-p
$(dir $@
) && \
100 $(call gb_Module_get_perfcheck_target
,%) :
101 $(call gb_Output_announce
,$*,$(true
),PFC
,5)
102 $(call gb_Output_announce_title
,module
$* perfchecks done.
)
103 -$(call gb_Helper_abbreviate_dirs
,\
104 mkdir
-p
$(dir $@
) && \
107 $(call gb_Module_get_target
,%) :
108 $(call gb_Output_announce
,$*,$(true
),MOD
,5)
109 $(call gb_Output_announce_title
,module
$* done.
)
110 -$(call gb_Helper_abbreviate_dirs
,\
111 mkdir
-p
$(dir $@
) && \
114 .PHONY
: all build build-l10n-only build-non-l10n-only unitcheck slowcheck subsequentcheck perfcheck
clean check debugrun help showmodules translations
117 all : build
$(if
$(CROSS_COMPILING
),,unitcheck
$(if
$(gb_PARTIAL_BUILD
),,slowcheck
))
119 build-tools
: $(gb_BUILD_TOOLS
)
120 $(call gb_Output_announce
,loaded tools
: $(gb_BUILD_TOOLS
),$(true
),ALL
,6)
121 $(call gb_Output_announce_title
,build-tools done.
)
122 $(call gb_Output_announce_bell
)
125 $(call gb_Output_announce
,top level modules
: $(foreach module
,$(filter-out deliverlog
$(WORKDIR
)/bootstrap
,$^
),$(notdir $(module
))),$(true
),ALL
,6)
126 $(if
$(gb_VERBOSE
),$(call gb_Output_announce
,loaded modules
: $(sort $(gb_Module_ALLMODULES
)),$(true
),ALL
,6))
127 $(call gb_Output_announce_title
,build done.
)
128 $(call gb_Output_announce_bell
)
131 $(call gb_Output_announce
,top level modules
: $(foreach module
,$(filter-out deliverlog
$(WORKDIR
)/bootstrap
,$^
),$(notdir $(module
))),$(true
),LOC
,6)
132 $(if
$(gb_VERBOSE
),$(call gb_Output_announce
,loaded modules
: $(sort $(gb_Module_ALLMODULES
)),$(true
),LOC
,6))
133 $(call gb_Output_announce_title
,l10n done.
)
134 $(call gb_Output_announce_bell
)
136 build-non-l10n-only
:
137 $(call gb_Output_announce
,top level modules
: $(foreach module
,$(filter-out deliverlog
$(WORKDIR
)/bootstrap
,$^
),$(notdir $(module
))),$(true
),BIN
,6)
138 $(if
$(gb_VERBOSE
),$(call gb_Output_announce
,loaded modules
: $(sort $(gb_Module_ALLMODULES
)),$(true
),BIN
,6))
139 $(call gb_Output_announce_title
,non-l10n done.
)
140 $(call gb_Output_announce_bell
)
143 $(if
$(gb_VERBOSE
),$(call gb_Output_announce
,loaded modules
: $(sort $(gb_Module_ALLMODULES
)),$(true
),CHK
,6))
144 $(call gb_Output_announce_title
,all unittests checked.
)
145 $(call gb_Output_announce_bell
)
148 $(if
$(gb_VERBOSE
),$(call gb_Output_announce
,loaded modules
: $(sort $(gb_Module_ALLMODULES
)),$(true
),SLC
,6))
149 $(call gb_Output_announce_title
,all slowtests checked.
)
150 $(call gb_Output_announce_bell
)
152 # removing the dependency on build for now until we can make a full build with gbuild
153 #subsequentcheck : all
155 $(if
$(gb_VERBOSE
),$(call gb_Output_announce
,loaded modules
: $(sort $(gb_Module_ALLMODULES
)),$(true
),SCK
,6))
156 $(call gb_Output_announce_title
,all subsequent tests checked.
)
157 $(call gb_Output_announce_bell
)
160 $(if
$(gb_VERBOSE
),$(call gb_Output_announce
,loaded modules
: $(sort $(gb_Module_ALLMODULES
)),$(true
),PFC
,6))
161 $(call gb_Output_announce_title
,all perftests checked.
)
162 $(call gb_Output_announce_bell
)
165 $(if
$(gb_VERBOSE
),$(call gb_Output_announce
,top level modules
: $(foreach module
,$^
,$(notdir $(module
))),$(false
),ALL
,6))
166 $(call gb_Output_announce
,loaded modules
: $(sort $(gb_Module_ALLMODULES
)),$(false
),ALL
,6)
167 $(call gb_Output_announce_title
,all cleared.
)
168 $(call gb_Output_announce_bell
)
170 check : unitcheck slowcheck
171 $(call gb_Output_announce_title
,all tests checked.
)
172 $(call gb_Output_announce_bell
)
175 $(call gb_Module_DEBUGRUNCOMMAND
)
178 @cat
$(SRCDIR
)/solenv
/gbuild
/gbuild.help.txt
181 $(info $(strip $(gb_Module_ALLMODULES
)))
184 translations
: $(WORKDIR
)/pot.done
186 $(WORKDIR
)/pot.done
: $(foreach exec
,cfgex helpex localize transex3 \
187 propex uiex ulfex xrmex treex
, \
188 $(call gb_Executable_get_target_for_build
,$(exec
)))
189 $(call gb_Output_announce
,$(subst .pot
,,$(subst $(WORKDIR
)/,,$@
)),$(true
),POT
,1)
190 $(call gb_Helper_abbreviate_dirs
,\
191 mkdir
-p
$(dir $@
) && $(call gb_Helper_execute
,localize
) $(SRCDIR
) $(dir $@
)/pot \
192 && find
$(dir $@
)/pot
-type f
-printf
"%P\n" | sed
-e
"s/\.pot/.po/" > $(dir $@
)/LIST \
195 # enable if: no "-MODULE/" defined AND ["all" defined OR "MODULE/" defined]
196 gb_Module__debug_enabled
= \
197 $(and
$(if
$(filter -$(1)/,$(ENABLE_DEBUGINFO_FOR
)),,$(true
)),\
198 $(filter all $(1)/,$(ENABLE_DEBUGINFO_FOR
)))
200 define gb_Module_Module
201 gb_Module_ALLMODULES
+= $(1)
202 gb_Module_MODULELOCATIONS
+= $(1):$(dir $(realpath
$(lastword
$(MAKEFILE_LIST
))))
203 gb_Module_TARGETSTACK
:= $(call gb_Module_get_target
,$(1)) $(gb_Module_TARGETSTACK
)
204 gb_Module_L10NTARGETSTACK
:= $(call gb_Module_get_l10n_target
,$(1)) $(gb_Module_L10NTARGETSTACK
)
205 gb_Module_CHECKTARGETSTACK
:= $(call gb_Module_get_check_target
,$(1)) $(gb_Module_CHECKTARGETSTACK
)
206 gb_Module_SLOWCHECKTARGETSTACK
:= $(call gb_Module_get_slowcheck_target
,$(1)) $(gb_Module_SLOWCHECKTARGETSTACK
)
207 gb_Module_SUBSEQUENTCHECKTARGETSTACK
:= $(call gb_Module_get_subsequentcheck_target
,$(1)) $(gb_Module_SUBSEQUENTCHECKTARGETSTACK
)
208 gb_Module_PERFCHECKTARGETSTACK
:= $(call gb_Module_get_perfcheck_target
,$(1)) $(gb_Module_PERFCHECKTARGETSTACK
)
209 gb_Module_CLEANTARGETSTACK
:= $(call gb_Module_get_clean_target
,$(1)) $(gb_Module_CLEANTARGETSTACK
)
210 gb_Module_CURRENTMODULE_DEBUG_ENABLED
:= $(call gb_Module__debug_enabled
,$(1))
211 gb_Module_CURRENTMODULE_NAME
:= $(1)
212 $(call gb_Helper_make_userfriendly_targets
,$(1),Module
)
213 $(if
$(filter-out libreoffice instsetoo_native android ios
,$(1)),\
214 $(call gb_Postprocess_register_target
,AllModulesButInstsetNative
,Module
,$(1)))
216 $(call gb_Postprocess_get_target
,AllModuleTests
) : $(call gb_Module_get_check_target
,$(1))
217 $(call gb_Postprocess_get_target
,AllModuleSlowtests
) : $(call gb_Module_get_slowcheck_target
,$(1))
221 # This is called inside the included file and pushes one target on each stack.
222 # This has to be called with full late evaluation ($$(eval $$(call ))) and
223 # should never be inlined ($(call )) as the calls defining it might be sourced
225 define gb_Module_register_target
226 gb_Module_CURRENTTARGET
:= $(1)
227 gb_Module_CURRENTCLEANTARGET
:= $(2)
231 # Here we include the file (in it there will be a call to gb_Module_register_target)
232 define gb_Module__read_targetfile
233 gb_Module_CURRENTTARGET
:=
234 gb_Module_CURRENTCLEANTARGET
:=
235 gb_Module_CURRENTMAKEFILE
:= $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS
)))$(2).mk
236 include $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS
)))$(2).mk
237 gb_Module_CURRENTMAKEFILE
:=
238 ifneq ($$(words $$(gb_Module_CURRENTTARGET
)) $$(words $$(gb_Module_CURRENTCLEANTARGET
)),1 1)
239 $$(eval
$$(call gb_Output_error
,No
$(3) registered while reading
$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS
)))$(2).mk
!))
244 define gb_Module_add_target
245 $(if
$(filter AllLang
% Dictionary
% UIConfig
% Package_registry
,$(2)),$(warning target
$(2) should be a l10n target
))
246 $(call gb_Module__read_targetfile
,$(1),$(2),target
)
248 $(call gb_Module_get_nonl10n_target
,$(1)) : $$(gb_Module_CURRENTTARGET
)
249 $(call gb_Module_get_clean_target
,$(1)) : $$(gb_Module_CURRENTCLEANTARGET
)
253 define gb_Module_add_l10n_target
254 $(if
$(filter AllLang
% CustomTarget_autotextshare Dictionary
% UIConfig
% Package_registry
,$(2)),,$(warning target
$(2) should not be a l10n target
))
255 $(call gb_Module__read_targetfile
,$(1),$(2),target
)
257 $(call gb_Module_get_l10n_target
,$(1)) : $$(gb_Module_CURRENTTARGET
)
258 $(call gb_Module_get_clean_target
,$(1)) : $$(gb_Module_CURRENTCLEANTARGET
)
262 define gb_Module_add_check_target
263 $(call gb_Module__read_targetfile
,$(1),$(2),check target
)
265 $(call gb_Module_get_check_target
,$(1)) : $$(gb_Module_CURRENTTARGET
)
266 $(call gb_Module_get_clean_target
,$(1)) : $$(gb_Module_CURRENTCLEANTARGET
)
270 define gb_Module_add_slowcheck_target
271 $(call gb_Module__read_targetfile
,$(1),$(2),slowcheck target
)
273 $(call gb_Module_get_slowcheck_target
,$(1)) : $$(gb_Module_CURRENTTARGET
)
274 $(call gb_Module_get_clean_target
,$(1)) : $$(gb_Module_CURRENTCLEANTARGET
)
278 # has order dependency on AllModulesButInstsetNative to be able to run
279 # subsequentcheck in the same make process on "make check"
280 define gb_Module_add_subsequentcheck_target
281 $(call gb_Module__read_targetfile
,$(1),$(2),subsequentcheck target
)
283 $(call gb_Module_get_subsequentcheck_target
,$(1)) : $$(gb_Module_CURRENTTARGET
)
284 $$(gb_Module_CURRENTTARGET
) :| \
285 $(call gb_Postprocess_get_target
,AllModulesButInstsetNative
)
286 $(call gb_Module_get_clean_target
,$(1)) : $$(gb_Module_CURRENTCLEANTARGET
)
290 define gb_Module_add_perfcheck_target
291 $(call gb_Module__read_targetfile
,$(1),$(2),perfcheck target
)
293 $(call gb_Module_get_perfcheck_target
,$(1)) : $$(gb_Module_CURRENTTARGET
)
294 $(call gb_Module_get_clean_target
,$(1)) : $$(gb_Module_CURRENTCLEANTARGET
)
298 define gb_Module_add_moduledir
299 include $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS
)))/$(2)/Module_
$(2).mk
300 $(call gb_Module_get_target
,$(1)) : $$(firstword $$(gb_Module_TARGETSTACK
))
301 $(call gb_Module_get_l10n_target
,$(1)) : $$(firstword $$(gb_Module_L10NTARGETSTACK
))
302 $(call gb_Module_get_check_target
,$(1)) : $$(firstword $$(gb_Module_CHECKTARGETSTACK
))
303 $(call gb_Module_get_slowcheck_target
,$(1)) : $$(firstword $$(gb_Module_SLOWCHECKTARGETSTACK
))
304 $(call gb_Module_get_subsequentcheck_target
,$(1)) : $$(firstword $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK
))
305 $(call gb_Module_get_perfcheck_target
,$(1)) : $$(firstword $$(gb_Module_PERFCHECKTARGETSTACK
))
306 $(call gb_Module_get_clean_target
,$(1)) : $$(firstword $$(gb_Module_CLEANTARGETSTACK
))
307 gb_Module_TARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_TARGETSTACK
)),$$(gb_Module_TARGETSTACK
))
308 gb_Module_L10NTARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_L10NTARGETSTACK
)),$$(gb_Module_L10NTARGETSTACK
))
309 gb_Module_CHECKTARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_CHECKTARGETSTACK
)),$$(gb_Module_CHECKTARGETSTACK
))
310 gb_Module_SLOWCHECKTARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_SLOWCHECKTARGETSTACK
)),$$(gb_Module_SLOWCHECKTARGETSTACK
))
311 gb_Module_SUBSEQUENTCHECKTARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK
)),$$(gb_Module_SUBSEQUENTCHECKTARGETSTACK
))
312 gb_Module_PERFCHECKTARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_PERFCHECKTARGETSTACK
)),$$(gb_Module_PERFCHECKTARGETSTACK
))
313 gb_Module_CLEANTARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_CLEANTARGETSTACK
)),$$(gb_Module_CLEANTARGETSTACK
))
317 define gb_Module_add_targets
318 $(call gb_Module_get_target
,$(1)) : $(call gb_Module_get_nonl10n_target
,$(1))
319 $(foreach target
,$(2),$(call gb_Module_add_target
,$(1),$(target
)))
323 define gb_Module_add_l10n_targets
324 $(call gb_Module_get_target
,$(1)) : $(call gb_Module_get_l10n_target
,$(1))
325 $(foreach target
,$(2),$(call gb_Module_add_l10n_target
,$(1),$(target
)))
329 gb_Module_add_targets_for_build
= $(call gb_Module_add_targets
,$(1),$(2))
331 define gb_Module_add_check_targets
332 $(foreach target
,$(2),$(call gb_Module_add_check_target
,$(1),$(target
)))
336 define gb_Module_add_slowcheck_targets
337 $(foreach target
,$(2),$(call gb_Module_add_slowcheck_target
,$(1),$(target
)))
341 define gb_Module_add_subsequentcheck_targets
342 $(foreach target
,$(2),$(call gb_Module_add_subsequentcheck_target
,$(1),$(target
)))
346 define gb_Module_add_perfcheck_targets
347 $(foreach target
,$(2),$(call gb_Module_add_perfcheck_target
,$(1),$(target
)))
351 define gb_Module_add_moduledirs
352 $(foreach target
,$(sort $(2)),$(call gb_Module_add_moduledir
,$(1),$(target
)))
356 define gb_Module_make_global_targets
357 ifneq ($$(gb_Module_TARGETSTACK
),)
358 $$(eval
$$(call gb_Output_error
,Corrupted module target stack
!1))
363 build
: build-non-l10n-only build-l10n-only
364 build-non-l10n-only
: $$(firstword $$(gb_Module_TARGETSTACK
))
365 build-l10n-only
: $$(firstword $$(gb_Module_L10NTARGETSTACK
))
366 unitcheck
: $$(firstword $$(gb_Module_CHECKTARGETSTACK
))
367 slowcheck
: $$(firstword $$(gb_Module_SLOWCHECKTARGETSTACK
))
368 subsequentcheck
: $$(firstword $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK
))
369 perfcheck
: $$(firstword $$(gb_Module_PERFCHECKTARGETSTACK
))
370 clean : $$(firstword $$(gb_Module_CLEANTARGETSTACK
))
372 ifneq ($$(words $$(gb_Module_TARGETSTACK
)),1)
373 $$(eval
$$(call gb_Output_error
,Corrupted module target stack
! $(gb_Module_TARGETSTACK
)))
376 gb_Module_TARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_TARGETSTACK
)),$$(gb_Module_TARGETSTACK
))
377 gb_Module_L10NTARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_L10NTARGETSTACK
)),$$(gb_Module_L10NTARGETSTACK
))
378 gb_Module_CHECKTARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_CHECKTARGETSTACK
)),$$(gb_Module_CHECKTARGETSTACK
))
379 gb_Module_SLOWCHECKTARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_SLOWCHECKTARGETSTACK
)),$$(gb_Module_SLOWCHECKTARGETSTACK
))
380 gb_Module_SUBSEQUENTCHECKTARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK
)),$$(gb_Module_SUBSEQUENTCHECKTARGETSTACK
))
381 gb_Module_PERFCHECKTARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_PERFCHECKTARGETSTACK
)),$$(gb_Module_PERFCHECKTARGETSTACK
))
382 gb_Module_CLEANTARGETSTACK
:= $$(wordlist
2,$$(words $$(gb_Module_CLEANTARGETSTACK
)),$$(gb_Module_CLEANTARGETSTACK
))
384 ifneq ($$(and
$$(gb_Module_TARGETSTACK
),$$(gb_Module_CHECKTARGETSTACK
),$$(gb_Module_SLOWCHECKTARGETSTACK
),$$(gb_Module_SUBSEQUENTCHECKTARGETSTACK
),$$(gb_Module_PERFCHECKTARGETSTACK
),$$(gb_Module_L10NTARGETSTACK
)),)
385 $$(eval
$$(call gb_Output_error
,Corrupted module target stack
!3))
388 $$(eval
$$(gb_Extensions_final_hook
))
391 # vim: set noet sw=4: