fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / solenv / gbuild / Module.mk
blobc971a47053d74921ce89112a3a89db26e2bf6c2a
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 # all (global) default goal build unitcheck
38 # Module class
40 gb_Module_ALLMODULES :=
41 gb_Module_MODULELOCATIONS :=
42 gb_Module_TARGETSTACK :=
43 gb_Module_CHECKTARGETSTACK :=
44 gb_Module_SLOWCHECKTARGETSTACK :=
45 gb_Module_SUBSEQUENTCHECKTARGETSTACK :=
46 gb_Module_CLEANTARGETSTACK :=
48 # The currently read gbuild makefile.
50 # gbuild classes should use this if they need to depend on their makefile
51 # (e.g., to make sure a zip file is rebuilt if files are removed from it).
52 # Because makefiles may include other makefiles, it is not safe to rely
53 # on $(MAKEFILE_LIST).
54 gb_Module_CURRENTMAKEFILE :=
56 .PHONY : $(call gb_Module_get_clean_target,%)
57 $(call gb_Module_get_clean_target,%) :
58 $(call gb_Output_announce,$*,$(false),MOD,5)
59 $(call gb_Output_announce_title,module $* cleared.)
60 -$(call gb_Helper_abbreviate_dirs,\
61 rm -f $(call gb_Module_get_target,$*) $(call gb_Module_get_check_target,$*) $(call gb_Module_get_slowcheck_target,$*) $(call gb_Module_get_subsequentcheck_target,$*))
63 $(call gb_Module_get_check_target,%) :
64 $(call gb_Output_announce,$*,$(true),CHK,5)
65 $(call gb_Output_announce_title,module $* checks done.)
66 -$(call gb_Helper_abbreviate_dirs,\
67 mkdir -p $(dir $@) && \
68 touch $@)
70 $(call gb_Module_get_slowcheck_target,%) :
71 $(call gb_Output_announce,$*,$(true),SLC,5)
72 $(call gb_Output_announce_title,module $* slowchecks done.)
73 -$(call gb_Helper_abbreviate_dirs,\
74 mkdir -p $(dir $@) && \
75 touch $@)
77 $(call gb_Module_get_subsequentcheck_target,%) :
78 $(call gb_Output_announce,$*,$(true),SCK,5)
79 $(call gb_Output_announce_title,module $* subsequentchecks done.)
80 -$(call gb_Helper_abbreviate_dirs,\
81 mkdir -p $(dir $@) && \
82 touch $@)
84 $(call gb_Module_get_target,%) :
85 $(call gb_Output_announce,$*,$(true),MOD,5)
86 $(call gb_Output_announce_title,module $* done.)
87 -$(call gb_Helper_abbreviate_dirs,\
88 mkdir -p $(dir $@) && \
89 touch $@)
91 .PHONY : all build unitcheck slowcheck subsequentcheck clean check debugrun help showmodules translations
92 .DEFAULT_GOAL := all
94 all : build $(if $(CROSS_COMPILING),,unitcheck $(if $(gb_PARTIAL_BUILD),,slowcheck))
96 build-tools : $(gb_BUILD_TOOLS)
97 $(call gb_Output_announce,loaded tools: $(gb_BUILD_TOOLS),$(true),ALL,6)
98 $(call gb_Output_announce_title,build-tools done.)
99 $(call gb_Output_announce_bell)
101 build :
102 $(call gb_Output_announce,top level modules: $(foreach module,$(filter-out deliverlog $(WORKDIR)/bootstrap,$^),$(notdir $(module))),$(true),ALL,6)
103 $(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),ALL,6)
104 $(call gb_Output_announce_title,build done.)
105 $(call gb_Output_announce_bell)
107 unitcheck :
108 $(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),CHK,6)
109 $(call gb_Output_announce_title,all unittests checked.)
110 $(call gb_Output_announce_bell)
112 slowcheck :
113 $(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),SLC,6)
114 $(call gb_Output_announce_title,all slowtests checked.)
115 $(call gb_Output_announce_bell)
117 # removing the dependency on build for now until we can make a full build with gbuild
118 #subsequentcheck : all
119 subsequentcheck :
120 $(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),SCK,6)
121 $(call gb_Output_announce_title,all subsequent tests checked.)
122 $(call gb_Output_announce_bell)
124 clean :
125 $(call gb_Output_announce,top level modules: $(foreach module,$^,$(notdir $(module))),$(false),ALL,6)
126 $(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(false),ALL,6)
127 $(call gb_Output_announce_title,all cleared.)
128 $(call gb_Output_announce_bell)
130 check : unitcheck slowcheck
131 $(call gb_Output_announce_title,all tests checked.)
132 $(call gb_Output_announce_bell)
134 debugrun :
135 $(call gb_Module_DEBUGRUNCOMMAND)
137 help :
138 @cat $(SRCDIR)/solenv/gbuild/gbuild.help.txt
140 showmodules :
141 $(info $(strip $(gb_Module_ALLMODULES)))
142 @true
144 translations : $(WORKDIR)/pot.done
146 $(WORKDIR)/pot.done : $(foreach exec,cfgex helpex localize transex3 \
147 propex uiex ulfex xrmex treex, \
148 $(call gb_Executable_get_target_for_build,$(exec)))
149 $(call gb_Output_announce,$(subst .pot,,$(subst $(WORKDIR)/,,$@)),$(true),POT,1)
150 $(call gb_Helper_abbreviate_dirs,\
151 mkdir -p $(dir $@) && $(call gb_Helper_execute,localize) $(SRCDIR) $(dir $@)/pot \
152 && find $(dir $@)/pot -type f -printf "%P\n" | sed -e "s/\.pot/.po/" > $(dir $@)/LIST \
153 && touch $@)
155 # enable if: no "-MODULE/" defined AND ["all" defined OR "MODULE/" defined]
156 gb_Module__debug_enabled = \
157 $(and $(if $(filter -$(1)/,$(ENABLE_DEBUGINFO_FOR)),,$(true)),\
158 $(filter all $(1)/,$(ENABLE_DEBUGINFO_FOR)))
160 define gb_Module_Module
161 $(if $(filter-out libreoffice instsetoo_native android ios,$(1)),$(call gb_Postprocess_get_target,AllModulesButInstsetNative) : $(call gb_Module_get_target,$(1)))
162 gb_Module_ALLMODULES += $(1)
163 gb_Module_MODULELOCATIONS += $(1):$(dir $(realpath $(lastword $(MAKEFILE_LIST))))
164 gb_Module_TARGETSTACK := $(call gb_Module_get_target,$(1)) $(gb_Module_TARGETSTACK)
165 gb_Module_CHECKTARGETSTACK := $(call gb_Module_get_check_target,$(1)) $(gb_Module_CHECKTARGETSTACK)
166 gb_Module_SLOWCHECKTARGETSTACK := $(call gb_Module_get_slowcheck_target,$(1)) $(gb_Module_SLOWCHECKTARGETSTACK)
167 gb_Module_SUBSEQUENTCHECKTARGETSTACK := $(call gb_Module_get_subsequentcheck_target,$(1)) $(gb_Module_SUBSEQUENTCHECKTARGETSTACK)
168 gb_Module_CLEANTARGETSTACK := $(call gb_Module_get_clean_target,$(1)) $(gb_Module_CLEANTARGETSTACK)
169 gb_Module_CURRENTMODULE_DEBUG_ENABLED := $(call gb_Module__debug_enabled,$(1))
170 gb_Module_CURRENTMODULE_NAME := $(1)
171 $(call gb_Helper_make_userfriendly_targets,$(1),Module)
173 $(call gb_Postprocess_get_target,AllModuleTests) : $(call gb_Module_get_check_target,$(1))
174 $(call gb_Postprocess_get_clean_target,AllModuleTests) : $(call gb_Module_get_clean_target,$(1))
176 endef
178 # This is called inside the included file and pushes one target on each stack.
179 # This has to be called with full late evaluation ($$(eval $$(call ))) and
180 # should never be inlined ($(call )) as the calls defining it might be sourced
181 # before gb_Module.
182 define gb_Module_register_target
183 gb_Module_CURRENTTARGET := $(1)
184 gb_Module_CURRENTCLEANTARGET := $(2)
186 endef
188 # Here we include the file (in it there will be a call to gb_Module_register_target)
189 define gb_Module__read_targetfile
190 gb_Module_CURRENTTARGET :=
191 gb_Module_CURRENTCLEANTARGET :=
192 gb_Module_CURRENTMAKEFILE := $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS)))$(2).mk
193 include $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS)))$(2).mk
194 gb_Module_CURRENTMAKEFILE :=
195 ifneq ($$(words $$(gb_Module_CURRENTTARGET)) $$(words $$(gb_Module_CURRENTCLEANTARGET)),1 1)
196 $$(eval $$(call gb_Output_error,No $(3) registered while reading $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS)))$(2).mk!))
197 endif
199 endef
201 define gb_Module_add_target
202 $(call gb_Module__read_targetfile,$(1),$(2),target)
204 $(call gb_Module_get_target,$(1)) : $$(gb_Module_CURRENTTARGET)
205 $(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET)
207 endef
209 define gb_Module_add_check_target
210 $(call gb_Module__read_targetfile,$(1),$(2),check target)
212 $(call gb_Module_get_check_target,$(1)) : $$(gb_Module_CURRENTTARGET)
213 $(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET)
215 endef
217 define gb_Module_add_slowcheck_target
218 $(call gb_Module__read_targetfile,$(1),$(2),slowcheck target)
220 $(call gb_Module_get_slowcheck_target,$(1)) : $$(gb_Module_CURRENTTARGET)
221 $(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET)
223 endef
225 define gb_Module_add_subsequentcheck_target
226 $(call gb_Module__read_targetfile,$(1),$(2),subsequentcheck target)
228 $(call gb_Module_get_subsequentcheck_target,$(1)) : $$(gb_Module_CURRENTTARGET)
229 $(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET)
231 endef
233 define gb_Module_add_moduledir
234 include $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS)))/$(2)/Module_$(2).mk
235 $(call gb_Module_get_target,$(1)) : $$(firstword $$(gb_Module_TARGETSTACK))
236 $(call gb_Module_get_check_target,$(1)) : $$(firstword $$(gb_Module_CHECKTARGETSTACK))
237 $(call gb_Module_get_slowcheck_target,$(1)) : $$(firstword $$(gb_Module_SLOWCHECKTARGETSTACK))
238 $(call gb_Module_get_subsequentcheck_target,$(1)) : $$(firstword $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK))
239 $(call gb_Module_get_clean_target,$(1)) : $$(firstword $$(gb_Module_CLEANTARGETSTACK))
240 gb_Module_TARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_TARGETSTACK)),$$(gb_Module_TARGETSTACK))
241 gb_Module_CHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_CHECKTARGETSTACK)),$$(gb_Module_CHECKTARGETSTACK))
242 gb_Module_SLOWCHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_SLOWCHECKTARGETSTACK)),$$(gb_Module_SLOWCHECKTARGETSTACK))
243 gb_Module_SUBSEQUENTCHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK)),$$(gb_Module_SUBSEQUENTCHECKTARGETSTACK))
244 gb_Module_CLEANTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_CLEANTARGETSTACK)),$$(gb_Module_CLEANTARGETSTACK))
246 endef
248 define gb_Module_add_targets
249 $(foreach target,$(2),$(call gb_Module_add_target,$(1),$(target)))
251 endef
253 gb_Module_add_targets_for_build = $(call gb_Module_add_targets,$(1),$(2))
255 define gb_Module_add_check_targets
256 $(foreach target,$(2),$(call gb_Module_add_check_target,$(1),$(target)))
258 endef
260 define gb_Module_add_slowcheck_targets
261 $(foreach target,$(2),$(call gb_Module_add_slowcheck_target,$(1),$(target)))
263 endef
265 define gb_Module_add_subsequentcheck_targets
266 $(foreach target,$(2),$(call gb_Module_add_subsequentcheck_target,$(1),$(target)))
268 endef
270 define gb_Module_add_moduledirs
271 $(foreach target,$(2),$(call gb_Module_add_moduledir,$(1),$(target)))
272 endef
274 define gb_Module_make_global_targets
275 ifneq ($$(gb_Module_TARGETSTACK),)
276 $$(eval $$(call gb_Output_error,Corrupted module target stack!1))
277 endif
279 include $(1)
281 build : $$(firstword $$(gb_Module_TARGETSTACK))
282 unitcheck : $$(firstword $$(gb_Module_CHECKTARGETSTACK))
283 slowcheck : $$(firstword $$(gb_Module_SLOWCHECKTARGETSTACK))
284 subsequentcheck : $$(firstword $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK))
285 clean : $$(firstword $$(gb_Module_CLEANTARGETSTACK))
287 ifneq ($$(words $$(gb_Module_TARGETSTACK)),1)
288 $$(eval $$(call gb_Output_error,Corrupted module target stack! $(gb_Module_TARGETSTACK)))
289 endif
291 gb_Module_TARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_TARGETSTACK)),$$(gb_Module_TARGETSTACK))
292 gb_Module_CHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_CHECKTARGETSTACK)),$$(gb_Module_CHECKTARGETSTACK))
293 gb_Module_SLOWCHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_SLOWCHECKTARGETSTACK)),$$(gb_Module_SLOWCHECKTARGETSTACK))
294 gb_Module_SUBSEQUENTCHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK)),$$(gb_Module_SUBSEQUENTCHECKTARGETSTACK))
295 gb_Module_CLEANTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_CLEANTARGETSTACK)),$$(gb_Module_CLEANTARGETSTACK))
297 ifneq ($$(and $$(gb_Module_TARGETSTACK),$$(gb_Module_CHECKTARGETSTACK),$$(gb_Module_SLOWCHECKTARGETSTACK),$$(gb_Module_SUBSEQUENTCHECKTARGETSTACK)),)
298 $$(eval $$(call gb_Output_error,Corrupted module target stack!3))
299 endif
301 $$(eval $$(gb_Extensions_final_hook))
302 endef
304 # vim: set noet sw=4: