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