xref: /aoo41x/main/solenv/gbuild/gbuild.mk (revision f0a50dfa)
1cdf0e10cSrcweir#*************************************************************************
2cdf0e10cSrcweir#
3cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4cdf0e10cSrcweir#
5cdf0e10cSrcweir# Copyright 2000, 2011 Oracle and/or its affiliates.
6cdf0e10cSrcweir#
7cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite
8cdf0e10cSrcweir#
9cdf0e10cSrcweir# This file is part of OpenOffice.org.
10cdf0e10cSrcweir#
11cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify
12cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3
13cdf0e10cSrcweir# only, as published by the Free Software Foundation.
14cdf0e10cSrcweir#
15cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful,
16cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of
17cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details
19cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code).
20cdf0e10cSrcweir#
21cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License
22cdf0e10cSrcweir# version 3 along with OpenOffice.org.  If not, see
23cdf0e10cSrcweir# <http://www.openoffice.org/license.html>
24cdf0e10cSrcweir# for a copy of the LGPLv3 License.
25cdf0e10cSrcweir#
26cdf0e10cSrcweir#*************************************************************************
27cdf0e10cSrcweir
28cdf0e10cSrcweir# vars needed from the env/calling makefile
29cdf0e10cSrcweir
30cdf0e10cSrcweir# CVER
31cdf0e10cSrcweir# DEBUG
32cdf0e10cSrcweir# GBUILDDIR
33cdf0e10cSrcweir# INPATH
34cdf0e10cSrcweir# JAVA_HOME
35cdf0e10cSrcweir# JDKINCS
36cdf0e10cSrcweir# LIBXML_CFLAGS
37cdf0e10cSrcweir# OS
38cdf0e10cSrcweir# PRODUCT
39cdf0e10cSrcweir# SOLARINC
40cdf0e10cSrcweir# SOLARLIB
41cdf0e10cSrcweir# STLPORT_VER
42cdf0e10cSrcweir# UPD
43cdf0e10cSrcweir
44cdf0e10cSrcweir# GXX_INCLUDE_PATH (Linux)
45cdf0e10cSrcweir# PTHREAD_CFLAGS (Linux)
46cdf0e10cSrcweir# SYSTEM_ICU (Linux)
47cdf0e10cSrcweir# SYSTEM_JPEG (Linux)
48cdf0e10cSrcweir# SYSTEM_LIBXML (Linux)
49cdf0e10cSrcweir# USE_SYSTEM_STL (Linux)
50cdf0e10cSrcweir
51cdf0e10cSrcweirSHELL := /bin/sh
52cdf0e10cSrcweirtrue := T
53cdf0e10cSrcweirfalse :=
54cdf0e10cSrcweirdefine NEWLINE
55cdf0e10cSrcweir
56cdf0e10cSrcweir
57cdf0e10cSrcweirendef
58cdf0e10cSrcweir
59cdf0e10cSrcweirdefine WHITESPACE
60cdf0e10cSrcweir
61cdf0e10cSrcweirendef
62cdf0e10cSrcweir
63cdf0e10cSrcweirCOMMA :=,
64cdf0e10cSrcweir
65cdf0e10cSrcweir# optional extensions that should never be essential
66cdf0e10cSrcweirifneq ($(wildcard $(GBUILDDIR)/extensions/pre_*.mk),)
67cdf0e10cSrcweirinclude $(wildcard $(GBUILDDIR)/extensions/pre_*.mk)
68cdf0e10cSrcweirendif
69cdf0e10cSrcweir
70cdf0e10cSrcweirinclude $(GBUILDDIR)/Output.mk
71cdf0e10cSrcweir
72cdf0e10cSrcweir# BuildDirs uses the Output functions already
73cdf0e10cSrcweirinclude $(GBUILDDIR)/BuildDirs.mk
74cdf0e10cSrcweir
75cdf0e10cSrcweir
76cdf0e10cSrcweirifneq ($(strip $(PRODUCT)$(product)),)
77cdf0e10cSrcweirgb_PRODUCT := $(true)
78cdf0e10cSrcweirelse
79cdf0e10cSrcweirifneq ($(strip $(product)),)
80cdf0e10cSrcweirgb_PRODUCT := $(true)
81cdf0e10cSrcweirelse
82cdf0e10cSrcweirgb_PRODUCT := $(false)
83cdf0e10cSrcweirendif
84cdf0e10cSrcweirendif
85cdf0e10cSrcweir
86cdf0e10cSrcweirifneq ($(strip $(DEBUG)$(debug)),)
87cdf0e10cSrcweirgb_DEBUGLEVEL := 2
88cdf0e10cSrcweirelse
89cdf0e10cSrcweirifeq ($(gb_PRODUCT),$(true))
90cdf0e10cSrcweirgb_DEBUGLEVEL := 0
91cdf0e10cSrcweirelse
92cdf0e10cSrcweirgb_DEBUGLEVEL := 1
93cdf0e10cSrcweirendif
94cdf0e10cSrcweirendif
95cdf0e10cSrcweir
96cdf0e10cSrcweirifneq ($(strip $(ENABLE_PCH)),)
97cdf0e10cSrcweirgb_ENABLE_PCH := $(true)
98cdf0e10cSrcweirelse
99cdf0e10cSrcweirgb_ENABLE_PCH := $(false)
100cdf0e10cSrcweirendif
101cdf0e10cSrcweir
102cdf0e10cSrcweir# for clean, setuplocal and removelocal goals we switch off dependencies
103cdf0e10cSrcweirifneq ($(filter cleanpackmodule clean setuplocal removelocal showdeliverables,$(MAKECMDGOALS)),)
104cdf0e10cSrcweirgb_FULLDEPS := $(false)
105cdf0e10cSrcweirelse
106cdf0e10cSrcweirgb_FULLDEPS := $(true)
107cdf0e10cSrcweirendif
108cdf0e10cSrcweir
109cdf0e10cSrcweirinclude $(GBUILDDIR)/Helper.mk
110cdf0e10cSrcweirinclude $(GBUILDDIR)/TargetLocations.mk
111cdf0e10cSrcweir
112cdf0e10cSrcweir$(eval $(call gb_Helper_init_registries))
113cdf0e10cSrcweir$(eval $(call gb_Helper_add_repositories,$(gb_REPOS)))
114cdf0e10cSrcweir$(eval $(call gb_Helper_collect_libtargets))
115cdf0e10cSrcweir
116cdf0e10cSrcweirifeq ($(OS),LINUX)
117cdf0e10cSrcweirinclude $(GBUILDDIR)/platform/linux.mk
118cdf0e10cSrcweirelse
119cdf0e10cSrcweirifeq ($(OS),WNT)
120cdf0e10cSrcweirifneq ($(USE_MINGW),)
121cdf0e10cSrcweirinclude $(GBUILDDIR)/platform/winmingw.mk
122cdf0e10cSrcweirelse
123cdf0e10cSrcweirinclude $(GBUILDDIR)/platform/windows.mk
124cdf0e10cSrcweirendif
125cdf0e10cSrcweirelse
126cdf0e10cSrcweirifeq ($(OS),SOLARIS)
127cdf0e10cSrcweirinclude $(GBUILDDIR)/platform/solaris.mk
128cdf0e10cSrcweirelse
129cdf0e10cSrcweirifeq ($(OS),MACOSX)
130cdf0e10cSrcweirinclude $(GBUILDDIR)/platform/macosx.mk
131cdf0e10cSrcweirelse
132ead13252SPedro Giffuniifeq ($(OS),FREEBSD)
133ead13252SPedro Giffuniinclude $(GBUILDDIR)/platform/freebsd.mk
134ead13252SPedro Giffunielse
135*f0a50dfaSPedro Giffuniifeq ($(OS),OS2)
136*f0a50dfaSPedro Giffuniinclude $(GBUILDDIR)/platform/os2.mk
137*f0a50dfaSPedro Giffunielse
138cdf0e10cSrcweir$(eval $(call gb_Output_error,Unsupported OS: $(OS)))
139cdf0e10cSrcweirendif
140cdf0e10cSrcweirendif
141cdf0e10cSrcweirendif
142cdf0e10cSrcweirendif
143ead13252SPedro Giffuniendif
144*f0a50dfaSPedro Giffuniendif
145cdf0e10cSrcweir
146cdf0e10cSrcweirinclude $(GBUILDDIR)/Tempfile.mk
147cdf0e10cSrcweir
1482dbae2ddSMichael Stahl# this is optional
1492dbae2ddSMichael Stahl-include $(foreach repo,$(gb_REPOS),$(repo)/RepositoryFixes.mk)
150cdf0e10cSrcweir
151cdf0e10cSrcweir$(eval $(call gb_Helper_collect_knownlibs))
152cdf0e10cSrcweir
153cdf0e10cSrcweirgb_GLOBALDEFS := \
154cdf0e10cSrcweir	-D_REENTRANT \
155cdf0e10cSrcweir	-DCUI \
156cdf0e10cSrcweir	-DENABLE_LAYOUT_EXPERIMENTAL=0 \
157cdf0e10cSrcweir	-DENABLE_LAYOUT=0 \
158cdf0e10cSrcweir	-DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
159cdf0e10cSrcweir	-DSOLAR_JAVA \
160cdf0e10cSrcweir	-DSTLPORT_VERSION=$(STLPORT_VER) \
161cdf0e10cSrcweir	-DSUPD=$(UPD) \
162cdf0e10cSrcweir	-DVCL \
163cdf0e10cSrcweir	$(gb_OSDEFS) \
164cdf0e10cSrcweir	$(gb_COMPILERDEFS) \
165cdf0e10cSrcweir	$(gb_CPUDEFS) \
166cdf0e10cSrcweir
167cdf0e10cSrcweirifeq ($(gb_PRODUCT),$(true))
168cdf0e10cSrcweirgb_GLOBALDEFS += \
169cdf0e10cSrcweir	-DPRODUCT \
170cdf0e10cSrcweir	-DPRODUCT_FULL \
171cdf0e10cSrcweir
172cdf0e10cSrcweirelse
173cdf0e10cSrcweirgb_GLOBALDEFS += \
174cdf0e10cSrcweir	-DDBG_UTIL \
175cdf0e10cSrcweir	-D_STLP_DEBUG \
176cdf0e10cSrcweir	-D_DEBUG \
177cdf0e10cSrcweir
178cdf0e10cSrcweirendif
179cdf0e10cSrcweir
180cdf0e10cSrcweirifeq ($(gb_DEBUGLEVEL),2)
181cdf0e10cSrcweirgb_GLOBALDEFS += \
182cdf0e10cSrcweir	-DDEBUG \
183cdf0e10cSrcweir
184cdf0e10cSrcweirelse
185cdf0e10cSrcweirgb_GLOBALDEFS += \
186cdf0e10cSrcweir	-DOPTIMIZE \
187cdf0e10cSrcweir	-DNDEBUG \
188cdf0e10cSrcweir
189cdf0e10cSrcweirendif
190cdf0e10cSrcweir
191cdf0e10cSrcweirifneq ($(strip $(ENABLE_GTK)),)
192cdf0e10cSrcweirgb_GLOBALDEFS += -DENABLE_GTK
193cdf0e10cSrcweirendif
194cdf0e10cSrcweir
195cdf0e10cSrcweirifneq ($(strip $(ENABLE_KDE)),)
196cdf0e10cSrcweirgb_GLOBALDEFS += -DENABLE_KDE
197cdf0e10cSrcweirendif
198cdf0e10cSrcweir
199cdf0e10cSrcweirifneq ($(strip $(ENABLE_KDE4)),)
200cdf0e10cSrcweirgb_GLOBALDEFS += -DENABLE_KDE4
201cdf0e10cSrcweirendif
202cdf0e10cSrcweir
203cdf0e10cSrcweirifeq ($(strip $(ENABLE_GRAPHITE)),TRUE)
204cdf0e10cSrcweirgb_GLOBALDEFS += -DENABLE_GRAPHITE
205cdf0e10cSrcweirendif
206cdf0e10cSrcweir
207cdf0e10cSrcweirgb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
208cdf0e10cSrcweir
209cdf0e10cSrcweirinclude $(GBUILDDIR)/Deliver.mk
210cdf0e10cSrcweir
211cdf0e10cSrcweir$(eval $(call gb_Deliver_init))
212cdf0e10cSrcweir
213cdf0e10cSrcweir# We are using a set of scopes that we might as well call classes.
214cdf0e10cSrcweir
215cdf0e10cSrcweir# It is important to include them in the right order as that is
216cdf0e10cSrcweir# -- at least in part -- defining precedence. This is not an issue in the
217cdf0e10cSrcweir# WORKDIR as there are no nameing collisions there, but OUTDIR is a mess
218cdf0e10cSrcweir# and precedence is important there. This is also platform dependant.
219cdf0e10cSrcweir# For example:
220cdf0e10cSrcweir# $(OUTDIR)/bin/% for executables collides
221cdf0e10cSrcweir#	with $(OUTDIR)/bin/%.res for resources on unix
222cdf0e10cSrcweir# $(OUTDIR)/lib/%.lib collides
223cdf0e10cSrcweir#	on windows (static and dynamic libs)
224cdf0e10cSrcweir# $(OUTDIR)/xml/% for packageparts collides
225cdf0e10cSrcweir#	with $(OUTDIR)/xml/component/%.component for components
226cdf0e10cSrcweir# This is less of an issue with GNU Make versions > 3.82 which matches for
227cdf0e10cSrcweir# shortest stem instead of first match. However, upon intoduction this version
228cdf0e10cSrcweir# is not available everywhere by default.
229cdf0e10cSrcweir
230cdf0e10cSrcweirinclude $(foreach class, \
231cdf0e10cSrcweir	ComponentTarget \
232cdf0e10cSrcweir	AllLangResTarget \
233cdf0e10cSrcweir	WinResTarget \
234cdf0e10cSrcweir	LinkTarget \
235cdf0e10cSrcweir	Library \
236cdf0e10cSrcweir	StaticLibrary \
237cdf0e10cSrcweir	Executable \
238cdf0e10cSrcweir	SdiTarget \
239cdf0e10cSrcweir	Package \
240cdf0e10cSrcweir	CustomTarget \
241cdf0e10cSrcweir	PrecompiledHeaders \
242cdf0e10cSrcweir	CppunitTest \
243cdf0e10cSrcweir	JavaClassSet \
244cdf0e10cSrcweir	JunitTest \
245cdf0e10cSrcweir	Module \
246cdf0e10cSrcweir,$(GBUILDDIR)/$(class).mk)
247cdf0e10cSrcweir
248cdf0e10cSrcweir# optional extensions that should never be essential
249cdf0e10cSrcweirifneq ($(wildcard $(GBUILDDIR)/extensions/post_*.mk),)
250cdf0e10cSrcweirinclude $(wildcard $(GBUILDDIR)/extensions/post_*.mk)
251cdf0e10cSrcweirendif
252cdf0e10cSrcweir
253cdf0e10cSrcweirifeq ($(SYSTEM_LIBXSLT),YES)
254cdf0e10cSrcweirgb_XSLTPROCTARGET :=
255cdf0e10cSrcweirgb_XSLTPROC := xsltproc
256cdf0e10cSrcweirelse
257cdf0e10cSrcweirgb_XSLTPROCTARGET := $(call gb_Executable_get_target,xsltproc)
258cdf0e10cSrcweirgb_XSLTPROC := $(gb_XSLTPROCPRECOMMAND) $(gb_XSLTPROCTARGET)
259cdf0e10cSrcweirendif
260cdf0e10cSrcweir
261cdf0e10cSrcweirexport gb_AWK
262cdf0e10cSrcweirexport gb_XSLTPROC
263cdf0e10cSrcweir
264cdf0e10cSrcweir# vim: set noet sw=4 ts=4:
265