xref: /aoo42x/main/solenv/gbuild/gbuild.mk (revision d27c1a36)
17871dc3eSAndrew Rist#**************************************************************
27871dc3eSAndrew Rist#
37871dc3eSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
47871dc3eSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
57871dc3eSAndrew Rist#  distributed with this work for additional information
67871dc3eSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
77871dc3eSAndrew Rist#  to you under the Apache License, Version 2.0 (the
87871dc3eSAndrew Rist#  "License"); you may not use this file except in compliance
97871dc3eSAndrew Rist#  with the License.  You may obtain a copy of the License at
107871dc3eSAndrew Rist#
117871dc3eSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
127871dc3eSAndrew Rist#
137871dc3eSAndrew Rist#  Unless required by applicable law or agreed to in writing,
147871dc3eSAndrew Rist#  software distributed under the License is distributed on an
157871dc3eSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
167871dc3eSAndrew Rist#  KIND, either express or implied.  See the License for the
177871dc3eSAndrew Rist#  specific language governing permissions and limitations
187871dc3eSAndrew Rist#  under the License.
197871dc3eSAndrew Rist#
207871dc3eSAndrew Rist#**************************************************************
217871dc3eSAndrew Rist
227871dc3eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir# vars needed from the env/calling makefile
25cdf0e10cSrcweir
26cdf0e10cSrcweir# CVER
27cdf0e10cSrcweir# DEBUG
28cdf0e10cSrcweir# GBUILDDIR
29cdf0e10cSrcweir# INPATH
30cdf0e10cSrcweir# JAVA_HOME
31cdf0e10cSrcweir# JDKINCS
32cdf0e10cSrcweir# LIBXML_CFLAGS
33cdf0e10cSrcweir# OS
34cdf0e10cSrcweir# PRODUCT
35cdf0e10cSrcweir# SOLARINC
36cdf0e10cSrcweir# SOLARLIB
37cdf0e10cSrcweir# UPD
38cdf0e10cSrcweir
39cdf0e10cSrcweir# PTHREAD_CFLAGS (Linux)
40cdf0e10cSrcweir# SYSTEM_ICU (Linux)
41cdf0e10cSrcweir# SYSTEM_JPEG (Linux)
42cdf0e10cSrcweir# SYSTEM_LIBXML (Linux)
43cdf0e10cSrcweir# USE_SYSTEM_STL (Linux)
44cdf0e10cSrcweir
4562c6e450SYuri Darioifeq ($(OS),OS2)
4662c6e450SYuri DarioSHELL := /@unixroot/usr/bin/sh
4762c6e450SYuri Darioelse
48cdf0e10cSrcweirSHELL := /bin/sh
4962c6e450SYuri Darioendif
50cdf0e10cSrcweirtrue := T
51cdf0e10cSrcweirfalse :=
52cdf0e10cSrcweirdefine NEWLINE
53cdf0e10cSrcweir
54cdf0e10cSrcweir
55cdf0e10cSrcweirendef
56cdf0e10cSrcweir
57cdf0e10cSrcweirdefine WHITESPACE
58cdf0e10cSrcweir
59cdf0e10cSrcweirendef
60cdf0e10cSrcweir
61cdf0e10cSrcweirCOMMA :=,
62cdf0e10cSrcweir
63cdf0e10cSrcweir# optional extensions that should never be essential
64cdf0e10cSrcweirifneq ($(wildcard $(GBUILDDIR)/extensions/pre_*.mk),)
65cdf0e10cSrcweirinclude $(wildcard $(GBUILDDIR)/extensions/pre_*.mk)
66cdf0e10cSrcweirendif
67cdf0e10cSrcweir
68cdf0e10cSrcweirinclude $(GBUILDDIR)/Output.mk
69cdf0e10cSrcweir
70cdf0e10cSrcweir# BuildDirs uses the Output functions already
71cdf0e10cSrcweirinclude $(GBUILDDIR)/BuildDirs.mk
72cdf0e10cSrcweir
73cdf0e10cSrcweir
74cdf0e10cSrcweirifneq ($(strip $(PRODUCT)$(product)),)
75cdf0e10cSrcweirgb_PRODUCT := $(true)
76cdf0e10cSrcweirelse
77cdf0e10cSrcweirifneq ($(strip $(product)),)
78cdf0e10cSrcweirgb_PRODUCT := $(true)
79cdf0e10cSrcweirelse
80cdf0e10cSrcweirgb_PRODUCT := $(false)
81cdf0e10cSrcweirendif
82cdf0e10cSrcweirendif
83cdf0e10cSrcweir
84cdf0e10cSrcweirifneq ($(strip $(DEBUG)$(debug)),)
85cdf0e10cSrcweirgb_DEBUGLEVEL := 2
86cdf0e10cSrcweirelse
87cdf0e10cSrcweirifeq ($(gb_PRODUCT),$(true))
88cdf0e10cSrcweirgb_DEBUGLEVEL := 0
89cdf0e10cSrcweirelse
90cdf0e10cSrcweirgb_DEBUGLEVEL := 1
91cdf0e10cSrcweirendif
92cdf0e10cSrcweirendif
93cdf0e10cSrcweir
94cf91f1aeSDamjan Jovanovicifeq ($(gb_DEBUGLEVEL),2)
95cf91f1aeSDamjan Jovanovicgb_DEBUGGING := TRUE
96cf91f1aeSDamjan Jovanovicendif
97cf91f1aeSDamjan Jovanovic
98cf91f1aeSDamjan Jovanovicifeq ($(ENABLE_SYMBOLS),SMALL)
99cf91f1aeSDamjan Jovanovicgb_DEBUGGING := TRUE
100cf91f1aeSDamjan Jovanovicelse ifeq ($(ENABLE_SYMBOLS),TRUE)
101cf91f1aeSDamjan Jovanovicgb_DEBUGGING := TRUE
102cf91f1aeSDamjan Jovanovicendif
103cf91f1aeSDamjan Jovanovic
104cf91f1aeSDamjan Jovanovicifeq ($(ENABLE_CRASHDUMP),TRUE)
105cf91f1aeSDamjan Jovanovicgb_DEBUGGING := TRUE
106cf91f1aeSDamjan Jovanovicendif
107cf91f1aeSDamjan Jovanovic
108cdf0e10cSrcweirifneq ($(strip $(ENABLE_PCH)),)
109cdf0e10cSrcweirgb_ENABLE_PCH := $(true)
110cdf0e10cSrcweirelse
111cdf0e10cSrcweirgb_ENABLE_PCH := $(false)
112cdf0e10cSrcweirendif
113cdf0e10cSrcweir
114cdf0e10cSrcweir# for clean, setuplocal and removelocal goals we switch off dependencies
115cdf0e10cSrcweirifneq ($(filter cleanpackmodule clean setuplocal removelocal showdeliverables,$(MAKECMDGOALS)),)
116cdf0e10cSrcweirgb_FULLDEPS := $(false)
117cdf0e10cSrcweirelse
118cdf0e10cSrcweirgb_FULLDEPS := $(true)
119cdf0e10cSrcweirendif
120cdf0e10cSrcweir
121f006f9b4SDamjan Jovanovicgb_UDK_MAJOR := 3
122f006f9b4SDamjan Jovanovic
123cdf0e10cSrcweirinclude $(GBUILDDIR)/Helper.mk
124cdf0e10cSrcweirinclude $(GBUILDDIR)/TargetLocations.mk
125cdf0e10cSrcweir
126cdf0e10cSrcweir$(eval $(call gb_Helper_init_registries))
127cdf0e10cSrcweir$(eval $(call gb_Helper_add_repositories,$(gb_REPOS)))
128cdf0e10cSrcweir$(eval $(call gb_Helper_collect_libtargets))
129cdf0e10cSrcweir
130cdf0e10cSrcweirifeq ($(OS),LINUX)
131cdf0e10cSrcweirinclude $(GBUILDDIR)/platform/linux.mk
132cdf0e10cSrcweirelse
133cdf0e10cSrcweirifeq ($(OS),WNT)
134cdf0e10cSrcweirifneq ($(USE_MINGW),)
135cdf0e10cSrcweirinclude $(GBUILDDIR)/platform/winmingw.mk
136cdf0e10cSrcweirelse
137cdf0e10cSrcweirinclude $(GBUILDDIR)/platform/windows.mk
138cdf0e10cSrcweirendif
139cdf0e10cSrcweirelse
140cdf0e10cSrcweirifeq ($(OS),SOLARIS)
141cdf0e10cSrcweirinclude $(GBUILDDIR)/platform/solaris.mk
142cdf0e10cSrcweirelse
143cdf0e10cSrcweirifeq ($(OS),MACOSX)
144cdf0e10cSrcweirinclude $(GBUILDDIR)/platform/macosx.mk
145cdf0e10cSrcweirelse
146ead13252SPedro Giffuniifeq ($(OS),FREEBSD)
147ead13252SPedro Giffuniinclude $(GBUILDDIR)/platform/freebsd.mk
148ead13252SPedro Giffunielse
149f0a50dfaSPedro Giffuniifeq ($(OS),OS2)
150f0a50dfaSPedro Giffuniinclude $(GBUILDDIR)/platform/os2.mk
151f0a50dfaSPedro Giffunielse
152cdf0e10cSrcweir$(eval $(call gb_Output_error,Unsupported OS: $(OS)))
153cdf0e10cSrcweirendif
154cdf0e10cSrcweirendif
155cdf0e10cSrcweirendif
156cdf0e10cSrcweirendif
157ead13252SPedro Giffuniendif
158f0a50dfaSPedro Giffuniendif
159cdf0e10cSrcweir
160cdf0e10cSrcweirinclude $(GBUILDDIR)/Tempfile.mk
161cdf0e10cSrcweir
1622dbae2ddSMichael Stahl# this is optional
1632dbae2ddSMichael Stahl-include $(foreach repo,$(gb_REPOS),$(repo)/RepositoryFixes.mk)
164cdf0e10cSrcweir
165cdf0e10cSrcweir$(eval $(call gb_Helper_collect_knownlibs))
166cdf0e10cSrcweir
167cdf0e10cSrcweirgb_GLOBALDEFS := \
168cdf0e10cSrcweir	-D_REENTRANT \
169cdf0e10cSrcweir	-DCUI \
170cdf0e10cSrcweir	-DENABLE_LAYOUT_EXPERIMENTAL=0 \
171cdf0e10cSrcweir	-DENABLE_LAYOUT=0 \
172cdf0e10cSrcweir	-DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
173cdf0e10cSrcweir	-DSOLAR_JAVA \
174cdf0e10cSrcweir	-DSUPD=$(UPD) \
175cdf0e10cSrcweir	-DVCL \
176cdf0e10cSrcweir	$(gb_OSDEFS) \
177cdf0e10cSrcweir	$(gb_COMPILERDEFS) \
178cdf0e10cSrcweir	$(gb_CPUDEFS) \
179cdf0e10cSrcweir
180cdf0e10cSrcweirifeq ($(gb_PRODUCT),$(true))
181cdf0e10cSrcweirgb_GLOBALDEFS += \
182cdf0e10cSrcweir	-DPRODUCT \
183cdf0e10cSrcweir	-DPRODUCT_FULL \
184cdf0e10cSrcweir
185cdf0e10cSrcweirelse
186cdf0e10cSrcweirgb_GLOBALDEFS += \
187cdf0e10cSrcweir	-DDBG_UTIL \
188cdf0e10cSrcweir	-D_STLP_DEBUG \
189cdf0e10cSrcweir
190cdf0e10cSrcweirendif
191cdf0e10cSrcweir
192cdf0e10cSrcweirifeq ($(gb_DEBUGLEVEL),2)
193cdf0e10cSrcweirgb_GLOBALDEFS += \
194cdf0e10cSrcweir	-DDEBUG \
195cdf0e10cSrcweir
196cdf0e10cSrcweirelse
197cdf0e10cSrcweirgb_GLOBALDEFS += \
198cdf0e10cSrcweir	-DOPTIMIZE \
199cdf0e10cSrcweir	-DNDEBUG \
200cdf0e10cSrcweir
201cdf0e10cSrcweirendif
202cdf0e10cSrcweir
203cdf0e10cSrcweirifneq ($(strip $(ENABLE_GTK)),)
204cdf0e10cSrcweirgb_GLOBALDEFS += -DENABLE_GTK
205cdf0e10cSrcweirendif
206cdf0e10cSrcweir
207cdf0e10cSrcweirifneq ($(strip $(ENABLE_KDE)),)
208cdf0e10cSrcweirgb_GLOBALDEFS += -DENABLE_KDE
209cdf0e10cSrcweirendif
210cdf0e10cSrcweir
211cdf0e10cSrcweirifneq ($(strip $(ENABLE_KDE4)),)
212cdf0e10cSrcweirgb_GLOBALDEFS += -DENABLE_KDE4
213cdf0e10cSrcweirendif
214cdf0e10cSrcweir
215cdf0e10cSrcweirifeq ($(strip $(ENABLE_GRAPHITE)),TRUE)
216cdf0e10cSrcweirgb_GLOBALDEFS += -DENABLE_GRAPHITE
217cdf0e10cSrcweirendif
218cdf0e10cSrcweir
219*d27c1a36SDon Lewis# Required for correct Windows function call ABI for expat static library
220*d27c1a36SDon Lewisifeq ($(SYSTEM_EXPAT),NO)
221*d27c1a36SDon Lewisgb_GLOBALDEFS += -DXML_STATIC
222*d27c1a36SDon Lewisendif
223*d27c1a36SDon Lewis
224cdf0e10cSrcweirgb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
225cdf0e10cSrcweir
226cdf0e10cSrcweirinclude $(GBUILDDIR)/Deliver.mk
227cdf0e10cSrcweir
228cdf0e10cSrcweir$(eval $(call gb_Deliver_init))
229cdf0e10cSrcweir
230b63233d8Sdamjaninclude $(SOLARENV)/inc/minor.mk
231b63233d8Sdamjan
232cdf0e10cSrcweir# We are using a set of scopes that we might as well call classes.
233cdf0e10cSrcweir
234cdf0e10cSrcweir# It is important to include them in the right order as that is
235cdf0e10cSrcweir# -- at least in part -- defining precedence. This is not an issue in the
236cdf0e10cSrcweir# WORKDIR as there are no nameing collisions there, but OUTDIR is a mess
23786e1cf34SPedro Giffuni# and precedence is important there. This is also platform dependent.
238cdf0e10cSrcweir# For example:
239cdf0e10cSrcweir# $(OUTDIR)/bin/% for executables collides
240cdf0e10cSrcweir#	with $(OUTDIR)/bin/%.res for resources on unix
241cdf0e10cSrcweir# $(OUTDIR)/lib/%.lib collides
242cdf0e10cSrcweir#	on windows (static and dynamic libs)
243cdf0e10cSrcweir# $(OUTDIR)/xml/% for packageparts collides
244cdf0e10cSrcweir#	with $(OUTDIR)/xml/component/%.component for components
245cdf0e10cSrcweir# This is less of an issue with GNU Make versions > 3.82 which matches for
246cdf0e10cSrcweir# shortest stem instead of first match. However, upon intoduction this version
247cdf0e10cSrcweir# is not available everywhere by default.
248cdf0e10cSrcweir
249cdf0e10cSrcweirinclude $(foreach class, \
250cdf0e10cSrcweir	ComponentTarget \
251cdf0e10cSrcweir	AllLangResTarget \
252cdf0e10cSrcweir	WinResTarget \
253cdf0e10cSrcweir	LinkTarget \
254cdf0e10cSrcweir	Library \
255cdf0e10cSrcweir	StaticLibrary \
256cdf0e10cSrcweir	Executable \
257cdf0e10cSrcweir	SdiTarget \
258cdf0e10cSrcweir	Package \
259cdf0e10cSrcweir	CustomTarget \
260cdf0e10cSrcweir	PrecompiledHeaders \
261e75d772dSDamjan Jovanovic	GoogleTest \
26241f03cd9SDamjan Jovanovic	Ant \
263b63233d8Sdamjan	Jar \
264cdf0e10cSrcweir	JavaClassSet \
265cdf0e10cSrcweir	JunitTest \
266cdf0e10cSrcweir	Module \
267b63233d8Sdamjan	UnoApiTarget \
268b63233d8Sdamjan	Zip \
269cdf0e10cSrcweir,$(GBUILDDIR)/$(class).mk)
270cdf0e10cSrcweir
271cdf0e10cSrcweir# optional extensions that should never be essential
272cdf0e10cSrcweirifneq ($(wildcard $(GBUILDDIR)/extensions/post_*.mk),)
273cdf0e10cSrcweirinclude $(wildcard $(GBUILDDIR)/extensions/post_*.mk)
274cdf0e10cSrcweirendif
275cdf0e10cSrcweir
276cdf0e10cSrcweirifeq ($(SYSTEM_LIBXSLT),YES)
277cdf0e10cSrcweirgb_XSLTPROCTARGET :=
278cdf0e10cSrcweirgb_XSLTPROC := xsltproc
279cdf0e10cSrcweirelse
280cdf0e10cSrcweirgb_XSLTPROCTARGET := $(call gb_Executable_get_target,xsltproc)
281cdf0e10cSrcweirgb_XSLTPROC := $(gb_XSLTPROCPRECOMMAND) $(gb_XSLTPROCTARGET)
282cdf0e10cSrcweirendif
283cdf0e10cSrcweir
284cdf0e10cSrcweirexport gb_AWK
285cdf0e10cSrcweirexport gb_XSLTPROC
286b63233d8Sdamjanexport GBUILDDIR
287b63233d8Sdamjan# FIXME exporting SRCDIR seems kind of a hack
288b63233d8Sdamjanexport SRCDIR
289cdf0e10cSrcweir
290cdf0e10cSrcweir# vim: set noet sw=4 ts=4:
291