VirtualBox

source: vbox/trunk/Config.kmk@ 3035

Last change on this file since 3035 was 3010, checked in by vboxsync, 17 years ago

backed out 21754

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 88.7 KB
Line 
1# $Id: Config.kmk 3010 2007-06-04 08:57:11Z vboxsync $
2## @file
3#
4# The global build configuration file for VBox.
5#
6# This file gets included by all makefiles through the
7# include $(PATH_KBUILD)/header.kmk statement.
8#
9
10#
11# Copyright (C) 2006-2007 innotek GmbH
12#
13# This file is part of VirtualBox Open Source Edition (OSE), as
14# available from http://www.virtualbox.org. This file is free software;
15# you can redistribute it and/or modify it under the terms of the GNU
16# General Public License as published by the Free Software Foundation,
17# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
18# distribution. VirtualBox OSE is distributed in the hope that it will
19# be useful, but WITHOUT ANY WARRANTY of any kind.
20#
21# If you received this file as part of a commercial VirtualBox
22# distribution, then only the terms of your commercial VirtualBox
23# license agreement apply instead of the previous paragraph.
24#
25
26
27#
28# kBuild stuff
29#
30
31# Enable automatic installation of what's built.
32KBUILD_DO_AUTO_INSTALL := 1
33# Add the GPLExport pass.
34PASSES := $(filter-out PACKING,$(PASSES)) PACKING # temporary hack
35PASSES += GPLEXPORT
36# Modify the order of the INSTALLS and OTHERS passes.
37DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES INSTALLS OTHERS
38
39## PASS: gplexport
40# This pass processes custom gplexport rules listed in
41# the GPLEXPORTS variable.
42PASS_GPLEXPORT := GPL and LGPL source export
43PASS_GPLEXPORT_trgs :=
44PASS_GPLEXPORT_vars := GPLEXPORTS
45PASS_GPLEXPORT_pass := gplexport
46#alias
47gplexport: pass_gplexport
48
49# Install paths.
50PATH_INS := $(PATH_OUT)
51ifeq ($(BUILD_TARGET),darwin)
52 INST_DIST = dist/
53 INST_SDK = $(INST_DIST)sdk/
54 INST_SDK_SAMPLES = $(INST_SDK)samples
55
56 # the bundles
57 INST_VIRTUALBOX = $(INST_DIST)VirtualBox.app/
58 INST_VBOXDRV = $(INST_DIST)VBoxDrv.kext/
59 INST_VBOXTAP = $(INST_DIST)VBoxTAP.kext/
60 INST_VBOXUSB = $(INST_DIST)VBoxUSB.kext/
61
62 # put everything in the VirtualBox app bundle.
63 INST_BIN = $(INST_VIRTUALBOX)Contents/MacOS/
64 INST_DLL = $(INST_BIN)
65 INST_SYS = $(INST_BIN)
66 INST_TESTCASE = $(INST_BIN)testcase/
67 INST_ADDITIONS = $(INST_BIN)additions/
68
69 # other paths
70 INST_TESTSUITE = testsuite/
71 INST_LIB = lib/
72 INST_ADDITIONS_LIB = $(PATH_LIB)/additions/
73
74else
75
76 INST_BIN = bin/
77 INST_DIST = $(INST_BIN)
78 INST_DLL = $(INST_BIN)
79 INST_SDK = $(INST_BIN)sdk/
80 INST_SDK_SAMPLES = $(INST_SDK)samples
81 INST_DLL = $(INST_BIN)
82 INST_SYS = $(INST_BIN)
83 INST_TESTCASE = $(INST_BIN)testcase/
84 INST_ADDITIONS = $(INST_BIN)additions/
85
86 INST_TESTSUITE = testsuite/
87 INST_LIB = lib/
88 INST_ADDITIONS_LIB = $(INST_LIB)additions/
89endif
90
91PATH_BIN = $(patsubst %/,%,$(PATH_INS)/$(INST_BIN))
92PATH_DLL = $(patsubst %/,%,$(PATH_INS)/$(INST_DLL))
93PATH_SYS = $(patsubst %/,%,$(PATH_INS)/$(INST_SYS))
94PATH_LIB = $(patsubst %/,%,$(PATH_INS)/$(INST_LIB))
95PATH_DOC = $(PATH_OUT)/doc
96VBOX_PATH_SDK = $(patsubst %/,%,$(PATH_INS)/$(INST_SDK))
97VBOX_PATH_DIST = $(patsubst %/,%,$(PATH_INS)/$(INST_DIST))
98VBOX_PATH_TESTSUITE = $(patsubst %/,%,$(PATH_INS)/$(INST_TESTSUITE))
99
100
101# Delete targets on failure.
102.DELETE_ON_ERROR:
103
104# Notify about important kBuild updates.
105ifneq ($(call int-ge,$(KMK_REVISION),972),1)
106 $(error You must update kBuild!)
107endif
108
109#
110# Define USERNAME early on.
111#
112ifndef USERNAME
113 ifdef USER
114 USERNAME = $(USER)
115 else
116 $(warning Warning: You must have USERNAME or USER in your environment.)
117 endif
118endif
119
120#
121# The VirtualBox version.
122#
123
124# Major version.
125VBOX_VERSION_MAJOR = 1
126# Minor version.
127VBOX_VERSION_MINOR = 3
128# This is the current build number. It should be increased every time we publish a
129# new build. The define is available in every source file. Only even build numbers
130# will be published, odd numbers are set during development.
131VBOX_VERSION_BUILD = 99
132# Full version string (may include more than just x.y.z, but no spaces or other problematic chars).
133VBOX_VERSION_STRING = $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
134
135
136#
137# The VirtualBox Configuration Defaults.
138#
139
140# Build linux / win32 additions.
141ifeq ($(BUILD_TARGET),linux)
142 VBOX_WITH_LINUX_ADDITIONS = 1
143 VBOX_WITH_WIN32_ADDITIONS = 1
144endif
145ifeq ($(BUILD_TARGET),l4)
146 VBOX_WITH_LINUX_ADDITIONS = 1
147 VBOX_WITH_WIN32_ADDITIONS = 1
148endif
149ifeq ($(BUILD_TARGET),win)
150 VBOX_WITH_WIN32_ADDITIONS = 1
151endif
152ifdef VBOX_WITH_LINUX_ADDITIONS
153 ifeq ($(BUILD_TARGET).$(BUILD_PLATFORM_ARCH),linux.x86)
154 VBOX_WITH_LINUX_ADDITIONS_32BIT_R0 = 1
155 endif
156endif
157# Enable the building of shared folders in the windows additions.
158VBOX_WITH_WIN32_ADDITIONS_SHAREDFOLDERS = 1
159
160# build the installer
161VBOX_WITH_INSTALLER = 1
162# enable VRDP server
163VBOX_WITH_VRDP = 1
164# enable new multiconnection code
165VBOX_WITH_VRDP_MC = 1
166# build VRDP authentication modules
167VBOX_WITH_VRDP_AUTHMOD = 1
168# build enhanced version of rdesktop
169VBOX_WITH_VRDP_RDESKTOP = 1
170ifeq ($(filter-out darwin.x86 darwin.amd64 os2.x86 win.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
171# build the support driver & library without IDT patching.
172## @todo invert this!
173VBOX_WITHOUT_IDT_PATCHING = 1
174endif
175# The kernel driver/module and related runtime libraries.
176VBOX_WITH_VBOXDRV = 1
177# build with secure label support
178ifeq ($(filter win.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),) # too much work with freetype and all that.
179VBOX_WITH_SECURELABEL = 1
180endif
181
182# the main api
183VBOX_WITH_MAIN = 1
184# the SDL based GUI
185VBOX_WITH_VBOXSDL = 1
186# the basic frontend (w/o Main)
187VBOX_WITH_VBOXBFE = 1
188# the Qt GUI
189VBOX_WITH_QTGUI = 1
190## the Direct Framebuffer GUI
191#VBOX_WITH_VBOXFB = 1
192# the gui debugger
193ifneq ($(BUILD_TYPE),release)
194VBOX_WITH_DEBUGGER_GUI = 1
195endif
196# the documentation
197VBOX_WITH_DOCS = 1
198# build the Host Guest Communication Manager component
199VBOX_WITH_HGCM = 1
200# Enable the USB feature.
201VBOX_WITH_USB = 1
202# Enable the ISCSI feature.
203VBOX_WITH_ISCSI = 1
204# Enable ALSA support for Linux
205VBOX_WITH_ALSA = 1
206# Disable WINMM support for Windows (not implemented)
207VBOX_WITH_WINMM =
208# Enable the kchmviewer
209VBOX_WITH_KCHMVIEWER = 1
210# Build the testsuite.
211VBOX_WITH_TESTSUITE = 1
212# Build the testcases.
213VBOX_WITH_TESTCASES = 1
214# Set this to not use COM or XPCOM in places where it can be avoided.
215#VBOX_WITHOUT_COM = 1
216# Set this to skip installing the redistributable compiler runtime.
217#VBOX_WITHOUT_COMPILER_REDIST = 1
218# Enabled internal networking.
219VBOX_WITH_INTERNAL_NETWORKING = 1
220# Enables the ffmpeg module for recording test runs.
221#VBOX_WITH_FFMPEG = 1
222
223
224#
225# Skip stuff.
226#
227
228# VBOX_QUICK can be used by core developers to speed to the build
229ifdef VBOX_QUICK
230 # undefine variables by assigning blank.
231 VBOX_WITH_TESTSUITE=
232 VBOX_WITH_TESTCASES=
233 VBOX_WITH_MAIN =
234 VBOX_WITH_VBOXSDL =
235 VBOX_WITH_VBOXBFE =
236 VBOX_WITH_QTGUI =
237 VBOX_WITH_DEBUGGER_GUI =
238 VBOX_WITH_DOCS =
239endif # VBOX_QUICK
240
241# l4 have to skip a few things.
242ifeq ($(BUILD_TARGET),l4)
243 VBOX_WITH_VBOXDRV=
244 VBOX_WITH_VRDP=
245 VBOX_WITH_VBOXSDL=
246 VBOX_WITH_QTGUI=
247 VBOX_WITH_MAIN=
248 VBOX_WITH_DOCS=
249 VBOX_WITH_ISCSI=
250 VBOX_WITH_INTERNAL_NETWORKING=
251endif
252
253# Darwin have to skip a few things at present.
254ifeq ($(BUILD_TARGET),darwin)
255 # Internal networking requires testing and possibly proper ring-3/ring0 separation.
256 VBOX_WITH_INTERNAL_NETWORKING=
257 # Don't bother with SDL ttf for now.
258 VBOX_WITH_SECURELABEL=
259 ifdef VBOX_OSE
260 # Qt/Mac v3.3.x requires patching to work for us.
261 VBOX_WITH_QTGUI=
262 endif
263 # Later:
264 VBOX_WITH_VRDP_AUTHMOD=
265 VBOX_WITH_VRDP_RDESKTOP=
266endif
267
268# Most stuff doesn't build yet on the new targets.
269ifeq ($(filter-out os2 freebsd solaris,$(BUILD_TARGET)),)
270 #VBOX_WITH_VBOXBFE=
271 VBOX_WITH_MAIN=
272 VBOX_WITH_VBOXSDL=
273 VBOX_WITH_QTGUI=
274 VBOX_WITH_DEBUGGER_GUI=
275 VBOX_WITH_INSTALLER=
276 VBOX_WITH_SECURELABEL=
277 VBOX_WITH_VRDP=
278 VBOX_WITH_VRDP_AUTHMOD=
279 VBOX_WITH_VRDP_RDESKTOP=
280 VBOX_WITH_TESTSUITE=
281 VBOX_WITH_USB=
282 VBOX_WITH_DOCS=
283endif
284
285
286#
287# Include automatic and local config file to override the above settings
288# and to provide defaults for the settings below this point.
289#
290AUTOCFG := $(wildcard $(PATH_ROOT)/AutoConfig.kmk)
291ifeq ($(AUTOCFG),)
292 # deprecated name. to be removed.
293 AUTOCFG := $(wildcard $(PATH_ROOT)/Config.kmkconf)
294 ifneq ($(AUTOCFG),)
295 $(warning Config.kmkconf has been renamed. Please re-run configure.)
296 endif
297endif
298ifneq ($(AUTOCFG),)
299 include $(AUTOCFG)
300endif
301
302LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
303ifeq ($(LOCALCFG),)
304 # deprecated name. to be removed.
305 LOCALCFG := $(wildcard $(PATH_ROOT)/Config.kmklocal)
306 ifneq ($(LOCALCFG),)
307 $(warning Please rename your Config.kmklocal to LocalConfig.kmk.)
308 endif
309endif
310ifneq ($(LOCALCFG),)
311 include $(LOCALCFG)
312endif
313
314
315#
316# Disable components that are not open sourced.
317#
318ifdef VBOX_OSE
319 VBOX_WITH_VRDP=
320 VBOX_WITH_USB=
321 VBOX_WITH_ISCSI=
322 VBOX_WITH_DEBUGGER_GUI=
323 VBOX_WITH_WIN32_ADDITIONS_SHAREDFOLDERS=
324 VBOX_WITH_SECURELABEL=
325 VBOX_WITH_INSTALLER=
326 VBOX_WITH_KCHMVIEWER=
327 VBOX_WITH_DOCS=
328 VBOX_WITH_TESTSUITE=
329 PASSES := $(filter-out PACKING,$(PASSES))
330endif
331
332#
333# Undefined VBOX_WITH_MAIN implies exclusion of a few more items.
334#
335ifndef VBOX_WITH_MAIN
336 VBOX_WITH_VRDP=
337 VBOX_WITH_VBOXSDL=
338 VBOX_WITH_QTGUI=
339 VBOX_WITH_DEBUGGER_GUI=
340endif
341
342
343#
344# Image and object format config.
345#
346ifeq ($(filter-out linux l4 freebsd netbsd openbsd solaris,$(BUILD_TARGET)),)
347 VBOX_LDR_FMT = elf
348endif
349ifeq ($(BUILD_TARGET),darwin)
350 VBOX_LDR_FMT = macho
351endif
352ifeq ($(BUILD_TARGET),os2)
353 VBOX_LDR_FMT = lx
354 VBOX_LDR_FMT32 = lx
355 VBOX_LDR_FMT64 = elf
356 DONT_USE_YASM = 1 # yasm doesn't implement omf yet.
357endif
358ifeq ($(BUILD_TARGET),win)
359 VBOX_LDR_FMT = pe
360endif
361VBOX_LDR_FMT32 ?= $(VBOX_LDR_FMT)
362VBOX_LDR_FMT64 ?= $(VBOX_LDR_FMT)
363
364#
365# Assembler setup.
366#
367# This is a bit complicated since we have to support two different assmblers
368# (yasm/nasm) and possibly two different formats (32-bit/64-bit).
369#
370ifeq ($(VBOX_LDR_FMT),elf)
371 ifeq ($(BUILD_TARGET_ARCH),x86)
372VBOX_ASFLAGS_FMT = -f elf32 -DASM_FORMAT_ELF
373 else
374VBOX_ASFLAGS_FMT = -f elf64 -DASM_FORMAT_ELF
375 endif
376VBOX_ASFLAGS_DBFINFO = -g dwarf2
377endif
378ifeq ($(VBOX_LDR_FMT),lx)
379 VBOX_ASFLAGS_FMT = -f obj -DASM_FORMAT_OMF
380 VBOX_ASFLAGS_DBFINFO = -g stabs
381endif
382ifeq ($(VBOX_LDR_FMT),macho)
383 VBOX_ASFLAGS_FMT = -f macho -DASM_FORMAT_MACHO
384 VBOX_ASFLAGS_DBFINFO = -g dwarf2
385endif
386ifeq ($(VBOX_LDR_FMT),pe)
387 ifeq ($(BUILD_TARGET_ARCH),x86)
388VBOX_ASFLAGS_FMT = -f win32 -DASM_FORMAT_PE
389 else
390VBOX_ASFLAGS_FMT = -f win64 -DASM_FORMAT_PE
391 endif
392endif
393ifndef VBOX_ASFLAGS_FMT
394 $(error VBOX_ASFLAGS_FMT is not defined. VBOX_LDR_FMT=$(VBOX_LDR_FMT))
395endif
396
397ifeq ($(VBOX_LDR_FMT32),elf)
398 VBOX_ASFLAGS_FMT32 = -f elf32 -DASM_FORMAT_ELF
399 VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
400endif
401ifeq ($(VBOX_LDR_FMT32),lx)
402 VBOX_ASFLAGS_FMT32 = -f obj -DASM_FORMAT_OMF
403 VBOX_ASFLAGS_DBFINFO32 = -g stabs
404endif
405ifeq ($(VBOX_LDR_FMT32),macho)
406 VBOX_ASFLAGS_FMT32 = -f macho -DASM_FORMAT_MACHO
407 VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
408endif
409ifeq ($(VBOX_LDR_FMT32),pe)
410 VBOX_ASFLAGS_FMT32 = -f win32 -DASM_FORMAT_PE
411endif
412ifndef VBOX_ASFLAGS_FMT32
413 $(error VBOX_ASFLAGS_FMT32 is not defined. VBOX_LDR_FMT32=$(VBOX_LDR_FMT32))
414endif
415
416ifeq ($(VBOX_LDR_FMT64),elf)
417 VBOX_ASFLAGS_FMT64 = -f elf64 -DASM_FORMAT_ELF
418 VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
419endif
420ifeq ($(VBOX_LDR_FMT64),macho)
421 VBOX_ASFLAGS_FMT64 = -f macho64 -DASM_FORMAT_MACHO
422 VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
423endif
424ifeq ($(VBOX_LDR_FMT64),pe)
425 VBOX_ASFLAGS_FMT64 = -f win64 -DASM_FORMAT_PE
426endif
427ifndef VBOX_ASFLAGS_FMT64
428 $(error VBOX_ASFLAGS_FMT64 is not defined. VBOX_LDR_FMT64=$(VBOX_LDR_FMT64))
429endif
430
431ifndef DONT_USE_YASM
432 VBOX_ASTOOL = YASM
433 VBOX_LDR_FMT_2_YASM_DBGINFO.elf = -g dwarf2
434 VBOX_LDR_FMT_2_YASM_DBGINFO.lx = -g stabs
435 VBOX_LDR_FMT_2_YASM_DBGINFO.macho =
436 VBOX_LDR_FMT_2_YASM_DBGINFO.pe =
437 VBOX_ASFLAGS = $(VBOX_ASFLAGS_FMT) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT))
438 VBOX_ASFLAGS32 = $(VBOX_ASFLAGS_FMT32) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT32))
439 VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT64))
440else
441 VBOX_ASTOOL = NASM
442 VBOX_ASFLAGS = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT)) -D__NASM__ -w+orphan-labels -g
443 VBOX_ASFLAGS32 = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT32)) -D__NASM__ -w+orphan-labels -g
444 VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__NASM__ -w+orphan-labels -g
445endif
446
447#
448# Windows only has mingw handy. On *nix we have to deal with cross compiling
449# 32-bit targets on 64-bit platforms, meaning we'll be using gcc32/g++32.
450# In the latter case we'll also have to disable all the all the R0 driver related stuff.
451#
452ifndef VBOX_GCC_TOOL
453 ifeq ($(BUILD_TARGET),win)
454 VBOX_GCC_TOOL := MINGW32
455 TOOL_MINGW32_CFLAGS := $(UNDEFINED) # override -g
456 else ifeq ($(BUILD_TARGET),os2)
457 VBOX_GCC_TOOL := GXX3OMF
458 else ifeq ($(BUILD_TARGET),darwin)
459 VBOX_GCC_TOOL := GXX4MACHO
460 else
461 VBOX_GCC_TOOL := GXX3
462 ifeq ($(BUILD_TARGET),$(BUILD_PLATFORM))
463 ifneq ($(BUILD_TARGET_ARCH),$(BUILD_PLATFORM_ARCH))
464 VBOX_GCC_TOOL := GXX32
465 VBOX_WITH_VBOXDRV=
466 VBOX_WITH_LINUX_ADDITIONS=
467 VBOX_WITH_WIN32_ADDITIONS=
468 endif
469 endif
470 endif
471endif
472ifndef VBOX_GCC32_TOOL
473 ifeq ($(BUILD_TARGET_ARCH),x86)
474 VBOX_GCC32_TOOL := $(VBOX_GCC_TOOL)
475 else ifeq ($(BUILD_TARGET),win)
476 VBOX_GCC32_TOOL := MINGW32
477 else
478 VBOX_GCC32_TOOL := GXX32
479 endif
480endif
481
482#
483# Decide which Visual C++ compiler version we're using by default.
484#
485ifndef VBOX_VCC_TOOL
486 ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.amd64)
487 VBOX_USE_VCC80 ?= 1 # Enforce VCC80 when targetting AMD64.
488 endif
489 ifdef VBOX_USE_VCC80
490 ifeq ($(BUILD_TARGET_ARCH),x86)
491 VBOX_VCC_TOOL := VCC80X86
492 else
493 VBOX_VCC_TOOL := VCC80AMD64
494 endif
495 else
496 VBOX_VCC_TOOL := VCC70
497 endif
498endif
499
500#
501# The kBuild tools and SDKs are using PATH_DEVTOOLS, PATH_DEVTOOLS_BLD
502# and PATH_DEVTOOLS_TRG to find things if we give them specific locations.
503#
504PATH_DEVTOOLS ?= $(PATH_ROOT)/tools
505PATH_DEVTOOLS := $(abspath $(PATH_DEVTOOLS))
506PATH_DEVTOOLS_BLD ?= $(PATH_DEVTOOLS)/$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)
507PATH_DEVTOOLS_TRG ?= $(PATH_DEVTOOLS)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)
508
509## @todo Remove the default tool crap here!
510TOOL = $(VBOX_GCC_TOOL)
511ifdef VBOX_USE_VCC80
512 TOOL.win.x86 = VCC80X86
513 TOOL.win.amd64 = VCC80AMD64
514else
515 TOOL.win = VCC70
516endif
517ASTOOL = $(VBOX_ASTOOL)
518
519#
520# L4.
521#
522ifdef L4_DIR
523 # default CPU type
524 ifeq ($(L4_CPU),)
525 L4_CPU = 586
526 endif
527 ifeq ($(L4_API),)
528 L4_API = l4v2
529 endif
530 L4_OBJ := $(L4_DIR)/build-x86-$(L4_CPU)-$(L4_API)
531 ifeq ($(BUILD_TARGET),l4)
532 L4LINUX26_INCDIR := \
533 $(L4LINUX26_DIR)/include \
534 $(L4LINUX26_DIR)/include/asm-l4/i386-arch
535 # support splitted Linux kernels (make O=<build directory>)
536 kernelsrc := $(shell $(SED_EXT) -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(L4LINUX26_DIR)/Makefile)
537 ifneq ($(kernelsrc),)
538 kernelpath := $(realpath $(kernelsrc))
539 L4LINUX26_INCDIR += \
540 $(L4LINUX26_DIR)/include2 \
541 $(kernelpath)/include
542 endif
543 L4_INCDIR := \
544 $(L4_OBJ)/include/uclibc++ \
545 $(L4_OBJ)/include/x86/uclibc \
546 $(L4_OBJ)/include/uclibc \
547 $(L4LINUX26_INCDIR) \
548 $(L4_OBJ)/include/x86/$(L4_API) \
549 $(L4_OBJ)/include/x86 \
550 $(L4_OBJ)/include \
551 $(L4_DIR)/tool/dice/include
552 L4_LIBDIR := \
553 $(L4_DIR)/build-x86-$(L4_CPU)-$(L4_API)/lib/x86_$(L4_CPU)/$(L4_API)
554 endif # BUILD_TARGET == l4
555endif # L4_DIR
556
557# Produce debugging information that the Fiasco kernel debugger can read.
558ifeq ($(BUILD_TARGET).$(BUILD_TYPE),l4.debug)
559 DEBUG_L4 = -gstabs+
560endif
561
562#
563# Setup the global defines and includes.
564#
565## @todo PATH_CURRENT has to go, fix the places where we rely on it.
566INCS += $(PATH_ROOT)/include $(PATH_OUT)
567DEFS += VBOX
568DEFS.debug := DEBUG DEBUG_$(subst $(subst _, ,_),_,$(USERNAME)) DEBUG_USERNAME=$(subst $(subst _, ,_),_,$(USERNAME))
569DEFS.profile = VBOX_WITH_STATISTICS
570DEFS.x86 = __X86__
571DEFS.amd64 = __AMD64__
572DEFS.darwin = __DARWIN__
573DEFS.darwin.x86 = VBOX_WITH_HYBIRD_32BIT_KERNEL
574DEFS.freebsd = __FREEBSD__
575DEFS.l4 = __L4__ __L4ENV__ L4API_l4v2 ARCH_x86 __NO_CTYPE _FILE_OFFSET_BITS=64
576ifeq ($(L4_API),l4v2onv4)
577 DEFS.l4 += L4API_l4v2onv4 STATIC_L4_INLINE
578endif
579DEFS.linux = __LINUX__ _FILE_OFFSET_BITS=64
580DEFS.netbsd = __NETBSD__
581DEFS.openbsd = __OPENBSD__
582DEFS.os2 = __OS2__
583DEFS.solaris = __SOLARIS__
584DEFS.win = __WIN__
585DEFS.win.x86 = __WIN32__
586DEFS.win.amd64 = __WIN64__
587# optional defines (use environment or make commandline)
588ifdef VBOX_WITH_DEBUGGER
589 DEFS += VBOX_WITH_DEBUGGER
590endif
591ifdef VBOX_WITH_DEBUGGER_GUI
592 DEFS += VBOX_WITH_DEBUGGER_GUI
593endif
594ifdef VBOX_WITH_STATISTICS
595 DEFS += VBOX_WITH_STATISTICS
596endif
597ifdef VBOX_STRICT
598 DEFS += VBOX_STRICT
599endif
600ifdef VBOX_WITHOUT_IDT_PATCHING
601 DEFS += VBOX_WITHOUT_IDT_PATCHING
602endif
603ifdef LOG_ENABLED
604 DEFS += LOG_ENABLED
605endif
606ifdef VBOX_OSE
607 DEFS += VBOX_OSE
608endif
609
610#
611# Compiler optimization flags.
612#
613ifeq ($(BUILD_TYPE),debug)
614 VBOX_GCC_FP ?= -fno-omit-frame-pointer
615 VBOX_GCC_OPT ?= -O0
616 VBOX_VCC_FP ?= -Oy-
617 VBOX_VCC_OPT ?=
618 VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer
619 VBOX_GCC_GC_OPT ?= -O0
620 VBOX_VCC_GC_FP ?= -Oy-
621 VBOX_VCC_GC_OPT ?=
622else
623 # We should use -fomit-frame-pointer for GCC / -Oy for VCC.
624 # -funwind-tables provides support for backtraces in gdb then.
625 VBOX_GCC_FP ?= -fno-omit-frame-pointer
626 VBOX_GCC_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
627 VBOX_VCC_FP ?= -Oy-
628 ifdef VBOX_USE_VCC80
629 VBOX_VCC_OPT ?= -O2 -GS-
630 else
631 VBOX_VCC_OPT ?= -Ogitb2
632 endif
633 VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer
634 VBOX_GCC_GC_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
635 VBOX_VCC_GC_FP ?= -Oy-
636 ifdef VBOX_USE_VCC80
637 VBOX_VCC_GC_OPT ?= -O2
638 else
639 VBOX_VCC_GC_OPT ?= -Ogitb2
640 endif
641endif
642
643#
644# ARCH_BITS_DEFS.
645#
646ifeq ($(BUILD_TARGET_ARCH),amd64)
647 ARCH_BITS_DEFS := HC_ARCH_BITS=64 GC_ARCH_BITS=32
648else ifeq ($(BUILD_TARGET_ARCH),x86)
649 ARCH_BITS_DEFS := HC_ARCH_BITS=32 GC_ARCH_BITS=32
650else
651 error BUILD_TARGET_ARCH=$(BUILD_TARGET_ARCH)
652endif
653
654#
655# Add the output dir(s) to the dynamic loader search path.
656#
657ifeq ($(filter-out linux l4 freebsd netbsd openbsd solaris,$(BUILD_TARGET)),)
658 export LD_LIBRARY_PATH:=$(PATH_BIN):$(PATH_LIB):$(LD_LIBRARY_PATH)
659endif
660ifeq ($(BUILD_TARGET),os2)
661 #fixme! export BEGINLIBPATH:=$(PATH_BIN);$(PATH_LIB);$(BEGINLIBPATH)
662endif
663ifeq ($(BUILD_TARGET),win)
664 export PATH:=$(PATH_BIN);$(PATH_LIB);$(PATH)
665endif
666
667#
668# Common libraries and tools.
669#
670ifeq ($(BUILD_TARGET),darwin)
671 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.dylib
672 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
673 LIB_KPROFILE = $(PATH_BIN)/kPrf2.dylib
674 LIB_VMM = $(PATH_BIN)/VBoxVMM.dylib
675 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
676 LIB_REM = $(PATH_LIB)/VBoxREMImp.dylib
677endif
678ifeq ($(BUILD_TARGET),l4)
679 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.s.so
680 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
681 LIB_KPROFILE = $(PATH_BIN)/kPrf2.s.so
682 LIB_VMM = $(PATH_BIN)/VBoxVMM.s.so
683 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
684 LIB_REM = $(PATH_BIN)/VBoxREMImp.s.so
685endif
686ifeq ($(filter-out linux freebsd netbsd openbsd solaris,$(BUILD_TARGET)),)
687 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.so
688 LIB_RUNTIME_EF = $(PATH_LIB)/RuntimeEFCPP.a
689 LIB_KPROFILE = $(PATH_BIN)/kPrf2.so
690 LIB_VMM = $(PATH_BIN)/VBoxVMM.so
691 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
692 LIB_REM = $(PATH_BIN)/VBoxREMImp.so
693endif
694ifeq ($(BUILD_TARGET),os2)
695 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.dll
696 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
697 LIB_KPROFILE = $(PATH_BIN)/kPrf2.dll
698 LIB_VMM = $(PATH_BIN)/VBoxVMM.dll
699 LIB_VMMGC = $(PATH_LIB)/VMMGCImp.lib
700 LIB_REM = $(PATH_LIB)/VBoxREMImp.lib
701 OBJ_SYS0 = $(PATH_OBJ)/src/VBox/Runtime/RuntimeR0/os2/sys0.obj
702endif
703ifeq ($(BUILD_TARGET),win)
704 LIB_RUNTIME = $(PATH_LIB)/VBoxRT.lib
705 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.lib
706 LIB_KPROFILE = $(PATH_LIB)/kPrf2.lib
707 LIB_VMM = $(PATH_LIB)/VBoxVMM.lib
708 LIB_VMMGC = $(PATH_OUT)/obj/src/VBox/VMM/VMMGC/VMMGC.lib
709 LIB_REM = $(PATH_LIB)/VBoxREMImp.lib
710endif
711
712# The kprofile build automagically links with kProfile.
713ifeq ($(BUILD_TYPE),kprofile)
714 LIB_RUNTIME += $(LIB_KPROFILE)
715endif
716
717# Overridable libraries (unix).
718LIB_PTHREAD ?= pthread
719LIB_XCURSOR ?= Xcursor
720
721## Enable C++ electric fence heap.
722#LIB_RUNTIME += $(LIB_RUNTIME_EF) $(LIB_RUNTIME)
723
724# Intel ASL compiler for ACPI
725VBOX_IASLCMD ?= $(firstword $(wildcard $(PATH_DEVTOOLS_BLD)/bin/iasl$(HOSTSUFF_EXE)) iasl$(HOSTSUFF_EXE))
726
727# Bruce's C compile is a C-compiler for BIOS-related 8086 code
728VBOX_BCC ?= $(PATH_DEVTOOLS_BLD)/bin/bcc$(HOSTSUFF_EXE) -B $(PATH_DEVTOOLS_BLD)/bin/
729
730# Assembler for BIOS-related 8086 code
731VBOX_AS86 ?= $(PATH_DEVTOOLS_BLD)/bin/as86$(HOSTSUFF_EXE)
732
733# libxslt XSLT processor. (see PATH_TOOL_YASM for explanation why it's temporarily located in bin.)
734ifeq ($(BUILD_PLATFORM),win)
735# VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/win.x86/libxslt/10114/xsltproc.exe
736 VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/win.x86/bin/xsltproc.exe
737else
738 VBOX_XSLTPROC ?= xsltproc$(HOSTSUFF_EXE)
739endif
740
741# bin2c (convert binary files into C arrays)
742VBOX_BIN2C ?= $(PATH_OBJ)/src/bldprogs/bin2c/bin2c$(HOSTSUFF_EXE)
743
744# mkisofs
745ifeq ($(BUILD_PLATFORM),win)
746 VBOX_MKISOFS ?= $(PATH_DEVTOOLS_BLD)/bin/mkisofs.exe
747else
748 VBOX_MKISOFS ?= mkisofs
749endif
750
751# Makeself for the linux installers.
752VBOX_MAKESELF ?= $(PATH_DEVTOOLS)/common/makeself/v2.1.4_1/makeself.sh
753
754# Microsoft HTML Help Workshop.
755VBOX_PATH_HTML_HELP_WORKSHOP ?= $(PATH_DEVTOOLS)/win.x86/HTML_Help_Workshop/v1.3/
756
757# Path to the null soft installer.
758VBOX_PATH_NSIS ?= $(PATH_DEVTOOLS)/win.x86/nsis/v2.22
759
760# Windows install tools...
761VBOX_PATH_WIX ?= $(PATH_DEVTOOLS)/win.x86/wix/v2.0.4611.0
762VBOX_PATH_DIFX ?= $(PATH_DEVTOOLS)/win.x86/DIFx/v2.1
763
764# We need to export YASM for OSE, but since it was converted to .zip we need to
765# allow for the location used by the zip to be properly cleaned up first.
766ifeq ($(filter-out win.x86 linux.x86, $(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)),)
767 PATH_TOOL_YASM ?= $(PATH_DEVTOOLS_BLD)/bin
768endif
769
770# XPCOM setup for all but win32.
771ifneq ($(BUILD_TARGET),win)
772 VBOX_WITH_XPCOM = 1
773 VBOX_XPIDL ?= $(PATH_OBJ)/src/libs/xpcom18a4/xpidl/xpidl$(HOSTSUFF_EXE)
774 VBOX_PATH_XPCOM_IDL ?= $(VBOX_PATH_SDK)/idl
775 VBOX_XPCOM_INCS ?= \
776 $(VBOX_PATH_SDK)/include \
777 $(VBOX_PATH_SDK)/include/xpcom \
778 $(VBOX_PATH_SDK)/include/xpcom/nsprpub \
779 $(VBOX_PATH_SDK)/include/xpcom/string \
780 $(VBOX_PATH_SDK)/include/xpcom/xpcom \
781 $(VBOX_PATH_SDK)/include/xpcom/ipcd
782 # libIDL-config (for xpcom18a4)
783 ifeq ($(origin VBOX_LIBIDL_CONFIG),undefined)
784 export VBOX_LIBIDL_CONFIG := $(firstword $(shell which libIDL-config-2 libIDL-config 2> /dev/null))
785 endif
786endif
787
788# The X11 LIBPATH. (The amd64 hack is for RHEL4.)
789ifeq ($(BUILD_TARGET_ARCH),amd64)
790 VBOX_LIBPATH_X11 ?= /usr/X11R6/lib64 /usr/X11R6/lib
791else
792 VBOX_LIBPATH_X11 ?= /usr/X11R6/lib
793endif
794
795# 32bit X11 LIBPATH for building 32bit guest additions
796VBOX_LIBPATH32_X11 ?= /usr/X11R6/lib32 /usr/X11R6/lib
797
798#
799# Mac OS X SDK paths.
800#
801VBOX_PATH_MACOSX_SDK ?= /Developer/SDKs/MacOSX10.4u.sdk
802VBOX_PATH_MACOSX_SDK_INCS ?= $(VBOX_PATH_MACOSX_SDK)/Developer/Headers
803
804
805#
806# GCC stuff properties.
807# Most of this is resolved on first kmk invocation and cached in PATH_OUT.
808#
809# Note! That a harmless warning is printed if the file doesn't exist.
810# Note! Changes in GCC are not detected automatically (yet).
811#
812include $(PATH_KBUILD)/tools/$(VBOX_GCC_TOOL).kmk
813ifneq ($(VBOX_GCC_TOOL),$(VBOX_GCC32_TOOL))
814 include $(PATH_KBUILD)/tools/$(VBOX_GCC32_TOOL).kmk
815endif
816
817VBOX_GCC_CHECK_CC = $(shell \
818 if $(TOOL_$(VBOX_GCC_TOOL)_CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
819 then echo "$(1)"; \
820 else echo "$(2)"; fi; )
821
822VBOX_GCC_CHECK_CXX = $(shell \
823 if $(TOOL_$(VBOX_GCC_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
824 then echo "$(1)"; \
825 else echo "$(2)"; fi; )
826
827VBOX_GCC32_CHECK_CXX = $(shell \
828 if $(TOOL_$(VBOX_GCC32_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
829 then echo "$(1)"; \
830 else echo "$(2)"; fi; )
831
832# This is kind of bad, the returned string needs to be re-evaluated before use.
833# The reason for this hack is that the windows kmk_ash cannot deal with $((1+1)).
834VBOX_GCC_VERSION = $(shell \
835 $(1) -dumpversion | $(SED_EXT) 's|\([0-9]\)\.\([0-9]\)\.\([0-9]\)|$$(int-add $$(int-mul 10000, \1), $$(int-mul 100, \2), \3)|' )
836
837# No $(QUIET) here as it's interesting to see what goes into the file.
838$(PATH_OUT)/GCCConfig.kmk: $(PATH_ROOT)/Config.kmk $(LOCALCFG) $(AUTOCFG)
839 $(call MSG_GENERATE,,$@,)
840 $(QUIET)$(RM) -f "$@"
841 $(QUIET)$(MKDIR) -p $(@D)
842
843 @# HC compiler switch detction.
844 $(APPEND) "$@" "VBOX_GCC_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CC))"
845 $(APPEND) "$@" "VBOX_GCC_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CXX))"
846 $(APPEND) "$@" "VBOX_GCC_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)"
847 $(APPEND) "$@" "VBOX_GCC_Wno-pointer-sign ?= $(call VBOX_GCC_CHECK_CC,-Wno-pointer-sign,)"
848 $(APPEND) "$@" "VBOX_GCC_Wno-variadic-macros ?= $(call VBOX_GCC_CHECK_CXX,-Wno-variadic-macros,)"
849 $(APPEND) "$@" "VBOX_GCC_Wno-invalid-offsetof ?= $(call VBOX_GCC_CHECK_CXX,-Wno-invalid-offsetof,)"
850 $(APPEND) "$@" "VBOX_GCC_Wno-extra ?= $(call VBOX_GCC_CHECK_CXX,-Wno-extra)"
851 $(APPEND) "$@" "VBOX_GCC_fno-stack-protector ?= $(call VBOX_GCC_CHECK_CC,-fno-stack-protector,)"
852 @# Produce code optimized for the most common IA32/AMD64/EM64T processors. Introduced with gcc version 4.2.
853 $(APPEND) "$@" "VBOX_GCC_mtune-generic ?= $(call VBOX_GCC_CHECK_CC,-mtune=generic,)"
854ifneq ($(BUILD_TARGET),l4)
855 @# Set default attribute for ELF and MACH-O symbols to ``hidden'' to reduce the number
856 @# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
857 $(APPEND) "$@" "ifneq ($$(VBOX_GCC_VERSION_CC),)"
858 $(APPEND) "$@" " ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CC),40000),)"
859 $(APPEND) "$@" " VBOX_GCC_fvisibility-hidden ?= $(call VBOX_GCC_CHECK_CC,-fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN,)"
860 $(APPEND) "$@" " endif"
861 $(APPEND) "$@" "endif"
862endif
863ifneq ($(BUILD_TARGET),l4)
864 @# Set default attribute for inline functions to ``hidden'' to reduce the number
865 @# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
866 $(APPEND) "$@" "ifneq ($$(VBOX_GCC_VERSION_CXX),)"
867 $(APPEND) "$@" " ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CXX),40000),)"
868 $(APPEND) "$@" " VBOX_GCC_fvisibility-inlines-hidden ?= $(call VBOX_GCC_CHECK_CXX,-fvisibility-inlines-hidden,)"
869 $(APPEND) "$@" " endif"
870 $(APPEND) "$@" "endif"
871endif
872 @# Find the compiler includes for IPRT no-crt.
873 $(APPEND) "$@" "VBOX_PATH_GCC_INCS ?= $(abspath $(dir $(shell LC_ALL=C $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)))/include"
874
875 @# 32-bit (GC) compiler switch detection.
876 $(APPEND) "$@" "VBOX_GCC32_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CC))"
877 $(APPEND) "$@" "VBOX_GCC32_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CXX))"
878 $(APPEND) "$@" "VBOX_GCC32_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC32_TOOL)_CC) -print-libgcc-file-name)"
879 $(APPEND) "$@" "VBOX_GCC32_Wno-variadic-macros ?= $(call VBOX_GCC32_CHECK_CXX,-Wno-variadic-macros,)"
880
881ifeq ($(BUILD_TARGET),l4)
882 @# L4
883 $(APPEND) "$@" "VBOX_PATH_L4_GCC3_INSTALL ?= $(shell LANG=C $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-search-dirs|$(SED_EXT) -ne 's+^install: \(.*[^/][^/]*\)/\?+\1+p')"
884endif
885
886include $(PATH_OUT)/GCCConfig.kmk
887
888ifeq ($(BUILD_TARGET),l4)
889 VBOX_L4_GCC3_INCS := $(VBOX_PATH_L4_GCC3_INSTALL)/include
890 # L4_GPP3_INCS := \
891 # $(VBOX_PATH_L4_GCC3_INSTALL)/include/g++-v3/ \
892 # $(VBOX_PATH_L4_GCC3_INSTALL)/include/g++-v3/i386-pc-linux-gnu/
893endif
894
895#
896# Coding Signing.
897#
898ifdef VBOX_SIGNING_MODE
899 ifeq ($(BUILD_PLATFORM),win)
900 # VBOX_PATH_SELFSIGN points to the Vista WDK bin/SelfSign directory.
901 ifndef VBOX_PATH_SELFSIGN
902 VBOX_PATH_SELFSIGN := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS)/win.x86/selfsign/*)))
903 ifeq ($(VBOX_PATH_SELFSIGN),)
904 VBOX_PATH_SELFSIGN := $(PATH_DEVTOOLS)/win.x86/selfsign/r1
905 endif
906 endif
907 VBOX_SIGNTOOL ?= $(VBOX_PATH_SELFSIGN)/SignTool.exe
908 VBOX_INF2CAT ?= $(VBOX_PATH_SELFSIGN)/Inf2Cat.exe
909
910 # There are two signing modes; 'self' and 'release'.
911 ifeq ($(strip $(VBOX_SIGNING_MODE)),self)
912 ## @todo
913 else ifeq ($(strip $(VBOX_SIGNING_MODE)),release)
914 VBOX_CROSS_CERTIFICATE_FILE ?= $(VBOX_PATH_SELFSIGN)/MSCV-GlobalSign.cer
915 VBOX_CROSS_CERTIFICATE_FILE_ARGS ?= /ac "$(VBOX_CROSS_CERTIFICATE_FILE)"
916 VBOX_CERTIFICATE_SUBJECT_NAME ?= InnoTek Systemberatung GmbH
917 VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
918 VBOX_CERTIFICATE_STORE ?= my
919 VBOX_CERTIFICATE_STORE_ARGS ?= /s "$(VBOX_CERTIFICATE_STORE)"
920 VBOX_TSA_URL ?= http://timestamp.verisign.com/scripts/timestamp.dll
921 VBOX_TSA_URL_ARGS ?= /t "$(VBOX_TSA_URL)"
922 ## Commands for signing a driver image after link.
923 VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_FILE_FN,$(out)))
924 ## Commands for signing an executable or a dll image after link.
925 VBOX_SIGN_IMAGE_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_FILE_FN,$(out)))
926 ## Sign a file.
927 # @param 1 The file to sign.
928 VBOX_SIGN_FILE_FN ?= $(VBOX_SIGNTOOL) sign \
929 $(VBOX_CROSS_CERTIFICATE_FILE_ARGS) \
930 $(VBOX_CERTIFICATE_STORE_ARGS) \
931 $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
932 $(VBOX_TSA_URL_ARGS) \
933 $(1)
934 ## Create a security catalog file.
935 # @param 1 The directory containing the stuff to sign.
936 # @param 2 The expected .cat name. (Inf2Cat lowercases it)
937 # @param 3 The list of OSes, separated by ';'.
938 VBOX_MAKE_CAT_HLP_FN ?= \
939 $(RM) -f $(2)\
940 $(NL)$(TAB)$(VBOX_INF2CAT) /driver:$(strip $(1)) /os:$(strip $(subst ;,$(COMMA),$(3))) /verbose \
941 $(NL)$(TAB)$(MV) $(2) $(2) \
942 $(NL)$(TAB)$(call VBOX_SIGN_FILE_FN,$(2))
943 VBOX_MAKE_CAT64_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),XP_X64;Server2003_X64;Vista_X64)
944 VBOX_MAKE_CAT32_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),2000;XP_X86;Server2003_X86;Vista_X86)
945 ifeq ($(BUILD_TARGET_ARCH),x86)
946 VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT32_FN,$(1),$(2))
947 else
948 VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT64_FN,$(1),$(2))
949 endif
950
951 # Enable signing of the additions.
952 VBOX_SIGN_ADDITIONS ?= 1
953
954 else
955 $(error Unknown VBOX_SIGNING_MODE: $(VBOX_SIGNING_MODE))
956 endif
957 else
958 VBOX_SIGNING_MODE :=
959 endif
960endif
961
962#
963# Windows .inf editing.
964#
965ifeq ($(BUILD_TARGET_ARCH),x86)
966 VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF32_FN,$(1),$(2))
967else
968 VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF64_FN,$(1),$(2))
969endif
970## Edit an inf file an x86 target.
971# @param 1 The inf file to edit.
972# @param 2 The output file.
973VBOX_EDIT_INF32_FN = $(SED) $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d') -e 's/^;x86 *//' -e '/^;amd64 /d' $(1) > $(2)
974## Edit an inf file an x86 target.
975# @param 1 The inf file to edit.
976# @param 2 The output file.
977VBOX_EDIT_INF64_FN = $(SED) $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d') -e 's/^;amd64 *//' -e '/^;x86 /d' $(1) > $(2)
978
979#
980# Default prefixes and suffixes.
981#
982VBOX_PREF_LIB =
983ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
984VBOX_SUFF_LIB = .lib
985else
986VBOX_SUFF_LIB = .a
987endif
988VBOX_SUFF_DLL = $(SUFF_DLL)
989VBOXW32GUEST_SUFF_LIB = .lib
990VBOXLNX32GUEST_SUFF_LIB = .a
991
992#
993# SDKs for external libraries.
994#
995SDK_VBOX_XERCES = .
996SDK_VBOX_XERCES_INCS ?= $(PATH_ROOT)/src/libs/xerces-2.6.0/src
997SDK_VBOX_XERCES_LIBS ?= $(PATH_LIB)/VBox-xerces$(VBOX_SUFF_LIB)
998
999SDK_VBOX_XALAN = .
1000SDK_VBOX_XALAN_INCS ?= $(PATH_ROOT)/src/libs/xalan-1.10.0
1001SDK_VBOX_XALAN_LIBS ?= $(PATH_LIB)/VBox-xalan$(VBOX_SUFF_LIB)
1002
1003SDK_VBOX_LIBPNG = .
1004SDK_VBOX_LIBPNG_INCS ?= $(PATH_ROOT)/src/libs/libpng-1.2.8
1005SDK_VBOX_LIBPNG_LIBS ?= $(PATH_LIB)/VBox-libpng$(VBOX_SUFF_LIB)
1006
1007SDK_VBOX_ZLIB = .
1008ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
1009 SDK_VBOX_ZLIB_INCS ?= $(PATH_ROOT)/src/libs/zlib-1.2.1
1010 SDK_VBOX_ZLIB_LIBS ?= $(PATH_LIB)/VBox-zlib$(VBOX_SUFF_LIB)
1011else
1012 SDK_VBOX_ZLIB_INCS ?=
1013 SDK_VBOX_ZLIB_LIBS ?= z
1014endif
1015
1016SDK_VBOX_OPENSSL = .
1017SDK_VBOX_OPENSSL_INCS?= $(PATH_ROOT)/src/libs/openssl-0.9.7e/include
1018SDK_VBOX_OPENSSL_LIBS?= $(PATH_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB)
1019
1020SDK_VBOX_FFMPEG = .
1021ifeq ($(filter-out win os2 darwin,$(BUILD_TARGET)),)
1022 SDK_VBOX_FFMPEG_INCS ?= \
1023 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavutil \
1024 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavcodec \
1025 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavformat
1026 ifeq ($(BUILD_TARGET),win)
1027 ## @todo Michael! Where is $(PATH_LIB)/VBoxFFmpegImp$(VBOX_SUFF_LIB) supposed to come from?
1028 #SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpeg.a
1029 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpegImp.lib
1030 else
1031 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_BIN)/VBoxFFmpeg$(SUFF_DLL)
1032 endif
1033else
1034 SDK_VBOX_FFMPEG_INCS ?= /usr/include/ffmpeg /usr/include/libpng
1035 SDK_VBOX_FFMPEG_LIBS ?= avutil avcodec avformat
1036endif
1037
1038#
1039# Special SDK for the problematic NTDLL.LIB.
1040#
1041SDK_VBOX_NTDLL = Requires W2K3DDK
1042SDK_VBOX_NTDLL_LIBS ?= $(PATH_SDK_W2K3DDK_LIB)/ntdll.lib
1043
1044
1045#
1046# Qt build tools and libraries.
1047# For *NIX we require it to be present on the system.
1048#
1049## @todo convert this into SDK and integrate the Qt stuff into kBuild.
1050ifeq ($(BUILD_TARGET),win)
1051 ifeq ($(BUILD_TARGET_ARCH),x86)
1052 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.3
1053 LIB_QT ?= $(VBOX_PATH_QT)/lib/dynamic/qt-mt333.lib
1054 else
1055 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.6
1056 LIB_QT ?= $(VBOX_PATH_QT)/lib/dynamic/qt-mt336.lib
1057 endif
1058 LIB_QTMAIN ?= $(VBOX_PATH_QT)/lib/dynamic/qtmain.lib
1059 ifndef QTDIR
1060 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
1061 QTDIR := $(call lastword,$(QTDIR))
1062 endif
1063
1064else ifeq ($(BUILD_TARGET),darwin)
1065 ifndef VBOX_PATH_QT
1066 VBOX_PATH_QT := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v3.*)))
1067 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.8-r1
1068 endif
1069 LIB_QT ?= $(VBOX_PATH_QT)/lib/libqt-mt.3.dylib
1070 LIB_QTMAIN ?= $(NO_SUCH_VARIABLE)
1071 ifndef QTDIR
1072 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
1073 QTDIR := $(call lastword,$(QTDIR))
1074 endif
1075else
1076 ifndef QTDIR
1077 # This is a pretty safe shot.
1078 export QTDIR := $(wildcard /usr/share/qt3)
1079 endif
1080endif
1081ifndef VBOX_PATH_QT
1082 VBOX_PATH_QT ?= $(QTDIR)
1083 LIB_QT ?= qt-mt
1084endif
1085ifeq ($(BUILD_PLATFORM),$(BUILD_TARGET))
1086 VBOX_PATH_QT_HOST ?= $(VBOX_PATH_QT)
1087else
1088 VBOX_PATH_QT_HOST ?= $(QTDIR)
1089endif
1090VBOX_UIC ?= $(VBOX_PATH_QT_HOST)/bin/uic$(HOSTSUFF_EXE)
1091VBOX_MOC ?= $(VBOX_PATH_QT_HOST)/bin/moc$(HOSTSUFF_EXE)
1092VBOX_LUPDATE ?= $(VBOX_PATH_QT_HOST)/bin/lupdate$(HOSTSUFF_EXE)
1093VBOX_LRELEASE ?= $(VBOX_PATH_QT_HOST)/bin/lrelease$(HOSTSUFF_EXE)
1094
1095#
1096# The linux kernel headers(/sources).
1097#
1098ifneq ($(filter linux,$(BUILD_TARGET)),)
1099 ifeq ($(origin VBOX_LINUX_SRC),undefined)
1100 ifneq ($(wildcard /lib/modules/$(shell uname -r)/build/include/linux/autoconf.h),)
1101 export VBOX_LINUX_SRC := /lib/modules/$(shell uname -r)/build
1102 else
1103 export VBOX_LINUX_SRC := /usr/src/linux
1104 endif
1105 endif
1106 ifeq ($(origin VBOX_LINUX_INCS),undefined)
1107 export VBOX_LINUX_INCS := $(VBOX_LINUX_SRC)/include
1108 # support splitted Linux kernels (make O=<build directory>)
1109 kernelsrc := $(shell $(SED_EXT) -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(VBOX_LINUX_SRC)/Makefile)
1110 ifneq ($(kernelsrc),)
1111 kernelpath := $(realpath $(VBOX_LINUX_SRC)/$(kernelsrc))
1112 VBOX_LINUX_INCS += $(VBOX_LINUX_SRC)/include2 $(kernelpath)/include
1113 else
1114 kernelpath := $(VBOX_LINUX_SRC)
1115 endif
1116 ifeq ($(BUILD_TARGET_ARCH),x86)
1117 VBOX_LINUX_INCS += $(kernelpath)/include/asm-i386/mach-default
1118 endif
1119 endif
1120endif
1121
1122
1123#
1124# Template for building GC things.
1125#
1126TEMPLATE_VBOXGC = VBox GC
1127TEMPLATE_VBOXGC_ASTOOL = $(VBOX_ASTOOL)
1128TEMPLATE_VBOXGC_ASFLAGS = $(VBOX_ASFLAGS32)
1129TEMPLATE_VBOXGC_DEFS = IN_GC $(ARCH_BITS_DEFS)
1130TEMPLATE_VBOXGC_SYSSUFF = .gc
1131TEMPLATE_VBOXGC_BLD_TRG_ARCH = x86
1132
1133ifeq ($(VBOX_LDR_FMT32),pe)
1134ifdef VBOX_USE_VCC80
1135 TEMPLATE_VBOXGC_TOOL = VCC80X86
1136 TEMPLATE_VBOXGC_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -W3 -wd4244 -wd4996 -Zc:wchar_t- -Gs8192 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP)
1137else
1138 TEMPLATE_VBOXGC_TOOL = VCC70
1139 TEMPLATE_VBOXGC_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP)
1140endif
1141TEMPLATE_VBOXGC_CFLAGS = $(TEMPLATE_VBOXGC_CXXFLAGS)
1142TEMPLATE_VBOXGC_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Lines -MapInfo:Exports -NoD
1143ifdef VBOX_USE_VCC80
1144 include $(PATH_KBUILD)/sdks/W2K3DDKX86.kmk
1145 TEMPLATE_VBOXGC_LIBS = \
1146 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1147else
1148 TEMPLATE_VBOXGC_LIBS = \
1149 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1150endif
1151endif
1152
1153ifeq ($(VBOX_LDR_FMT32),elf)
1154TEMPLATE_VBOXGC_TOOL = $(VBOX_GCC32_TOOL)
1155TEMPLATE_VBOXGC_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -fno-exceptions -fno-rtti $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
1156TEMPLATE_VBOXGC_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden)
1157TEMPLATE_VBOXGC_LDFLAGS = -nostdlib -Bsymbolic
1158# temporarily, must fix the loader.
1159TEMPLATE_VBOXGC_LDFLAGS += -S
1160TEMPLATE_VBOXGC_LDFLAGS.release = -S
1161TEMPLATE_VBOXGC_LIBS = \
1162 $(VBOX_GCC32_LIBGCC) # instricts
1163endif
1164
1165ifeq ($(VBOX_LDR_FMT32),macho)
1166TEMPLATE_VBOXGC_TOOL = GXX4MACHO
1167TEMPLATE_VBOXGC_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -fno-common -msoft-float -static -fno-exceptions -fno-rtti $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing
1168TEMPLATE_VBOXGC_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -fno-common -msoft-float -static -Wno-trigraphs -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing
1169TEMPLATE_VBOXGC_LDFLAGS = -nostdlib
1170#TEMPLATE_VBOXGC_LDFLAGS.release = -Wl,-S ???
1171endif
1172
1173ifeq ($(VBOX_LDR_FMT32),lx)
1174TEMPLATE_VBOXGC_TOOL = GXX3OMF
1175TEMPLATE_VBOXGC_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -fno-exceptions -fno-rtti $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing
1176TEMPLATE_VBOXGC_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing
1177TEMPLATE_VBOXGC_LDFLAGS = -Zdll -nostdlib
1178TEMPLATE_VBOXGC_LIBS = \
1179 $(VBOX_GCC32_LIBGCC) \
1180 $(OBJ_SYS0) \
1181 end
1182endif
1183
1184
1185#
1186# Template for building a GC ring-3 testcase (tstVMStructGC, tstDevStructGC).
1187#
1188TEMPLATE_VBOXGCEXE = VBox GC as ring-3 testcase
1189TEMPLATE_VBOXGCEXE_EXTENDS = VBOXGC
1190
1191ifeq ($(VBOX_LDR_FMT32),pe)
1192 TEMPLATE_VBOXGCEXE_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD -Debug
1193 TEMPLATE_VBOXGCEXE_SDKS = WIN32SDK
1194 ifdef VBOX_USE_VCC80
1195 TEMPLATE_VBOXGCEXE_LIBS = \
1196 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
1197 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib
1198 else
1199 TEMPLATE_VBOXGCEXE_LIBS = \
1200 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
1201 $(PATH_TOOL_VCC70_LIB)/oldnames.lib
1202 endif
1203endif
1204
1205ifeq ($(VBOX_LDR_FMT32),elf)
1206 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1207 TEMPLATE_VBOXGCEXE_LDFLAGS.release = -g
1208endif
1209
1210ifeq ($(VBOX_LDR_FMT32),macho)
1211 TEMPLATE_VBOXGCEXE_CFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CFLAGS))
1212 TEMPLATE_VBOXGCEXE_CXXFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CXXFLAGS))
1213 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1214endif
1215
1216ifeq ($(VBOX_LDR_FMT32),lx)
1217 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1218 TEMPLATE_VBOXGCEXE_LIBS = $(NO_SUCH_VARIABLE)
1219endif
1220
1221
1222#
1223# Template for building R0 things.
1224#
1225TEMPLATE_VBOXR0 = VBox Ring 0
1226TEMPLATE_VBOXR0_ASTOOL = $(VBOX_ASTOOL)
1227TEMPLATE_VBOXR0_ASFLAGS = $(VBOX_ASFLAGS)
1228TEMPLATE_VBOXR0_DEFS = IN_RING0 $(ARCH_BITS_DEFS)
1229
1230ifeq ($(VBOX_LDR_FMT),pe)
1231TEMPLATE_VBOXR0_TOOL = $(VBOX_VCC_TOOL)
1232ifdef VBOX_USE_VCC80
1233 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -W3 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1234else
1235 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1236endif
1237TEMPLATE_VBOXR0_CFLAGS = $(TEMPLATE_VBOXR0_CXXFLAGS)
1238TEMPLATE_VBOXR0_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD
1239ifdef VBOX_USE_VCC80
1240 TEMPLATE_VBOXR0_LIBS.x86 = \
1241 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1242else
1243 TEMPLATE_VBOXR0_LIBS.x86 = \
1244 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1245endif
1246endif # pe
1247
1248ifeq ($(VBOX_LDR_FMT),elf)
1249TEMPLATE_VBOXR0_TOOL = $(VBOX_GCC_TOOL)
1250TEMPLATE_VBOXR0_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden)
1251TEMPLATE_VBOXR0_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -fno-rtti -fno-exceptions $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
1252TEMPLATE_VBOXR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding
1253TEMPLATE_VBOXR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables
1254TEMPLATE_VBOXR0_LDFLAGS = -nostdlib -Bsymbolic
1255# temporarily, must fix the loader.
1256TEMPLATE_VBOXR0_LDFLAGS += -S
1257TEMPLATE_VBOXR0_LDFLAGS.release = -S
1258TEMPLATE_VBOXR0_LIBS = \
1259 $(VBOX_GCC_LIBGCC) # instricts
1260endif
1261
1262ifeq ($(VBOX_LDR_FMT),macho)
1263TEMPLATE_VBOXR0_TOOL = GXX4MACHO
1264TEMPLATE_VBOXR0_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -fno-common -msoft-float -static -fno-rtti -fno-exceptions $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing
1265TEMPLATE_VBOXR0_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -fno-common -msoft-float -static -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing
1266TEMPLATE_VBOXR0_LDFLAGS = -nostdlib
1267#TEMPLATE_VBOXR0_LDFLAGS.release = -Wl,-S ???
1268endif
1269
1270ifeq ($(VBOX_LDR_FMT),lx)
1271TEMPLATE_VBOXR0_TOOL = GXX3OMF
1272TEMPLATE_VBOXR0_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing
1273TEMPLATE_VBOXR0_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -fno-rtti -fno-exceptions $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing
1274TEMPLATE_VBOXR0_LDFLAGS = -Zdll -nostdlib
1275TEMPLATE_VBOXR0_LIBS = \
1276 $(VBOX_GCC_LIBGCC) \
1277 $(OBJ_SYS0) \
1278 end
1279endif
1280
1281
1282#
1283# Template for building SUPDRV R0 things.
1284#
1285TEMPLATE_VBOXR0DRV = VBox SUPDRV Ring 0
1286TEMPLATE_VBOXR0DRV_ASTOOL = $(VBOX_ASTOOL)
1287TEMPLATE_VBOXR0DRV_ASFLAGS = $(VBOX_ASFLAGS)
1288TEMPLATE_VBOXR0DRV_DEFS = IN_RING0 IN_RT_R0 $(ARCH_BITS_DEFS)
1289
1290ifeq ($(BUILD_TARGET),win)
1291 TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_VCC_TOOL)
1292 TEMPLATE_VBOXR0DRV_RCDEFS = \
1293 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1294 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1295 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1296 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1297 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1298 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1299 TEMPLATE_VBOXR0DRV_DEFS.x86 = _X86_
1300 TEMPLATE_VBOXR0DRV_DEFS.amd64 = _AMD64_
1301 ifdef VBOX_USE_VCC80
1302 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -W3 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1303 else
1304 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -W3 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1305 endif
1306 TEMPLATE_VBOXR0DRV_CFLAGS = $(TEMPLATE_VBOXR0DRV_CXXFLAGS)
1307 TEMPLATE_VBOXR0DRV_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Debug
1308 TEMPLATE_VBOXR0DRV_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
1309endif
1310
1311ifeq ($(BUILD_TARGET),linux)
1312TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1313TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0
1314TEMPLATE_VBOXR0DRV_INCS = $(VBOX_LINUX_INCS)
1315TEMPLATE_VBOXR0DRV_CFLAGS = -nostdinc -iwithprefix include \
1316 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1317 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1318TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mpreferred-stack-boundary=2 -msoft-float
1319TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1320 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1321 -Wno-sign-compare -Wdeclaration-after-statement
1322TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXR0DRV_CFLAGS)) -fno-exceptions -fno-rtti
1323 ifndef VBOX_LINUX_VERSION_2_4
1324# 2.6
1325TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1326TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1327TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1328 else
1329# 2.4
1330TEMPLATE_VBOXR0DRV_SYSSUFF = .o
1331TEMPLATE_VBOXR0DRV_LDFLAGS = -r -s
1332 endif
1333endif
1334
1335ifeq ($(BUILD_TARGET),os2)
1336TEMPLATE_VBOXR0DRV_TOOL = GXX3OMF
1337TEMPLATE_VBOXR0DRV_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-rtti -fno-exceptions
1338TEMPLATE_VBOXR0DRV_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing
1339TEMPLATE_VBOXR0DRV_LIBS = $(VBOX_GCC_LIBGCC)
1340# wlink thinks physdevice doesn't need fixups and should have a stack - stupid!
1341TEMPLATE_VBOXR0DRV_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
1342endif
1343
1344ifeq ($(BUILD_TARGET),darwin)
1345TEMPLATE_VBOXR0DRV_TOOL = GXX4MACHO
1346TEMPLATE_VBOXR0DRV_DEFS += KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT
1347TEMPLATE_VBOXR0DRV_INCS += \
1348 /System/Library/Frameworks/Kernel.framework/PrivateHeaders \
1349 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Kernel.framework/Headers
1350TEMPLATE_VBOXR0DRV_CXXFLAGS = \
1351 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1352 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1353 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1354 -fapple-kext -fno-rtti -fcheck-new
1355TEMPLATE_VBOXR0DRV_CXXFLAGS.release = $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fasm-blocks
1356TEMPLATE_VBOXR0DRV_CXXFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1357TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1358TEMPLATE_VBOXR0DRV_CFLAGS = \
1359 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1360 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1361 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1362 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1363TEMPLATE_VBOXR0DRV_CFLAGS.release = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1364TEMPLATE_VBOXR0DRV_CFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.profile)
1365TEMPLATE_VBOXR0DRV_CFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile)
1366TEMPLATE_VBOXR0DRV_LDFLAGS = -static -nostdlib -r -Wl,-Y,1455 \
1367 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
1368TEMPLATE_VBOXR0DRV_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC)
1369endif
1370
1371ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),) # pure guess work just to avoid the warning below
1372TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1373TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ IN_RING0 IN_RT_R0
1374TEMPLATE_VBOXR0DRV_CFLAGS = \
1375 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1376 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1377TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -msoft-float
1378TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1379 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1380 -Wno-sign-compare -Wdeclaration-after-statement
1381TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXR0DRV_CFLAGS)) -fno-exceptions -fno-rtti
1382TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1383TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1384TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1385endif
1386
1387ifdef VBOX_WITH_VBOXDRV
1388 ifndef TEMPLATE_VBOXR0DRV_TOOL
1389 $(warning Warning: VBox Build: Target $(BUILD_PLATFORM) is not officially supported!)
1390 endif
1391endif
1392
1393
1394
1395#
1396# Template for building R3 executables and static libraries which are linked into executables.
1397#
1398TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
1399TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
1400TEMPLATE_VBOXR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
1401TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
1402TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
1403ifeq ($(BUILD_TARGET),win)
1404 TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
1405 TEMPLATE_VBOXR3EXE_RCDEFS = \
1406 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1407 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1408 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1409 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1410 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1411 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1412 TEMPLATE_VBOXR3EXE_SDKS = WINPSDK
1413 ifdef VBOX_USE_VCC80
1414 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MD -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1415 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
1416 else
1417 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MD -W3 -wd4065 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1418 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -GZ
1419 endif
1420 TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
1421 TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
1422 TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1423 TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1424 TEMPLATE_VBOXR3EXE_LDFLAGS = \
1425 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1426 /DISALLOWLIB:libc.lib \
1427 /DISALLOWLIB:libcd.lib \
1428 /DISALLOWLIB:libcmt.lib \
1429 /DISALLOWLIB:libcmtd.lib \
1430 /DISALLOWLIB:msvcrtd.lib
1431 TEMPLATE_VBOXR3EXE_LIBS = \
1432 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1433 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1434 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib
1435 TEMPLATE_VBOXR3EXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1436
1437else # the gcc guys
1438TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
1439TEMPLATE_VBOXR3EXE_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
1440# L4 currently can't handle exception handling.
1441TEMPLATE_VBOXR3EXE_CXXFLAGS.l4 = -fno-exceptions -nostdinc \
1442 $(addprefix -I,$(VBOX_L4_GCC3_INCS) $(L4_INCDIR) $(FILE_TOOL_GPP3_INCDIR)) \
1443 $(DEBUG_L4)
1444TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
1445TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1446TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1447TEMPLATE_VBOXR3EXE_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-hidden)
1448TEMPLATE_VBOXR3EXE_CFLAGS.darwin = -fno-common
1449TEMPLATE_VBOXR3EXE_CFLAGS.l4 = -nostdinc \
1450 $(addprefix -I,$(VBOX_L4_GCC3_INCS) $(L4_INCDIR)) $(DEBUG_L4)
1451TEMPLATE_VBOXR3EXE_DEFS.l4 = L4_THREAD_SAFE
1452TEMPLATE_VBOXR3EXE_LDFLAGS.l4 = \
1453 $(L4_LIBDIR)/../crt0.o \
1454 -T$(L4_LIBDIR)/../main_dyn.ld -nostdlib \
1455 -Wl,--export-dynamic,--dynamic-linker=libld-l4.s.so \
1456 -Wl,--rpath-link,$(L4_LIBDIR)
1457TEMPLATE_VBOXR3EXE_LDFLAGS.linux = -Wl,-z,noexecstack
1458 ifeq ($(BUILD_TARGET),linux)
1459TEMPLATE_VBOXR3EXE_LIBS = pthread m rt dl
1460 else ifeq ($(BUILD_TARGET),l4)
1461TEMPLATE_VBOXR3EXE_LIBS = \
1462 $(L4_LIBDIR)/libvboxserver.s.so \
1463 $(L4_LIBDIR)/libuc++.0.s.so \
1464 supc++ gcc_eh gcc \
1465 $(L4_LIBDIR)/libdl.s.so \
1466 $(L4_LIBDIR)/libuc.0.s.so
1467 else ifeq ($(BUILD_TARGET),os2)
1468TEMPLATE_VBOXR3EXE_TOOL = GXX3OMF
1469TEMPLATE_VBOXR3EXE_LIBS = socket iconv
1470 else ifeq ($(BUILD_TARGET),darwin)
1471TEMPLATE_VBOXR3EXE_TOOL = GXX4MACHO
1472TEMPLATE_VBOXR3EXE_LIBS =
1473TEMPLATE_VBOXR3EXE_LDFLAGS = -read_only_relocs suppress
1474TEMPLATE_VBOXR3EXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1475 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1476TEMPLATE_VBOXR3EXE_TOOL = GXX3
1477TEMPLATE_VBOXR3EXE_LIBS = pthread
1478 else ifeq ($(BUILD_TARGET),solaris)
1479$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1480TEMPLATE_VBOXR3EXE_TOOL = GXX3PLAIN
1481TEMPLATE_VBOXR3EXE_LIBS = rt
1482 else
1483$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1484TEMPLATE_VBOXR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.release)
1485TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease)
1486 endif
1487endif
1488
1489#
1490# Template for building R3 shared objects / DLLs.
1491# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
1492#
1493TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
1494TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
1495TEMPLATE_VBOXR3_LDFLAGS.l4 = $(L4_LIBDIR)/../crt0.s.o -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
1496TEMPLATE_VBOXR3_DEFS.l4 = $(TEMPLATE_VBOXR3EXE_DEFS.l4) __PIC__
1497TEMPLATE_VBOXR3_DEFS.darwin = $(TEMPLATE_VBOXR3EXE_DEFS.darwin) PIC
1498ifeq ($(BUILD_TARGET_ARCH),amd64)
1499 ifneq ($(BUILD_TARGET),win)
1500 TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
1501 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
1502 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
1503 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
1504 endif
1505endif
1506
1507#
1508# Ring-3 testcase.
1509# This is the VBOXR3EXE template only with a different install dir.
1510#
1511TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
1512TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
1513TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
1514TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
1515ifeq ($(BUILD_TARGET),win)
1516 ifdef VBOX_SIGNING_MODE
1517 TEMPLATE_VBOXR3TSTEXE_POST_CMDS =
1518 endif
1519endif
1520
1521#
1522# Template for building bad C/C++ style R3 executables (no -pedantic).
1523#
1524TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
1525TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
1526ifneq ($(BUILD_TARGET),win)
1527 # (only gcc)
1528 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
1529 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
1530 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3EXE_CFLAGS))
1531endif
1532
1533#
1534# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
1535# This is mostly identical to the VBOXR3NPEXE template.
1536#
1537TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
1538TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3NPEXE
1539TEMPLATE_VBOXR3NP_LDFLAGS.l4 = \
1540 $(L4_LIBDIR)/../crt0.s.o \
1541 -T$(L4_LIBDIR)/../main_rel.ld \
1542 -nostdlib
1543TEMPLATE_VBOXR3NP_DEFS.l4 = $(TEMPLATE_VBOXR3NPEXE_DEFS.l4) __PIC__
1544ifeq ($(BUILD_TARGET_ARCH),amd64)
1545 ifneq ($(BUILD_TARGET),win)
1546 TEMPLATE_VBOXR3NP_DEFS = $(TEMPLATE_VBOXR3NPEXE_DEFS) PIC
1547 TEMPLATE_VBOXR3NP_CFLAGS = $(TEMPLATE_VBOXR3NPEXE_CFLAGS) -fPIC
1548 TEMPLATE_VBOXR3NP_CXXFLAGS = $(TEMPLATE_VBOXR3NPEXE_CXXFLAGS) -fPIC
1549 TEMPLATE_VBOXR3NP_LDFLAGS = $(TEMPLATE_VBOXR3NPEXE_LDFLAGS) -fPIC
1550 endif
1551endif
1552
1553
1554#
1555# Template for building libraries, shared libraries / modules
1556# which only depends on IPRT for crt.
1557#
1558TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
1559TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
1560TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
1561## @todo C++
1562TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno -Wall
1563TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -mcmodel=medium -fno-common
1564#TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O0 -fno-math-errno -fno-peephole2 -fno-strict-aliasing - for win64.
1565TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
1566TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1567TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1568TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -mdynamic-no-pic
1569TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
1570
1571ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.amd64)
1572 # cross compile to 64-bit ELF (linux).
1573 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
1574 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
1575 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
1576 TEMPLATE_VBOXNOCRTGCC_LIBS = $(PATH_DEVTOOLS)/win.x86/x86_64-unknown-linux-gnu/20060701-r2/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/libgcc.a
1577 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1578
1579else ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1580 # Use the default GCC (MinGW) with the Microsoft linker.
1581 # (Drop all '-g' options as we're unable to strip the debug info.)
1582 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1583 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1584 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1585 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
1586 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
1587 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1588 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
1589
1590else
1591 # Use the default GCC.
1592 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
1593 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1594 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1595 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1596 TEMPLATE_VBOXNOCRTGCC_CFLAGS += $(VBOX_GCC_fno-stack-protector)
1597 TEMPLATE_VBOXNOCRTGCC_CXXFLAGS += $(VBOX_GCC_fno-stack-protector)
1598 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1599 ifneq ($(filter-out os2 darwin solaris,$(BUILD_TARGET)),)
1600 ifneq ($(BUILD_TARGET_ARCH),amd64)
1601 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
1602 endif
1603 endif
1604 ifneq ($(filter-out freebsd,$(BUILD_TARGET)),)
1605 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
1606 else
1607 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1608 endif
1609endif
1610
1611
1612#
1613# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
1614#
1615TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
1616TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
1617TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
1618ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1619 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
1620else
1621 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
1622endif
1623
1624
1625#
1626# Template for building executables that is part of the VBox MAIN component.
1627#
1628TEMPLATE_VBOXMAINEXE = VBox Main Executables
1629TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
1630TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
1631TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE NDEBUG=1
1632TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
1633TEMPLATE_VBOXMAINEXE_INCS = \
1634 $(VBOX_PATH_SDK)/include
1635ifdef VBOX_WITH_XPCOM
1636 TEMPLATE_VBOXMAINEXE_INCS += \
1637 $(VBOX_XPCOM_INCS)
1638endif
1639
1640ifeq ($(BUILD_TARGET),win)
1641 TEMPLATE_VBOXMAINEXE_SDKS = WINPSDK W2K3DDK
1642 ifdef VBOX_USE_VCC80
1643 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
1644 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GF- -MD -EHsc -W3 -wd4065 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1645 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
1646 else
1647 TEMPLATE_VBOXMAINEXE_TOOL = VCC70
1648 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GX- -GF- -MD -EHsc -W3 -wd4065 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1649 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -GZ
1650 endif
1651 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
1652 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1653 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
1654 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1655 TEMPLATE_VBOXMAINEXE_INCS += \
1656 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1657 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
1658 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
1659 /DISALLOWLIB:libc.lib \
1660 /DISALLOWLIB:libcd.lib \
1661 /DISALLOWLIB:msvcrt.lib \
1662 /DISALLOWLIB:msvcrtd.lib \
1663 /DISALLOWLIB:libcmtd.lib \
1664 /DISALLOWLIB:libcmt.lib
1665 TEMPLATE_VBOXMAINEXE_LIBS = \
1666 $(LIB_RUNTIME) \
1667 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1668 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1669 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1670 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1671 TEMPLATE_VBOXMAINEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1672
1673else # the GCC guys:
1674
1675TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
1676TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
1677TEMPLATE_VBOXMAINEXE_CXXFLAGS = -g -Wall -Wno-long-long -Wno-trigraphs -pipe -Wno-non-virtual-dtor -fshort-wchar -fpermissive $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
1678TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -fno-inline
1679TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
1680TEMPLATE_VBOXMAINEXE_CFLAGS = -g -Wall -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-hidden)
1681TEMPLATE_VBOXMAINEXE_CFLAGS.debug = -fno-inline
1682TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1683TEMPLATE_VBOXMAINEXE_INCS += $(VBOX_XPCOM_INCS)
1684 ifeq ($(BUILD_TARGET),linux)
1685TEMPLATE_VBOXMAINEXE_LIBS = pthread m rt
1686 else ifeq ($(BUILD_TARGET),l4)
1687TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1688# no libs as yet in l4 target - must be added later
1689 else ifeq ($(BUILD_TARGET),os2)
1690TEMPLATE_VBOXMAINEXE_TOOL = GXX3OMF
1691TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1692 else ifeq ($(BUILD_TARGET),darwin)
1693TEMPLATE_VBOXMAINEXE_TOOL = GXX4MACHO
1694TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1695TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin = -bind_at_load -framework Carbon
1696 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1697TEMPLATE_VBOXMAINEXE_TOOL = GXX3
1698TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1699TEMPLATE_VBOXMAINEXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1700 else ifeq ($(BUILD_TARGET),solaris)
1701$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1702TEMPLATE_VBOXMAINEXE_TOOL = GXX3PLAIN
1703TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt
1704 else
1705$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1706TEMPLATE_VBOXMAINEXE_LIBS =
1707 endif
1708
1709endif # !win
1710
1711#
1712# Template for building the Main components.
1713# This differ from VBOXMAINEXE only in PIC handling and similar DLL stuff.
1714#
1715TEMPLATE_VBOXMAIN = VBox Main Components
1716TEMPLATE_VBOXMAIN_EXTENDS = VBOXMAINEXE
1717ifeq ($(BUILD_TARGET_ARCH),amd64)
1718 ifneq ($(BUILD_TARGET),win)
1719 TEMPLATE_VBOXMAIN_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
1720 TEMPLATE_VBOXMAIN_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
1721 TEMPLATE_VBOXMAIN_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1722 TEMPLATE_VBOXMAIN_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
1723 endif
1724endif
1725TEMPLATE_VBOXMAIN_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin))
1726
1727#
1728# Template for building executables that use the VBox MAIN component (COM stuff etc.).
1729#
1730TEMPLATE_VBOXMAINCLIENTEXE = VBox MAIN Client (executable)
1731TEMPLATE_VBOXMAINCLIENTEXE_EXTENDS = VBOXMAINCLIENT
1732
1733## @todo Cleanup the EXE/DLL usage of this template. In the mean time, don't use this template.
1734TEMPLATE_VBOXMAINCLIENT = VBox MAIN Client (executrable)
1735TEMPLATE_VBOXMAINCLIENT_EXTENDS = VBOXMAINEXE
1736ifeq ($(BUILD_TARGET),win)
1737 TEMPLATE_VBOXMAINCLIENT_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
1738 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
1739 $(PATH_SDK_WINPSDK_LIB)/User32.Lib \
1740 $(PATH_SDK_WINPSDK_LIB)/Shell32.Lib \
1741 $(PATH_SDK_WINPSDK_LIB)/ShLwApi.Lib \
1742 $(PATH_SDK_WINPSDK_LIB)/Ole32.Lib \
1743 $(PATH_SDK_WINPSDK_LIB)/OleAut32.Lib \
1744 $(PATH_SDK_WINPSDK_LIB)/Uuid.Lib
1745else
1746 TEMPLATE_VBOXMAINCLIENT_LIBS = $(TEMPLATE_VBOXMAINEXE_LIBS) \
1747 $(PATH_LIB)/VBoxXPCOM$(VBOX_SUFF_LIB) \
1748 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
1749 $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL) \
1750 $(LIB_RUNTIME)
1751
1752 TEMPLATE_VBOXMAINCLIENT_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
1753 NDEBUG TRIMMED
1754 ## Wonder why we compile main with defaults for these two and then drops it in the client executables...
1755 TEMPLATE_VBOXMAINCLIENT_CXXFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS) \
1756 -fno-rtti -fno-exceptions
1757 TEMPLATE_VBOXMAINCLIENT_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
1758 -pthread
1759 TEMPLATE_VBOXMAINCLIENT_LDFLAGS.darwin = $(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin) \
1760 -bind_at_load -framework Carbon
1761endif
1762
1763#
1764# Template for building shared libraries / DLLs that use the VBox MAIN component (COM stuff etc.).
1765# This differ from VBOXMAINCLIENTEXE only in PIC handling and similar DLL stuff.
1766#
1767TEMPLATE_VBOXMAINCLIENTDLL = VBox MAIN Client Shared Libraries
1768TEMPLATE_VBOXMAINCLIENTDLL_EXTENDS = VBOXMAINCLIENTEXE
1769ifeq ($(BUILD_TARGET_ARCH),amd64)
1770 ifneq ($(BUILD_TARGET),win)
1771 TEMPLATE_VBOXMAINCLIENTDLL_DEFS = PIC $(TEMPLATE_VBOXMAINCLIENTEXE_DEFS)
1772 TEMPLATE_VBOXMAINCLIENTDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CFLAGS)
1773 TEMPLATE_VBOXMAINCLIENTDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS)
1774 TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)
1775 endif
1776endif
1777TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin))
1778
1779
1780#
1781# Template for building Qt GUI executables.
1782#
1783TEMPLATE_VBOXQTGUIEXE = VBox Qt GUI Executable
1784TEMPLATE_VBOXQTGUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS)
1785TEMPLATE_VBOXQTGUIEXE_INCS = \
1786 $(VBOX_PATH_SDK)/include \
1787 $(VBOX_PATH_QT)/include
1788
1789ifeq ($(BUILD_TARGET),win)
1790 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_VCC_TOOL)
1791 TEMPLATE_VBOXQTGUIEXE_DEFS += _WIN32_WINNT=0x0500 UNICODE QT_DLL _CRT_SECURE_NO_DEPRECATE
1792 ## @todo VCC70 flags?
1793 ifdef VBOX_USE_VCC80
1794 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1795 -nologo -Zm200 -W3 -MD -EHsc -Zc:wchar_t-
1796 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu
1797 else
1798 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1799 -nologo -Zm200 -W3 -MD -GX
1800 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -GZ
1801 endif
1802 TEMPLATE_VBOXQTGUIEXE_INCS += \
1803 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1804 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = \
1805 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
1806 /DELAYLOAD:oleaut32.dll
1807 TEMPLATE_VBOXQTGUIEXE_SDKS = WINPSDK
1808 TEMPLATE_VBOXQTGUIEXE_LIBS = \
1809 $(LIB_QT) \
1810 $(LIB_QTMAIN) \
1811 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
1812 $(LIB_RUNTIME) \
1813 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1814 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1815 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1816 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
1817 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1818 TEMPLATE_VBOXQTGUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1819
1820else # the gcc guys:
1821 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_GCC_TOOL)
1822 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM
1823 TEMPLATE_VBOXQTGUIEXE_DEFS.linux = _REENTRANT
1824
1825 TEMPLATE_VBOXQTGUIEXE_INCS += \
1826 $(LIB_SDL_INC) \
1827 $(VBOX_XPCOM_INCS)
1828 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1829 -pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
1830 -Wno-long-long -fshort-wchar -fno-strict-aliasing \
1831 $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
1832 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -pthread
1833 ## @todo no $(LIB_QTMAIN) here?
1834 TEMPLATE_VBOXQTGUIEXE_LIBS = \
1835 $(LIB_QT) \
1836 $(LIB_SDL) \
1837 $(PATH_LIB)/VBoxXPCOM$(VBOX_SUFF_LIB) \
1838 $(LIB_RUNTIME) \
1839 $(LIB_REM) \
1840 $(LIB_VMM) \
1841 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
1842 $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
1843
1844 ifeq ($(BUILD_TARGET_ARCH),amd64)
1845 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
1846 $(VBOX_PATH_QT)/lib64 $(VBOX_PATH_QT)/lib
1847 else
1848 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
1849 $(VBOX_PATH_QT)/lib
1850 endif
1851
1852 ifeq ($(BUILD_TARGET),darwin)
1853 TEMPLATE_VBOXQTGUIEXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1854 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -framework Carbon -framework QuickTime -bind_at_load
1855 TEMPLATE_VBOXQTGUIEXE_LIBS +=
1856 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
1857 else ifeq ($(BUILD_TARGET),os2)
1858 TEMPLATE_VBOXQTGUIEXE_LIBS +=
1859 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
1860 else
1861 TEMPLATE_VBOXQTGUIEXE_LIBS += \
1862 Xext \
1863 X11 \
1864 m \
1865 $(LIB_PTHREAD)
1866 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \
1867 $(VBOX_LIBPATH_X11)
1868 endif
1869
1870endif
1871
1872#
1873# Template for building Qt GUI components.
1874#
1875TEMPLATE_VBOXQTGUI = VBox Qt GUI Components
1876TEMPLATE_VBOXQTGUI_EXTENDS = VBOXQTGUIEXE
1877TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN) $(PATH_BIN)/VBoxXML$(VBOX_SUFF_DLL),$(TEMPLATE_VBOXQTGUIEXE_LIBS))
1878ifeq ($(BUILD_TARGET),darwin)
1879 TEMPLATE_VBOXQTGUI_LDFLAGS = $(filter-out -framework Carbon -framework QuickTime -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS))
1880endif
1881ifeq ($(BUILD_TARGET_ARCH),amd64)
1882 ifneq ($(BUILD_TARGET),win)
1883 TEMPLATE_VBOXQTGUI_DEFS = PIC $(TEMPLATE_VBOXQTGUIEXE_DEFS)
1884 TEMPLATE_VBOXQTGUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CFLAGS)
1885 TEMPLATE_VBOXQTGUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS)
1886 TEMPLATE_VBOXQTGUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_LDFLAGS)
1887 endif
1888endif
1889
1890
1891#
1892# Template for building build bldprogs.
1893#
1894TEMPLATE_VBOXBLDPROG = VBox Build Program
1895TEMPLATE_VBOXBLDPROG_DEFS = IN_RING3
1896ifeq ($(BUILD_PLATFORM),win)
1897 ifeq ($(BUILD_PLATFORM_ARCH),x86)
1898 ifdef VBOX_USE_VCC80
1899 TEMPLATE_VBOXBLDPROG_TOOL = VCC80X86
1900 else
1901 TEMPLATE_VBOXBLDPROG_TOOL = VCC70
1902 endif
1903 TEMPLATE_VBOXBLDPROG_SDKS = WIN32SDK
1904 else
1905 TEMPLATE_VBOXBLDPROG_TOOL = VCC80AMD64
1906 TEMPLATE_VBOXBLDPROG_SDKS = WIN64SDK
1907 endif
1908 ifneq ($(TEMPLATE_VBOXBLDPROG_TOOL),VCC70)
1909 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -W3 -wd4996 -Zc:wchar_t-
1910 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -RTCsu
1911 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -Oy- -GS-
1912 else
1913 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -W3
1914 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -GZ
1915 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -Ogitb2 -Oy-
1916 endif
1917 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1918 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1919 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
1920 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
1921 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1922 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
1923 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
1924 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
1925 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1926 /DISALLOWLIB:libcd.lib \
1927 /DISALLOWLIB:libcmtd.lib \
1928 /DISALLOWLIB:msvcrt.lib \
1929 /DISALLOWLIB:msvcrtd.lib \
1930 /DISALLOWLIB:msvcprt.lib \
1931 /DISALLOWLIB:msvcprtd.lib
1932 TEMPLATE_VBOXBLDPROG_LIBS = \
1933 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
1934 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt.lib \
1935 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt.lib
1936
1937else
1938# (gcc of some kind )
1939TEMPLATE_VBOXBLDPROG_TOOL = GXX3
1940TEMPLATE_VBOXBLDPROG_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1941TEMPLATE_VBOXBLDPROG_CFLAGS.debug = -fno-inline
1942TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
1943TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
1944TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
1945TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe
1946TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -fno-inline
1947TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
1948TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1949TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1950 ifeq ($(BUILD_PLATFORM),linux)
1951TEMPLATE_VBOXBLDPROG_LIBS = pthread m rt dl
1952 else ifeq ($(BUILD_PLATFORM),os2)
1953TEMPLATE_VBOXBLDPROG_TOOL = GXX3OMF
1954TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
1955 else ifeq ($(BUILD_PLATFORM),darwin)
1956TEMPLATE_VBOXBLDPROG_TOOL = GXX4MACHO
1957TEMPLATE_VBOXBLDPROG_LIBS =
1958TEMPLATE_VBOXBLDPROG_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1959 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_PLATFORM)),)
1960TEMPLATE_VBOXBLDPROG_TOOL = GXX3
1961TEMPLATE_VBOXBLDPROG_LIBS =
1962 else ifeq ($(BUILD_PLATFORM),solaris)
1963$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
1964TEMPLATE_VBOXBLDPROG_TOOL = GXX3PLAIN
1965TEMPLATE_VBOXBLDPROG_LIBS = rt
1966 else
1967$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
1968 endif
1969
1970endif # !win
1971
1972
1973
1974#
1975# Template for building R3 win32 guest additions.
1976#
1977TEMPLATE_VBOXW32GUESTR3 = VBox Win32 Guest Program
1978TEMPLATE_VBOXW32GUESTR3_INST = $(INST_ADDITIONS)
1979TEMPLATE_VBOXW32GUESTR3_BLD_TRG = win
1980TEMPLATE_VBOXW32GUESTR3_BLD_TRG_ARCH = x86
1981TEMPLATE_VBOXW32GUESTR3_BLD_TRG_CPU = i386
1982TEMPLATE_VBOXW32GUESTR3_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 IN_RT_R3 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
1983TEMPLATE_VBOXW32GUESTR3_RCDEFS = \
1984 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1985 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1986 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1987 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1988 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1989 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1990TEMPLATE_VBOXW32GUESTR3_ASTOOL = YASM
1991TEMPLATE_VBOXW32GUESTR3_ASFLAGS = -f win -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
1992TEMPLATE_VBOXW32GUESTR3_DLLSUFF = .dll
1993TEMPLATE_VBOXW32GUESTR3_EXESUFF = .exe
1994TEMPLATE_VBOXW32GUESTR3_LIBSUFF = .lib
1995TEMPLATE_VBOXW32GUESTR3_ARLIBSUFF = .lib
1996TEMPLATE_VBOXW32GUESTR3_SDKS = WIN32SDK W2K3DDKX86
1997ifdef VBOX_USE_VCC80
1998 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC80X86
1999 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
2000 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -RTCsu
2001 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -O2 -Oy- -GS-
2002else
2003 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC70
2004 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -U__LINUX__ -U__OS2__ -W3
2005 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -GZ
2006 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -Ogitb2 -Oy-
2007endif
2008TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2009TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2010TEMPLATE_VBOXW32GUESTR3_CFLAGS = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS)
2011TEMPLATE_VBOXW32GUESTR3_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug)
2012TEMPLATE_VBOXW32GUESTR3_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2013TEMPLATE_VBOXW32GUESTR3_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile)
2014TEMPLATE_VBOXW32GUESTR3_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile)
2015TEMPLATE_VBOXW32GUESTR3_INCS = \
2016 $(VBOX_PATH_SDK)/include
2017TEMPLATE_VBOXW32GUESTR3_LDFLAGS = \
2018 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE \
2019 /DISALLOWLIB:libc.lib \
2020 /DISALLOWLIB:libcd.lib \
2021 /DISALLOWLIB:msvcrt.lib \
2022 /DISALLOWLIB:libcmtd.lib \
2023 /DISALLOWLIB:msvcrtd.lib
2024ifdef VBOX_USE_VCC80
2025 TEMPLATE_VBOXW32GUESTR3_LIBS = \
2026 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib \
2027 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
2028 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
2029else
2030 TEMPLATE_VBOXW32GUESTR3_LIBS = \
2031 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \
2032 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
2033 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
2034endif
2035TEMPLATE_VBOXW32GUESTR3_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2036
2037#
2038# R3 win32 guest libraries
2039#
2040TEMPLATE_VBOXW32GUESTR3LIB = VBox Win32 Guest User Libraries
2041TEMPLATE_VBOXW32GUESTR3LIB_EXTENDS = VBOXW32GUESTR3
2042TEMPLATE_VBOXW32GUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
2043
2044
2045#
2046# Template for building R0 win32 guest tools.
2047#
2048TEMPLATE_VBOXW32GUESTR0 = VBox Win32 Guest Driver
2049TEMPLATE_VBOXW32GUESTR0_INST = $(INST_ADDITIONS)
2050TEMPLATE_VBOXW32GUESTR0_BLD_TRG = win
2051TEMPLATE_VBOXW32GUESTR0_BLD_TRG_ARCH = x86
2052TEMPLATE_VBOXW32GUESTR0_BLD_TRG_CPU = i386
2053TEMPLATE_VBOXW32GUESTR0_DEFS = _X86_ IN_GUEST IN_GUEST_R0 IN_RING0 IN_RT_R0 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
2054TEMPLATE_VBOXW32GUESTR0_RCDEFS = \
2055 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
2056 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
2057 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
2058 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
2059 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
2060 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
2061TEMPLATE_VBOXW32GUESTR0_ASTOOL = YASM
2062TEMPLATE_VBOXW32GUESTR0_ASFLAGS = -f win32 -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
2063TEMPLATE_VBOXW32GUESTR0_SYSSUFF = .sys
2064ifdef VBOX_USE_VCC80
2065 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC80X86
2066 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
2067 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -EHs-c- -Zl
2068 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -O2 -Oy-
2069else
2070 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC70
2071 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -U__LINUX__ -U__OS2__ -W3
2072 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -GX- -Zl
2073 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -Ogitb2 -Oy-
2074endif
2075TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2076TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2077TEMPLATE_VBOXW32GUESTR0_CFLAGS = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS)
2078TEMPLATE_VBOXW32GUESTR0_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug)
2079TEMPLATE_VBOXW32GUESTR0_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2080TEMPLATE_VBOXW32GUESTR0_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile)
2081TEMPLATE_VBOXW32GUESTR0_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile)
2082TEMPLATE_VBOXW32GUESTR0_LDFLAGS = \
2083 -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Machine:X86 -Debug \
2084 /DISALLOWLIB:libcd.lib \
2085 /DISALLOWLIB:msvcrt.lib \
2086 /DISALLOWLIB:msvcrtd.lib \
2087 /DISALLOWLIB:libcmtd.lib
2088TEMPLATE_VBOXW32GUESTR0_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
2089
2090#
2091# R0 win32 guest libraries
2092#
2093TEMPLATE_VBOXW32GUESTR0LIB = VBox Win32 Guest Driver
2094TEMPLATE_VBOXW32GUESTR0LIB_EXTENDS = VBOXW32GUESTR0
2095TEMPLATE_VBOXW32GUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
2096
2097
2098#
2099# Windows rc workaround for crosscompiling.
2100# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
2101#
2102ifneq ($(BUILD_PLATFORM),win)
2103 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2104 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2105 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2106 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
2107else
2108 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
2109 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
2110 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
2111 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
2112 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
2113 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
2114 ) Sorry_Cannot_find_mc_in_the_PSDK)
2115endif
2116
2117
2118#
2119# Template for syntax checking the linux guest additions.
2120# Not properly realized yet.
2121#
2122TEMPLATE_VBOXLNX32GUESTR0 = Template for *syntax checking* linux guest additions kernel modules
2123TEMPLATE_VBOXLNX32GUESTR0_TOOL = $(VBOX_GCC_TOOL)
2124TEMPLATE_VBOXLNX32GUESTR0_BLD_TRG = linux
2125TEMPLATE_VBOXLNX32GUESTR0_DEFS = __KERNEL__ MODULE IN_GUEST IN_GUEST_R0 IN_RING0 IN_RT_R0
2126TEMPLATE_VBOXLNX32GUESTR0_INCS = $(VBOX_LINUX_INCS)
2127TEMPLATE_VBOXLNX32GUESTR0_CFLAGS = -nostdinc -iwithprefix include \
2128 -O2 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
2129 $(VBOX_GCC_fno-stack-protector) -fno-strict-aliasing -fno-common \
2130 -mpreferred-stack-boundary=2 -msoft-float
2131TEMPLATE_VBOXLNX32GUESTR0_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXLNX32GUESTR0_CFLAGS)) -fno-exceptions -fno-rtti
2132ifndef VBOX_LINUX_VERSION_2_4
2133# 2.6
2134TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .ko
2135TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -m elf_i386 -r
2136else
2137# 2.4
2138TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .o
2139TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -r -s
2140endif
2141
2142
2143#
2144# Tools and templates for building 32-bit linux guest additions.
2145#
2146TOOL_VBOXLNX32NOCPPLD = Linker tool replacing the VBOX_GCC32_TOOL linker (g++).
2147TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_OUTPUT = $(outbase).map
2148TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
2149TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_DEPORD =
2150define TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_CMDS
2151 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_CC) $(flags) -o $(out) $(objs)\
2152 $(foreach p,$(libpath), -L$(p))\
2153 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
2154 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_MAP,$(outbase).map)
2155endef
2156TOOL_VBOXLNX32NOCPPLD_LINK_DLL_OUTPUT = $(outbase).map
2157TOOL_VBOXLNX32NOCPPLD_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
2158TOOL_VBOXLNX32NOCPPLD_LINK_DLL_DEPORD =
2159# (no SONAME for now)
2160define TOOL_VBOXLNX32NOCPPLD_LINK_DLL_CMDS
2161 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_CC) $(TOOL_$(VBOX_GCC32_TOOL)_LDFLAGS.dll) $(flags) -o $(out)\
2162 $(objs)\
2163 $(foreach p,$(libpath), -L$(p))\
2164 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
2165 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_MAP,$(outbase).map)
2166endef
2167TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_OUTPUT = $(outbase).map
2168TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
2169TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_DEPORD =
2170define TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_CMDS
2171 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_LD_SYSMOD) $(TOOL_VBOXLNX32NOCPPLD_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
2172 $(foreach p,$(libpath), -L$(p))\
2173 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
2174 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_SYSMOD_MAP,$(outbase).map)
2175endef
2176
2177TEMPLATE_VBOXLNX32GUESTR3EXE = Template for building 32-bit linux guest additions programs.
2178TEMPLATE_VBOXLNX32GUESTR3EXE_INST = $(INST_ADDITIONS)
2179TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG = linux
2180TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_ARCH = x86
2181TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_CPU = i386
2182TEMPLATE_VBOXLNX32GUESTR3EXE_TOOL = $(VBOX_GCC32_TOOL)
2183TEMPLATE_VBOXLNX32GUESTR3EXE_ASTOOL = YASM
2184TEMPLATE_VBOXLNX32GUESTR3EXE_ASFLAGS = -f elf32 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels
2185TEMPLATE_VBOXLNX32GUESTR3EXE_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 HC_ARCH_BITS=32 GC_ARCH_BITS=32
2186TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe $(VBOX_GCC_fno-stack-protector)
2187TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug = -fno-inline
2188TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2189TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2190TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2191TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.release = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2192TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug)
2193TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile)
2194TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile)
2195TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_fno-stack-protector)
2196# No LDFLAGS nor LIBS!
2197
2198TEMPLATE_VBOXLNX32GUESTR3EXENOCPP = Template for building 32-bit linux guest additions programs without any C++.
2199TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2200TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_LDTOOL = VBOXLNX32NOCPPLD
2201# No LDFLAGS nor LIBS!
2202
2203TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP = Template for building 32-bit linux guest additions shared objects without any C++.
2204TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2205TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDTOOL = VBOXLNX32NOCPPLD
2206TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS)
2207TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS)
2208TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDFLAGS = -fPIC
2209
2210TEMPLATE_VBOXLNX32GUESTR3LIB = Template for building 32-bit linux guest additions libraries.
2211TEMPLATE_VBOXLNX32GUESTR3LIB_EXTENDS = VBOXLNX32GUESTR3EXE
2212TEMPLATE_VBOXLNX32GUESTR3LIB_INST = $(INST_ADDITION_LIB)
2213
2214
2215#
2216# Two targets to coordinate version number changes properly. Note that the
2217# only way to get a really consistent build is to run 'kmk' in the top-level
2218# directory. If you don't run it there, you get a consistent sub-tree only.
2219#
2220VBOX_VERSION_STAMP = $(PATH_OUT)/version-stamp-$(VBOX_VERSION_STRING)
2221VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
2222VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
2223
2224$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
2225 $(call MSG_GENERATE,,$@)
2226 $(QUIET)$(MKDIR) -p $(@D)
2227 $(QUIET)$(RM) -f $(filter-out $@,$(wildcard $(PATH_OUT)/version-stamp-*))
2228 $(QUIET)$(ECHO_EXT) > $@
2229
2230$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
2231 $(call MSG_GENERATE,,$@)
2232 $(QUIET)$(MKDIR) -p $(@D)
2233 $(QUIET)$(RM) -f $@ $@.tmp
2234 $(QUIET)$(APPEND) $@.tmp "#ifndef __version_generated_h__"
2235 $(QUIET)$(APPEND) $@.tmp "#define __version_generated_h__"
2236 $(QUIET)$(APPEND) $@.tmp ""
2237 $(QUIET)$(APPEND) $@.tmp "#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)"
2238 $(QUIET)$(APPEND) $@.tmp "#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)"
2239 $(QUIET)$(APPEND) $@.tmp "#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)"
2240 $(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_STRING "$(VBOX_VERSION_STRING)"'
2241 $(QUIET)$(APPEND) $@.tmp ""
2242 $(QUIET)$(APPEND) $@.tmp "#endif"
2243 $(QUIET)$(MV) -f $@.tmp $@
2244
2245#
2246# Used for external makefiles which cannot include Config.kmk
2247#
2248$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
2249 $(call MSG_GENERATE,,$@)
2250 $(QUIET)$(MKDIR) -p $(@D)
2251 $(QUIET)$(RM) -f $@ $@.tmp
2252 $(QUIET)$(APPEND) $@.tmp "VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)"
2253 $(QUIET)$(APPEND) $@.tmp "VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)"
2254 $(QUIET)$(APPEND) $@.tmp "VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)"
2255 $(QUIET)$(APPEND) $@.tmp "VBOX_VERSION_STRING = $(VBOX_VERSION_STRING)"
2256 $(QUIET)$(MV) -f $@.tmp $@
2257
2258
2259# Force building of the version header file as the first thing anywhere in
2260# the tree. This eliminates the need for manual dependencies on it.
2261Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2262Makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2263makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2264
2265
2266#
2267# Legacy.
2268#
2269ifneq ($(LOCALCFG),)
2270 include $(LOCALCFG)
2271endif
2272
2273
2274#
2275# Some extra goals.
2276#
2277.PHONY: up update st stat status
2278up update::
2279 svn$(HOSTSUFF_EXE) up
2280
2281st stat status:
2282 svn$(HOSTSUFF_EXE) status
2283
2284quick:
2285 $(MAKE) VBOX_QUICK=1
2286
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette