lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / solenv / gbuild / gbuild.mk
blob1a20050b651e2e9fa7bdfc11c0e556381f27ecc2
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 .
20 GBUILDDIR:=$(SRCDIR)/solenv/gbuild
22 # vars needed from the env/calling makefile
24 # DEBUG
25 # JAVA_HOME
26 # LIBXML_CFLAGS
27 # OS
28 # SOLARINC
29 # UPD
31 # PTHREAD_CFLAGS (Linux)
32 # SYSTEM_ICU (Linux)
33 # SYSTEM_LIBJPEG (Linux)
34 # SYSTEM_LIBXML (Linux)
36 .DELETE_ON_ERROR:
38 # do not use built-in rules
39 # DO NOT TOUCH THIS LINE UNLESS YOU REALLY KNOW WHAT YOU ARE DOING
40 # REMOVING THIS MAKES e.g. MODULE SW ALONE SLOWER BY SOME 300%
41 # FOR TAIL_BUILD THE IMPACT IS HUGE!
42 # (unless you are doing make -r, which we should explicitly NOT require from
43 # users)
44 MAKEFLAGS += r
45 .SUFFIXES:
47 true := T
48 false :=
49 define NEWLINE
52 endef
54 define WHITESPACE
56 endef
58 COMMA :=,
60 OPEN_PAREN :=(
61 CLOSE_PAREN :=)
63 gb_VERBOSE := $(verbose)
65 include $(GBUILDDIR)/Helper.mk
67 # optional extensions that should never be essential
68 ifneq ($(wildcard $(GBUILDDIR)/extensions/pre_*.mk),)
69 include $(wildcard $(GBUILDDIR)/extensions/pre_*.mk)
70 endif
72 include $(GBUILDDIR)/Output.mk
74 gb_TIMELOG := 0
75 ifneq ($(strip $(TIMELOG)$(timelog)),)
76 gb_TIMELOG := 1
77 endif
79 ifneq ($(ENABLE_DBGUTIL),)
80 gb_ENABLE_DBGUTIL := $(true)
81 else
82 gb_ENABLE_DBGUTIL := $(false)
83 endif
85 gb_DEBUGLEVEL := 0
86 ifneq ($(strip $(DEBUG)),)
87 gb_DEBUGLEVEL := 1
88 # make DEBUG=true should force -g
89 ifeq ($(origin DEBUG),command line)
90 ENABLE_DEBUGINFO_FOR := all
91 ENABLE_SYMBOLS := TRUE
92 endif
93 endif
94 ifneq ($(strip $(debug)),)
95 gb_DEBUGLEVEL := 1
96 ifeq ($(origin debug),command line)
97 ENABLE_DEBUGINFO_FOR := all
98 ENABLE_SYMBOLS := TRUE
99 endif
100 endif
101 ifeq ($(gb_ENABLE_DBGUTIL),$(true))
102 gb_DEBUGLEVEL := 1
103 endif
105 ifneq ($(strip $(DBGLEVEL)),)
106 gb_DEBUGLEVEL := $(strip $(DBGLEVEL))
107 ifeq ($(origin DBGLEVEL),command line)
108 ENABLE_DEBUGINFO_FOR := all
109 endif
110 endif
111 ifneq ($(strip $(dbglevel)),)
112 gb_DEBUGLEVEL := $(strip $(dbglevel))
113 ifeq ($(origin dbglevel),command line)
114 ENABLE_DEBUGINFO_FOR := all
115 endif
116 endif
118 # note: ENABLE_BREAKPAD turns on gb_SYMBOL
119 ifneq ($(strip $(ENABLE_SYMBOLS)$(enable_symbols)$(ENABLE_BREAKPAD)),)
120 gb_SYMBOL := $(true)
121 else
122 gb_SYMBOL := $(false)
123 endif
125 ifneq ($(strip $(ENABLE_PCH)),)
126 gb_ENABLE_PCH := $(true)
127 else
128 gb_ENABLE_PCH := $(false)
129 endif
131 ifneq ($(nodep)$(ENABLE_PRINT_DEPS),)
132 gb_FULLDEPS := $(false)
133 else
134 gb_FULLDEPS := $(true)
135 endif
137 ifneq ($(strip $(patches)$(PATCHES)),)
138 gb_KEEP_PRISTINE := $(true)
139 else
140 gb_KEEP_PRISTINE := $(false)
141 endif
143 ifeq ($(findstring s,$(MAKEFLAGS)),)
144 gb_QUIET_EXTERNAL := $(false)
145 else
146 gb_QUIET_EXTERNAL := $(true)
147 endif
149 # save user-supplied flags for latter use
150 ifneq ($(strip $(ENVCFLAGS)),)
151 gb__ENV_CFLAGS := $(ENVCFLAGS)
152 endif
153 ifneq ($(strip $(ENVCFLAGSCXX)),)
154 gb__ENV_CXXFLAGS := $(ENVCFLAGSCXX)
155 endif
157 include $(GBUILDDIR)/ExternalExecutable.mk
158 include $(GBUILDDIR)/TargetLocations.mk
159 include $(GBUILDDIR)/Tempfile.mk
161 $(eval $(call gb_Helper_init_registries))
162 include $(SRCDIR)/Repository.mk
163 include $(SRCDIR)/RepositoryExternal.mk
164 $(eval $(call gb_Helper_collect_knownlibs))
166 gb_Library_DLLPOSTFIX := lo
168 # Include platform/cpu/compiler specific config/definitions
170 include $(GBUILDDIR)/platform/$(OS)_$(CPUNAME)_$(COM).mk
172 # this is optional
173 include $(SRCDIR)/RepositoryFixes.mk
175 # after platform; at least currently python depends on variable set in platform
176 $(eval $(call gb_ExternalExecutable_collect_registrations))
178 # add user-supplied flags
179 ifneq ($(strip gb__ENV_CFLAGS),)
180 gb_LinkTarget_CFLAGS += $(gb__ENV_CFLAGS)
181 endif
182 ifneq ($(strip gb__ENV_CXXFLAGS),)
183 gb_LinkTarget_CXXFLAGS += $(gb__ENV_CXXFLAGS)
184 endif
186 gb_CPUDEFS += -D$(CPUNAME)
188 gb_GLOBALDEFS := \
189 -D_REENTRANT \
190 -DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
191 $(gb_OSDEFS) \
192 $(gb_COMPILERDEFS) \
193 $(gb_CPUDEFS) \
195 ifeq ($(gb_ENABLE_DBGUTIL),$(true))
196 gb_GLOBALDEFS += -DDBG_UTIL
198 ifneq ($(COM)-$(MSVC_USE_DEBUG_RUNTIME),MSC-)
199 gb_GLOBALDEFS += -D_DEBUG
200 endif
201 endif
203 ifeq ($(gb_TIMELOG),1)
204 gb_GLOBALDEFS += -DTIMELOG \
206 endif
208 ifeq ($(strip $(ASSERT_ALWAYS_ABORT)),FALSE)
209 gb_GLOBALDEFS += -DNDEBUG \
211 endif
213 ifeq ($(gb_DEBUGLEVEL),0)
215 ifeq ($(ENABLE_SAL_LOG),TRUE)
216 gb_GLOBALDEFS += -DSAL_LOG_INFO \
217 -DSAL_LOG_WARN \
219 endif
221 else
222 gb_GLOBALDEFS += -DSAL_LOG_INFO \
223 -DSAL_LOG_WARN \
225 ifneq ($(gb_DEBUGLEVEL),1) # 2 or more
226 gb_GLOBALDEFS += -DDEBUG \
228 endif
229 endif
231 gb_GLOBALDEFS += \
232 $(call gb_Helper_define_if_set,\
233 DISABLE_DYNLOADING \
234 ENABLE_LTO \
237 gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
239 # This is used to detect whether LibreOffice is being built (as opposed to building
240 # 3rd-party code). Used for tag deprecation for API we want to
241 # ensure is not used at all externally while we clean
242 # out our internal usage, for code in sal/ that should be used only internally, etc.
243 gb_DEFS_INTERNAL := \
244 -DLIBO_INTERNAL_ONLY \
246 include $(GBUILDDIR)/Deliver.mk
248 $(eval $(call gb_Deliver_init))
250 # We are using a set of scopes that we might as well call classes.
252 # TODO: to what extent is the following still true?
253 # It is important to include them in the right order as that is
254 # -- at least in part -- defining precedence. This is not an issue in the
255 # WORKDIR as there are no naming collisions there, but INSTDIR is a mess
256 # and precedence is important there. This is also platform dependent.
258 # This is less of an issue with GNU Make versions > 3.82 which matches for
259 # shortest stem instead of first match. However, upon introduction this version
260 # is not available everywhere by default.
262 include $(foreach class, \
263 ComponentTarget \
264 Postprocess \
265 AllLangMoTarget \
266 WinResTarget \
267 LinkTarget \
268 Library \
269 StaticLibrary \
270 Executable \
271 SdiTarget \
272 Package \
273 ExternalPackage \
274 CustomTarget \
275 ExternalProject \
276 Gallery \
277 Pagein \
278 PrecompiledHeaders \
279 Pyuno \
280 PythonTest \
281 UITest \
282 Rdb \
283 CppunitTest \
284 Jar \
285 JavaClassSet \
286 JunitTest \
287 Module \
288 UIConfig \
289 UnoApiTarget \
290 UnoApi \
291 UnpackedTarball \
292 InternalUnoApi \
293 CliAssembly \
294 CliLibrary \
295 CliNativeLibrary \
296 CliUnoApi \
297 Zip \
298 AllLangPackage \
299 Configuration \
300 HelpTarget \
301 AllLangHelp \
302 Extension \
303 ExtensionPackage \
304 Dictionary \
305 InstallModuleTarget \
306 InstallModule \
307 InstallScript \
308 AutoInstall \
309 PackageSet \
310 GeneratedPackage \
311 CompilerTest \
312 ,$(GBUILDDIR)/$(class).mk)
314 $(eval $(call gb_Helper_process_executable_registrations))
315 $(eval $(call gb_Postprocess_make_targets))
317 # optional extensions that should never be essential
318 ifneq ($(wildcard $(GBUILDDIR)/extensions/post_*.mk),)
319 include $(wildcard $(GBUILDDIR)/extensions/post_*.mk)
320 endif
322 define gb_Extensions_final_hook
323 ifneq ($(wildcard $(GBUILDDIR)/extensions/final_*.mk),)
324 include $(wildcard $(GBUILDDIR)/extensions/final_*.mk)
325 endif
327 endef
329 # vim: set noet sw=4: