bump product version to 4.1.6.2
[LibreOffice.git] / solenv / gbuild / gbuild.mk
blob27975228e6a9b7e64b90018c19b6fcd838a354df
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 # INPATH
26 # JAVA_HOME
27 # LIBXML_CFLAGS
28 # OS
29 # PRODUCT
30 # SOLARINC
31 # SOLARLIB
32 # UPD
34 # PTHREAD_CFLAGS (Linux)
35 # SYSTEM_ICU (Linux)
36 # SYSTEM_JPEG (Linux)
37 # SYSTEM_LIBXML (Linux)
39 .DELETE_ON_ERROR:
41 # do not use built-in rules
42 # DO NOT TOUCH THIS LINE UNLESS YOU REALLY KNOW WHAT YOU ARE DOING
43 # REMOVING THIS MAKES e.g. MODULE SW ALONE SLOWER BY SOME 300%
44 # FOR TAIL_BUILD THE IMPACT IS HUGE!
45 # (unless you are doing make -r, which we should explicitly NOT require from
46 # users)
47 MAKEFLAGS += r
48 .SUFFIXES:
50 # by default gbuild use /bin/sh
51 # if you want to use a particular shell
52 # you can export gb_SHELL=<path_to_shell>
55 ifdef gb_SHELL
56 SHELL := $(gb_SHELL)
57 else
58 SHELL := /bin/sh
59 endif
61 true := T
62 false :=
63 define NEWLINE
66 endef
68 define WHITESPACE
70 endef
72 COMMA :=,
74 CLOSE_PAREN :=)
76 include $(GBUILDDIR)/Helper.mk
78 # optional extensions that should never be essential
79 ifneq ($(wildcard $(GBUILDDIR)/extensions/pre_*.mk),)
80 include $(wildcard $(GBUILDDIR)/extensions/pre_*.mk)
81 endif
83 include $(GBUILDDIR)/Output.mk
85 gb_TIMELOG := 0
86 ifneq ($(strip $(TIMELOG)$(timelog)),)
87 gb_TIMELOG := 1
88 endif
90 # This used to be PRODUCT="" (for the same meaning as ENABLE_DBGUTIL="TRUE"),
91 # but the product meaning is now only confusing.
92 ifneq ($(ENABLE_DBGUTIL),)
93 gb_ENABLE_DBGUTIL := $(true)
94 else
95 gb_ENABLE_DBGUTIL := $(false)
96 endif
98 gb_DEBUGLEVEL := 0
99 ifneq ($(strip $(DEBUG)),)
100 gb_DEBUGLEVEL := 1
101 # make DEBUG=true should force -g
102 ifeq ($(origin DEBUG),command line)
103 ENABLE_DEBUGINFO_FOR := all
104 endif
105 endif
106 ifneq ($(strip $(debug)),)
107 gb_DEBUGLEVEL := 1
108 ifeq ($(origin debug),command line)
109 ENABLE_DEBUGINFO_FOR := all
110 endif
111 endif
112 ifeq ($(gb_ENABLE_DBGUTIL),$(true))
113 gb_DEBUGLEVEL := 1
114 endif
116 ifneq ($(strip $(DBGLEVEL)),)
117 gb_DEBUGLEVEL := $(strip $(DBGLEVEL))
118 ifeq ($(origin DBGLEVEL),command line)
119 ENABLE_DEBUGINFO_FOR := all
120 endif
121 endif
122 ifneq ($(strip $(dbglevel)),)
123 gb_DEBUGLEVEL := $(strip $(dbglevel))
124 ifeq ($(origin dbglevel),command line)
125 ENABLE_DEBUGINFO_FOR := all
126 endif
127 endif
129 ifeq ($(HARDLINKDELIVER),TRUE)
130 gb_Deliver_HARDLINK := $(true)
131 endif
133 ifeq ($(or $(ENABLE_SYMBOLS),$(enable_symbols)),FALSE)
134 gb_SYMBOL := $(false)
135 else
136 ifneq ($(strip $(ENABLE_SYMBOLS)$(enable_symbols)),)
137 gb_SYMBOL := $(true)
138 endif
139 endif
141 ifneq ($(strip $(ENABLE_PCH)),)
142 gb_ENABLE_PCH := $(true)
143 else
144 gb_ENABLE_PCH := $(false)
145 endif
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
177 $(eval $(call gb_Helper_init_registries))
178 include $(SRCDIR)/Repository.mk
179 include $(SRCDIR)/RepositoryExternal.mk
180 $(eval $(call gb_Helper_collect_knownlibs))
182 gb_Library_DLLPOSTFIX := lo
184 # Include platform/cpu/compiler specific config/definitions
185 include $(GBUILDDIR)/platform/$(OS)_$(CPUNAME)_$(COM).mk
187 # this is optional
188 include $(SRCDIR)/RepositoryFixes.mk
190 # after platform; at least currently python depends on variable set in platform
191 $(eval $(call gb_ExternalExecutable_collect_registrations))
193 # add user-supplied flags
194 ifneq ($(strip gb__ENV_CFLAGS),)
195 gb_LinkTarget_CFLAGS += $(gb__ENV_CFLAGS)
196 endif
197 ifneq ($(strip gb__ENV_CXXFLAGS),)
198 gb_LinkTarget_CXXFLAGS += $(gb__ENV_CXXFLAGS)
199 endif
201 gb_CPUDEFS += -D$(CPUNAME)
203 gb_GLOBALDEFS := \
204 -D_REENTRANT \
205 -DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
206 -DSUPD=$(UPD) \
207 $(gb_OSDEFS) \
208 $(gb_COMPILERDEFS) \
209 $(gb_CPUDEFS) \
211 # This is used to detect whether LibreOffice is being built (as opposed to building
212 # 3rd-party code). Used for tag deprecation for API we want to
213 # ensure is not used at all externally while we clean
214 # out our internal usage, for code in sal/ that should be used only internally, etc.
215 gb_GLOBALDEFS += \
216 -DLIBO_INTERNAL_ONLY \
218 ifeq ($(gb_ENABLE_DBGUTIL),$(true))
219 gb_GLOBALDEFS += -DDBG_UTIL
221 ifneq ($(COM)-$(MSVC_USE_DEBUG_RUNTIME),MSC-)
222 gb_GLOBALDEFS += -D_DEBUG
223 endif
224 endif
226 ifneq ($(strip $(SOLAR_JAVA)),)
227 gb_GLOBALDEFS += -DSOLAR_JAVA
228 endif
230 ifeq ($(gb_TIMELOG),1)
231 gb_GLOBALDEFS += -DTIMELOG \
233 endif
235 ifeq ($(gb_DEBUGLEVEL),0)
236 gb_GLOBALDEFS += -DOPTIMIZE \
238 ifeq ($(strip $(ASSERT_ALWAYS_ABORT)),FALSE)
239 gb_GLOBALDEFS += -DNDEBUG \
241 endif
243 else
244 gb_GLOBALDEFS += -DSAL_LOG_INFO \
245 -DSAL_LOG_WARN \
247 ifneq ($(gb_DEBUGLEVEL),1) # 2 or more
248 gb_GLOBALDEFS += -DDEBUG \
250 endif
251 endif
253 ifeq ($(ENABLE_HEADLESS),TRUE)
254 gb_GLOBALDEFS += -DLIBO_HEADLESS \
256 endif
258 gb_GLOBALDEFS += \
259 $(call gb_Helper_define_if_set,\
260 DISABLE_DBCONNECTIVITY \
261 DISABLE_DYNLOADING \
262 DISABLE_EXPORT \
263 DISABLE_SCRIPTING \
264 ENABLE_MACOSX_SANDBOX \
265 ENABLE_READONLY_INSTALLSET \
268 gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
270 ifeq ($(origin gb_RUNNABLE_INSTDIR),undefined)
271 gb_RUNNABLE_INSTDIR :=
272 endif
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 # It is important to include them in the right order as that is
281 # -- at least in part -- defining precedence. This is not an issue in the
282 # WORKDIR as there are no nameing collisions there, but OUTDIR is a mess
283 # and precedence is important there. This is also platform dependant.
284 # For example:
285 # $(OUTDIR)/bin/% for executables collides
286 # with $(OUTDIR)/bin/%.res for resources on unix
287 # $(OUTDIR)/lib/%.lib collides
288 # on windows (static and dynamic libs)
289 # $(OUTDIR)/xml/% for packageparts collides
290 # with $(OUTDIR)/xml/component/%.component for components
291 # This is less of an issue with GNU Make versions > 3.82 which matches for
292 # shortest stem instead of first match. However, upon intoduction this version
293 # is not available everywhere by default.
295 include $(foreach class, \
296 ComponentTarget \
297 AllLangResTarget \
298 WinResTarget \
299 LinkTarget \
300 Library \
301 StaticLibrary \
302 Executable \
303 SdiTarget \
304 Package \
305 ExternalPackage \
306 CustomTarget \
307 ExternalProject \
308 Gallery \
309 Pagein \
310 PrecompiledHeaders \
311 Pyuno \
312 PythonTest \
313 Rdb \
314 CppunitTest \
315 Jar \
316 JavaClassSet \
317 JunitTest \
318 Module \
319 UIConfig \
320 UnoApiTarget \
321 UnoApi \
322 UnpackedTarball \
323 InternalUnoApi \
324 CliAssembly \
325 CliLibrary \
326 CliNativeLibrary \
327 CliUnoApi \
328 Zip \
329 AllLangPackage \
330 Configuration \
331 HelpTarget \
332 AllLangHelp \
333 ExtensionTarget \
334 Dictionary \
335 Extension \
336 InstallModuleTarget \
337 InstallModule \
338 InstallScript \
339 AutoInstallLibs \
340 Postprocess \
341 PackageSet \
342 GeneratedPackage \
343 ,$(GBUILDDIR)/$(class).mk)
345 $(eval $(call gb_Helper_process_executable_registrations))
346 $(eval $(call gb_Postprocess_make_targets))
348 # optional extensions that should never be essential
349 ifneq ($(wildcard $(GBUILDDIR)/extensions/post_*.mk),)
350 include $(wildcard $(GBUILDDIR)/extensions/post_*.mk)
351 endif
353 define gb_Extensions_final_hook
354 ifneq ($(wildcard $(GBUILDDIR)/extensions/final_*.mk),)
355 include $(wildcard $(GBUILDDIR)/extensions/final_*.mk)
356 endif
358 endef
360 # vim: set noet sw=4: