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