Bump version to 6.4.7.2.M8
[LibreOffice.git] / solenv / gbuild / gbuild.mk
blobd41c40123bc2bcc6bafb7819cb3091a0a3999614
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_ENABLE_SYMBOLS_FOR := $(ENABLE_SYMBOLS_FOR)
87 # ENABLE_SYMBOLS (presumably from the command line)
88 ifneq ($(strip $(ENABLE_SYMBOLS)),)
89 gb_ENABLE_SYMBOLS_FOR := $(ENABLE_SYMBOLS)
90 endif
91 ifneq ($(strip $(enable_symbols)),)
92 gb_ENABLE_SYMBOLS_FOR := $(enable_symbols)
93 endif
95 # note: ENABLE_BREAKPAD turns on symbols
96 ifneq ($(strip $(ENABLE_BREAKPAD)),)
97 gb_ENABLE_SYMBOLS_FOR := all
98 endif
100 gb_DEBUGLEVEL := 0
101 ifneq ($(strip $(DEBUG)),)
102 gb_DEBUGLEVEL := 1
103 # make DEBUG=true should force -g
104 ifeq ($(origin DEBUG),command line)
105 gb_ENABLE_SYMBOLS_FOR := all
106 endif
107 endif
108 ifneq ($(strip $(debug)),)
109 gb_DEBUGLEVEL := 1
110 ifeq ($(origin debug),command line)
111 gb_ENABLE_SYMBOLS_FOR := all
112 endif
113 endif
114 ifeq ($(gb_ENABLE_DBGUTIL),$(true))
115 gb_DEBUGLEVEL := 1
116 endif
118 ifneq ($(strip $(DBGLEVEL)),)
119 gb_DEBUGLEVEL := $(strip $(DBGLEVEL))
120 ifeq ($(origin DBGLEVEL),command line)
121 gb_ENABLE_SYMBOLS_FOR := all
122 endif
123 endif
124 ifneq ($(strip $(dbglevel)),)
125 gb_DEBUGLEVEL := $(strip $(dbglevel))
126 ifeq ($(origin dbglevel),command line)
127 gb_ENABLE_SYMBOLS_FOR := all
128 endif
129 endif
131 # handle special cases
132 ifeq ($(gb_ENABLE_SYMBOLS_FOR),1)
133 gb_ENABLE_SYMBOLS_FOR := all
134 endif
135 ifeq ($(gb_ENABLE_SYMBOLS_FOR),0)
136 gb_ENABLE_SYMBOLS_FOR :=
137 endif
138 ifeq ($(gb_ENABLE_SYMBOLS_FOR),yes)
139 gb_ENABLE_SYMBOLS_FOR := all
140 endif
141 ifeq ($(gb_ENABLE_SYMBOLS_FOR),no)
142 gb_ENABLE_SYMBOLS_FOR :=
143 endif
145 gb_ENABLE_PCH := $(ENABLE_PCH)
147 ifneq ($(nodep)$(ENABLE_PRINT_DEPS),)
148 gb_FULLDEPS := $(false)
149 else
150 gb_FULLDEPS := $(true)
151 endif
153 ifneq ($(strip $(patches)$(PATCHES)),)
154 gb_KEEP_PRISTINE := $(true)
155 else
156 gb_KEEP_PRISTINE := $(false)
157 endif
159 ifeq ($(findstring s,$(MAKEFLAGS)),)
160 gb_QUIET_EXTERNAL := $(false)
161 else
162 gb_QUIET_EXTERNAL := $(true)
163 endif
165 # save user-supplied flags for latter use
166 ifneq ($(strip $(ENVCFLAGS)),)
167 gb__ENV_CFLAGS := $(ENVCFLAGS)
168 endif
169 ifneq ($(strip $(ENVCFLAGSCXX)),)
170 gb__ENV_CXXFLAGS := $(ENVCFLAGSCXX)
171 endif
173 include $(GBUILDDIR)/ExternalExecutable.mk
174 include $(GBUILDDIR)/TargetLocations.mk
175 include $(GBUILDDIR)/Tempfile.mk
176 include $(GBUILDDIR)/TestHelpers.mk
178 $(eval $(call gb_Helper_init_registries))
179 include $(SRCDIR)/Repository.mk
180 include $(SRCDIR)/RepositoryExternal.mk
181 $(eval $(call gb_Helper_collect_knownlibs))
183 gb_Library_DLLPOSTFIX := lo
185 # Include platform/cpu/compiler specific config/definitions
187 include $(GBUILDDIR)/platform/$(OS)_$(CPUNAME)_$(COM).mk
189 # this is optional
190 include $(SRCDIR)/RepositoryFixes.mk
192 # after platform; at least currently python depends on variable set in platform
193 $(eval $(call gb_ExternalExecutable_collect_registrations))
195 # add user-supplied flags
196 ifneq ($(strip gb__ENV_CFLAGS),)
197 gb_LinkTarget_CFLAGS += $(gb__ENV_CFLAGS)
198 endif
199 ifneq ($(strip gb__ENV_CXXFLAGS),)
200 gb_LinkTarget_CXXFLAGS += $(gb__ENV_CXXFLAGS)
201 endif
203 gb_CPUDEFS += -D$(CPUNAME)
205 gb_GLOBALDEFS := \
206 -D_REENTRANT \
207 -DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
208 $(gb_OSDEFS) \
209 $(gb_COMPILERDEFS) \
210 $(gb_CPUDEFS) \
212 ifeq ($(gb_ENABLE_DBGUTIL),$(true))
213 gb_GLOBALDEFS += -DDBG_UTIL
215 ifneq ($(COM)-$(MSVC_USE_DEBUG_RUNTIME),MSC-)
216 gb_GLOBALDEFS += -D_DEBUG
217 endif
218 endif
220 ifeq ($(gb_TIMELOG),1)
221 gb_GLOBALDEFS += -DTIMELOG \
223 endif
225 ifeq ($(strip $(ASSERT_ALWAYS_ABORT)),FALSE)
226 gb_GLOBALDEFS += -DNDEBUG \
228 endif
230 ifeq ($(gb_DEBUGLEVEL),0)
232 ifeq ($(ENABLE_SAL_LOG),TRUE)
233 gb_GLOBALDEFS += -DSAL_LOG_INFO \
234 -DSAL_LOG_WARN \
236 endif
238 else
239 gb_GLOBALDEFS += -DSAL_LOG_INFO \
240 -DSAL_LOG_WARN \
242 ifneq ($(gb_DEBUGLEVEL),1) # 2 or more
243 gb_GLOBALDEFS += -DDEBUG \
245 endif
246 endif
248 gb_GLOBALDEFS += \
249 $(call gb_Helper_define_if_set,\
250 DISABLE_DYNLOADING \
251 ENABLE_LTO \
254 gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
256 # Common environment variables passed into all gb_*Test classes:
257 # * Cap the number of threads unittests use:
258 gb_TEST_ENV_VARS := MAX_CONCURRENCY=4
259 # * Disable searching for certificates by default:
260 gb_TEST_ENV_VARS += MOZILLA_CERTIFICATE_FOLDER=
261 # Avoid hanging if the cups daemon requests a password:
262 gb_TEST_ENV_VARS += SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION=1
263 ifeq (,$(SAL_USE_VCLPLUGIN))
264 gb_TEST_ENV_VARS += SAL_USE_VCLPLUGIN=svp
265 endif
267 # This is used to detect whether LibreOffice is being built (as opposed to building
268 # 3rd-party code). Used for tag deprecation for API we want to
269 # ensure is not used at all externally while we clean
270 # out our internal usage, for code in sal/ that should be used only internally, etc.
271 gb_DEFS_INTERNAL := \
272 -DLIBO_INTERNAL_ONLY \
274 include $(GBUILDDIR)/Deliver.mk
276 $(eval $(call gb_Deliver_init))
278 # We are using a set of scopes that we might as well call classes.
280 # TODO: to what extent is the following still true?
281 # It is important to include them in the right order as that is
282 # -- at least in part -- defining precedence. This is not an issue in the
283 # WORKDIR as there are no naming collisions there, but INSTDIR is a mess
284 # and precedence is important there. This is also platform dependent.
286 # This is less of an issue with GNU Make versions > 3.82 which matches for
287 # shortest stem instead of first match. However, upon introduction this version
288 # is not available everywhere by default.
290 include $(foreach class, \
291 ComponentTarget \
292 Postprocess \
293 AllLangMoTarget \
294 WinResTarget \
295 LinkTarget \
296 Library \
297 StaticLibrary \
298 Executable \
299 SdiTarget \
300 Package \
301 ExternalPackage \
302 CustomTarget \
303 ExternalProject \
304 Gallery \
305 Pagein \
306 PrecompiledHeaders \
307 Pyuno \
308 PythonTest \
309 UITest \
310 Rdb \
311 CppunitTest \
312 Jar \
313 JavaClassSet \
314 JunitTest \
315 Module \
316 UIConfig \
317 UnoApiTarget \
318 UnoApi \
319 UnpackedTarball \
320 InternalUnoApi \
321 CliAssembly \
322 CliLibrary \
323 CliNativeLibrary \
324 CliUnoApi \
325 Zip \
326 AllLangPackage \
327 Configuration \
328 HelpTarget \
329 AllLangHelp \
330 Extension \
331 ExtensionPackage \
332 Dictionary \
333 InstallModuleTarget \
334 InstallModule \
335 InstallScript \
336 AutoInstall \
337 PackageSet \
338 GeneratedPackage \
339 CompilerTest \
340 ,$(GBUILDDIR)/$(class).mk)
342 $(eval $(call gb_Helper_process_executable_registrations))
343 $(eval $(call gb_Postprocess_make_targets))
345 # optional extensions that should never be essential
346 ifneq ($(wildcard $(GBUILDDIR)/extensions/post_*.mk),)
347 include $(wildcard $(GBUILDDIR)/extensions/post_*.mk)
348 endif
350 define gb_Extensions_final_hook
351 ifneq ($(wildcard $(GBUILDDIR)/extensions/final_*.mk),)
352 include $(wildcard $(GBUILDDIR)/extensions/final_*.mk)
353 endif
355 endef
357 # vim: set noet sw=4: