xref: /aoo41x/main/solenv/gbuild/gbuild.mk (revision 7871dc3e)
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# STLPORT_VER
38# UPD
39
40# GXX_INCLUDE_PATH (Linux)
41# PTHREAD_CFLAGS (Linux)
42# SYSTEM_ICU (Linux)
43# SYSTEM_JPEG (Linux)
44# SYSTEM_LIBXML (Linux)
45# USE_SYSTEM_STL (Linux)
46
47SHELL := /bin/sh
48true := T
49false :=
50define NEWLINE
51
52
53endef
54
55define WHITESPACE
56
57endef
58
59COMMA :=,
60
61# optional extensions that should never be essential
62ifneq ($(wildcard $(GBUILDDIR)/extensions/pre_*.mk),)
63include $(wildcard $(GBUILDDIR)/extensions/pre_*.mk)
64endif
65
66include $(GBUILDDIR)/Output.mk
67
68# BuildDirs uses the Output functions already
69include $(GBUILDDIR)/BuildDirs.mk
70
71
72ifneq ($(strip $(PRODUCT)$(product)),)
73gb_PRODUCT := $(true)
74else
75ifneq ($(strip $(product)),)
76gb_PRODUCT := $(true)
77else
78gb_PRODUCT := $(false)
79endif
80endif
81
82ifneq ($(strip $(DEBUG)$(debug)),)
83gb_DEBUGLEVEL := 2
84else
85ifeq ($(gb_PRODUCT),$(true))
86gb_DEBUGLEVEL := 0
87else
88gb_DEBUGLEVEL := 1
89endif
90endif
91
92ifneq ($(strip $(ENABLE_PCH)),)
93gb_ENABLE_PCH := $(true)
94else
95gb_ENABLE_PCH := $(false)
96endif
97
98# for clean, setuplocal and removelocal goals we switch off dependencies
99ifneq ($(filter cleanpackmodule clean setuplocal removelocal showdeliverables,$(MAKECMDGOALS)),)
100gb_FULLDEPS := $(false)
101else
102gb_FULLDEPS := $(true)
103endif
104
105include $(GBUILDDIR)/Helper.mk
106include $(GBUILDDIR)/TargetLocations.mk
107
108$(eval $(call gb_Helper_init_registries))
109$(eval $(call gb_Helper_add_repositories,$(gb_REPOS)))
110$(eval $(call gb_Helper_collect_libtargets))
111
112ifeq ($(OS),LINUX)
113include $(GBUILDDIR)/platform/linux.mk
114else
115ifeq ($(OS),WNT)
116ifneq ($(USE_MINGW),)
117include $(GBUILDDIR)/platform/winmingw.mk
118else
119include $(GBUILDDIR)/platform/windows.mk
120endif
121else
122ifeq ($(OS),SOLARIS)
123include $(GBUILDDIR)/platform/solaris.mk
124else
125ifeq ($(OS),MACOSX)
126include $(GBUILDDIR)/platform/macosx.mk
127else
128ifeq ($(OS),FREEBSD)
129include $(GBUILDDIR)/platform/freebsd.mk
130else
131ifeq ($(OS),OS2)
132include $(GBUILDDIR)/platform/os2.mk
133else
134$(eval $(call gb_Output_error,Unsupported OS: $(OS)))
135endif
136endif
137endif
138endif
139endif
140endif
141
142include $(GBUILDDIR)/Tempfile.mk
143
144# this is optional
145-include $(foreach repo,$(gb_REPOS),$(repo)/RepositoryFixes.mk)
146
147$(eval $(call gb_Helper_collect_knownlibs))
148
149gb_GLOBALDEFS := \
150	-D_REENTRANT \
151	-DCUI \
152	-DENABLE_LAYOUT_EXPERIMENTAL=0 \
153	-DENABLE_LAYOUT=0 \
154	-DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
155	-DSOLAR_JAVA \
156	-DSTLPORT_VERSION=$(STLPORT_VER) \
157	-DSUPD=$(UPD) \
158	-DVCL \
159	$(gb_OSDEFS) \
160	$(gb_COMPILERDEFS) \
161	$(gb_CPUDEFS) \
162
163ifeq ($(gb_PRODUCT),$(true))
164gb_GLOBALDEFS += \
165	-DPRODUCT \
166	-DPRODUCT_FULL \
167
168else
169gb_GLOBALDEFS += \
170	-DDBG_UTIL \
171	-D_STLP_DEBUG \
172	-D_DEBUG \
173
174endif
175
176ifeq ($(gb_DEBUGLEVEL),2)
177gb_GLOBALDEFS += \
178	-DDEBUG \
179
180else
181gb_GLOBALDEFS += \
182	-DOPTIMIZE \
183	-DNDEBUG \
184
185endif
186
187ifneq ($(strip $(ENABLE_GTK)),)
188gb_GLOBALDEFS += -DENABLE_GTK
189endif
190
191ifneq ($(strip $(ENABLE_KDE)),)
192gb_GLOBALDEFS += -DENABLE_KDE
193endif
194
195ifneq ($(strip $(ENABLE_KDE4)),)
196gb_GLOBALDEFS += -DENABLE_KDE4
197endif
198
199ifeq ($(strip $(ENABLE_GRAPHITE)),TRUE)
200gb_GLOBALDEFS += -DENABLE_GRAPHITE
201endif
202
203gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
204
205include $(GBUILDDIR)/Deliver.mk
206
207$(eval $(call gb_Deliver_init))
208
209# We are using a set of scopes that we might as well call classes.
210
211# It is important to include them in the right order as that is
212# -- at least in part -- defining precedence. This is not an issue in the
213# WORKDIR as there are no nameing collisions there, but OUTDIR is a mess
214# and precedence is important there. This is also platform dependant.
215# For example:
216# $(OUTDIR)/bin/% for executables collides
217#	with $(OUTDIR)/bin/%.res for resources on unix
218# $(OUTDIR)/lib/%.lib collides
219#	on windows (static and dynamic libs)
220# $(OUTDIR)/xml/% for packageparts collides
221#	with $(OUTDIR)/xml/component/%.component for components
222# This is less of an issue with GNU Make versions > 3.82 which matches for
223# shortest stem instead of first match. However, upon intoduction this version
224# is not available everywhere by default.
225
226include $(foreach class, \
227	ComponentTarget \
228	AllLangResTarget \
229	WinResTarget \
230	LinkTarget \
231	Library \
232	StaticLibrary \
233	Executable \
234	SdiTarget \
235	Package \
236	CustomTarget \
237	PrecompiledHeaders \
238	CppunitTest \
239	JavaClassSet \
240	JunitTest \
241	Module \
242,$(GBUILDDIR)/$(class).mk)
243
244# optional extensions that should never be essential
245ifneq ($(wildcard $(GBUILDDIR)/extensions/post_*.mk),)
246include $(wildcard $(GBUILDDIR)/extensions/post_*.mk)
247endif
248
249ifeq ($(SYSTEM_LIBXSLT),YES)
250gb_XSLTPROCTARGET :=
251gb_XSLTPROC := xsltproc
252else
253gb_XSLTPROCTARGET := $(call gb_Executable_get_target,xsltproc)
254gb_XSLTPROC := $(gb_XSLTPROCPRECOMMAND) $(gb_XSLTPROCTARGET)
255endif
256
257export gb_AWK
258export gb_XSLTPROC
259
260# vim: set noet sw=4 ts=4:
261