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