xref: /trunk/main/solenv/gbuild/gbuild.mk (revision 78ecfec3)
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
121include $(GBUILDDIR)/Helper.mk
122include $(GBUILDDIR)/TargetLocations.mk
123
124$(eval $(call gb_Helper_init_registries))
125$(eval $(call gb_Helper_add_repositories,$(gb_REPOS)))
126$(eval $(call gb_Helper_collect_libtargets))
127
128ifeq ($(OS),LINUX)
129include $(GBUILDDIR)/platform/linux.mk
130else
131ifeq ($(OS),WNT)
132ifneq ($(USE_MINGW),)
133include $(GBUILDDIR)/platform/winmingw.mk
134else
135include $(GBUILDDIR)/platform/windows.mk
136endif
137else
138ifeq ($(OS),SOLARIS)
139include $(GBUILDDIR)/platform/solaris.mk
140else
141ifeq ($(OS),MACOSX)
142include $(GBUILDDIR)/platform/macosx.mk
143else
144ifeq ($(OS),FREEBSD)
145include $(GBUILDDIR)/platform/freebsd.mk
146else
147ifeq ($(OS),OS2)
148include $(GBUILDDIR)/platform/os2.mk
149else
150$(eval $(call gb_Output_error,Unsupported OS: $(OS)))
151endif
152endif
153endif
154endif
155endif
156endif
157
158include $(GBUILDDIR)/Tempfile.mk
159
160# this is optional
161-include $(foreach repo,$(gb_REPOS),$(repo)/RepositoryFixes.mk)
162
163$(eval $(call gb_Helper_collect_knownlibs))
164
165gb_GLOBALDEFS := \
166	-D_REENTRANT \
167	-DCUI \
168	-DENABLE_LAYOUT_EXPERIMENTAL=0 \
169	-DENABLE_LAYOUT=0 \
170	-DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
171	-DSOLAR_JAVA \
172	-DSUPD=$(UPD) \
173	-DVCL \
174	$(gb_OSDEFS) \
175	$(gb_COMPILERDEFS) \
176	$(gb_CPUDEFS) \
177
178ifeq ($(gb_PRODUCT),$(true))
179gb_GLOBALDEFS += \
180	-DPRODUCT \
181	-DPRODUCT_FULL \
182
183else
184gb_GLOBALDEFS += \
185	-DDBG_UTIL \
186	-D_STLP_DEBUG \
187
188endif
189
190ifeq ($(gb_DEBUGLEVEL),2)
191gb_GLOBALDEFS += \
192	-DDEBUG \
193
194else
195gb_GLOBALDEFS += \
196	-DOPTIMIZE \
197	-DNDEBUG \
198
199endif
200
201ifneq ($(strip $(ENABLE_GTK)),)
202gb_GLOBALDEFS += -DENABLE_GTK
203endif
204
205ifneq ($(strip $(ENABLE_KDE)),)
206gb_GLOBALDEFS += -DENABLE_KDE
207endif
208
209ifneq ($(strip $(ENABLE_KDE4)),)
210gb_GLOBALDEFS += -DENABLE_KDE4
211endif
212
213ifeq ($(strip $(ENABLE_GRAPHITE)),TRUE)
214gb_GLOBALDEFS += -DENABLE_GRAPHITE
215endif
216
217gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
218
219include $(GBUILDDIR)/Deliver.mk
220
221$(eval $(call gb_Deliver_init))
222
223include $(SOLARENV)/inc/minor.mk
224
225# We are using a set of scopes that we might as well call classes.
226
227# It is important to include them in the right order as that is
228# -- at least in part -- defining precedence. This is not an issue in the
229# WORKDIR as there are no nameing collisions there, but OUTDIR is a mess
230# and precedence is important there. This is also platform dependent.
231# For example:
232# $(OUTDIR)/bin/% for executables collides
233#	with $(OUTDIR)/bin/%.res for resources on unix
234# $(OUTDIR)/lib/%.lib collides
235#	on windows (static and dynamic libs)
236# $(OUTDIR)/xml/% for packageparts collides
237#	with $(OUTDIR)/xml/component/%.component for components
238# This is less of an issue with GNU Make versions > 3.82 which matches for
239# shortest stem instead of first match. However, upon intoduction this version
240# is not available everywhere by default.
241
242include $(foreach class, \
243	ComponentTarget \
244	AllLangResTarget \
245	WinResTarget \
246	LinkTarget \
247	Library \
248	StaticLibrary \
249	Executable \
250	SdiTarget \
251	Package \
252	CustomTarget \
253	PrecompiledHeaders \
254	GoogleTest \
255	Jar \
256	JavaClassSet \
257	JunitTest \
258	Module \
259	UnoApiTarget \
260	Zip \
261,$(GBUILDDIR)/$(class).mk)
262
263# optional extensions that should never be essential
264ifneq ($(wildcard $(GBUILDDIR)/extensions/post_*.mk),)
265include $(wildcard $(GBUILDDIR)/extensions/post_*.mk)
266endif
267
268ifeq ($(SYSTEM_LIBXSLT),YES)
269gb_XSLTPROCTARGET :=
270gb_XSLTPROC := xsltproc
271else
272gb_XSLTPROCTARGET := $(call gb_Executable_get_target,xsltproc)
273gb_XSLTPROC := $(gb_XSLTPROCPRECOMMAND) $(gb_XSLTPROCTARGET)
274endif
275
276export gb_AWK
277export gb_XSLTPROC
278export GBUILDDIR
279# FIXME exporting SRCDIR seems kind of a hack
280export SRCDIR
281
282# vim: set noet sw=4 ts=4:
283