xref: /aoo41x/main/solenv/gbuild/gbuild.mk (revision 2dbae2dd)
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2011 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28# vars needed from the env/calling makefile
29
30# CVER
31# DEBUG
32# GBUILDDIR
33# INPATH
34# JAVA_HOME
35# JDKINCS
36# LIBXML_CFLAGS
37# OS
38# PRODUCT
39# SOLARINC
40# SOLARLIB
41# STLPORT_VER
42# UPD
43
44# GXX_INCLUDE_PATH (Linux)
45# PTHREAD_CFLAGS (Linux)
46# SYSTEM_ICU (Linux)
47# SYSTEM_JPEG (Linux)
48# SYSTEM_LIBXML (Linux)
49# USE_SYSTEM_STL (Linux)
50
51SHELL := /bin/sh
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
132$(eval $(call gb_Output_error,Unsupported OS: $(OS)))
133endif
134endif
135endif
136endif
137
138include $(GBUILDDIR)/Tempfile.mk
139
140# this is optional
141-include $(foreach repo,$(gb_REPOS),$(repo)/RepositoryFixes.mk)
142
143$(eval $(call gb_Helper_collect_knownlibs))
144
145gb_GLOBALDEFS := \
146	-D_REENTRANT \
147	-DCUI \
148	-DENABLE_LAYOUT_EXPERIMENTAL=0 \
149	-DENABLE_LAYOUT=0 \
150	-DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
151	-DSOLAR_JAVA \
152	-DSTLPORT_VERSION=$(STLPORT_VER) \
153	-DSUPD=$(UPD) \
154	-DVCL \
155	$(gb_OSDEFS) \
156	$(gb_COMPILERDEFS) \
157	$(gb_CPUDEFS) \
158
159ifeq ($(gb_PRODUCT),$(true))
160gb_GLOBALDEFS += \
161	-DPRODUCT \
162	-DPRODUCT_FULL \
163
164else
165gb_GLOBALDEFS += \
166	-DDBG_UTIL \
167	-D_STLP_DEBUG \
168	-D_DEBUG \
169
170endif
171
172ifeq ($(gb_DEBUGLEVEL),2)
173gb_GLOBALDEFS += \
174	-DDEBUG \
175
176else
177gb_GLOBALDEFS += \
178	-DOPTIMIZE \
179	-DNDEBUG \
180
181endif
182
183ifneq ($(strip $(ENABLE_GTK)),)
184gb_GLOBALDEFS += -DENABLE_GTK
185endif
186
187ifneq ($(strip $(ENABLE_KDE)),)
188gb_GLOBALDEFS += -DENABLE_KDE
189endif
190
191ifneq ($(strip $(ENABLE_KDE4)),)
192gb_GLOBALDEFS += -DENABLE_KDE4
193endif
194
195ifeq ($(strip $(ENABLE_GRAPHITE)),TRUE)
196gb_GLOBALDEFS += -DENABLE_GRAPHITE
197endif
198
199gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
200
201include $(GBUILDDIR)/Deliver.mk
202
203$(eval $(call gb_Deliver_init))
204
205# We are using a set of scopes that we might as well call classes.
206
207# It is important to include them in the right order as that is
208# -- at least in part -- defining precedence. This is not an issue in the
209# WORKDIR as there are no nameing collisions there, but OUTDIR is a mess
210# and precedence is important there. This is also platform dependant.
211# For example:
212# $(OUTDIR)/bin/% for executables collides
213#	with $(OUTDIR)/bin/%.res for resources on unix
214# $(OUTDIR)/lib/%.lib collides
215#	on windows (static and dynamic libs)
216# $(OUTDIR)/xml/% for packageparts collides
217#	with $(OUTDIR)/xml/component/%.component for components
218# This is less of an issue with GNU Make versions > 3.82 which matches for
219# shortest stem instead of first match. However, upon intoduction this version
220# is not available everywhere by default.
221
222include $(foreach class, \
223	ComponentTarget \
224	AllLangResTarget \
225	WinResTarget \
226	LinkTarget \
227	Library \
228	StaticLibrary \
229	Executable \
230	SdiTarget \
231	Package \
232	CustomTarget \
233	PrecompiledHeaders \
234	CppunitTest \
235	JavaClassSet \
236	JunitTest \
237	Module \
238,$(GBUILDDIR)/$(class).mk)
239
240# optional extensions that should never be essential
241ifneq ($(wildcard $(GBUILDDIR)/extensions/post_*.mk),)
242include $(wildcard $(GBUILDDIR)/extensions/post_*.mk)
243endif
244
245ifeq ($(SYSTEM_LIBXSLT),YES)
246gb_XSLTPROCTARGET :=
247gb_XSLTPROC := xsltproc
248else
249gb_XSLTPROCTARGET := $(call gb_Executable_get_target,xsltproc)
250gb_XSLTPROC := $(gb_XSLTPROCPRECOMMAND) $(gb_XSLTPROCTARGET)
251endif
252
253export gb_AWK
254export gb_XSLTPROC
255
256# vim: set noet sw=4 ts=4:
257