xref: /trunk/main/solenv/gbuild/gbuild.mk (revision 190cb148)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24# vars needed from the env/calling makefile
25
26# CVER
27# DEBUG
28# GBUILDDIR
29# INPATH
30# JAVA_HOME
31# JDKINCS
32# LIBXML_CFLAGS
33# OS
34# PRODUCT
35# SOLARINC
36# SOLARLIB
37# UPD
38
39# PTHREAD_CFLAGS (Linux)
40# SYSTEM_ICU (Linux)
41# SYSTEM_JPEG (Linux)
42# SYSTEM_LIBXML (Linux)
43# USE_SYSTEM_STL (Linux)
44
45ifeq ($(OS),OS2)
46SHELL := /@unixroot/usr/bin/sh
47else
48SHELL := /bin/sh
49endif
50true := T
51false :=
52define NEWLINE
53
54
55endef
56
57define WHITESPACE
58
59endef
60
61COMMA :=,
62
63# optional extensions that should never be essential
64ifneq ($(wildcard $(GBUILDDIR)/extensions/pre_*.mk),)
65include $(wildcard $(GBUILDDIR)/extensions/pre_*.mk)
66endif
67
68include $(GBUILDDIR)/Output.mk
69
70# BuildDirs uses the Output functions already
71include $(GBUILDDIR)/BuildDirs.mk
72
73
74ifneq ($(strip $(PRODUCT)$(product)),)
75gb_PRODUCT := $(true)
76else
77ifneq ($(strip $(product)),)
78gb_PRODUCT := $(true)
79else
80gb_PRODUCT := $(false)
81endif
82endif
83
84ifneq ($(strip $(DEBUG)$(debug)),)
85gb_DEBUGLEVEL := 2
86else
87ifeq ($(gb_PRODUCT),$(true))
88gb_DEBUGLEVEL := 0
89else
90gb_DEBUGLEVEL := 1
91endif
92endif
93
94ifeq ($(gb_DEBUGLEVEL),2)
95gb_DEBUGGING := TRUE
96endif
97
98ifeq ($(ENABLE_SYMBOLS),SMALL)
99gb_DEBUGGING := TRUE
100else ifeq ($(ENABLE_SYMBOLS),TRUE)
101gb_DEBUGGING := TRUE
102endif
103
104ifeq ($(ENABLE_CRASHDUMP),TRUE)
105gb_DEBUGGING := TRUE
106endif
107
108ifneq ($(strip $(ENABLE_PCH)),)
109gb_ENABLE_PCH := $(true)
110else
111gb_ENABLE_PCH := $(false)
112endif
113
114# for clean, setuplocal and removelocal goals we switch off dependencies
115ifneq ($(filter cleanpackmodule clean setuplocal removelocal showdeliverables,$(MAKECMDGOALS)),)
116gb_FULLDEPS := $(false)
117else
118gb_FULLDEPS := $(true)
119endif
120
121gb_UDK_MAJOR := 3
122
123include $(GBUILDDIR)/Helper.mk
124include $(GBUILDDIR)/TargetLocations.mk
125
126$(eval $(call gb_Helper_init_registries))
127$(eval $(call gb_Helper_add_repositories,$(gb_REPOS)))
128$(eval $(call gb_Helper_collect_libtargets))
129
130ifeq ($(OS),LINUX)
131include $(GBUILDDIR)/platform/linux.mk
132else
133ifeq ($(OS),WNT)
134ifneq ($(USE_MINGW),)
135include $(GBUILDDIR)/platform/winmingw.mk
136else
137include $(GBUILDDIR)/platform/windows.mk
138endif
139else
140ifeq ($(OS),SOLARIS)
141include $(GBUILDDIR)/platform/solaris.mk
142else
143ifeq ($(OS),MACOSX)
144include $(GBUILDDIR)/platform/macosx.mk
145else
146ifeq ($(OS),FREEBSD)
147include $(GBUILDDIR)/platform/freebsd.mk
148else
149ifeq ($(OS),OS2)
150include $(GBUILDDIR)/platform/os2.mk
151else
152$(eval $(call gb_Output_error,Unsupported OS: $(OS)))
153endif
154endif
155endif
156endif
157endif
158endif
159
160include $(GBUILDDIR)/Tempfile.mk
161
162# this is optional
163-include $(foreach repo,$(gb_REPOS),$(repo)/RepositoryFixes.mk)
164
165$(eval $(call gb_Helper_collect_knownlibs))
166
167gb_GLOBALDEFS := \
168	-D_REENTRANT \
169	-DCUI \
170	-DENABLE_LAYOUT_EXPERIMENTAL=0 \
171	-DENABLE_LAYOUT=0 \
172	-DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
173	-DSOLAR_JAVA \
174	-DSUPD=$(UPD) \
175	-DVCL \
176	$(gb_OSDEFS) \
177	$(gb_COMPILERDEFS) \
178	$(gb_CPUDEFS) \
179
180ifeq ($(gb_PRODUCT),$(true))
181gb_GLOBALDEFS += \
182	-DPRODUCT \
183	-DPRODUCT_FULL \
184
185else
186gb_GLOBALDEFS += \
187	-DDBG_UTIL \
188	-D_STLP_DEBUG \
189
190endif
191
192ifeq ($(gb_DEBUGLEVEL),2)
193gb_GLOBALDEFS += \
194	-DDEBUG \
195
196else
197gb_GLOBALDEFS += \
198	-DOPTIMIZE \
199	-DNDEBUG \
200
201endif
202
203ifneq ($(strip $(ENABLE_GTK)),)
204gb_GLOBALDEFS += -DENABLE_GTK
205endif
206
207ifneq ($(strip $(ENABLE_KDE)),)
208gb_GLOBALDEFS += -DENABLE_KDE
209endif
210
211ifneq ($(strip $(ENABLE_KDE4)),)
212gb_GLOBALDEFS += -DENABLE_KDE4
213endif
214
215ifeq ($(strip $(ENABLE_GRAPHITE)),TRUE)
216gb_GLOBALDEFS += -DENABLE_GRAPHITE
217endif
218
219# Required for correct Windows function call ABI for expat static library
220ifeq ($(SYSTEM_EXPAT),NO)
221gb_GLOBALDEFS += -DXML_STATIC
222endif
223
224gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
225
226include $(GBUILDDIR)/Deliver.mk
227
228$(eval $(call gb_Deliver_init))
229
230include $(SOLARENV)/inc/minor.mk
231
232# We are using a set of scopes that we might as well call classes.
233
234# It is important to include them in the right order as that is
235# -- at least in part -- defining precedence. This is not an issue in the
236# WORKDIR as there are no nameing collisions there, but OUTDIR is a mess
237# and precedence is important there. This is also platform dependent.
238# For example:
239# $(OUTDIR)/bin/% for executables collides
240#	with $(OUTDIR)/bin/%.res for resources on unix
241# $(OUTDIR)/lib/%.lib collides
242#	on windows (static and dynamic libs)
243# $(OUTDIR)/xml/% for packageparts collides
244#	with $(OUTDIR)/xml/component/%.component for components
245# This is less of an issue with GNU Make versions > 3.82 which matches for
246# shortest stem instead of first match. However, upon intoduction this version
247# is not available everywhere by default.
248
249include $(foreach class, \
250	ComponentTarget \
251	AllLangResTarget \
252	WinResTarget \
253	LinkTarget \
254	Library \
255	StaticLibrary \
256	Executable \
257	SdiTarget \
258	Package \
259	CustomTarget \
260	PrecompiledHeaders \
261	GoogleTest \
262	Ant \
263	Jar \
264	JavaClassSet \
265	JunitTest \
266	Module \
267	UnoApiTarget \
268	Zip \
269,$(GBUILDDIR)/$(class).mk)
270
271# optional extensions that should never be essential
272ifneq ($(wildcard $(GBUILDDIR)/extensions/post_*.mk),)
273include $(wildcard $(GBUILDDIR)/extensions/post_*.mk)
274endif
275
276ifeq ($(SYSTEM_LIBXSLT),YES)
277gb_XSLTPROCTARGET :=
278gb_XSLTPROC := xsltproc
279else
280gb_XSLTPROCTARGET := $(call gb_Executable_get_target,xsltproc)
281gb_XSLTPROC := $(gb_XSLTPROCPRECOMMAND) $(gb_XSLTPROCTARGET)
282endif
283
284export gb_AWK
285export gb_XSLTPROC
286export GBUILDDIR
287# FIXME exporting SRCDIR seems kind of a hack
288export SRCDIR
289
290# vim: set noet sw=4 ts=4:
291