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
63 gb_VERBOSE
:= $(verbose
)
65 include $(GBUILDDIR
)/Helper.mk
67 # optional extensions that should never be essential
68 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/pre_
*.mk
),)
69 include $(wildcard $(GBUILDDIR
)/extensions
/pre_
*.mk
)
72 include $(GBUILDDIR
)/Output.mk
75 ifneq ($(strip $(TIMELOG
)$(timelog
)),)
79 ifneq ($(ENABLE_DBGUTIL
),)
80 gb_ENABLE_DBGUTIL
:= $(true
)
82 gb_ENABLE_DBGUTIL
:= $(false
)
86 ifneq ($(strip $(DEBUG
)),)
88 # make DEBUG=true should force -g
89 ifeq ($(origin DEBUG
),command line
)
90 ENABLE_DEBUGINFO_FOR
:= all
91 ENABLE_SYMBOLS
:= TRUE
94 ifneq ($(strip $(debug
)),)
96 ifeq ($(origin debug
),command line
)
97 ENABLE_DEBUGINFO_FOR
:= all
98 ENABLE_SYMBOLS
:= TRUE
101 ifeq ($(gb_ENABLE_DBGUTIL
),$(true
))
105 ifneq ($(strip $(DBGLEVEL
)),)
106 gb_DEBUGLEVEL
:= $(strip $(DBGLEVEL
))
107 ifeq ($(origin DBGLEVEL
),command line
)
108 ENABLE_DEBUGINFO_FOR
:= all
111 ifneq ($(strip $(dbglevel
)),)
112 gb_DEBUGLEVEL
:= $(strip $(dbglevel
))
113 ifeq ($(origin dbglevel
),command line
)
114 ENABLE_DEBUGINFO_FOR
:= all
118 # note: ENABLE_BREAKPAD turns on gb_SYMBOL
119 ifneq ($(strip $(ENABLE_SYMBOLS
)$(enable_symbols
)$(ENABLE_BREAKPAD
)),)
122 gb_SYMBOL
:= $(false
)
125 ifneq ($(strip $(ENABLE_PCH
)),)
126 gb_ENABLE_PCH
:= $(true
)
128 gb_ENABLE_PCH
:= $(false
)
131 ifneq ($(nodep
)$(ENABLE_PRINT_DEPS
),)
132 gb_FULLDEPS
:= $(false
)
134 gb_FULLDEPS
:= $(true
)
137 ifneq ($(strip $(patches
)$(PATCHES
)),)
138 gb_KEEP_PRISTINE
:= $(true
)
140 gb_KEEP_PRISTINE
:= $(false
)
143 ifeq ($(findstring s
,$(MAKEFLAGS
)),)
144 gb_QUIET_EXTERNAL
:= $(false
)
146 gb_QUIET_EXTERNAL
:= $(true
)
149 # save user-supplied flags for latter use
150 ifneq ($(strip $(ENVCFLAGS
)),)
151 gb__ENV_CFLAGS
:= $(ENVCFLAGS
)
153 ifneq ($(strip $(ENVCFLAGSCXX
)),)
154 gb__ENV_CXXFLAGS
:= $(ENVCFLAGSCXX
)
157 include $(GBUILDDIR
)/ExternalExecutable.mk
158 include $(GBUILDDIR
)/TargetLocations.mk
159 include $(GBUILDDIR
)/Tempfile.mk
161 $(eval
$(call gb_Helper_init_registries
))
162 include $(SRCDIR
)/Repository.mk
163 include $(SRCDIR
)/RepositoryExternal.mk
164 $(eval
$(call gb_Helper_collect_knownlibs
))
166 gb_Library_DLLPOSTFIX
:= lo
168 # Include platform/cpu/compiler specific config/definitions
169 include $(GBUILDDIR
)/platform
/$(OS
)_
$(CPUNAME
)_
$(COM
).mk
172 include $(SRCDIR
)/RepositoryFixes.mk
174 # after platform; at least currently python depends on variable set in platform
175 $(eval
$(call gb_ExternalExecutable_collect_registrations
))
177 # add user-supplied flags
178 ifneq ($(strip gb__ENV_CFLAGS
),)
179 gb_LinkTarget_CFLAGS
+= $(gb__ENV_CFLAGS
)
181 ifneq ($(strip gb__ENV_CXXFLAGS
),)
182 gb_LinkTarget_CXXFLAGS
+= $(gb__ENV_CXXFLAGS
)
185 gb_CPUDEFS
+= -D
$(CPUNAME
)
189 -DOSL_DEBUG_LEVEL
=$(gb_DEBUGLEVEL
) \
194 ifeq ($(gb_ENABLE_DBGUTIL
),$(true
))
195 gb_GLOBALDEFS
+= -DDBG_UTIL
197 ifneq ($(COM
)-$(MSVC_USE_DEBUG_RUNTIME
),MSC-
)
198 gb_GLOBALDEFS
+= -D_DEBUG
202 ifeq ($(gb_TIMELOG
),1)
203 gb_GLOBALDEFS
+= -DTIMELOG \
207 ifeq ($(gb_DEBUGLEVEL
),0)
209 ifeq ($(strip $(ASSERT_ALWAYS_ABORT
)),FALSE
)
210 gb_GLOBALDEFS
+= -DNDEBUG \
214 ifeq ($(ENABLE_SAL_LOG
),TRUE
)
215 gb_GLOBALDEFS
+= -DSAL_LOG_INFO \
221 gb_GLOBALDEFS
+= -DSAL_LOG_INFO \
224 ifneq ($(gb_DEBUGLEVEL
),1) # 2 or more
225 gb_GLOBALDEFS
+= -DDEBUG \
230 ifeq ($(ENABLE_HEADLESS
),TRUE
)
231 gb_GLOBALDEFS
+= -DLIBO_HEADLESS \
236 $(call gb_Helper_define_if_set
,\
241 gb_GLOBALDEFS
:= $(sort $(gb_GLOBALDEFS
))
243 # This is used to detect whether LibreOffice is being built (as opposed to building
244 # 3rd-party code). Used for tag deprecation for API we want to
245 # ensure is not used at all externally while we clean
246 # out our internal usage, for code in sal/ that should be used only internally, etc.
247 gb_DEFS_INTERNAL
:= \
248 -DLIBO_INTERNAL_ONLY \
250 include $(GBUILDDIR
)/Deliver.mk
252 $(eval
$(call gb_Deliver_init
))
254 # We are using a set of scopes that we might as well call classes.
256 # TODO: to what extent is the following still true?
257 # It is important to include them in the right order as that is
258 # -- at least in part -- defining precedence. This is not an issue in the
259 # WORKDIR as there are no naming collisions there, but INSTDIR is a mess
260 # and precedence is important there. This is also platform dependent.
262 # This is less of an issue with GNU Make versions > 3.82 which matches for
263 # shortest stem instead of first match. However, upon introduction this version
264 # is not available everywhere by default.
266 include $(foreach class
, \
309 InstallModuleTarget \
316 ,$(GBUILDDIR
)/$(class
).mk
)
318 $(eval
$(call gb_Helper_process_executable_registrations
))
319 $(eval
$(call gb_Postprocess_make_targets
))
321 # optional extensions that should never be essential
322 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/post_
*.mk
),)
323 include $(wildcard $(GBUILDDIR
)/extensions
/post_
*.mk
)
326 define gb_Extensions_final_hook
327 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/final_
*.mk
),)
328 include $(wildcard $(GBUILDDIR
)/extensions
/final_
*.mk
)
333 # vim: set noet sw=4: