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 include $(GBUILDDIR
)/Conditions.mk
73 include $(SRCDIR
)/solenv
/inc
/langlist.mk
75 # optional extensions that should never be essential
76 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/pre_
*.mk
),)
77 include $(wildcard $(GBUILDDIR
)/extensions
/pre_
*.mk
)
80 include $(GBUILDDIR
)/Output.mk
83 ifneq ($(strip $(TIMELOG
)$(timelog
)),)
87 ifneq ($(ENABLE_DBGUTIL
),)
88 gb_ENABLE_DBGUTIL
:= $(true
)
90 gb_ENABLE_DBGUTIL
:= $(false
)
93 gb_ENABLE_SYMBOLS_FOR
:= $(ENABLE_SYMBOLS_FOR
)
95 # ENABLE_SYMBOLS (presumably from the command line)
96 ifneq ($(strip $(ENABLE_SYMBOLS
)),)
97 gb_ENABLE_SYMBOLS_FOR
:= $(ENABLE_SYMBOLS
)
99 ifneq ($(strip $(enable_symbols
)),)
100 gb_ENABLE_SYMBOLS_FOR
:= $(enable_symbols
)
103 # note: ENABLE_BREAKPAD turns on symbols
104 ifneq ($(strip $(ENABLE_BREAKPAD
)),)
105 gb_ENABLE_SYMBOLS_FOR
:= all
109 ifneq ($(strip $(DEBUG
)),)
111 # make DEBUG=true should force -g
112 ifeq ($(origin DEBUG
),command line
)
113 gb_ENABLE_SYMBOLS_FOR
:= all
116 ifneq ($(strip $(debug
)),)
118 ifeq ($(origin debug
),command line
)
119 gb_ENABLE_SYMBOLS_FOR
:= all
122 ifeq ($(gb_ENABLE_DBGUTIL
),$(true
))
126 ifneq ($(strip $(DBGLEVEL
)),)
127 gb_DEBUGLEVEL
:= $(strip $(DBGLEVEL
))
128 ifeq ($(origin DBGLEVEL
),command line
)
129 gb_ENABLE_SYMBOLS_FOR
:= all
132 ifneq ($(strip $(dbglevel
)),)
133 gb_DEBUGLEVEL
:= $(strip $(dbglevel
))
134 ifeq ($(origin dbglevel
),command line
)
135 gb_ENABLE_SYMBOLS_FOR
:= all
139 # handle special cases
140 ifeq ($(gb_ENABLE_SYMBOLS_FOR
),1)
141 gb_ENABLE_SYMBOLS_FOR
:= all
143 ifeq ($(gb_ENABLE_SYMBOLS_FOR
),0)
144 gb_ENABLE_SYMBOLS_FOR
:=
146 ifeq ($(gb_ENABLE_SYMBOLS_FOR
),yes
)
147 gb_ENABLE_SYMBOLS_FOR
:= all
149 ifeq ($(gb_ENABLE_SYMBOLS_FOR
),no
)
150 gb_ENABLE_SYMBOLS_FOR
:=
153 # Detect whether symbols should be enabled for the given gbuild target.
154 # enable if: no "-TARGET" defined AND [module is enabled OR "TARGET" defined]
155 gb_target_symbols_enabled
= \
156 $(and
$(if
$(filter -$(1),$(ENABLE_SYMBOLS_FOR
)),,$(true
)),\
157 $(or
$(gb_Module_CURRENTMODULE_SYMBOLS_ENABLED
),\
158 $(filter $(1),$(ENABLE_SYMBOLS_FOR
))))
161 gb_ENABLE_PCH
:= $(ENABLE_PCH
)
163 # Setting BLOCK_PCH effectively disables PCH, but the extra object file will be still linked in.
164 # This is useful for rebuilding only some files with PCH disabled, e.g. to check #include's,
165 # disabling the whole ENABLE_PCH would lead to unresolved symbols at link time.
169 ifneq ($(nodep
)$(ENABLE_PRINT_DEPS
),)
170 gb_FULLDEPS
:= $(false
)
172 gb_FULLDEPS
:= $(true
)
175 ifneq ($(strip $(patches
)$(PATCHES
)),)
176 gb_KEEP_PRISTINE
:= $(true
)
178 gb_KEEP_PRISTINE
:= $(false
)
181 ifeq ($(findstring s
,$(MAKEFLAGS
)),)
182 gb_QUIET_EXTERNAL
:= $(false
)
184 gb_QUIET_EXTERNAL
:= $(true
)
187 # save user-supplied flags for latter use
188 ifneq ($(strip $(ENVCFLAGS
)),)
189 gb__ENV_CFLAGS
:= $(ENVCFLAGS
)
191 ifneq ($(strip $(ENVCFLAGSCXX
)),)
192 gb__ENV_CXXFLAGS
:= $(ENVCFLAGSCXX
)
195 include $(GBUILDDIR
)/ExternalExecutable.mk
196 include $(GBUILDDIR
)/TargetLocations.mk
199 $(file
>$(1),$(2))$(1)
202 $(eval
$(call gb_Helper_init_registries
))
203 include $(SRCDIR
)/Repository.mk
204 include $(SRCDIR
)/RepositoryExternal.mk
205 $(eval
$(call gb_Helper_collect_knownlibs
))
207 gb_Library_DLLPOSTFIX
:= lo
210 gb_CONFIGURE_PLATFORMS
:= --build
=$(BUILD_PLATFORM
) --host
=$(HOST_PLATFORM
)
212 # Include platform/cpu/compiler specific config/definitions
214 include $(GBUILDDIR
)/platform
/$(OS
)_
$(CPUNAME
)_
$(COM
).mk
217 include $(SRCDIR
)/RepositoryFixes.mk
219 # after platform; at least currently python depends on variable set in platform
220 $(eval
$(call gb_ExternalExecutable_collect_registrations
))
222 # add user-supplied flags
223 ifneq ($(strip gb__ENV_CFLAGS
),)
224 gb_LinkTarget_CFLAGS
+= $(gb__ENV_CFLAGS
)
226 ifneq ($(strip gb__ENV_CXXFLAGS
),)
227 gb_LinkTarget_CXXFLAGS
+= $(gb__ENV_CXXFLAGS
)
230 gb_CPUDEFS
+= -D
$(CPUNAME
)
234 -DOSL_DEBUG_LEVEL
=$(gb_DEBUGLEVEL
) \
239 ifeq ($(gb_ENABLE_DBGUTIL
),$(true
))
240 gb_GLOBALDEFS
+= -DDBG_UTIL
242 ifneq ($(COM
)-$(MSVC_USE_DEBUG_RUNTIME
),MSC-
)
243 gb_GLOBALDEFS
+= -D_DEBUG
247 ifeq ($(gb_TIMELOG
),1)
248 gb_GLOBALDEFS
+= -DTIMELOG \
252 ifeq ($(strip $(ASSERT_ALWAYS_ABORT
)),FALSE
)
253 gb_GLOBALDEFS
+= -DNDEBUG \
257 ifeq ($(ENABLE_SAL_LOG
),TRUE
)
258 gb_GLOBALDEFS
+= -DSAL_LOG_INFO \
263 ifneq ($(gb_DEBUGLEVEL
),0)
264 ifneq ($(gb_DEBUGLEVEL
),1) # 2 or more
265 gb_GLOBALDEFS
+= -DDEBUG \
271 $(call gb_Helper_define_if_set
,\
275 gb_GLOBALDEFS
:= $(sort $(gb_GLOBALDEFS
))
277 # Common environment variables passed into all gb_*Test classes:
278 # * Cap the number of threads unittests use:
279 gb_TEST_ENV_VARS
:= MAX_CONCURRENCY
=4
280 # * Disable searching for certificates by default:
282 # see xmlsecurity/source/xmlsec/nss/nssinitializer.cxx for use
284 # a) If MOZILLA_CERTIFICATE_FOLDER is empty then LibreOffice autodetects
285 # the user's mozilla-descended application profile. To disable that we
286 # use a non-empty string here.
288 # b) Using dbm: appears to nss as equivalent to an empty path so the
289 # initial NSS_InitReadWrite will fail. In response to that failure
290 # LibreOffice will create a temp fallback cert database which is removed
292 gb_TEST_ENV_VARS
+= MOZILLA_CERTIFICATE_FOLDER
=dbm
:
293 # Avoid hanging if the cups daemon requests a password:
294 gb_TEST_ENV_VARS
+= SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION
=1
295 ifeq (,$(SAL_USE_VCLPLUGIN
))
296 gb_TEST_ENV_VARS
+= SAL_USE_VCLPLUGIN
=svp
299 # This is used to detect whether LibreOffice is being built (as opposed to building
300 # 3rd-party code). Used for tag deprecation for API we want to
301 # ensure is not used at all externally while we clean
302 # out our internal usage, for code in sal/ that should be used only internally, etc.
303 gb_DEFS_INTERNAL
:= \
304 -DLIBO_INTERNAL_ONLY \
306 include $(GBUILDDIR
)/Deliver.mk
308 $(eval
$(call gb_Deliver_init
))
310 include $(GBUILDDIR
)/Trace.mk
312 # We are using a set of scopes that we might as well call classes.
314 # TODO: to what extent is the following still true?
315 # It is important to include them in the right order as that is
316 # -- at least in part -- defining precedence. This is not an issue in the
317 # WORKDIR as there are no naming collisions there, but INSTDIR is a mess
318 # and precedence is important there. This is also platform dependent.
320 # This is less of an issue with GNU Make versions > 3.82 which matches for
321 # shortest stem instead of first match. However, upon introduction this version
322 # is not available everywhere by default.
324 include $(foreach class
, \
367 InstallModuleTarget \
374 ,$(GBUILDDIR
)/$(class
).mk
)
376 $(eval
$(call gb_Helper_process_executable_registrations
))
377 $(eval
$(call gb_Postprocess_make_targets
))
379 # optional extensions that should never be essential
380 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/post_
*.mk
),)
381 include $(wildcard $(GBUILDDIR
)/extensions
/post_
*.mk
)
384 define gb_Extensions_final_hook
385 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/final_
*.mk
),)
386 include $(wildcard $(GBUILDDIR
)/extensions
/final_
*.mk
)
392 ifneq ($(gb_ENABLE_PCH
),)
393 # CCACHE_SLOPPINESS should contain pch_defines,time_macros for PCHs.
394 gb_CCACHE_SLOPPINESS
:=
395 ifeq ($(shell test -z
"$$CCACHE_SLOPPINESS" && echo
1),1)
396 gb_CCACHE_SLOPPINESS
:= CCACHE_SLOPPINESS
=pch_defines
,time_macros
398 ifeq ($(shell echo
"$$CCACHE_SLOPPINESS" | grep
-q pch_defines | grep
-q time_macros
&& echo
1),1)
399 gb_CCACHE_SLOPPINESS
:= CCACHE_SLOPPINESS
=$CCACHE_SLOPPINESS:pch_defines
,time_macros
402 gb_COMPILER_SETUP
+= $(gb_CCACHE_SLOPPINESS
)
405 ifneq ($(CCACHE_DEPEND_MODE
),)
406 gb_COMPILER_SETUP
+= CCACHE_DEPEND
=1
409 # vim: set noet sw=4: