bump product version to 4.2.0.1
[LibreOffice.git] / solenv / gbuild / gbuild.mk
blob0796f8ba2541fb57ceafee6dcbaa219cb5346a65
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 # SOLARLIB
30 # UPD
32 # PTHREAD_CFLAGS (Linux)
33 # SYSTEM_ICU (Linux)
34 # SYSTEM_JPEG (Linux)
35 # SYSTEM_LIBXML (Linux)
37 .DELETE_ON_ERROR:
39 # do not use built-in rules
40 # DO NOT TOUCH THIS LINE UNLESS YOU REALLY KNOW WHAT YOU ARE DOING
41 # REMOVING THIS MAKES e.g. MODULE SW ALONE SLOWER BY SOME 300%
42 # FOR TAIL_BUILD THE IMPACT IS HUGE!
43 # (unless you are doing make -r, which we should explicitly NOT require from
44 # users)
45 MAKEFLAGS += r
46 .SUFFIXES:
48 # by default gbuild use /bin/sh
49 # if you want to use a particular shell
50 # you can export gb_SHELL=<path_to_shell>
53 ifdef gb_SHELL
54 SHELL := $(gb_SHELL)
55 else
56 SHELL := /bin/sh
57 endif
59 true := T
60 false :=
61 define NEWLINE
64 endef
66 define WHITESPACE
68 endef
70 COMMA :=,
72 CLOSE_PAREN :=)
74 include $(GBUILDDIR)/Helper.mk
76 # optional extensions that should never be essential
77 ifneq ($(wildcard $(GBUILDDIR)/extensions/pre_*.mk),)
78 include $(wildcard $(GBUILDDIR)/extensions/pre_*.mk)
79 endif
81 include $(GBUILDDIR)/Output.mk
83 gb_TIMELOG := 0
84 ifneq ($(strip $(TIMELOG)$(timelog)),)
85 gb_TIMELOG := 1
86 endif
88 ifneq ($(ENABLE_DBGUTIL),)
89 gb_ENABLE_DBGUTIL := $(true)
90 else
91 gb_ENABLE_DBGUTIL := $(false)
92 endif
94 gb_DEBUGLEVEL := 0
95 ifneq ($(strip $(DEBUG)),)
96 gb_DEBUGLEVEL := 1
97 # make DEBUG=true should force -g
98 ifeq ($(origin DEBUG),command line)
99 ENABLE_DEBUGINFO_FOR := all
100 endif
101 endif
102 ifneq ($(strip $(debug)),)
103 gb_DEBUGLEVEL := 1
104 ifeq ($(origin debug),command line)
105 ENABLE_DEBUGINFO_FOR := all
106 endif
107 endif
108 ifeq ($(gb_ENABLE_DBGUTIL),$(true))
109 gb_DEBUGLEVEL := 1
110 endif
112 ifneq ($(strip $(DBGLEVEL)),)
113 gb_DEBUGLEVEL := $(strip $(DBGLEVEL))
114 ifeq ($(origin DBGLEVEL),command line)
115 ENABLE_DEBUGINFO_FOR := all
116 endif
117 endif
118 ifneq ($(strip $(dbglevel)),)
119 gb_DEBUGLEVEL := $(strip $(dbglevel))
120 ifeq ($(origin dbglevel),command line)
121 ENABLE_DEBUGINFO_FOR := all
122 endif
123 endif
125 ifeq ($(HARDLINKDELIVER),TRUE)
126 gb_Deliver_HARDLINK := $(true)
127 endif
129 ifeq ($(or $(ENABLE_SYMBOLS),$(enable_symbols)),FALSE)
130 gb_SYMBOL := $(false)
131 else
132 ifneq ($(strip $(ENABLE_SYMBOLS)$(enable_symbols)),)
133 gb_SYMBOL := $(true)
134 endif
135 endif
137 ifneq ($(strip $(ENABLE_PCH)),)
138 gb_ENABLE_PCH := $(true)
139 else
140 gb_ENABLE_PCH := $(false)
141 endif
143 ifneq ($(nodep)$(ENABLE_PRINT_DEPS),)
144 gb_FULLDEPS := $(false)
145 else
146 gb_FULLDEPS := $(true)
147 endif
149 ifneq ($(strip $(patches)$(PATCHES)),)
150 gb_KEEP_PRISTINE := $(true)
151 else
152 gb_KEEP_PRISTINE := $(false)
153 endif
155 ifeq ($(findstring s,$(MAKEFLAGS)),)
156 gb_QUIET_EXTERNAL := $(false)
157 else
158 gb_QUIET_EXTERNAL := $(true)
159 endif
161 # save user-supplied flags for latter use
162 ifneq ($(strip $(ENVCFLAGS)),)
163 gb__ENV_CFLAGS := $(ENVCFLAGS)
164 endif
165 ifneq ($(strip $(ENVCFLAGSCXX)),)
166 gb__ENV_CXXFLAGS := $(ENVCFLAGSCXX)
167 endif
169 include $(GBUILDDIR)/ExternalExecutable.mk
170 include $(GBUILDDIR)/TargetLocations.mk
171 include $(GBUILDDIR)/Tempfile.mk
173 $(eval $(call gb_Helper_init_registries))
174 include $(SRCDIR)/Repository.mk
175 include $(SRCDIR)/RepositoryExternal.mk
176 $(eval $(call gb_Helper_collect_knownlibs))
178 gb_Library_DLLPOSTFIX := lo
180 # Include platform/cpu/compiler specific config/definitions
181 include $(GBUILDDIR)/platform/$(OS)_$(CPUNAME)_$(COM).mk
183 # this is optional
184 include $(SRCDIR)/RepositoryFixes.mk
186 # after platform; at least currently python depends on variable set in platform
187 $(eval $(call gb_ExternalExecutable_collect_registrations))
189 # add user-supplied flags
190 ifneq ($(strip gb__ENV_CFLAGS),)
191 gb_LinkTarget_CFLAGS += $(gb__ENV_CFLAGS)
192 endif
193 ifneq ($(strip gb__ENV_CXXFLAGS),)
194 gb_LinkTarget_CXXFLAGS += $(gb__ENV_CXXFLAGS)
195 endif
197 gb_CPUDEFS += -D$(CPUNAME)
199 gb_GLOBALDEFS := \
200 -D_REENTRANT \
201 -DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
202 -DSUPD=$(UPD) \
203 $(gb_OSDEFS) \
204 $(gb_COMPILERDEFS) \
205 $(gb_CPUDEFS) \
207 # This is used to detect whether LibreOffice is being built (as opposed to building
208 # 3rd-party code). Used for tag deprecation for API we want to
209 # ensure is not used at all externally while we clean
210 # out our internal usage, for code in sal/ that should be used only internally, etc.
211 gb_GLOBALDEFS += \
212 -DLIBO_INTERNAL_ONLY \
214 ifeq ($(gb_ENABLE_DBGUTIL),$(true))
215 gb_GLOBALDEFS += -DDBG_UTIL
217 ifneq ($(COM)-$(MSVC_USE_DEBUG_RUNTIME),MSC-)
218 gb_GLOBALDEFS += -D_DEBUG
219 endif
220 endif
222 ifeq ($(gb_TIMELOG),1)
223 gb_GLOBALDEFS += -DTIMELOG \
225 endif
227 ifeq ($(gb_DEBUGLEVEL),0)
228 gb_GLOBALDEFS += -DOPTIMIZE \
230 ifeq ($(strip $(ASSERT_ALWAYS_ABORT)),FALSE)
231 gb_GLOBALDEFS += -DNDEBUG \
233 endif
235 else
236 gb_GLOBALDEFS += -DSAL_LOG_INFO \
237 -DSAL_LOG_WARN \
239 ifneq ($(gb_DEBUGLEVEL),1) # 2 or more
240 gb_GLOBALDEFS += -DDEBUG \
242 endif
243 endif
245 ifeq ($(ENABLE_HEADLESS),TRUE)
246 gb_GLOBALDEFS += -DLIBO_HEADLESS \
248 endif
250 gb_GLOBALDEFS += \
251 $(call gb_Helper_define_if_set,\
252 DISABLE_DBCONNECTIVITY \
253 DISABLE_DYNLOADING \
254 DISABLE_EXPORT \
255 DISABLE_SCRIPTING \
256 ENABLE_LTO \
259 gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
261 gb_USER_INSTALLATION = $(call gb_Helper_make_url,$(TESTINSTALLDIR)/)
263 include $(GBUILDDIR)/Deliver.mk
265 $(eval $(call gb_Deliver_init))
267 # We are using a set of scopes that we might as well call classes.
269 # TODO: to what extent is the following still true?
270 # It is important to include them in the right order as that is
271 # -- at least in part -- defining precedence. This is not an issue in the
272 # WORKDIR as there are no nameing collisions there, but INSTDIR is a mess
273 # and precedence is important there. This is also platform dependant.
275 # This is less of an issue with GNU Make versions > 3.82 which matches for
276 # shortest stem instead of first match. However, upon intoduction this version
277 # is not available everywhere by default.
279 include $(foreach class, \
280 ComponentTarget \
281 Postprocess \
282 AllLangResTarget \
283 WinResTarget \
284 LinkTarget \
285 Library \
286 StaticLibrary \
287 Executable \
288 SdiTarget \
289 Package \
290 ExternalPackage \
291 CustomTarget \
292 ExternalProject \
293 Gallery \
294 Pagein \
295 PrecompiledHeaders \
296 Pyuno \
297 PythonTest \
298 Rdb \
299 CppunitTest \
300 Jar \
301 JavaClassSet \
302 JunitTest \
303 Module \
304 UIConfig \
305 UnoApiTarget \
306 UnoApi \
307 UnpackedTarball \
308 InternalUnoApi \
309 CliAssembly \
310 CliLibrary \
311 CliNativeLibrary \
312 CliUnoApi \
313 Zip \
314 AllLangPackage \
315 Configuration \
316 HelpTarget \
317 AllLangHelp \
318 Extension \
319 ExtensionPackage \
320 Dictionary \
321 InstallModuleTarget \
322 InstallModule \
323 InstallScript \
324 AutoInstall \
325 PackageSet \
326 GeneratedPackage \
327 ,$(GBUILDDIR)/$(class).mk)
329 $(eval $(call gb_Helper_process_executable_registrations))
330 $(eval $(call gb_Postprocess_make_targets))
332 # optional extensions that should never be essential
333 ifneq ($(wildcard $(GBUILDDIR)/extensions/post_*.mk),)
334 include $(wildcard $(GBUILDDIR)/extensions/post_*.mk)
335 endif
337 define gb_Extensions_final_hook
338 ifneq ($(wildcard $(GBUILDDIR)/extensions/final_*.mk),)
339 include $(wildcard $(GBUILDDIR)/extensions/final_*.mk)
340 endif
342 endef
344 # vim: set noet sw=4: