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)
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
47 # by default gbuild use /bin/sh
48 # if you want to use a particular shell
49 # you can export gb_SHELL=<path_to_shell>
55 ifeq ($(OS_FOR_BUILD
),WNT
)
56 ifeq ($(GNUMAKE_WIN_NATIVE
),TRUE
)
57 SHELL
:= $(shell cygpath
-m
/bin
/sh
)
81 gb_VERBOSE
:= $(verbose
)$(VERBOSE
)
83 include $(GBUILDDIR
)/Helper.mk
85 # optional extensions that should never be essential
86 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/pre_
*.mk
),)
87 include $(wildcard $(GBUILDDIR
)/extensions
/pre_
*.mk
)
90 include $(GBUILDDIR
)/Output.mk
93 ifneq ($(strip $(TIMELOG
)$(timelog
)),)
97 ifneq ($(ENABLE_DBGUTIL
),)
98 gb_ENABLE_DBGUTIL
:= $(true
)
100 gb_ENABLE_DBGUTIL
:= $(false
)
104 ifneq ($(strip $(DEBUG
)),)
106 # make DEBUG=true should force -g
107 ifeq ($(origin DEBUG
),command line
)
108 ENABLE_DEBUGINFO_FOR
:= all
111 ifneq ($(strip $(debug
)),)
113 ifeq ($(origin debug
),command line
)
114 ENABLE_DEBUGINFO_FOR
:= all
117 ifeq ($(gb_ENABLE_DBGUTIL
),$(true
))
121 ifneq ($(strip $(DBGLEVEL
)),)
122 gb_DEBUGLEVEL
:= $(strip $(DBGLEVEL
))
123 ifeq ($(origin DBGLEVEL
),command line
)
124 ENABLE_DEBUGINFO_FOR
:= all
127 ifneq ($(strip $(dbglevel
)),)
128 gb_DEBUGLEVEL
:= $(strip $(dbglevel
))
129 ifeq ($(origin dbglevel
),command line
)
130 ENABLE_DEBUGINFO_FOR
:= all
134 ifeq ($(HARDLINKDELIVER
),TRUE
)
135 gb_Deliver_HARDLINK
:= $(true
)
138 # note: ENABLE_CRASHDUMP turns on gb_SYMBOL
139 ifeq ($(or
$(ENABLE_SYMBOLS
),$(enable_symbols
)),FALSE
)
140 gb_SYMBOL
:= $(false
)
142 ifneq ($(strip $(ENABLE_SYMBOLS
)$(enable_symbols
)$(ENABLE_CRASHDUMP
)),)
147 ifneq ($(strip $(ENABLE_PCH
)),)
148 gb_ENABLE_PCH
:= $(true
)
150 gb_ENABLE_PCH
:= $(false
)
153 ifneq ($(nodep
)$(ENABLE_PRINT_DEPS
),)
154 gb_FULLDEPS
:= $(false
)
156 gb_FULLDEPS
:= $(true
)
159 ifneq ($(strip $(patches
)$(PATCHES
)),)
160 gb_KEEP_PRISTINE
:= $(true
)
162 gb_KEEP_PRISTINE
:= $(false
)
165 ifeq ($(findstring s
,$(MAKEFLAGS
)),)
166 gb_QUIET_EXTERNAL
:= $(false
)
168 gb_QUIET_EXTERNAL
:= $(true
)
171 # save user-supplied flags for latter use
172 ifneq ($(strip $(ENVCFLAGS
)),)
173 gb__ENV_CFLAGS
:= $(ENVCFLAGS
)
175 ifneq ($(strip $(ENVCFLAGSCXX
)),)
176 gb__ENV_CXXFLAGS
:= $(ENVCFLAGSCXX
)
179 include $(GBUILDDIR
)/ExternalExecutable.mk
180 include $(GBUILDDIR
)/TargetLocations.mk
181 include $(GBUILDDIR
)/Tempfile.mk
183 $(eval
$(call gb_Helper_init_registries
))
184 include $(SRCDIR
)/Repository.mk
185 include $(SRCDIR
)/RepositoryExternal.mk
186 $(eval
$(call gb_Helper_collect_knownlibs
))
188 gb_Library_DLLPOSTFIX
:= lo
190 # Include platform/cpu/compiler specific config/definitions
191 include $(GBUILDDIR
)/platform
/$(OS
)_
$(CPUNAME
)_
$(COM
).mk
194 include $(SRCDIR
)/RepositoryFixes.mk
196 # after platform; at least currently python depends on variable set in platform
197 $(eval
$(call gb_ExternalExecutable_collect_registrations
))
199 # add user-supplied flags
200 ifneq ($(strip gb__ENV_CFLAGS
),)
201 gb_LinkTarget_CFLAGS
+= $(gb__ENV_CFLAGS
)
203 ifneq ($(strip gb__ENV_CXXFLAGS
),)
204 gb_LinkTarget_CXXFLAGS
+= $(gb__ENV_CXXFLAGS
)
207 gb_CPUDEFS
+= -D
$(CPUNAME
)
211 -DOSL_DEBUG_LEVEL
=$(gb_DEBUGLEVEL
) \
216 ifeq ($(gb_ENABLE_DBGUTIL
),$(true
))
217 gb_GLOBALDEFS
+= -DDBG_UTIL
219 ifneq ($(COM
)-$(MSVC_USE_DEBUG_RUNTIME
),MSC-
)
220 gb_GLOBALDEFS
+= -D_DEBUG
224 ifeq ($(gb_TIMELOG
),1)
225 gb_GLOBALDEFS
+= -DTIMELOG \
229 ifeq ($(gb_DEBUGLEVEL
),0)
230 gb_GLOBALDEFS
+= -DOPTIMIZE \
232 ifeq ($(strip $(ASSERT_ALWAYS_ABORT
)),FALSE
)
233 gb_GLOBALDEFS
+= -DNDEBUG \
237 ifeq ($(ENABLE_SAL_LOG
),TRUE
)
238 gb_GLOBALDEFS
+= -DSAL_LOG_INFO \
244 gb_GLOBALDEFS
+= -DSAL_LOG_INFO \
247 ifneq ($(gb_DEBUGLEVEL
),1) # 2 or more
248 gb_GLOBALDEFS
+= -DDEBUG \
253 ifeq ($(ENABLE_HEADLESS
),TRUE
)
254 gb_GLOBALDEFS
+= -DLIBO_HEADLESS \
259 $(call gb_Helper_define_if_set
,\
265 gb_GLOBALDEFS
:= $(sort $(gb_GLOBALDEFS
))
267 # This is used to detect whether LibreOffice is being built (as opposed to building
268 # 3rd-party code). Used for tag deprecation for API we want to
269 # ensure is not used at all externally while we clean
270 # out our internal usage, for code in sal/ that should be used only internally, etc.
271 gb_DEFS_INTERNAL
:= \
272 -DLIBO_INTERNAL_ONLY \
274 include $(GBUILDDIR
)/Deliver.mk
276 $(eval
$(call gb_Deliver_init
))
278 # We are using a set of scopes that we might as well call classes.
280 # TODO: to what extent is the following still true?
281 # It is important to include them in the right order as that is
282 # -- at least in part -- defining precedence. This is not an issue in the
283 # WORKDIR as there are no nameing collisions there, but INSTDIR is a mess
284 # and precedence is important there. This is also platform dependent.
286 # This is less of an issue with GNU Make versions > 3.82 which matches for
287 # shortest stem instead of first match. However, upon intoduction this version
288 # is not available everywhere by default.
290 include $(foreach class
, \
332 InstallModuleTarget \
338 ,$(GBUILDDIR
)/$(class
).mk
)
340 $(eval
$(call gb_Helper_process_executable_registrations
))
341 $(eval
$(call gb_Postprocess_make_targets
))
343 # optional extensions that should never be essential
344 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/post_
*.mk
),)
345 include $(wildcard $(GBUILDDIR
)/extensions
/post_
*.mk
)
348 define gb_Extensions_final_hook
349 ifneq ($(wildcard $(GBUILDDIR
)/extensions
/final_
*.mk
),)
350 include $(wildcard $(GBUILDDIR
)/extensions
/final_
*.mk
)
355 # vim: set noet sw=4: