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
32 # PTHREAD_CFLAGS (Linux)
35 # SYSTEM_LIBXML (Linux)
39 # do not use built-in rules
40 # DO NOT TOUCH THIS LINE UNLESS YOU REALLY KNOW WHAT YOU ARE DOING
41 # REMOVING THIS MAKES e.g. MODULE SW ALONE SLOWER BY SOME 300%
42 # FOR TAIL_BUILD THE IMPACT IS HUGE!
43 # (unless you are doing make -r, which we should explicitly NOT require from
48 # by default gbuild use /bin/sh
49 # if you want to use a particular shell
50 # you can export gb_SHELL=<path_to_shell>
74 include $(GBUILDDIR
)/Helper.mk
76 # optional extensions that should never be essential
77 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/pre_
*.mk
),)
78 include $(wildcard $(GBUILDDIR
)/extensions
/pre_
*.mk
)
81 include $(GBUILDDIR
)/Output.mk
84 ifneq ($(strip $(TIMELOG
)$(timelog
)),)
88 ifneq ($(ENABLE_DBGUTIL
),)
89 gb_ENABLE_DBGUTIL
:= $(true
)
91 gb_ENABLE_DBGUTIL
:= $(false
)
95 ifneq ($(strip $(DEBUG
)),)
97 # make DEBUG=true should force -g
98 ifeq ($(origin DEBUG
),command line
)
99 ENABLE_DEBUGINFO_FOR
:= all
102 ifneq ($(strip $(debug
)),)
104 ifeq ($(origin debug
),command line
)
105 ENABLE_DEBUGINFO_FOR
:= all
108 ifeq ($(gb_ENABLE_DBGUTIL
),$(true
))
112 ifneq ($(strip $(DBGLEVEL
)),)
113 gb_DEBUGLEVEL
:= $(strip $(DBGLEVEL
))
114 ifeq ($(origin DBGLEVEL
),command line
)
115 ENABLE_DEBUGINFO_FOR
:= all
118 ifneq ($(strip $(dbglevel
)),)
119 gb_DEBUGLEVEL
:= $(strip $(dbglevel
))
120 ifeq ($(origin dbglevel
),command line
)
121 ENABLE_DEBUGINFO_FOR
:= all
125 ifeq ($(HARDLINKDELIVER
),TRUE
)
126 gb_Deliver_HARDLINK
:= $(true
)
129 ifeq ($(or
$(ENABLE_SYMBOLS
),$(enable_symbols
)),FALSE
)
130 gb_SYMBOL
:= $(false
)
132 ifneq ($(strip $(ENABLE_SYMBOLS
)$(enable_symbols
)),)
137 ifneq ($(strip $(ENABLE_PCH
)),)
138 gb_ENABLE_PCH
:= $(true
)
140 gb_ENABLE_PCH
:= $(false
)
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
171 include $(GBUILDDIR
)/Tempfile.mk
173 $(eval
$(call gb_Helper_init_registries
))
174 include $(SRCDIR
)/Repository.mk
175 include $(SRCDIR
)/RepositoryExternal.mk
176 $(eval
$(call gb_Helper_collect_knownlibs
))
178 gb_Library_DLLPOSTFIX
:= lo
180 # Include platform/cpu/compiler specific config/definitions
181 include $(GBUILDDIR
)/platform
/$(OS
)_
$(CPUNAME
)_
$(COM
).mk
184 include $(SRCDIR
)/RepositoryFixes.mk
186 # after platform; at least currently python depends on variable set in platform
187 $(eval
$(call gb_ExternalExecutable_collect_registrations
))
189 # add user-supplied flags
190 ifneq ($(strip gb__ENV_CFLAGS
),)
191 gb_LinkTarget_CFLAGS
+= $(gb__ENV_CFLAGS
)
193 ifneq ($(strip gb__ENV_CXXFLAGS
),)
194 gb_LinkTarget_CXXFLAGS
+= $(gb__ENV_CXXFLAGS
)
197 gb_CPUDEFS
+= -D
$(CPUNAME
)
201 -DOSL_DEBUG_LEVEL
=$(gb_DEBUGLEVEL
) \
207 # This is used to detect whether LibreOffice is being built (as opposed to building
208 # 3rd-party code). Used for tag deprecation for API we want to
209 # ensure is not used at all externally while we clean
210 # out our internal usage, for code in sal/ that should be used only internally, etc.
212 -DLIBO_INTERNAL_ONLY \
214 ifeq ($(gb_ENABLE_DBGUTIL
),$(true
))
215 gb_GLOBALDEFS
+= -DDBG_UTIL
217 ifneq ($(COM
)-$(MSVC_USE_DEBUG_RUNTIME
),MSC-
)
218 gb_GLOBALDEFS
+= -D_DEBUG
222 ifeq ($(gb_TIMELOG
),1)
223 gb_GLOBALDEFS
+= -DTIMELOG \
227 ifeq ($(gb_DEBUGLEVEL
),0)
228 gb_GLOBALDEFS
+= -DOPTIMIZE \
230 ifeq ($(strip $(ASSERT_ALWAYS_ABORT
)),FALSE
)
231 gb_GLOBALDEFS
+= -DNDEBUG \
236 gb_GLOBALDEFS
+= -DSAL_LOG_INFO \
239 ifneq ($(gb_DEBUGLEVEL
),1) # 2 or more
240 gb_GLOBALDEFS
+= -DDEBUG \
245 ifeq ($(ENABLE_HEADLESS
),TRUE
)
246 gb_GLOBALDEFS
+= -DLIBO_HEADLESS \
251 $(call gb_Helper_define_if_set
,\
252 DISABLE_DBCONNECTIVITY \
259 gb_GLOBALDEFS
:= $(sort $(gb_GLOBALDEFS
))
261 gb_USER_INSTALLATION
= $(call gb_Helper_make_url
,$(TESTINSTALLDIR
)/)
263 include $(GBUILDDIR
)/Deliver.mk
265 $(eval
$(call gb_Deliver_init
))
267 # We are using a set of scopes that we might as well call classes.
269 # TODO: to what extent is the following still true?
270 # It is important to include them in the right order as that is
271 # -- at least in part -- defining precedence. This is not an issue in the
272 # WORKDIR as there are no nameing collisions there, but INSTDIR is a mess
273 # and precedence is important there. This is also platform dependant.
275 # This is less of an issue with GNU Make versions > 3.82 which matches for
276 # shortest stem instead of first match. However, upon intoduction this version
277 # is not available everywhere by default.
279 include $(foreach class
, \
321 InstallModuleTarget \
327 ,$(GBUILDDIR
)/$(class
).mk
)
329 $(eval
$(call gb_Helper_process_executable_registrations
))
330 $(eval
$(call gb_Postprocess_make_targets
))
332 # optional extensions that should never be essential
333 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/post_
*.mk
),)
334 include $(wildcard $(GBUILDDIR
)/extensions
/post_
*.mk
)
337 define gb_Extensions_final_hook
338 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/final_
*.mk
),)
339 include $(wildcard $(GBUILDDIR
)/extensions
/final_
*.mk
)
344 # vim: set noet sw=4: