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
31 # PTHREAD_CFLAGS (Linux)
33 # SYSTEM_LIBJPEG (Linux)
34 # SYSTEM_LIBXML (Linux)
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
49 gb_not
= $(if
$(1),$(false
),$(true
))
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
)
76 include $(GBUILDDIR
)/Output.mk
79 ifneq ($(strip $(TIMELOG
)$(timelog
)),)
83 ifneq ($(ENABLE_DBGUTIL
),)
84 gb_ENABLE_DBGUTIL
:= $(true
)
86 gb_ENABLE_DBGUTIL
:= $(false
)
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
)
95 ifneq ($(strip $(enable_symbols
)),)
96 gb_ENABLE_SYMBOLS_FOR
:= $(enable_symbols
)
99 # note: ENABLE_BREAKPAD turns on symbols
100 ifneq ($(strip $(ENABLE_BREAKPAD
)),)
101 gb_ENABLE_SYMBOLS_FOR
:= all
105 ifneq ($(strip $(DEBUG
)),)
107 # make DEBUG=true should force -g
108 ifeq ($(origin DEBUG
),command line
)
109 gb_ENABLE_SYMBOLS_FOR
:= all
112 ifneq ($(strip $(debug
)),)
114 ifeq ($(origin debug
),command line
)
115 gb_ENABLE_SYMBOLS_FOR
:= all
118 ifeq ($(gb_ENABLE_DBGUTIL
),$(true
))
122 ifneq ($(strip $(DBGLEVEL
)),)
123 gb_DEBUGLEVEL
:= $(strip $(DBGLEVEL
))
124 ifeq ($(origin DBGLEVEL
),command line
)
125 gb_ENABLE_SYMBOLS_FOR
:= all
128 ifneq ($(strip $(dbglevel
)),)
129 gb_DEBUGLEVEL
:= $(strip $(dbglevel
))
130 ifeq ($(origin dbglevel
),command line
)
131 gb_ENABLE_SYMBOLS_FOR
:= all
135 # handle special cases
136 ifeq ($(gb_ENABLE_SYMBOLS_FOR
),1)
137 gb_ENABLE_SYMBOLS_FOR
:= all
139 ifeq ($(gb_ENABLE_SYMBOLS_FOR
),0)
140 gb_ENABLE_SYMBOLS_FOR
:=
142 ifeq ($(gb_ENABLE_SYMBOLS_FOR
),yes
)
143 gb_ENABLE_SYMBOLS_FOR
:= all
145 ifeq ($(gb_ENABLE_SYMBOLS_FOR
),no
)
146 gb_ENABLE_SYMBOLS_FOR
:=
150 gb_ENABLE_PCH
:= $(ENABLE_PCH
)
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.
158 ifneq ($(nodep
)$(ENABLE_PRINT_DEPS
),)
159 gb_FULLDEPS
:= $(false
)
161 gb_FULLDEPS
:= $(true
)
164 ifneq ($(strip $(patches
)$(PATCHES
)),)
165 gb_KEEP_PRISTINE
:= $(true
)
167 gb_KEEP_PRISTINE
:= $(false
)
170 ifeq ($(findstring s
,$(MAKEFLAGS
)),)
171 gb_QUIET_EXTERNAL
:= $(false
)
173 gb_QUIET_EXTERNAL
:= $(true
)
176 # save user-supplied flags for latter use
177 ifneq ($(strip $(ENVCFLAGS
)),)
178 gb__ENV_CFLAGS
:= $(ENVCFLAGS
)
180 ifneq ($(strip $(ENVCFLAGSCXX
)),)
181 gb__ENV_CXXFLAGS
:= $(ENVCFLAGSCXX
)
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
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
)
209 ifneq ($(strip gb__ENV_CXXFLAGS
),)
210 gb_LinkTarget_CXXFLAGS
+= $(gb__ENV_CXXFLAGS
)
213 gb_CPUDEFS
+= -D
$(CPUNAME
)
217 -DOSL_DEBUG_LEVEL
=$(gb_DEBUGLEVEL
) \
222 ifeq ($(gb_ENABLE_DBGUTIL
),$(true
))
223 gb_GLOBALDEFS
+= -DDBG_UTIL
225 ifneq ($(COM
)-$(MSVC_USE_DEBUG_RUNTIME
),MSC-
)
226 gb_GLOBALDEFS
+= -D_DEBUG
230 ifeq ($(gb_TIMELOG
),1)
231 gb_GLOBALDEFS
+= -DTIMELOG \
235 ifeq ($(strip $(ASSERT_ALWAYS_ABORT
)),FALSE
)
236 gb_GLOBALDEFS
+= -DNDEBUG \
240 ifeq ($(ENABLE_SAL_LOG
),TRUE
)
241 gb_GLOBALDEFS
+= -DSAL_LOG_INFO \
246 ifneq ($(gb_DEBUGLEVEL
),0)
247 ifneq ($(gb_DEBUGLEVEL
),1) # 2 or more
248 gb_GLOBALDEFS
+= -DDEBUG \
254 $(call gb_Helper_define_if_set
,\
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
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
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
, \
350 InstallModuleTarget \
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
)
367 define gb_Extensions_final_hook
368 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/final_
*.mk
),)
369 include $(wildcard $(GBUILDDIR
)/extensions
/final_
*.mk
)
374 # vim: set noet sw=4: