Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / solenv / gbuild / gbuild.mk
blobb87f6fc569dd99b6081f2b69a7446fd5f5c948d5
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
169 include $(GBUILDDIR)/platform/$(OS)_$(CPUNAME)_$(COM).mk
171 # this is optional
172 include $(SRCDIR)/RepositoryFixes.mk
174 # after platform; at least currently python depends on variable set in platform
175 $(eval $(call gb_ExternalExecutable_collect_registrations))
177 # add user-supplied flags
178 ifneq ($(strip gb__ENV_CFLAGS),)
179 gb_LinkTarget_CFLAGS += $(gb__ENV_CFLAGS)
180 endif
181 ifneq ($(strip gb__ENV_CXXFLAGS),)
182 gb_LinkTarget_CXXFLAGS += $(gb__ENV_CXXFLAGS)
183 endif
185 gb_CPUDEFS += -D$(CPUNAME)
187 gb_GLOBALDEFS := \
188 -D_REENTRANT \
189 -DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
190 $(gb_OSDEFS) \
191 $(gb_COMPILERDEFS) \
192 $(gb_CPUDEFS) \
194 ifeq ($(gb_ENABLE_DBGUTIL),$(true))
195 gb_GLOBALDEFS += -DDBG_UTIL
197 ifneq ($(COM)-$(MSVC_USE_DEBUG_RUNTIME),MSC-)
198 gb_GLOBALDEFS += -D_DEBUG
199 endif
200 endif
202 ifeq ($(gb_TIMELOG),1)
203 gb_GLOBALDEFS += -DTIMELOG \
205 endif
207 ifeq ($(gb_DEBUGLEVEL),0)
209 ifeq ($(strip $(ASSERT_ALWAYS_ABORT)),FALSE)
210 gb_GLOBALDEFS += -DNDEBUG \
212 endif
214 ifeq ($(ENABLE_SAL_LOG),TRUE)
215 gb_GLOBALDEFS += -DSAL_LOG_INFO \
216 -DSAL_LOG_WARN \
218 endif
220 else
221 gb_GLOBALDEFS += -DSAL_LOG_INFO \
222 -DSAL_LOG_WARN \
224 ifneq ($(gb_DEBUGLEVEL),1) # 2 or more
225 gb_GLOBALDEFS += -DDEBUG \
227 endif
228 endif
230 ifeq ($(ENABLE_HEADLESS),TRUE)
231 gb_GLOBALDEFS += -DLIBO_HEADLESS \
233 endif
235 gb_GLOBALDEFS += \
236 $(call gb_Helper_define_if_set,\
237 DISABLE_DYNLOADING \
238 ENABLE_LTO \
241 gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
243 # This is used to detect whether LibreOffice is being built (as opposed to building
244 # 3rd-party code). Used for tag deprecation for API we want to
245 # ensure is not used at all externally while we clean
246 # out our internal usage, for code in sal/ that should be used only internally, etc.
247 gb_DEFS_INTERNAL := \
248 -DLIBO_INTERNAL_ONLY \
250 include $(GBUILDDIR)/Deliver.mk
252 $(eval $(call gb_Deliver_init))
254 # We are using a set of scopes that we might as well call classes.
256 # TODO: to what extent is the following still true?
257 # It is important to include them in the right order as that is
258 # -- at least in part -- defining precedence. This is not an issue in the
259 # WORKDIR as there are no naming collisions there, but INSTDIR is a mess
260 # and precedence is important there. This is also platform dependent.
262 # This is less of an issue with GNU Make versions > 3.82 which matches for
263 # shortest stem instead of first match. However, upon introduction this version
264 # is not available everywhere by default.
266 include $(foreach class, \
267 ComponentTarget \
268 Postprocess \
269 AllLangMoTarget \
270 WinResTarget \
271 LinkTarget \
272 Library \
273 StaticLibrary \
274 Executable \
275 SdiTarget \
276 Package \
277 ExternalPackage \
278 CustomTarget \
279 ExternalProject \
280 Gallery \
281 Pagein \
282 PrecompiledHeaders \
283 Pyuno \
284 PythonTest \
285 UITest \
286 Rdb \
287 CppunitTest \
288 Jar \
289 JavaClassSet \
290 JunitTest \
291 Module \
292 UIConfig \
293 UnoApiTarget \
294 UnoApi \
295 UnpackedTarball \
296 InternalUnoApi \
297 CliAssembly \
298 CliLibrary \
299 CliNativeLibrary \
300 CliUnoApi \
301 Zip \
302 AllLangPackage \
303 Configuration \
304 HelpTarget \
305 AllLangHelp \
306 Extension \
307 ExtensionPackage \
308 Dictionary \
309 InstallModuleTarget \
310 InstallModule \
311 InstallScript \
312 AutoInstall \
313 PackageSet \
314 GeneratedPackage \
315 CompilerTest \
316 ,$(GBUILDDIR)/$(class).mk)
318 $(eval $(call gb_Helper_process_executable_registrations))
319 $(eval $(call gb_Postprocess_make_targets))
321 # optional extensions that should never be essential
322 ifneq ($(wildcard $(GBUILDDIR)/extensions/post_*.mk),)
323 include $(wildcard $(GBUILDDIR)/extensions/post_*.mk)
324 endif
326 define gb_Extensions_final_hook
327 ifneq ($(wildcard $(GBUILDDIR)/extensions/final_*.mk),)
328 include $(wildcard $(GBUILDDIR)/extensions/final_*.mk)
329 endif
331 endef
333 # vim: set noet sw=4: