xref: /AOO42X/main/solenv/gbuild/gbuild.mk (revision 9cdf899530dec194946476d2272fd1a5a304c699)
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
95ifeq ($(gb_DEBUGLEVEL),2)
96gb_DEBUGGING := TRUE
97endif
98
99ifeq ($(ENABLE_SYMBOLS),SMALL)
100gb_DEBUGGING := TRUE
101else ifeq ($(ENABLE_SYMBOLS),TRUE)
102gb_DEBUGGING := TRUE
103endif
104
105ifeq ($(ENABLE_CRASHDUMP),TRUE)
106gb_DEBUGGING := TRUE
107endif
108
109ifneq ($(strip $(ENABLE_PCH)),)
110gb_ENABLE_PCH := $(true)
111else
112gb_ENABLE_PCH := $(false)
113endif
114
115# for clean, setuplocal and removelocal goals we switch off dependencies
116ifneq ($(filter cleanpackmodule clean setuplocal removelocal showdeliverables,$(MAKECMDGOALS)),)
117gb_FULLDEPS := $(false)
118else
119gb_FULLDEPS := $(true)
120endif
121
122include $(GBUILDDIR)/Helper.mk
123include $(GBUILDDIR)/TargetLocations.mk
124
125$(eval $(call gb_Helper_init_registries))
126$(eval $(call gb_Helper_add_repositories,$(gb_REPOS)))
127$(eval $(call gb_Helper_collect_libtargets))
128
129ifeq ($(OS),LINUX)
130include $(GBUILDDIR)/platform/linux.mk
131else
132ifeq ($(OS),WNT)
133ifneq ($(USE_MINGW),)
134include $(GBUILDDIR)/platform/winmingw.mk
135else
136include $(GBUILDDIR)/platform/windows.mk
137endif
138else
139ifeq ($(OS),SOLARIS)
140include $(GBUILDDIR)/platform/solaris.mk
141else
142ifeq ($(OS),MACOSX)
143include $(GBUILDDIR)/platform/macosx.mk
144else
145ifeq ($(OS),FREEBSD)
146include $(GBUILDDIR)/platform/freebsd.mk
147else
148ifeq ($(OS),OS2)
149include $(GBUILDDIR)/platform/os2.mk
150else
151$(eval $(call gb_Output_error,Unsupported OS: $(OS)))
152endif
153endif
154endif
155endif
156endif
157endif
158
159include $(GBUILDDIR)/Tempfile.mk
160
161# this is optional
162-include $(foreach repo,$(gb_REPOS),$(repo)/RepositoryFixes.mk)
163
164$(eval $(call gb_Helper_collect_knownlibs))
165
166gb_GLOBALDEFS := \
167    -D_REENTRANT \
168    -DCUI \
169    -DENABLE_LAYOUT_EXPERIMENTAL=0 \
170    -DENABLE_LAYOUT=0 \
171    -DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
172    -DSOLAR_JAVA \
173    -DSUPD=$(UPD) \
174    -DVCL \
175    $(gb_OSDEFS) \
176    $(gb_COMPILERDEFS) \
177    $(gb_CPUDEFS) \
178
179ifeq ($(gb_PRODUCT),$(true))
180gb_GLOBALDEFS += \
181    -DPRODUCT \
182    -DPRODUCT_FULL \
183
184else
185gb_GLOBALDEFS += \
186    -DDBG_UTIL \
187    -D_STLP_DEBUG \
188
189endif
190
191ifeq ($(gb_DEBUGLEVEL),2)
192gb_GLOBALDEFS += \
193    -DDEBUG \
194
195else
196gb_GLOBALDEFS += \
197    -DOPTIMIZE \
198    -DNDEBUG \
199
200endif
201
202ifneq ($(strip $(ENABLE_GTK)),)
203gb_GLOBALDEFS += -DENABLE_GTK
204endif
205
206ifneq ($(strip $(ENABLE_KDE)),)
207gb_GLOBALDEFS += -DENABLE_KDE
208endif
209
210ifneq ($(strip $(ENABLE_KDE4)),)
211gb_GLOBALDEFS += -DENABLE_KDE4
212endif
213
214ifeq ($(strip $(ENABLE_GRAPHITE)),TRUE)
215gb_GLOBALDEFS += -DENABLE_GRAPHITE
216endif
217
218gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
219
220include $(GBUILDDIR)/Deliver.mk
221
222$(eval $(call gb_Deliver_init))
223
224include $(SOLARENV)/inc/minor.mk
225
226# We are using a set of scopes that we might as well call classes.
227
228# It is important to include them in the right order as that is
229# -- at least in part -- defining precedence. This is not an issue in the
230# WORKDIR as there are no nameing collisions there, but OUTDIR is a mess
231# and precedence is important there. This is also platform dependent.
232# For example:
233# $(OUTDIR)/bin/% for executables collides
234#   with $(OUTDIR)/bin/%.res for resources on unix
235# $(OUTDIR)/lib/%.lib collides
236#   on windows (static and dynamic libs)
237# $(OUTDIR)/xml/% for packageparts collides
238#   with $(OUTDIR)/xml/component/%.component for components
239# This is less of an issue with GNU Make versions > 3.82 which matches for
240# shortest stem instead of first match. However, upon intoduction this version
241# is not available everywhere by default.
242
243include $(foreach class, \
244    ComponentTarget \
245    AllLangResTarget \
246    WinResTarget \
247    LinkTarget \
248    Library \
249    StaticLibrary \
250    Executable \
251    SdiTarget \
252    Package \
253    CustomTarget \
254    PrecompiledHeaders \
255    GoogleTest \
256    Jar \
257    JavaClassSet \
258    JunitTest \
259    Module \
260    UnoApiTarget \
261    Zip \
262,$(GBUILDDIR)/$(class).mk)
263
264# optional extensions that should never be essential
265ifneq ($(wildcard $(GBUILDDIR)/extensions/post_*.mk),)
266include $(wildcard $(GBUILDDIR)/extensions/post_*.mk)
267endif
268
269ifeq ($(SYSTEM_LIBXSLT),YES)
270gb_XSLTPROCTARGET :=
271gb_XSLTPROC := xsltproc
272else
273gb_XSLTPROCTARGET := $(call gb_Executable_get_target,xsltproc)
274gb_XSLTPROC := $(gb_XSLTPROCPRECOMMAND) $(gb_XSLTPROCTARGET)
275endif
276
277export gb_AWK
278export gb_XSLTPROC
279export GBUILDDIR
280# FIXME exporting SRCDIR seems kind of a hack
281export SRCDIR
282
283# vim: set noet sw=4 ts=4:
284