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