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 ifeq ($(strip $(dbglevel
)),)
95 gb_ENABLE_SYMBOLS_FOR
:= $(ENABLE_SYMBOLS_FOR
)
97 # enable_symbols (presumably from the command line)
98 ifneq ($(strip $(enable_symbols
)),)
99 gb_ENABLE_SYMBOLS_FOR
:= $(enable_symbols
)
101 ifeq ($(origin debug
),command line
)
102 gb_ENABLE_SYMBOLS_FOR
:= all
104 ifeq ($(origin dbglevel
),command line
)
105 gb_ENABLE_SYMBOLS_FOR
:= all
108 # note: ENABLE_BREAKPAD turns on symbols
109 ifneq ($(strip $(ENABLE_BREAKPAD
)),)
110 gb_ENABLE_SYMBOLS_FOR
:= all
113 # handle special cases
114 ifeq ($(gb_ENABLE_SYMBOLS_FOR
),1)
115 gb_ENABLE_SYMBOLS_FOR
:= all
117 ifeq ($(gb_ENABLE_SYMBOLS_FOR
),0)
118 gb_ENABLE_SYMBOLS_FOR
:=
120 ifeq ($(gb_ENABLE_SYMBOLS_FOR
),yes
)
121 gb_ENABLE_SYMBOLS_FOR
:= all
123 ifeq ($(gb_ENABLE_SYMBOLS_FOR
),no
)
124 gb_ENABLE_SYMBOLS_FOR
:=
127 # Detect whether symbols should be enabled for the given gbuild target.
128 # enable if: no "-TARGET" defined AND [module is enabled OR "TARGET" defined]
129 gb_target_symbols_enabled
= \
130 $(and
$(if
$(filter -$(1),$(ENABLE_SYMBOLS_FOR
)),,$(true
)),\
131 $(or
$(gb_Module_CURRENTMODULE_SYMBOLS_ENABLED
),\
132 $(filter $(1),$(ENABLE_SYMBOLS_FOR
))))
135 gb_ENABLE_PCH
:= $(ENABLE_PCH
)
137 # Setting BLOCK_PCH effectively disables PCH, but the extra object file will be still linked in.
138 # This is useful for rebuilding only some files with PCH disabled, e.g. to check #include's,
139 # disabling the whole ENABLE_PCH would lead to unresolved symbols at link time.
143 ifneq ($(nodep
)$(ENABLE_PRINT_DEPS
),)
144 gb_FULLDEPS
:= $(false
)
146 gb_FULLDEPS
:= $(true
)
149 ifneq ($(strip $(patches
)$(PATCHES
)),)
150 gb_KEEP_PRISTINE
:= $(true
)
152 gb_KEEP_PRISTINE
:= $(false
)
155 ifeq ($(findstring s
,$(MAKEFLAGS
)),)
156 gb_QUIET_EXTERNAL
:= $(false
)
158 gb_QUIET_EXTERNAL
:= $(true
)
161 # save user-supplied flags for latter use
162 ifneq ($(strip $(ENVCFLAGS
)),)
163 gb__ENV_CFLAGS
:= $(ENVCFLAGS
)
165 ifneq ($(strip $(ENVCFLAGSCXX
)),)
166 gb__ENV_CXXFLAGS
:= $(ENVCFLAGSCXX
)
169 include $(GBUILDDIR
)/ExternalExecutable.mk
170 include $(GBUILDDIR
)/TargetLocations.mk
173 $(file
>$(1),$(2))$(1)
176 $(eval
$(call gb_Helper_init_registries
))
177 include $(SRCDIR
)/Repository.mk
178 include $(SRCDIR
)/RepositoryExternal.mk
179 $(eval
$(call gb_Helper_collect_knownlibs
))
181 gb_Library_DLLPOSTFIX
:= lo
184 gb_CONFIGURE_PLATFORMS
:= --build
=$(BUILD_PLATFORM
) --host
=$(HOST_PLATFORM
)
186 # Include platform/cpu/compiler specific config/definitions
188 include $(GBUILDDIR
)/platform
/$(OS
)_
$(CPUNAME
)_
$(COM
).mk
191 include $(SRCDIR
)/RepositoryFixes.mk
193 # after platform; at least currently python depends on variable set in platform
194 $(eval
$(call gb_ExternalExecutable_collect_registrations
))
196 # add user-supplied flags
197 ifneq ($(strip gb__ENV_CFLAGS
),)
198 gb_LinkTarget_CFLAGS
+= $(gb__ENV_CFLAGS
)
200 ifneq ($(strip gb__ENV_CXXFLAGS
),)
201 gb_LinkTarget_CXXFLAGS
+= $(gb__ENV_CXXFLAGS
)
204 gb_CPUDEFS
+= -D
$(CPUNAME
)
208 -DOSL_DEBUG_LEVEL
=$(dbglevel
) \
213 ifeq ($(ENABLE_DBGUTIL
),TRUE
)
214 gb_GLOBALDEFS
+= -DDBG_UTIL
216 ifneq ($(COM
)-$(MSVC_USE_DEBUG_RUNTIME
),MSC-
)
217 gb_GLOBALDEFS
+= -D_DEBUG
221 ifeq ($(gb_TIMELOG
),1)
222 gb_GLOBALDEFS
+= -DTIMELOG \
226 ifeq ($(strip $(ASSERT_ALWAYS_ABORT
)),FALSE
)
227 gb_GLOBALDEFS
+= -DNDEBUG \
231 ifeq ($(ENABLE_SAL_LOG
),TRUE
)
232 gb_GLOBALDEFS
+= -DSAL_LOG_INFO \
238 $(call gb_Helper_define_if_set
,\
242 gb_GLOBALDEFS
:= $(sort $(gb_GLOBALDEFS
))
244 # Common environment variables passed into all gb_*Test classes:
245 # * Cap the number of threads unittests use:
246 gb_TEST_ENV_VARS
:= MAX_CONCURRENCY
=4
247 # * Disable searching for certificates by default:
249 # see xmlsecurity/source/xmlsec/nss/nssinitializer.cxx for use
251 # a) If MOZILLA_CERTIFICATE_FOLDER is empty then LibreOffice autodetects
252 # the user's mozilla-descended application profile. To disable that we
253 # use a non-empty string here.
255 # b) Using dbm: appears to nss as equivalent to an empty path so the
256 # initial NSS_InitReadWrite will fail. In response to that failure
257 # LibreOffice will create a temp fallback cert database which is removed
259 gb_TEST_ENV_VARS
+= MOZILLA_CERTIFICATE_FOLDER
=dbm
:
260 # Avoid hanging if the cups daemon requests a password:
261 gb_TEST_ENV_VARS
+= SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION
=1
262 ifeq (,$(SAL_USE_VCLPLUGIN
))
263 gb_TEST_ENV_VARS
+= SAL_USE_VCLPLUGIN
=svp
266 # This is used to detect whether LibreOffice is being built (as opposed to building
267 # 3rd-party code). Used for tag deprecation for API we want to
268 # ensure is not used at all externally while we clean
269 # out our internal usage, for code in sal/ that should be used only internally, etc.
270 gb_DEFS_INTERNAL
:= \
271 -DLIBO_INTERNAL_ONLY \
273 include $(GBUILDDIR
)/Deliver.mk
275 $(eval
$(call gb_Deliver_init
))
277 include $(GBUILDDIR
)/Trace.mk
279 # We are using a set of scopes that we might as well call classes.
281 # TODO: to what extent is the following still true?
282 # It is important to include them in the right order as that is
283 # -- at least in part -- defining precedence. This is not an issue in the
284 # WORKDIR as there are no naming collisions there, but INSTDIR is a mess
285 # and precedence is important there. This is also platform dependent.
287 # This is less of an issue with GNU Make versions > 3.82 which matches for
288 # shortest stem instead of first match. However, upon introduction this version
289 # is not available everywhere by default.
291 include $(foreach class
, \
334 InstallModuleTarget \
341 ,$(GBUILDDIR
)/$(class
).mk
)
343 $(eval
$(call gb_Helper_process_executable_registrations
))
344 $(eval
$(call gb_Postprocess_make_targets
))
346 # optional extensions that should never be essential
347 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/post_
*.mk
),)
348 include $(wildcard $(GBUILDDIR
)/extensions
/post_
*.mk
)
351 define gb_Extensions_final_hook
352 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/final_
*.mk
),)
353 include $(wildcard $(GBUILDDIR
)/extensions
/final_
*.mk
)
359 ifneq ($(gb_ENABLE_PCH
),)
360 # CCACHE_SLOPPINESS should contain pch_defines,time_macros for PCHs.
361 gb_CCACHE_SLOPPINESS
:=
362 ifeq ($(shell test -z
"$$CCACHE_SLOPPINESS" && echo
1),1)
363 gb_CCACHE_SLOPPINESS
:= CCACHE_SLOPPINESS
=pch_defines
,time_macros
365 ifeq ($(shell echo
"$$CCACHE_SLOPPINESS" | grep
-q pch_defines | grep
-q time_macros
&& echo
1),1)
366 gb_CCACHE_SLOPPINESS
:= CCACHE_SLOPPINESS
=$CCACHE_SLOPPINESS:pch_defines
,time_macros
369 gb_COMPILER_SETUP
+= $(gb_CCACHE_SLOPPINESS
)
372 ifneq ($(CCACHE_DEPEND_MODE
),)
373 gb_COMPILER_SETUP
+= CCACHE_DEPEND
=1
377 mkdir
-p
$(@D
) && touch
$@
379 # vim: set noet sw=4: