nss: upgrade to release 3.73
[LibreOffice.git] / solenv / gbuild / gbuild.mk
blob86ed3d32a376f7c4b2370c15af0d2d4c85a156fa
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 gb_not = $(if $(1),$(false),$(true))
51 define NEWLINE
54 endef
56 define WHITESPACE
58 endef
60 COMMA :=,
62 OPEN_PAREN :=(
63 CLOSE_PAREN :=)
65 gb_SPACE:=$(gb_SPACE) $(gb_SPACE)
67 gb_VERBOSE := $(verbose)
69 include $(GBUILDDIR)/Helper.mk
71 # optional extensions that should never be essential
72 ifneq ($(wildcard $(GBUILDDIR)/extensions/pre_*.mk),)
73 include $(wildcard $(GBUILDDIR)/extensions/pre_*.mk)
74 endif
76 include $(GBUILDDIR)/Output.mk
78 gb_TIMELOG := 0
79 ifneq ($(strip $(TIMELOG)$(timelog)),)
80 gb_TIMELOG := 1
81 endif
83 ifneq ($(ENABLE_DBGUTIL),)
84 gb_ENABLE_DBGUTIL := $(true)
85 else
86 gb_ENABLE_DBGUTIL := $(false)
87 endif
89 gb_ENABLE_SYMBOLS_FOR := $(ENABLE_SYMBOLS_FOR)
91 # ENABLE_SYMBOLS (presumably from the command line)
92 ifneq ($(strip $(ENABLE_SYMBOLS)),)
93 gb_ENABLE_SYMBOLS_FOR := $(ENABLE_SYMBOLS)
94 endif
95 ifneq ($(strip $(enable_symbols)),)
96 gb_ENABLE_SYMBOLS_FOR := $(enable_symbols)
97 endif
99 # note: ENABLE_BREAKPAD turns on symbols
100 ifneq ($(strip $(ENABLE_BREAKPAD)),)
101 gb_ENABLE_SYMBOLS_FOR := all
102 endif
104 gb_DEBUGLEVEL := 0
105 ifneq ($(strip $(DEBUG)),)
106 gb_DEBUGLEVEL := 1
107 # make DEBUG=true should force -g
108 ifeq ($(origin DEBUG),command line)
109 gb_ENABLE_SYMBOLS_FOR := all
110 endif
111 endif
112 ifneq ($(strip $(debug)),)
113 gb_DEBUGLEVEL := 1
114 ifeq ($(origin debug),command line)
115 gb_ENABLE_SYMBOLS_FOR := all
116 endif
117 endif
118 ifeq ($(gb_ENABLE_DBGUTIL),$(true))
119 gb_DEBUGLEVEL := 1
120 endif
122 ifneq ($(strip $(DBGLEVEL)),)
123 gb_DEBUGLEVEL := $(strip $(DBGLEVEL))
124 ifeq ($(origin DBGLEVEL),command line)
125 gb_ENABLE_SYMBOLS_FOR := all
126 endif
127 endif
128 ifneq ($(strip $(dbglevel)),)
129 gb_DEBUGLEVEL := $(strip $(dbglevel))
130 ifeq ($(origin dbglevel),command line)
131 gb_ENABLE_SYMBOLS_FOR := all
132 endif
133 endif
135 # handle special cases
136 ifeq ($(gb_ENABLE_SYMBOLS_FOR),1)
137 gb_ENABLE_SYMBOLS_FOR := all
138 endif
139 ifeq ($(gb_ENABLE_SYMBOLS_FOR),0)
140 gb_ENABLE_SYMBOLS_FOR :=
141 endif
142 ifeq ($(gb_ENABLE_SYMBOLS_FOR),yes)
143 gb_ENABLE_SYMBOLS_FOR := all
144 endif
145 ifeq ($(gb_ENABLE_SYMBOLS_FOR),no)
146 gb_ENABLE_SYMBOLS_FOR :=
147 endif
149 ifeq ($(BLOCK_PCH),)
150 gb_ENABLE_PCH := $(ENABLE_PCH)
151 else
152 # Setting BLOCK_PCH effectively disables PCH, but the extra object file will be still linked in.
153 # This is useful for rebuilding only some files with PCH disabled, e.g. to check #include's,
154 # disabling the whole ENABLE_PCH would lead to unresolved symbols at link time.
155 gb_ENABLE_PCH :=
156 endif
158 ifneq ($(nodep)$(ENABLE_PRINT_DEPS),)
159 gb_FULLDEPS := $(false)
160 else
161 gb_FULLDEPS := $(true)
162 endif
164 ifneq ($(strip $(patches)$(PATCHES)),)
165 gb_KEEP_PRISTINE := $(true)
166 else
167 gb_KEEP_PRISTINE := $(false)
168 endif
170 ifeq ($(findstring s,$(MAKEFLAGS)),)
171 gb_QUIET_EXTERNAL := $(false)
172 else
173 gb_QUIET_EXTERNAL := $(true)
174 endif
176 # save user-supplied flags for latter use
177 ifneq ($(strip $(ENVCFLAGS)),)
178 gb__ENV_CFLAGS := $(ENVCFLAGS)
179 endif
180 ifneq ($(strip $(ENVCFLAGSCXX)),)
181 gb__ENV_CXXFLAGS := $(ENVCFLAGSCXX)
182 endif
184 include $(GBUILDDIR)/ExternalExecutable.mk
185 include $(GBUILDDIR)/TargetLocations.mk
186 include $(GBUILDDIR)/Tempfile.mk
188 $(eval $(call gb_Helper_init_registries))
189 include $(SRCDIR)/Repository.mk
190 include $(SRCDIR)/RepositoryExternal.mk
191 $(eval $(call gb_Helper_collect_knownlibs))
193 gb_Library_DLLPOSTFIX := lo
195 # Include platform/cpu/compiler specific config/definitions
197 include $(GBUILDDIR)/platform/$(OS)_$(CPUNAME)_$(COM).mk
199 # this is optional
200 include $(SRCDIR)/RepositoryFixes.mk
202 # after platform; at least currently python depends on variable set in platform
203 $(eval $(call gb_ExternalExecutable_collect_registrations))
205 # add user-supplied flags
206 ifneq ($(strip gb__ENV_CFLAGS),)
207 gb_LinkTarget_CFLAGS += $(gb__ENV_CFLAGS)
208 endif
209 ifneq ($(strip gb__ENV_CXXFLAGS),)
210 gb_LinkTarget_CXXFLAGS += $(gb__ENV_CXXFLAGS)
211 endif
213 gb_CPUDEFS += -D$(CPUNAME)
215 gb_GLOBALDEFS := \
216 -D_REENTRANT \
217 -DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
218 $(gb_OSDEFS) \
219 $(gb_COMPILERDEFS) \
220 $(gb_CPUDEFS) \
222 ifeq ($(gb_ENABLE_DBGUTIL),$(true))
223 gb_GLOBALDEFS += -DDBG_UTIL
225 ifneq ($(COM)-$(MSVC_USE_DEBUG_RUNTIME),MSC-)
226 gb_GLOBALDEFS += -D_DEBUG
227 endif
228 endif
230 ifeq ($(gb_TIMELOG),1)
231 gb_GLOBALDEFS += -DTIMELOG \
233 endif
235 ifeq ($(strip $(ASSERT_ALWAYS_ABORT)),FALSE)
236 gb_GLOBALDEFS += -DNDEBUG \
238 endif
240 ifeq ($(ENABLE_SAL_LOG),TRUE)
241 gb_GLOBALDEFS += -DSAL_LOG_INFO \
242 -DSAL_LOG_WARN \
244 endif
246 ifneq ($(gb_DEBUGLEVEL),0)
247 ifneq ($(gb_DEBUGLEVEL),1) # 2 or more
248 gb_GLOBALDEFS += -DDEBUG \
250 endif
251 endif
253 gb_GLOBALDEFS += \
254 $(call gb_Helper_define_if_set,\
255 DISABLE_DYNLOADING \
258 gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
260 # Common environment variables passed into all gb_*Test classes:
261 # * Cap the number of threads unittests use:
262 gb_TEST_ENV_VARS := MAX_CONCURRENCY=4
263 # * Disable searching for certificates by default:
265 # see xmlsecurity/source/xmlsec/nss/nssinitializer.cxx for use
267 # a) If MOZILLA_CERTIFICATE_FOLDER is empty then LibreOffice autodetects
268 # the user's mozilla-decended application profile. To disable that we
269 # use a non-empty string here.
271 # b) Using dbm: appears to nss as equivalent to an empty path so the
272 # initial NSS_InitReadWrite will fail. In response to that failure
273 # LibreOffice will create a temp fallback cert database which is removed
274 # on process exit
275 gb_TEST_ENV_VARS += MOZILLA_CERTIFICATE_FOLDER=dbm:
276 # Avoid hanging if the cups daemon requests a password:
277 gb_TEST_ENV_VARS += SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION=1
278 ifeq (,$(SAL_USE_VCLPLUGIN))
279 gb_TEST_ENV_VARS += SAL_USE_VCLPLUGIN=svp
280 endif
282 # This is used to detect whether LibreOffice is being built (as opposed to building
283 # 3rd-party code). Used for tag deprecation for API we want to
284 # ensure is not used at all externally while we clean
285 # out our internal usage, for code in sal/ that should be used only internally, etc.
286 gb_DEFS_INTERNAL := \
287 -DLIBO_INTERNAL_ONLY \
289 include $(GBUILDDIR)/Deliver.mk
291 $(eval $(call gb_Deliver_init))
293 include $(GBUILDDIR)/Trace.mk
295 # We are using a set of scopes that we might as well call classes.
297 # TODO: to what extent is the following still true?
298 # It is important to include them in the right order as that is
299 # -- at least in part -- defining precedence. This is not an issue in the
300 # WORKDIR as there are no naming collisions there, but INSTDIR is a mess
301 # and precedence is important there. This is also platform dependent.
303 # This is less of an issue with GNU Make versions > 3.82 which matches for
304 # shortest stem instead of first match. However, upon introduction this version
305 # is not available everywhere by default.
307 include $(foreach class, \
308 ComponentTarget \
309 Postprocess \
310 AllLangMoTarget \
311 WinResTarget \
312 LinkTarget \
313 Library \
314 StaticLibrary \
315 Executable \
316 SdiTarget \
317 Package \
318 ExternalPackage \
319 CustomTarget \
320 ExternalProject \
321 Gallery \
322 Pagein \
323 PrecompiledHeaders \
324 Pyuno \
325 PythonTest \
326 UITest \
327 Rdb \
328 CppunitTest \
329 Jar \
330 JavaClassSet \
331 JunitTest \
332 Module \
333 UIConfig \
334 UnoApiTarget \
335 UnoApi \
336 UnpackedTarball \
337 InternalUnoApi \
338 CliAssembly \
339 CliLibrary \
340 CliNativeLibrary \
341 CliUnoApi \
342 Zip \
343 AllLangPackage \
344 Configuration \
345 HelpTarget \
346 AllLangHelp \
347 Extension \
348 ExtensionPackage \
349 Dictionary \
350 InstallModuleTarget \
351 InstallModule \
352 InstallScript \
353 AutoInstall \
354 PackageSet \
355 GeneratedPackage \
356 CompilerTest \
357 ,$(GBUILDDIR)/$(class).mk)
359 $(eval $(call gb_Helper_process_executable_registrations))
360 $(eval $(call gb_Postprocess_make_targets))
362 # optional extensions that should never be essential
363 ifneq ($(wildcard $(GBUILDDIR)/extensions/post_*.mk),)
364 include $(wildcard $(GBUILDDIR)/extensions/post_*.mk)
365 endif
367 define gb_Extensions_final_hook
368 ifneq ($(wildcard $(GBUILDDIR)/extensions/final_*.mk),)
369 include $(wildcard $(GBUILDDIR)/extensions/final_*.mk)
370 endif
372 endef
374 # vim: set noet sw=4: