VirtualBox

source: vbox/trunk/Config.kmk@ 10639

Last change on this file since 10639 was 10614, checked in by vboxsync, 16 years ago

Enable posix timers by default by all users of the code (requirement of VBoxSVC now). Enabled VBOX_WITH_RESOURECE_USAGE_API everywhere as it turned out Darwin is using the generic timers and not the posix ones as initially thought.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 116.0 KB
Line 
1# $Id: Config.kmk 10614 2008-07-14 19:52:32Z vboxsync $
2## @file
3# The global build configuration file for VBox.
4#
5# This file gets included by all makefiles through the
6# include $(KBUILD_PATH)/header.kmk statement.
7#
8
9#
10# Copyright (C) 2006-2007 Sun Microsystems, Inc.
11#
12# This file is part of VirtualBox Open Source Edition (OSE), as
13# available from http://www.virtualbox.org. This file is free software;
14# you can redistribute it and/or modify it under the terms of the GNU
15# General Public License as published by the Free Software Foundation,
16# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
17# distribution. VirtualBox OSE is distributed in the hope that it will
18# be useful, but WITHOUT ANY WARRANTY of any kind.
19#
20
21# Marker.
22VBOX_ROOT_CONFIG_KMK_INCLUDED = 1
23
24#
25# kBuild stuff
26#
27
28# Enable automatic installation of what's built.
29KBUILD_DO_AUTO_INSTALL := 1
30PASSES := $(filter-out PACKING,$(PASSES)) PACKING # temporary hack
31# Modify the order of the INSTALLS and OTHERS passes.
32DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES INSTALLS OTHERS
33# Modify the build types.
34## @todo checked and dbgopt
35KBUILD_BLD_TYPES = release profile debug kprofile
36
37# Install paths.
38PATH_INS := $(PATH_OUT)
39ifeq ($(KBUILD_TARGET),darwin)
40 INST_DIST = dist/
41 INST_SDK = $(INST_DIST)sdk/
42 INST_SDK_SAMPLES = $(INST_SDK)samples
43
44 # the bundles
45 INST_VIRTUALBOX = $(INST_DIST)VirtualBox.app/
46 INST_VBOXDRV = $(INST_DIST)VBoxDrv.kext/
47 INST_VBOXNETFLT = $(INST_DIST)VBoxNetFlt.kext/
48 INST_VBOXNETTAP = $(INST_DIST)VBoxNetTap.kext/
49 INST_VBOXUSB = $(INST_DIST)VBoxUSB.kext/
50
51 # put everything in the VirtualBox app bundle.
52 INST_BIN = $(INST_VIRTUALBOX)Contents/MacOS/
53 INST_DLL = $(INST_BIN)
54 INST_SYS = $(INST_BIN)
55 INST_TESTCASE = $(INST_BIN)testcase/
56 INST_ADDITIONS = $(INST_BIN)additions/
57
58 # other paths
59 INST_TESTSUITE = testsuite/
60 INST_LIB = lib/
61 INST_ADDITIONS_LIB = $(PATH_LIB)/additions/
62
63else
64
65 INST_BIN = bin/
66 INST_DIST = $(INST_BIN)
67 INST_DLL = $(INST_BIN)
68 INST_SDK = $(INST_BIN)sdk/
69 INST_SDK_SAMPLES = $(INST_SDK)samples
70 INST_DLL = $(INST_BIN)
71 INST_SYS = $(INST_BIN)
72 INST_TESTCASE = $(INST_BIN)testcase/
73 INST_ADDITIONS = $(INST_BIN)additions/
74
75 INST_TESTSUITE = testsuite/
76 INST_LIB = lib/
77 INST_ADDITIONS_LIB = $(INST_LIB)additions/
78endif
79
80PATH_BIN = $(patsubst %/,%,$(PATH_INS)/$(INST_BIN))
81PATH_DLL = $(patsubst %/,%,$(PATH_INS)/$(INST_DLL))
82PATH_SYS = $(patsubst %/,%,$(PATH_INS)/$(INST_SYS))
83PATH_LIB = $(patsubst %/,%,$(PATH_INS)/$(INST_LIB))
84PATH_DOC = $(PATH_OUT)/doc
85VBOX_PATH_SDK = $(patsubst %/,%,$(PATH_INS)/$(INST_SDK))
86VBOX_PATH_DIST = $(patsubst %/,%,$(PATH_INS)/$(INST_DIST))
87VBOX_PATH_TESTSUITE = $(patsubst %/,%,$(PATH_INS)/$(INST_TESTSUITE))
88VBOX_PATH_ADDITIONS = $(patsubst %/,%,$(PATH_INS)/$(INST_ADDITIONS))
89VBOX_PATH_ADDITIONS_LIB = $(patsubst %/,%,$(PATH_INS)/$(INST_ADDITIONS_LIB))
90
91
92# Delete targets on failure.
93.DELETE_ON_ERROR:
94
95# Notify about important kBuild updates.
96ifneq ($(call int-ge,$(KMK_REVISION),1650),1)
97 $(error You must update kBuild! KMK_REVISION=$(KMK_REVISION) KBUILD_PATH=$(KBUILD_PATH))
98endif
99
100#
101# Define USERNAME early on.
102#
103ifndef USERNAME
104 ifdef USER
105 USERNAME = $(USER)
106 else
107 $(warning Warning: You must have USERNAME or USER in your environment.)
108 endif
109endif
110
111#
112# The VirtualBox version.
113#
114
115# Major version.
116VBOX_VERSION_MAJOR = 1
117# Minor version.
118VBOX_VERSION_MINOR = 6
119# This is the current build number. It should be increased every time we publish a
120# new build. The define is available in every source file. Only even build numbers
121# will be published, odd numbers are set during development.
122VBOX_VERSION_BUILD = 51
123# Full version string (may include more than just x.y.z, but no spaces or other problematic chars).
124VBOX_VERSION_STRING = $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
125# Force the additions.sh script to get an exact additions build when we're doing the release.
126ifeq ($(int-mod $(VBOX_VERSION_BUILD),2),0)
127 export VBOX_ADDITIONS_SH_MODE = release
128endif
129
130
131#
132# The VirtualBox package type.
133#
134ifeq ($(KBUILD_TARGET),win)
135 VBOX_PACKAGE_OS = WINDOWS
136else ifeq ($(KBUILD_TARGET),linux)
137 VBOX_PACKAGE_OS = LINUX
138else ifeq ($(KBUILD_TARGET),darwin)
139 VBOX_PACKAGE_OS = DARWIN
140else ifeq ($(KBUILD_TARGET),solaris)
141 VBOX_PACKAGE_OS = SOLARIS
142else if1of ($(KBUILD_TARGET), dragonfly freebsd netbsd openbsd)
143 VBOX_PACKAGE_OS = BSD
144else
145 $(error Cannot determine VBOX_PACKAGE_OS)
146endif
147ifeq ($(KBUILD_TARGET_ARCH),x86)
148 VBOX_PACKAGE_ARCH = 32BITS
149else
150 VBOX_PACKAGE_ARCH = 64BITS
151endif
152# distribution, mostly for Linux/Solaris where we support different distributions
153# this strip will be overridden by the Linux packaging scripts
154VBOX_PACKAGE_DIST ?= GENERIC
155# Full string
156VBOX_PACKAGE_STRING = $(VBOX_PACKAGE_OS)_$(VBOX_PACKAGE_ARCH)_$(VBOX_PACKAGE_DIST)
157
158
159#
160# The VirtualBox Configuration Defaults.
161#
162# We try to document all the build configuration options here, thing which
163# aren't enabled by default is left commented out just to show that they
164# exist and which value they should have (usually 1, but anyway).
165#
166
167# This indicates that additions (of some kind or another) is being _built_.
168# VBOX_WITHOUT_ADDITIONS overrides it.
169#if1of ($(KBUILD_TARGET), freebsd linux os2 solaris win)
170if1of ($(KBUILD_TARGET), linux solaris win)
171 VBOX_WITH_ADDITIONS = 1
172endif
173# Build the optional ring-0 part of the additions for syntax checking.
174# (Except when cross-building on linux since we're using /usr/src/...)
175ifn1of ($(KBUILD_TARGET).$(KBUILD_HOST_ARCH).$(KBUILD_TARGET_ARCH), linux.x86.amd64 linux.amd64.x86)
176 VBOX_WITH_ADDITION_DRIVERS = 1
177endif
178# Build X11 additions. Can be disabled separately.
179if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd solaris)
180 VBOX_WITH_X11_ADDITIONS = 1
181endif
182# Enable the building of shared folders in the windows additions.
183VBOX_WITH_WIN32_ADDITIONS_SHAREDFOLDERS = 1
184# Take the binaries of the OS/2 Additions.
185VBOX_WITH_OS2_ADDITIONS_BIN = 1
186# Use additions from the build server.
187#VBOX_WITH_ADDITIONS_FROM_BUILD_SERVER = 1
188# Don't bother with additions, overrides VBOX_WITH_ADDITIONS.
189# This is not used by makefiles, only Config.kmk, see below.
190#VBOX_WITHOUT_ADDITIONS = 1
191# Only build the additions (for the additions build server).
192#VBOX_ONLY_ADDITIONS = 1
193ifdef VBOX_ADDITIONS_ONLY # typical mistake.
194 $(error It is VBOX_ONLY_ADDITIONS=1 not VBOX_ADDITIONS_ONLY!)
195endif
196# Don't create the additions ISO.
197# (Used by the additions build server, don't invert it.)
198#VBOX_WITHOUT_ADDITIONS_ISO = 1
199
200# build the installer
201VBOX_WITH_INSTALLER = 1
202# enable VRDP server
203VBOX_WITH_VRDP = 1
204# build VRDP authentication modules
205VBOX_WITH_VRDP_AUTHMOD = 1
206# build enhanced version of rdesktop
207VBOX_WITH_VRDP_RDESKTOP = 1
208if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), win.x86 l4.x86 l4.amd64)
209# build the support driver & library with IDT patching.
210VBOX_WITH_IDT_PATCHING = 1
211endif
212# Activate this to force the VM to pre-allocate the guest RAM before startup
213VBOX_WITH_PREALLOC_RAM_BY_DEFAULT =
214# The kernel driver/module and related runtime libraries.
215VBOX_WITH_VBOXDRV = 1
216# build with secure label support
217ifeq ($(filter win.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) # too much work with freetype and all that.
218VBOX_WITH_SECURELABEL = 1
219endif
220
221# The main api.
222VBOX_WITH_MAIN = 1
223# The webservices api.
224VBOX_WITH_WEBSERVICES = 1
225# The SDL based GUI.
226VBOX_WITH_VBOXSDL = 1
227# The basic frontend (w/o Main).
228VBOX_WITH_VBOXBFE = 1
229# The Qt GUI.
230VBOX_WITH_QTGUI = 1
231# The Qt 4 GUI (experimental).
232if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.x86 win.x86 win.amd64 linux.x86 linux.amd64)
233 VBOX_WITH_QT4GUI = 1
234endif
235# The headless frontend.
236VBOX_WITH_HEADLESS = 1
237## the Direct Framebuffer GUI
238#VBOX_WITH_VBOXFB = 1
239# Enable the debugger.
240ifneq ($(KBUILD_TYPE),release)
241 VBOX_WITH_DEBUGGER = 1
242 # Enable the debugger GUI.
243 VBOX_WITH_DEBUGGER_GUI = 1
244endif
245# the documentation
246VBOX_WITH_DOCS = 1
247# build the Host Guest Communication Manager component
248VBOX_WITH_HGCM = 1
249# Enable the USB feature.
250VBOX_WITH_USB = 1
251# Enable the USB 2.0 controller
252VBOX_WITH_EHCI = 1
253# Enable the ISCSI feature.
254VBOX_WITH_ISCSI = 1
255# Enable the E1000 feature
256VBOX_WITH_E1000 = 1
257# Enable ALSA support for Linux
258VBOX_WITH_ALSA = 1
259# Enable Pulse support for Linux
260VBOX_WITH_PULSE = 1
261# Disable WINMM support for Windows (not implemented)
262VBOX_WITH_WINMM =
263# Enable the kchmviewer
264VBOX_WITH_KCHMVIEWER = 1
265# Build the testsuite.
266VBOX_WITH_TESTSUITE = 1
267# Build the testcases.
268VBOX_WITH_TESTCASES = 1
269# Set this to not use COM or XPCOM in places where it can be avoided.
270#VBOX_WITHOUT_COM = 1
271# Set this to skip installing the redistributable compiler runtime.
272#VBOX_WITHOUT_COMPILER_REDIST = 1
273# Enabled internal networking.
274VBOX_WITH_INTERNAL_NETWORKING = 1
275# Enables the ffmpeg module for recording test runs.
276# Enable this for non-Linux builds later.
277ifeq ($(KBUILD_TARGET),linux)
278# VBOX_WITH_FFMPEG = 1
279endif
280# Enable OpenGL service
281VBOX_WITH_OGL = 1
282# Enable shared folders
283VBOX_WITH_SHARED_FOLDERS = 1
284# Enable shared clipboard
285VBOX_WITH_SHARED_CLIPBOARD = 1
286# Enable the Intel PXE ROM (replaces Etherboot).
287VBOX_WITH_INTEL_PXE = 1
288# Strip binaries of release and profile builds
289VBOX_DO_STRIP = $(if $(filter release profile,$(KBUILD_TYPE)),1,)
290# Strip R0/GC modules (current requirement for our loader)
291VBOX_DO_STRIP_MODULES = 1
292# Use kStuff for MACH-O and LX binary loading.
293if1of ($(KBUILD_TARGET),darwin os2)
294IPRT_WITH_KSTUFF = 1
295endif
296# Enable Crossbow support for Solaris.
297VBOX_WITH_CROSSBOW = 1
298# Enable setuid wrapper for Solaris.
299#VBOX_WITH_SUID_WRAPPER = 1
300# Enable the PDM Lock and let I/O threads call into the PICs.
301VBOX_WITH_PDM_LOCK = 1
302# Enable Seamless mode
303VBOX_X11_SEAMLESS_GUEST = 1
304# Enable the virtual SATA/AHCI controller
305VBOX_WITH_AHCI = 1
306# Enable the new async completion manager
307VBOX_WITH_PDM_ASYNC_COMPLETION = 1
308# Enable use of the $ORIGIN rpath feature. This is the default on
309# Solaris, but not else where for various reasons (ld.so, dist builds).
310ifeq ($(KBUILD_TARGET),solaris)
311 VBOX_WITH_ORIGIN = 1
312endif
313# Temporary switch for enabling / disabling the new USB code on Darwin.
314VBOX_WITH_NEW_USB_CODE_ON_DARWIN=1
315# Use the new VBI module on Solaris.
316VBOX_WITH_SOLARIS_VBI = 1
317# Enable 64 bits guest pointers.
318if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), linux.amd64 solaris.amd64 win.amd64)
319VBOX_WITH_64_BITS_GUESTS = 1
320else
321# VBOX_WITH_64_BITS_GUESTS = 1
322endif
323# Enable the host/guest information service (aka guest properties).
324VBOX_WITH_INFO_SVC = 1
325# Enable performance API.
326VBOX_WITH_RESOURCE_USAGE_API = 1
327
328
329#
330# Skip stuff.
331#
332
333# VBOX_QUICK can be used by core developers to speed to the build
334ifdef VBOX_QUICK
335 # undefine variables by assigning blank.
336 VBOX_WITH_TESTSUITE=
337 VBOX_WITH_TESTCASES=
338 VBOX_WITH_MAIN =
339 VBOX_WITH_VBOXSDL =
340 VBOX_WITH_VBOXBFE =
341 VBOX_WITH_QTGUI =
342 VBOX_WITH_DEBUGGER_GUI =
343 VBOX_WITH_DOCS =
344endif # VBOX_QUICK
345
346ifeq ($(KBUILD_TARGET),darwin)
347 # Internal networking requires testing and possibly proper ring-3/ring0 separation.
348 VBOX_WITH_INTERNAL_NETWORKING=
349 # Don't bother with SDL ttf for now.
350 VBOX_WITH_SECURELABEL=
351 # We'll use the native html/help viewer.
352 VBOX_WITH_KCHMVIEWER=
353 # Later:
354 VBOX_WITH_VRDP_AUTHMOD=
355 VBOX_WITH_VRDP_RDESKTOP=
356 VBOX_WITH_PDM_ASYNC_COMPLETION=
357endif
358
359ifeq ($(KBUILD_TARGET),freebsd)
360 VBOX_WITH_INSTALLER=
361 VBOX_WITH_SECURELABEL=
362 VBOX_WITH_VRDP_AUTHMOD=
363 VBOX_WITH_VRDP_RDESKTOP=
364 VBOX_WITH_TESTSUITE=
365 VBOX_WITH_USB=
366 VBOX_WITH_EHCI=
367 VBOX_WITH_DOCS=
368 VBOX_WITH_KCHMVIEWER=
369endif
370
371ifeq ($(KBUILD_TARGET),l4)
372 VBOX_WITH_VBOXDRV=
373 VBOX_WITH_ADDITION_DRIVERS=
374 VBOX_WITH_VRDP=
375 VBOX_WITH_HEADLESS=
376 VBOX_WITH_VBOXSDL=
377 VBOX_WITH_QTGUI=
378 VBOX_WITH_MAIN=
379 VBOX_WITH_DOCS=
380 VBOX_WITH_ISCSI=
381 VBOX_WITH_INTERNAL_NETWORKING=
382 VBOX_WITH_PDM_ASYNC_COMPLETION=
383 VBOX_WITH_KCHMVIEWER=
384endif
385
386ifeq ($(KBUILD_TARGET),os2)
387 VBOX_WITH_INSTALLER=
388 VBOX_WITH_SECURELABEL=
389 VBOX_WITH_VRDP_AUTHMOD=
390 VBOX_WITH_VRDP_RDESKTOP=
391 VBOX_WITH_TESTSUITE=
392 VBOX_WITH_USB=
393 VBOX_WITH_EHCI=
394 VBOX_WITH_DOCS=
395 VBOX_WITH_PDM_ASYNC_COMPLETION=
396 VBOX_WITH_KCHMVIEWER=
397endif
398
399ifeq ($(KBUILD_TARGET),solaris)
400 VBOX_WITH_SECURELABEL=
401 VBOX_WITH_VRDP_AUTHMOD=
402 VBOX_WITH_VRDP_RDESKTOP=
403 VBOX_WITH_OGL=
404 VBOX_WITH_KCHMVIEWER=
405endif
406
407ifeq ($(KBUILD_TARGET),win)
408 VBOX_WITH_VRDP_RDESKTOP=
409 VBOX_WITH_KCHMVIEWER=
410endif
411
412
413#
414# Include automatic and local config file to override the above settings
415# and to provide defaults for the settings below this point.
416#
417AUTOCFG := $(wildcard $(PATH_ROOT)/AutoConfig.kmk)
418ifeq ($(AUTOCFG),)
419 # deprecated name. to be removed.
420 AUTOCFG := $(wildcard $(PATH_ROOT)/Config.kmkconf)
421 ifneq ($(AUTOCFG),)
422 $(warning Config.kmkconf has been renamed. Please re-run configure.)
423 endif
424endif
425ifneq ($(AUTOCFG),)
426 include $(AUTOCFG)
427endif
428
429LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
430ifeq ($(LOCALCFG),)
431 # deprecated name. to be removed.
432 LOCALCFG := $(wildcard $(PATH_ROOT)/Config.kmklocal)
433 ifneq ($(LOCALCFG),)
434 $(warning Please rename your Config.kmklocal to LocalConfig.kmk.)
435 endif
436endif
437ifneq ($(LOCALCFG),)
438 include $(LOCALCFG)
439endif
440
441
442#
443# Disable components that are not open sourced.
444#
445ifdef VBOX_OSE
446 VBOX_WITH_WEBSERVICES=
447 VBOX_WITH_VRDP=
448 VBOX_WITH_USB=
449 VBOX_WITH_EHCI=
450 VBOX_WITH_ISCSI=
451 VBOX_WITH_E1000=
452 VBOX_WITH_DEBUGGER_GUI=
453 VBOX_WITH_WIN32_ADDITIONS_SHAREDFOLDERS=
454 VBOX_WITHOUT_ADDITIONS_ISO=1
455 VBOX_WITH_OS2_ADDITIONS_BIN=
456 VBOX_WITH_SECURELABEL=
457 VBOX_WITH_KCHMVIEWER=
458 VBOX_WITH_DOCS=
459 VBOX_WITH_TESTSUITE=
460 VBOX_WITH_INTEL_PXE=
461 ifeq ($(KBUILD_TARGET),darwin)
462 # Qt/Mac v3.3.x requires patching to work for us.
463 VBOX_WITH_QTGUI=
464 endif
465 ifn1of ($(KBUILD_TARGET),linux solaris)
466 # Only the Linux, Solaris installers are public
467 VBOX_WITH_INSTALLER=
468 endif
469 VBOX_WITH_AHCI=
470 VBOX_WITH_PDM_ASYNC_COMPLETION=
471endif
472
473#
474# Sanitize the additions build config variables.
475#
476ifdef VBOX_WITH_ADDITIONS_FROM_BUILD_SERVER
477 VBOX_WITHOUT_ADDITIONS := 1
478 ifdef VBOX_ONLY_ADDITIONS
479 $(error VBOX_ONLY_ADDITIONS + VBOX_WITH_ADDITIONS_FROM_BUILD_SERVER does not add up!)
480 endif
481endif
482
483ifdef VBOX_ONLY_ADDITIONS
484 ifdef VBOX_WITHOUT_ADDITIONS
485 $(error VBOX_ONLY_ADDITIONS + VBOX_WITHOUT_ADDITIONS does not add up!)
486 endif
487endif
488
489ifdef VBOX_WITHOUT_ADDITIONS
490 # Zap anything that could be contradicting this.
491 VBOX_WITH_ADDITIONS :=
492endif
493
494#
495# Disable components for headless
496#
497ifdef VBOX_HEADLESS
498 VBOX_WITH_QTGUI=
499 VBOX_WITH_VBOXSDL=
500 VBOX_WITH_VBOXBFE=
501 VBOX_WITH_OGL=
502 VBOX_WITH_KCHMVIEWER=
503endif
504
505#
506# Undefined VBOX_WITH_MAIN implies exclusion of a few more items.
507#
508ifndef VBOX_WITH_MAIN
509 VBOX_WITH_VRDP=
510 VBOX_WITH_VBOXSDL=
511 VBOX_WITH_QTGUI=
512 VBOX_WITH_DEBUGGER_GUI=
513 VBOX_WITH_HEADLESS=
514endif
515
516#
517# Mark OSE builds clearly, helps figuring out limitations more easily.
518#
519ifdef VBOX_OSE
520VBOX_VERSION_STRING = $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)_OSE
521endif
522
523
524#
525# Image and object format config.
526#
527if1of ($(KBUILD_TARGET), linux l4 freebsd netbsd openbsd solaris)
528 VBOX_LDR_FMT = elf
529endif
530ifeq ($(KBUILD_TARGET),darwin)
531 VBOX_LDR_FMT = macho
532endif
533ifeq ($(KBUILD_TARGET),os2)
534 VBOX_LDR_FMT = lx
535 VBOX_LDR_FMT32 = lx
536 VBOX_LDR_FMT64 = elf
537 DONT_USE_YASM = 1 # yasm doesn't implement omf yet.
538endif
539ifeq ($(KBUILD_TARGET),win)
540 VBOX_LDR_FMT = pe
541endif
542VBOX_LDR_FMT32 ?= $(VBOX_LDR_FMT)
543VBOX_LDR_FMT64 ?= $(VBOX_LDR_FMT)
544
545#
546# Assembler setup.
547#
548# This is a bit complicated since we have to support two different assmblers
549# (yasm/nasm) and possibly two different formats (32-bit/64-bit).
550#
551ifeq ($(VBOX_LDR_FMT),elf)
552 ifeq ($(KBUILD_TARGET_ARCH),x86)
553VBOX_ASFLAGS_FMT = -f elf32 -DASM_FORMAT_ELF
554 else
555VBOX_ASFLAGS_FMT = -f elf64 -DASM_FORMAT_ELF
556 endif
557 VBOX_ASFLAGS_DBFINFO = -g dwarf2
558endif
559ifeq ($(VBOX_LDR_FMT),lx)
560 VBOX_ASFLAGS_FMT = -f obj -DASM_FORMAT_OMF
561 VBOX_ASFLAGS_DBFINFO = -g stabs
562endif
563ifeq ($(VBOX_LDR_FMT),macho)
564 VBOX_ASFLAGS_FMT = -f macho -DASM_FORMAT_MACHO
565 VBOX_ASFLAGS_DBFINFO = -g dwarf2
566endif
567ifeq ($(VBOX_LDR_FMT),pe)
568 ifeq ($(KBUILD_TARGET_ARCH),x86)
569VBOX_ASFLAGS_FMT = -f win32 -DASM_FORMAT_PE
570 else
571VBOX_ASFLAGS_FMT = -f win64 -DASM_FORMAT_PE
572 endif
573VBOX_ASFLAGS_DBFINFO = -g cv8
574endif
575ifndef VBOX_ASFLAGS_FMT
576 $(error VBOX_ASFLAGS_FMT is not defined. VBOX_LDR_FMT=$(VBOX_LDR_FMT))
577endif
578
579ifeq ($(VBOX_LDR_FMT32),elf)
580 VBOX_ASFLAGS_FMT32 = -f elf32 -DASM_FORMAT_ELF
581 VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
582endif
583ifeq ($(VBOX_LDR_FMT32),lx)
584 VBOX_ASFLAGS_FMT32 = -f obj -DASM_FORMAT_OMF
585 VBOX_ASFLAGS_DBFINFO32 = -g stabs
586endif
587ifeq ($(VBOX_LDR_FMT32),macho)
588 VBOX_ASFLAGS_FMT32 = -f macho -DASM_FORMAT_MACHO
589 VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
590endif
591ifeq ($(VBOX_LDR_FMT32),pe)
592 VBOX_ASFLAGS_FMT32 = -f win32 -DASM_FORMAT_PE
593 VBOX_ASFLAGS_DBFINFO32 = -g cv8
594endif
595ifndef VBOX_ASFLAGS_FMT32
596 $(error VBOX_ASFLAGS_FMT32 is not defined. VBOX_LDR_FMT32=$(VBOX_LDR_FMT32))
597endif
598
599ifeq ($(VBOX_LDR_FMT64),elf)
600 VBOX_ASFLAGS_FMT64 = -f elf64 -DASM_FORMAT_ELF
601 VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
602endif
603ifeq ($(VBOX_LDR_FMT64),macho)
604 VBOX_ASFLAGS_FMT64 = -f macho64 -DASM_FORMAT_MACHO
605 VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
606endif
607ifeq ($(VBOX_LDR_FMT64),pe)
608 VBOX_ASFLAGS_FMT64 = -f win64 -DASM_FORMAT_PE
609 VBOX_ASFLAGS_DBFINFO64 = -g cv8
610endif
611ifndef VBOX_ASFLAGS_FMT64
612 $(error VBOX_ASFLAGS_FMT64 is not defined. VBOX_LDR_FMT64=$(VBOX_LDR_FMT64))
613endif
614
615ifndef DONT_USE_YASM
616 VBOX_ASTOOL = YASM
617 VBOX_LDR_FMT_2_YASM_DBGINFO.elf = -g dwarf2
618 VBOX_LDR_FMT_2_YASM_DBGINFO.lx = -g stabs
619 VBOX_LDR_FMT_2_YASM_DBGINFO.macho =
620 VBOX_LDR_FMT_2_YASM_DBGINFO.pe = -g cv8
621 VBOX_ASFLAGS = $(VBOX_ASFLAGS_FMT) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT))
622 VBOX_ASFLAGS32 = $(VBOX_ASFLAGS_FMT32) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT32))
623 VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT64))
624else
625 VBOX_ASTOOL = NASM
626 VBOX_ASFLAGS = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT)) -D__NASM__ -w+orphan-labels -g
627 VBOX_ASFLAGS32 = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT32)) -D__NASM__ -w+orphan-labels -g
628 VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__NASM__ -w+orphan-labels -g
629endif
630
631#
632# Windows only has mingw handy. On *nix we have to deal with cross compiling
633# 32-bit targets on 64-bit platforms, meaning we'll be using gcc32/g++32.
634# In the latter case we'll also have to disable all the all the R0 driver related stuff.
635#
636ifndef VBOX_GCC_TOOL
637 ifeq ($(KBUILD_TARGET),win)
638 VBOX_GCC_TOOL := MINGW32
639 TOOL_MINGW32_CFLAGS := $(UNDEFINED) # override -g
640 else ifeq ($(KBUILD_TARGET),os2)
641 VBOX_GCC_TOOL := GXX3OMF
642 else ifeq ($(KBUILD_TARGET),darwin)
643 VBOX_GCC_TOOL := GXX4MACHO
644 else ifeq ($(KBUILD_TARGET),solaris)
645 VBOX_GCC_TOOL := GXX3PLAIN
646 VBOX_GCC32_TOOL := GXX3PLAIN
647 else
648 VBOX_GCC_TOOL := GXX3
649 ifeq ($(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH),x86.amd64) ## @todo mixing target/host here!
650 VBOX_GCC_TOOL := GXX32
651 VBOX_WITH_VBOXDRV=
652 else ifeq ($(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH),amd64.x86)
653 VBOX_GCC_TOOL := GXX64
654 VBOX_WITH_VBOXDRV=
655 endif
656 endif
657endif
658ifndef VBOX_GCC32_TOOL
659 ifeq ($(KBUILD_TARGET_ARCH),x86)
660 VBOX_GCC32_TOOL := $(VBOX_GCC_TOOL)
661 else ifeq ($(KBUILD_TARGET),win)
662 VBOX_GCC32_TOOL := MINGW32
663 else
664 VBOX_GCC32_TOOL := GXX32
665 endif
666endif
667
668#
669# Decide which Visual C++ compiler version we're using by default.
670#
671ifndef VBOX_VCC_TOOL
672 ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
673 VBOX_USE_VCC80 ?= 1 # Enforce VCC80 when targetting AMD64.
674 endif
675 ifdef VBOX_USE_VCC80
676 ifeq ($(KBUILD_TARGET_ARCH),x86)
677 VBOX_VCC_TOOL := VCC80X86
678 else
679 VBOX_VCC_TOOL := VCC80AMD64
680 endif
681 else
682 VBOX_VCC_TOOL := VCC70
683 endif
684endif
685
686#
687# The kBuild tools and SDKs are using PATH_DEVTOOLS, PATH_DEVTOOLS_BLD
688# and PATH_DEVTOOLS_TRG to find things if we give them specific locations.
689#
690PATH_DEVTOOLS ?= $(PATH_ROOT)/tools
691PATH_DEVTOOLS := $(abspath $(PATH_DEVTOOLS))
692PATH_DEVTOOLS_BLD ?= $(PATH_DEVTOOLS)/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)
693PATH_DEVTOOLS_TRG ?= $(PATH_DEVTOOLS)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
694
695## @todo Remove the default tool crap here!
696TOOL = $(VBOX_GCC_TOOL)
697ifdef VBOX_USE_VCC80
698 TOOL.win.x86 = VCC80X86
699 TOOL.win.amd64 = VCC80AMD64
700else
701 TOOL.win = VCC70
702endif
703ASTOOL = $(VBOX_ASTOOL)
704
705#
706# L4-specific settings.
707#
708ifdef L4_DIR
709 ifeq ($(KBUILD_TARGET),l4)
710 L4_API ?= l4v2
711 L4_ARCH ?= $(KBUILD_TARGET_ARCH)
712 ifeq ($(L4_ARCH),x86)
713 L4_CPU ?= 586
714 L4LINUX26_INCDIR := $(L4LINUX26_DIR)/include \
715 $(L4LINUX26_DIR)/include/asm-l4/i386-arch
716 else ifeq ($(L4_ARCH),amd64)
717 L4_CPU ?= k8
718 L4LINUX26_INCDIR := $(L4LINUX26_DIR)/include
719 # no red zone for L4 because of IPC bindings
720 CFLAGS.l4 = -mno-red-zone
721 CXXFLAGS.l4 = -mno-red-zone
722 else
723 $(error L4_ARCH=$(L4_ARCH))
724 endif
725 L4_OBJ := $(L4_DIR)/build-$(L4_ARCH)-$(L4_CPU)-$(L4_API)
726 # support splitted Linux kernels (make O=<build directory>)
727 kernelsrc := $(shell $(SED_EXT) -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(L4LINUX26_DIR)/Makefile)
728 ifneq ($(kernelsrc),)
729 kernelpath := $(realpath $(kernelsrc))
730 L4LINUX26_INCDIR += $(L4LINUX26_DIR)/include2 $(kernelpath)/include
731 endif
732 L4_INCDIR := \
733 $(L4_OBJ)/include/uclibc++ \
734 $(L4_OBJ)/include/$(L4_ARCH)/uclibc \
735 $(L4_OBJ)/include/uclibc \
736 $(L4LINUX26_INCDIR) \
737 $(L4_OBJ)/include/$(L4_ARCH)/$(L4_API) \
738 $(L4_OBJ)/include/$(L4_API) \
739 $(L4_OBJ)/include/$(L4_ARCH) \
740 $(L4_OBJ)/include \
741 $(L4_DIR)/tool/dice/include
742 L4_LIBDIR := \
743 $(L4_DIR)/build-$(L4_ARCH)-$(L4_CPU)-$(L4_API)/lib/$(L4_ARCH)_$(L4_CPU)/$(L4_API)
744 endif # KBUILD_TARGET == l4
745endif # L4_DIR
746
747# Produce debugging information that the Fiasco kernel debugger can read.
748ifeq ($(KBUILD_TARGET).$(KBUILD_TYPE),l4.debug)
749 DEBUG_L4 = -gstabs+
750endif
751
752#
753# Setup the global defines and includes.
754#
755# Note! The __SOMETHING__ #defines are deprecated as they violate the C/C++ specs.
756#
757INCS += $(PATH_ROOT)/include $(PATH_OUT)
758DEFS += VBOX
759DEFS.debug := DEBUG DEBUG_$(subst $(subst _, ,_),_,$(USERNAME)) DEBUG_USERNAME=$(subst $(subst _, ,_),_,$(USERNAME))
760DEFS.profile = VBOX_WITH_STATISTICS
761DEFS.x86 = RT_ARCH_X86 __X86__
762DEFS.amd64 = RT_ARCH_AMD64 __AMD64__
763DEFS.darwin = RT_OS_DARWIN __DARWIN__
764DEFS.darwin.x86 = VBOX_WITH_HYBIRD_32BIT_KERNEL
765DEFS.freebsd = RT_OS_FREEBSD __FREEBSD__
766DEFS.l4 = RT_OS_L4 __L4__ __L4ENV__ L4API_l4v2 ARCH_$(KBUILD_TARGET_ARCH) __NO_CTYPE _FILE_OFFSET_BITS=64
767DEFS.linux = RT_OS_LINUX _FILE_OFFSET_BITS=64
768DEFS.netbsd = RT_OS_NETBSD
769DEFS.openbsd = RT_OS_OPENBSD
770DEFS.os2 = RT_OS_OS2 __OS2__
771DEFS.solaris = RT_OS_SOLARIS _FILE_OFFSET_BITS=64
772DEFS.win = RT_OS_WINDOWS __WIN__
773DEFS.win.x86 = __WIN32__
774DEFS.win.amd64 = __WIN64__
775# optional defines (use environment or make commandline)
776ifdef VBOX_WITH_DEBUGGER
777 DEFS += VBOX_WITH_DEBUGGER
778endif
779ifdef VBOX_WITH_DEBUGGER_GUI
780 DEFS += VBOX_WITH_DEBUGGER_GUI
781endif
782ifdef VBOX_WITH_STATISTICS
783 DEFS += VBOX_WITH_STATISTICS
784endif
785ifdef VBOX_STRICT
786 DEFS += VBOX_STRICT
787endif
788ifdef LOG_ENABLED
789 DEFS += LOG_ENABLED
790endif
791ifdef VBOX_OSE
792 DEFS += VBOX_OSE
793endif
794ifdef VBOX_WITH_NEW_PHYS_CODE
795 DEFS += VBOX_WITH_NEW_PHYS_CODE
796endif
797ifdef VBOX_WITH_64_BITS_GUESTS
798 DEFS += VBOX_WITH_64_BITS_GUESTS
799endif
800## @todo eliminate these guys.
801ifdef VBOX_WITH_INTERNAL_NETWORKING
802DEFS += VBOX_WITH_INTERNAL_NETWORKING
803endif
804
805#
806# Compiler optimization flags.
807#
808ifeq ($(KBUILD_TYPE),debug)
809 VBOX_GCC_FP ?= -fno-omit-frame-pointer
810 VBOX_GCC_OPT ?= -O0
811 VBOX_VCC_FP ?= -Oy-
812 VBOX_VCC_OPT ?=
813 VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer
814 VBOX_GCC_GC_OPT ?= -O0
815 VBOX_VCC_GC_FP ?= -Oy-
816 VBOX_VCC_GC_OPT ?=
817else
818 # We should use -fomit-frame-pointer for GCC / -Oy for VCC.
819 # -funwind-tables provides support for backtraces in gdb then.
820 VBOX_GCC_FP ?= -fno-omit-frame-pointer
821 VBOX_GCC_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
822 VBOX_VCC_FP ?= -Oy-
823 ifdef VBOX_USE_VCC80
824 VBOX_VCC_OPT ?= -O2 -GS-
825 else
826 VBOX_VCC_OPT ?= -Ogitb2
827 endif
828 VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer
829 VBOX_GCC_GC_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
830 VBOX_VCC_GC_FP ?= -Oy-
831 ifdef VBOX_USE_VCC80
832 VBOX_VCC_GC_OPT ?= -O2
833 else
834 VBOX_VCC_GC_OPT ?= -Ogitb2
835 endif
836endif
837
838#
839# ARCH_BITS_DEFS.
840#
841ifeq ($(KBUILD_TARGET_ARCH),amd64)
842 ARCH_BITS_DEFS := HC_ARCH_BITS=64
843else ifeq ($(KBUILD_TARGET_ARCH),x86)
844 ARCH_BITS_DEFS := HC_ARCH_BITS=32
845else
846 error KBUILD_TARGET_ARCH=$(KBUILD_TARGET_ARCH)
847endif
848
849ifdef VBOX_WITH_64_BITS_GUESTS
850 VBOX_GC_ARCH_BITS_DEFS := GC_ARCH_BITS=64
851else
852 VBOX_GC_ARCH_BITS_DEFS := GC_ARCH_BITS=32
853endif
854ARCH_BITS_DEFS += $(VBOX_GC_ARCH_BITS_DEFS)
855
856#
857# Add the output dir(s) to the dynamic loader search path.
858#
859if1of ($(KBUILD_TARGET), linux l4 freebsd netbsd openbsd solaris)
860 export LD_LIBRARY_PATH:=$(PATH_BIN):$(PATH_LIB):$(LD_LIBRARY_PATH)
861endif
862ifeq ($(KBUILD_TARGET),os2)
863 #fixme! export BEGINLIBPATH:=$(PATH_BIN);$(PATH_LIB);$(BEGINLIBPATH)
864endif
865ifeq ($(KBUILD_TARGET),win)
866 export PATH:=$(PATH_BIN);$(PATH_LIB);$(PATH)
867endif
868
869#
870# Common libraries and tools.
871#
872ifeq ($(KBUILD_TARGET),darwin)
873 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.dylib
874 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
875 LIB_KPROFILE = $(PATH_BIN)/kPrf2.dylib
876 LIB_VMM = $(PATH_BIN)/VBoxVMM.dylib
877 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
878 LIB_REM = $(PATH_LIB)/VBoxREMImp.dylib
879 LIB_XPCOM = $(PATH_BIN)/VBoxXPCOM.dylib
880 LIB_DDU = $(PATH_BIN)/VBoxDDU.dylib
881 LIB_SETTINGS = $(PATH_BIN)/VBoxSettings.dylib
882endif
883ifeq ($(KBUILD_TARGET),l4)
884 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.s.so
885 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
886 LIB_KPROFILE = $(PATH_BIN)/kPrf2.s.so
887 LIB_VMM = $(PATH_BIN)/VBoxVMM.s.so
888 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
889 LIB_REM = $(PATH_BIN)/VBoxREMImp.s.so
890 LIB_XPCOM = $(PATH_BIN)/VBoxXPCOM.s.so
891 LIB_DDU = $(PATH_BIN)/VBoxDDU.s.so
892 LIB_SETTINGS = $(PATH_BIN)/VBoxSettings.s.so
893endif
894if1of ($(KBUILD_TARGET), linux freebsd netbsd openbsd solaris)
895 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.so
896 LIB_RUNTIME_EF = $(PATH_LIB)/RuntimeEFCPP.a
897 LIB_KPROFILE = $(PATH_BIN)/kPrf2.so
898 LIB_VMM = $(PATH_BIN)/VBoxVMM.so
899 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
900 LIB_REM = $(PATH_BIN)/VBoxREMImp.so
901 LIB_XPCOM = $(PATH_BIN)/VBoxXPCOM.so
902 LIB_DDU = $(PATH_BIN)/VBoxDDU.so
903 LIB_SETTINGS = $(PATH_BIN)/VBoxSettings.so
904endif
905ifeq ($(KBUILD_TARGET),os2)
906 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.dll
907 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
908 LIB_KPROFILE = $(PATH_BIN)/kPrf2.dll
909 LIB_VMM = $(PATH_BIN)/VBoxVMM.dll
910 LIB_VMMGC = $(PATH_LIB)/VMMGCImp.lib
911 LIB_REM = $(PATH_LIB)/VBoxREMImp.lib
912 LIB_XPCOM = $(PATH_BIN)/VBoxXCOM.dll
913 LIB_DDU = $(PATH_BIN)/VBoxDDU.dll
914 LIB_SETTINGS = $(PATH_BIN)/VBoxSett.dll
915 OBJ_SYS0 = $(PATH_OBJ)/src/VBox/Runtime/RuntimeR0/os2/sys0.obj
916endif
917ifeq ($(KBUILD_TARGET),win)
918 LIB_RUNTIME = $(PATH_LIB)/VBoxRT.lib
919 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.lib
920 LIB_KPROFILE = $(PATH_LIB)/kPrf2.lib
921 LIB_VMM = $(PATH_LIB)/VBoxVMM.lib
922 ifdef VBOX_SINGLE_MAKEFILE
923 LIB_VMMGC = $(PATH_OBJ)/VMMGC/VMMGC.lib
924 else
925 LIB_VMMGC = $(PATH_OBJ)/src/VBox/VMM/VMMGC/VMMGC.lib
926 endif
927 LIB_REM = $(PATH_LIB)/VBoxREMImp.lib
928 LIB_XPCOM = $(PATH_BIN)/VBoxXPCOM.dll
929 LIB_DDU = $(PATH_LIB)/VBoxDDU.lib
930 LIB_SETTINGS = $(PATH_LIB)/VBoxSettings.lib
931endif
932
933# The kprofile build automagically links with kProfile.
934ifeq ($(KBUILD_TYPE),kprofile)
935 LIB_RUNTIME += $(LIB_KPROFILE)
936endif
937
938## Enable C++ electric fence heap. (Warning: will easily run out of virtual memory / kernel stuff on Linux/Windows.)
939#LIB_RUNTIME += $(LIB_RUNTIME_EF) $(LIB_RUNTIME)
940
941# Overridable libraries (unix).
942LIB_PTHREAD ?= pthread
943
944# Xcursor (consider an SDK for this).
945# (LIB_XCURSOR is legacy, remove in a month or two.)
946ifndef VBOX_XCURSOR_LIBS
947 VBOX_XCURSOR_LIBS := $(LIB_XCURSOR)
948endif
949ifeq ($(VBOX_XCURSOR_LIBS),)
950 ifeq ($(KBUILD_TARGET),solaris)
951 VBOX_XCURSOR_LIBS := $(lastword $(wildcard $(PATH_DEVTOOLS_TRG)/libXcursor/*/lib/libXcursor.a))
952 ifneq ($(VBOX_XCURSOR_LIBS),)
953 VBOX_XCURSOR_INCS := $(patsubst %/lib/libXcursor.a,%/include, $(VBOX_XCURSOR_LIBS))
954 VBOX_XCURSOR_LIBS += X11 Xrender Xfixes
955 endif
956 endif
957 ifeq ($(VBOX_XCURSOR_LIBS),)
958 VBOX_XCURSOR_LIBS := Xcursor
959 endif
960endif
961
962
963# Intel ASL compiler for ACPI
964VBOX_IASLCMD ?= $(firstword $(wildcard $(PATH_DEVTOOLS_BLD)/bin/iasl$(HOSTSUFF_EXE)) iasl$(HOSTSUFF_EXE))
965
966# Bruce's C compile is a C-compiler for BIOS-related 8086 code
967VBOX_BCC ?= $(PATH_DEVTOOLS_BLD)/bin/bcc$(HOSTSUFF_EXE) -B $(PATH_DEVTOOLS_BLD)/bin/
968
969# Assembler for BIOS-related 8086 code
970VBOX_AS86 ?= $(PATH_DEVTOOLS_BLD)/bin/as86$(HOSTSUFF_EXE)
971
972# libxslt XSLT processor. (see PATH_TOOL_YASM for explanation why it's temporarily located in bin.)
973ifeq ($(KBUILD_HOST),win)
974# VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/win.x86/libxslt/10114/xsltproc.exe
975 VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/win.x86/bin/xsltproc.exe
976else ifeq ($(KBUILD_HOST),os2)
977 VBOX_XSLTPROC ?= BEGINLIBPATH="$(PATH_DEVTOOLS_BLD)/bin;$$BEGINLIBPATH" $(PATH_DEVTOOLS_BLD)/bin/xsltproc.exe
978else
979 VBOX_XSLTPROC ?= xsltproc$(HOSTSUFF_EXE)
980endif
981
982# bin2c (convert binary files into C arrays)
983VBOX_BIN2C ?= $(PATH_OBJ)/bin2c/bin2c$(HOSTSUFF_EXE)
984
985# mkisofs
986ifeq ($(KBUILD_HOST),win)
987 VBOX_MKISOFS ?= $(PATH_DEVTOOLS_BLD)/bin/mkisofs.exe
988else
989 VBOX_MKISOFS ?= mkisofs
990endif
991
992# Makeself for the linux installers.
993VBOX_MAKESELF ?= $(PATH_DEVTOOLS)/common/makeself/v2.1.4_1/makeself.sh
994
995# Microsoft HTML Help Workshop.
996VBOX_PATH_HTML_HELP_WORKSHOP ?= $(PATH_DEVTOOLS)/win.x86/HTML_Help_Workshop/v1.3/
997
998# Path to the null soft installer.
999VBOX_PATH_NSIS ?= $(PATH_DEVTOOLS)/win.x86/nsis/v2.33-log-nsscm-r1
1000
1001# Path to AutoIt3.
1002VBOX_PATH_AUTOIT3 ?= $(PATH_DEVTOOLS)/win.x86/autoit/v3.2.10.0
1003
1004# Windows install tools...
1005VBOX_PATH_WIX ?= $(PATH_DEVTOOLS)/win.x86/wix/v2.0.4611.0
1006VBOX_PATH_DIFX ?= $(PATH_DEVTOOLS)/win.$(KBUILD_TARGET_ARCH)/DIFx/v2.1
1007
1008# We need to export YASM for OSE, but since it was converted to .zip we need to
1009# allow for the location used by the zip to be properly cleaned up first.
1010if1of ($(KBUILD_HOST).$(KBUILD_HOST_ARCH), win.x86 linux.x86 solaris.x86)
1011 PATH_TOOL_YASM ?= $(PATH_DEVTOOLS_BLD)/bin
1012endif
1013
1014# XPCOM setup for all but win32.
1015ifneq ($(KBUILD_TARGET),win)
1016 VBOX_WITH_XPCOM = 1
1017 VBOX_XPIDL ?= $(VBOX_PATH_SDK)/bin/xpidl$(HOSTSUFF_EXE)
1018 VBOX_PATH_XPCOM_IDL ?= $(VBOX_PATH_SDK)/idl
1019 VBOX_XPCOM_INCS ?= \
1020 $(VBOX_PATH_SDK)/include \
1021 $(VBOX_PATH_SDK)/include/xpcom \
1022 $(VBOX_PATH_SDK)/include/xpcom/nsprpub \
1023 $(VBOX_PATH_SDK)/include/xpcom/string \
1024 $(VBOX_PATH_SDK)/include/xpcom/xpcom \
1025 $(VBOX_PATH_SDK)/include/xpcom/ipcd
1026 ifneq ($(KBUILD_TARGET),os2)
1027 # libIDL-config (for xpcom18a4)
1028 ifeq ($(origin VBOX_LIBIDL_CONFIG),undefined)
1029 export VBOX_LIBIDL_CONFIG := $(firstword $(shell which libIDL-config-2 libIDL-config 2> /dev/null))
1030 endif
1031 endif
1032endif
1033
1034ifeq ($(KBUILD_TARGET),os2)
1035 # search DLLs in the EXE directory first
1036 VBOX_XPIDL := BEGINLIBPATH="$(dir $(VBOX_XPIDL));$$BEGINLIBPATH" $(VBOX_XPIDL)
1037endif
1038#$(error $(VBOX_XPIDL))
1039
1040# The X11 LIBPATH. (The amd64 hack is for RHEL4.)
1041ifeq ($(KBUILD_TARGET_ARCH),amd64)
1042 VBOX_LIBPATH_X11 ?= /usr/X11R6/lib64 /usr/X11R6/lib
1043else
1044 VBOX_LIBPATH_X11 ?= /usr/X11R6/lib
1045endif
1046
1047# 32bit X11 LIBPATH for building 32bit guest additions
1048VBOX_LIBPATH32_X11 ?= /usr/X11R6/lib32 /usr/X11R6/lib
1049
1050#
1051# Macros dealing with the darwin version we're targeting.
1052#
1053ifeq ($(KBUILD_TARGET),darwin)
1054 VBOX_DEF_MACOSX_VERSION_MIN ?= 10.4
1055 ifeq ($(VBOX_DEF_MACOSX_VERSION_MIN),10.4)
1056 ifeq ($(origin VBOX_DARWIN_CLASSIC_LINKER),undefined)
1057 VBOX_DARWIN_CLASSIC_LINKER := $(shell ld -v 2>&1 )
1058 ifneq ($(filter ld64%, $(subst :, , $(VBOX_DARWIN_CLASSIC_LINKER))),)
1059 export VBOX_DARWIN_CLASSIC_LINKER := -Wl,-classic_linker
1060 else
1061 export VBOX_DARWIN_CLASSIC_LINKER :=
1062 endif
1063 endif
1064 VBOX_PATH_MACOSX_SDK ?= /Developer/SDKs/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN)u.sdk
1065 else
1066 VBOX_PATH_MACOSX_SDK ?= /Developer/SDKs/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN).sdk
1067 endif
1068 VBOX_DARWIN_DEF_SDK_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=$(subst .,,$(VBOX_DEF_MACOSX_VERSION_MIN))0 \
1069 MAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(VBOX_DEF_MACOSX_VERSION_MIN))0
1070 VBOX_DARWIN_DEF_SDK_CFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
1071 VBOX_DARWIN_DEF_SDK_CXXFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
1072 VBOX_DARWIN_DEF_SDK_OBJCFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
1073 VBOX_DARWIN_DEF_SDK_LDFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK) $(VBOX_DARWIN_CLASSIC_LINKER)
1074endif # target=darwin
1075
1076#
1077# The X11 headers.
1078#
1079VBOX_PATH_X11_ROOT = $(PATH_ROOT)/src/VBox/Additions/x11/x11include
1080VBOX_PATH_X11_XFREE_4_2 = $(VBOX_PATH_X11_ROOT)/4.2
1081VBOX_PATH_X11_XFREE_4_3 = $(VBOX_PATH_X11_ROOT)/4.3
1082VBOX_PATH_X11_XORG_7_0 = $(VBOX_PATH_X11_ROOT)/7.0
1083VBOX_PATH_X11_XORG_7_1 = $(VBOX_PATH_X11_ROOT)/7.1
1084VBOX_PATH_X11_XORG_1_3 = $(VBOX_PATH_X11_ROOT)/1.3
1085VBOX_PATH_X11_XORG_1_4 = $(VBOX_PATH_X11_ROOT)/1.4
1086VBOX_PATH_X11_XORG_1_5 = $(VBOX_PATH_X11_ROOT)/1.5
1087
1088#
1089# Various other variables.
1090#
1091
1092# Two helper variables for the VBOX_WITH_ORIGIN stuff:
1093# VBOX_ORIGIN - Indirect expansion trick.
1094# VBOX_GCC_RPATH_OPT - Different GCC/LD combinations needs different options.
1095VBOX_ORIGIN = $$ORIGIN
1096ifeq ($(KBUILD_TARGET),solaris)
1097 VBOX_GCC_RPATH_OPT = -R
1098else
1099 VBOX_GCC_RPATH_OPT = -Wl,-rpath,
1100endif
1101
1102# The icons to use.
1103ifdef VBOX_OSE
1104 VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_win.ico
1105 VBOX_MACOSX_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox.icns
1106else
1107 ifeq ($(KBUILD_HOST),win)
1108 VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox-vista.ico
1109 TOOL_VCC80X86_RC := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
1110 TOOL_VCC80AMD64_RC := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
1111 TOOL_VCC70_RC := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
1112 else
1113 VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox-winxp.ico
1114 endif
1115 VBOX_MACOSX_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox.icns
1116endif
1117
1118
1119#
1120# GCC stuff properties.
1121# Most of this is resolved on first kmk invocation and cached in PATH_OUT.
1122#
1123# Note! That a harmless warning is printed if the file doesn't exist.
1124# Note! Changes in GCC are not detected automatically (yet).
1125#
1126include $(KBUILD_PATH)/tools/$(VBOX_GCC_TOOL).kmk
1127ifneq ($(VBOX_GCC_TOOL),$(VBOX_GCC32_TOOL))
1128 include $(KBUILD_PATH)/tools/$(VBOX_GCC32_TOOL).kmk
1129endif
1130
1131# These tests never worked on Windows because of /dev/null, so, there
1132# can be no harm in just dropping them until cygwin is mp safe.
1133ifeq ($(KBUILD_HOST),win)
1134VBOX_GCC_CHECK_CC = $(2)
1135VBOX_GCC_CHECK_CXX = $(2)
1136VBOX_GCC_CHECK_LD = $(2)
1137VBOX_GCC32_CHECK_CXX = $(2)
1138else
1139VBOX_GCC_CHECK_CC = $(shell \
1140 if $(TOOL_$(VBOX_GCC_TOOL)_CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
1141 then echo "$(1)"; \
1142 else echo "$(2)"; fi; )
1143
1144VBOX_GCC_CHECK_CXX = $(shell \
1145 if $(TOOL_$(VBOX_GCC_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
1146 then echo "$(1)"; \
1147 else echo "$(2)"; fi; )
1148
1149VBOX_GCC_CHECK_LD = $(shell \
1150 if $(TOOL_$(VBOX_GCC_TOOL)_LD) -Wl,$(1) -nostdlib -o /dev/null -xc /dev/null > /dev/null 2>&1 ;\
1151 then echo "-Wl,$(1)"; \
1152 else echo "$(2)"; fi; )
1153
1154VBOX_GCC32_CHECK_CXX = $(shell \
1155 if $(TOOL_$(VBOX_GCC32_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
1156 then echo "$(1)"; \
1157 else echo "$(2)"; fi; )
1158endif
1159
1160ifeq ($(KBUILD_HOST),win)
1161# This isn't important (yet) on windows, so cook the result until
1162# cygwin is feeling better.
1163VBOX_GCC_VERSION := $(int-add $(int-mul 10000, 3), $(int-mul 100, 3), 3)
1164else
1165# This is kind of bad, the returned string needs to be re-evaluated before use.
1166# The reason for this hack is that the windows kmk_ash cannot deal with $((1+1)).
1167VBOX_GCC_VERSION = $(shell \
1168 $(1) -dumpversion | $(SED_EXT) 's|\([0-9]\)\.\([0-9]\)\.\([0-9]\)|$$(int-add $$(int-mul 10000, \1), $$(int-mul 100, \2), \3)|' )
1169endif
1170
1171# No $(QUIET) here as it's interesting to see what goes into the file.
1172$(PATH_OUT)/GCCConfig.kmk: $(PATH_ROOT)/Config.kmk $(LOCALCFG) $(AUTOCFG)
1173 $(call MSG_GENERATE,,$@,)
1174 $(QUIET)$(RM) -f '$@'
1175 $(QUIET)$(MKDIR) -p $(@D)
1176
1177# HC compiler switch detection.
1178 $(APPEND) '$@' 'VBOX_GCC_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CC))'
1179 $(APPEND) '$@' 'VBOX_GCC_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CXX))'
1180 $(APPEND) '$@' 'VBOX_GCC_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)'
1181 $(APPEND) '$@' 'VBOX_GCC_Wno-pointer-sign ?= $(call VBOX_GCC_CHECK_CC,-Wno-pointer-sign,)'
1182 $(APPEND) '$@' 'VBOX_GCC_Wno-variadic-macros ?= $(call VBOX_GCC_CHECK_CXX,-Wno-variadic-macros,)'
1183 $(APPEND) '$@' 'VBOX_GCC_Wno-invalid-offsetof ?= $(call VBOX_GCC_CHECK_CXX,-Wno-invalid-offsetof,)'
1184 $(APPEND) '$@' 'VBOX_GCC_Wno-extra ?= $(call VBOX_GCC_CHECK_CXX,-Wno-extra)'
1185 $(APPEND) '$@' 'VBOX_GCC_fno-stack-protector ?= $(call VBOX_GCC_CHECK_CC,-fno-stack-protector,)'
1186# Produce code optimized for the most common IA32/AMD64/EM64T processors. Introduced with gcc version 4.2.
1187 $(APPEND) '$@' 'VBOX_GCC_mtune-generic ?= $(call VBOX_GCC_CHECK_CC,-mtune=generic,)'
1188 $(APPEND) '$@' 'VBOX_LD_as_needed ?= $(call VBOX_GCC_CHECK_LD,--as-needed,)'
1189ifneq ($(KBUILD_TARGET),l4)
1190# Set default attribute for ELF and MACH-O symbols to ``hidden'' to reduce the number
1191# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
1192 $(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CC),)'
1193 $(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CC),40000),)'
1194 $(APPEND) '$@' ' VBOX_GCC_fvisibility-hidden ?= $(call VBOX_GCC_CHECK_CC,-fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN -DRT_USE_VISIBILITY_DEFAULT,)'
1195 $(APPEND) '$@' ' endif'
1196 $(APPEND) '$@' 'endif'
1197endif
1198ifneq ($(KBUILD_TARGET),l4)
1199# Set default attribute for inline functions to ``hidden'' to reduce the number
1200# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
1201 $(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CXX),)'
1202 $(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CXX),40000),)'
1203 $(APPEND) '$@' ' VBOX_GCC_fvisibility-inlines-hidden ?= $(call VBOX_GCC_CHECK_CXX,-fvisibility-inlines-hidden,)'
1204 $(APPEND) '$@' ' endif'
1205 $(APPEND) '$@' 'endif'
1206endif
1207# Find the compiler includes for IPRT no-crt.
1208# Note that `$(dir $(gcc -print-libgcc-file-name))/include does not work for a 64-bit cross build on a 32-bit build host.
1209ifeq ($(KBUILD_HOST),win)
1210# With the cygwin issues and gcc on windows returning a useless path, just skip this on windows.
1211 $(APPEND) '$@' 'VBOX_PATH_GCC_INCS ?= '
1212else
1213 $(APPEND) '$@' 'VBOX_PATH_GCC_INCS ?= $(shell LC_ALL=C $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-search-dirs|$(SED_EXT) -ne 's+^install: \(.*[^/][^/]*\)/+\1+p')/include'
1214endif
1215# 32-bit (GC) compiler switch detection.
1216 $(APPEND) '$@' 'VBOX_GCC32_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CC))'
1217 $(APPEND) '$@' 'VBOX_GCC32_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CXX))'
1218 $(APPEND) '$@' 'VBOX_GCC32_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC32_TOOL)_CC) -print-libgcc-file-name)'
1219 $(APPEND) '$@' 'VBOX_GCC32_Wno-variadic-macros ?= $(call VBOX_GCC32_CHECK_CXX,-Wno-variadic-macros,)'
1220
1221include $(PATH_OUT)/GCCConfig.kmk
1222
1223
1224#
1225# Code Signing.
1226#
1227ifdef VBOX_SIGNING_MODE
1228 ifeq ($(KBUILD_HOST),win)
1229 # VBOX_PATH_SELFSIGN points to the Vista WDK bin/SelfSign directory.
1230 ifndef VBOX_PATH_SELFSIGN
1231 VBOX_PATH_SELFSIGN := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS)/win.x86/selfsign/*)))
1232 ifeq ($(VBOX_PATH_SELFSIGN),)
1233 VBOX_PATH_SELFSIGN := $(PATH_DEVTOOLS)/win.x86/selfsign/r1
1234 endif
1235 endif
1236 VBOX_SIGNTOOL ?= $(VBOX_PATH_SELFSIGN)/SignTool.exe
1237 VBOX_INF2CAT ?= $(VBOX_PATH_SELFSIGN)/Inf2Cat.exe
1238
1239 # There are three signing modes; 'test', 'development' and 'release'.
1240 ifeq ($(strip $(VBOX_SIGNING_MODE)),test)
1241 VBOX_CERTIFICATE_SUBJECT_NAME ?= MyTestCertificate
1242 VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
1243 else if1of ($(VBOX_SIGNING_MODE),release development)
1244 VBOX_CERTIFICATE_SUBJECT_NAME ?= Sun Microsystems, Inc.
1245 VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
1246 VBOX_CROSS_CERTIFICATE_FILE ?= $(VBOX_PATH_SELFSIGN)/MSCV-VSClass3.cer
1247 VBOX_CROSS_CERTIFICATE_FILE_ARGS ?= /ac "$(VBOX_CROSS_CERTIFICATE_FILE)"
1248 VBOX_TSA_URL ?= http://timestamp.verisign.com/scripts/timestamp.dll
1249 VBOX_TSA_URL_ARGS ?= /t "$(VBOX_TSA_URL)"
1250 else
1251 $(error Unknown VBOX_SIGNING_MODE: $(VBOX_SIGNING_MODE))
1252 endif
1253 VBOX_CERTIFICATE_STORE ?= my
1254 VBOX_CERTIFICATE_STORE_ARGS ?= /s "$(VBOX_CERTIFICATE_STORE)"
1255
1256 ## Commands for signing a driver image after link.
1257 VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_FILE_FN,$(out)))
1258 ## Sign a file.
1259 # @param 1 The file to sign.
1260 VBOX_SIGN_FILE_FN ?= $(VBOX_SIGNTOOL) sign \
1261 $(VBOX_CROSS_CERTIFICATE_FILE_ARGS) \
1262 $(VBOX_CERTIFICATE_STORE_ARGS) \
1263 $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
1264 $(VBOX_TSA_URL_ARGS) \
1265 $(1)
1266 ## Create a security catalog file.
1267 # @param 1 The directory containing the stuff to sign.
1268 # @param 2 The expected .cat name. (Inf2Cat lowercases it)
1269 # @param 3 The list of OSes, separated by ';'.
1270 VBOX_MAKE_CAT_HLP_FN ?= \
1271 $(RM) -f $(2)\
1272 $(NL)$(TAB)$(VBOX_INF2CAT) /driver:$(strip $(1)) /os:$(strip $(subst ;,$(COMMA),$(3))) /verbose \
1273 $(NL)$(TAB)$(MV) $(2) $(2) \
1274 $(NL)$(TAB)$(call VBOX_SIGN_FILE_FN,$(2))
1275 VBOX_MAKE_CAT64_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),XP_X64;Server2003_X64;Vista_X64)
1276 VBOX_MAKE_CAT32_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),2000;XP_X86;Server2003_X86;Vista_X86)
1277 ifeq ($(KBUILD_TARGET_ARCH),x86)
1278 VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT32_FN,$(1),$(2))
1279 else
1280 VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT64_FN,$(1),$(2))
1281 endif
1282
1283 # Go nuts, sign everything.
1284 ifeq ($(strip $(VBOX_SIGNING_MODE)),release)
1285 ## Commands for signing an executable or a dll image after link.
1286 VBOX_SIGN_IMAGE_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_FILE_FN,$(out)))
1287 ## Enable signing of the additions.
1288 VBOX_SIGN_ADDITIONS ?= 1
1289 endif
1290 else
1291 # Not windows build platform, ignore.
1292 VBOX_SIGNING_MODE :=
1293 endif
1294endif
1295
1296#
1297# Windows .inf editing.
1298#
1299ifeq ($(KBUILD_TARGET_ARCH),x86)
1300 VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF32_FN,$(1),$(2))
1301else
1302 VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF64_FN,$(1),$(2))
1303endif
1304## Edit an inf file an x86 target.
1305# @param 1 The inf file to edit.
1306# @param 2 The output file.
1307VBOX_EDIT_INF32_FN = $(SED) $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d') -e 's/^;x86 *//' -e '/^;amd64 /d' --output $(2) $(1)
1308## Edit an inf file an x86 target.
1309# @param 1 The inf file to edit.
1310# @param 2 The output file.
1311VBOX_EDIT_INF64_FN = $(SED) $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d') -e 's/^;amd64 *//' -e '/^;x86 /d' --output $(2) $(1)
1312
1313#
1314# Default prefixes and suffixes.
1315#
1316VBOX_PREF_LIB =
1317if1of ($(KBUILD_TARGET),win os2)
1318VBOX_SUFF_LIB = .lib
1319else
1320VBOX_SUFF_LIB = .a
1321endif
1322VBOX_SUFF_DLL = $(SUFF_DLL)
1323ifeq ($(KBUILD_TARGET),os2) # GXX3OMF produces out .o at the moment.
1324VBOX_SUFF_OBJ = .o
1325else
1326VBOX_SUFF_OBJ = $(SUFF_OBJ)
1327endif
1328VBOXW32GUEST_SUFF_LIB = .lib
1329VBOXLNX32GUEST_SUFF_LIB = .a
1330
1331#
1332# SDKs for external libraries.
1333#
1334SDK_VBOX_LIBXML2 = .
1335#if1of ($(KBUILD_TARGET),win os2 solaris)
1336 SDK_VBOX_LIBXML2_INCS ?= $(PATH_ROOT)/src/libs/libxml2-2.6.30/include
1337 SDK_VBOX_LIBXML2_LIBS ?= $(PATH_LIB)/VBox-libxml2$(VBOX_SUFF_LIB)
1338 SDK_VBOX_LIBXML2_DEFS ?= LIBXML_STATIC
1339 SDK_VBOX_LIBXML2_DEFS.win += WIN32 _WINDOWS _MBCS
1340#else if1of ($(KBUILD_TARGET),linux)
1341# SDK_VBOX_LIBXML2_INCS ?=
1342# SDK_VBOX_LIBXML2_LIBS ?=
1343# SDK_VBOX_LIBXML2_CFLAGS ?= $(shell pkg-config libxml-2.0 --cflags)
1344# SDK_VBOX_LIBXML2_CXXFLAGS ?= $(SDK_VBOX_LIBXML2_CFLAGS)
1345# SDK_VBOX_LIBXML2_LDFLAGS ?= $(shell pkg-config libxml-2.0 --libs)
1346#else
1347# SDK_VBOX_LIBXML2_INCS ?=
1348# SDK_VBOX_LIBXML2_LIBS ?= xml2
1349#endif
1350
1351SDK_VBOX_LIBXSLT = .
1352#if1of ($(KBUILD_TARGET),win os2 solaris)
1353 SDK_VBOX_LIBXSLT_INCS ?= $(PATH_ROOT)/src/libs/libxslt-1.1.22
1354 SDK_VBOX_LIBXSLT_LIBS ?= $(PATH_LIB)/VBox-libxslt$(VBOX_SUFF_LIB)
1355 SDK_VBOX_LIBXSLT_DEFS ?=
1356 SDK_VBOX_LIBXSLT_DEFS.win += WIN32 _WINDOWS _MBCS _REENTRANT
1357#else if1of ($(KBUILD_TARGET),linux)
1358# SDK_VBOX_LIBXSLT_INCS ?=
1359# SDK_VBOX_LIBXSLT_LIBS ?=
1360# SDK_VBOX_LIBXSLT_CFLAGS ?= $(shell pkg-config libxslt-1.0 --cflags)
1361# SDK_VBOX_LIBXSLT_CXXFLAGS ?= $(SDK_VBOX_LIBXSLT_CFLAGS)
1362# SDK_VBOX_LIBXSLT_LDFLAGS ?= $(shell pkg-config libxslt-1.0 --libs)
1363#else
1364# SDK_VBOX_LIBXSLT_INCS ?=
1365# SDK_VBOX_LIBXSLT_LIBS ?= xslt
1366#endif
1367
1368SDK_VBOX_LIBPNG = .
1369SDK_VBOX_LIBPNG_INCS ?= $(PATH_ROOT)/src/libs/libpng-1.2.8
1370SDK_VBOX_LIBPNG_LIBS ?= $(PATH_LIB)/VBox-libpng$(VBOX_SUFF_LIB)
1371
1372SDK_VBOX_ZLIB = .
1373if1of ($(KBUILD_TARGET), win os2)
1374 SDK_VBOX_ZLIB_INCS ?= $(PATH_ROOT)/src/libs/zlib-1.2.1
1375 SDK_VBOX_ZLIB_LIBS ?= $(PATH_LIB)/VBox-zlib$(VBOX_SUFF_LIB)
1376else
1377 SDK_VBOX_ZLIB_INCS ?=
1378 SDK_VBOX_ZLIB_LIBS ?= z
1379endif
1380
1381SDK_VBOX_OPENSSL = .
1382if1of ($(KBUILD_TARGET), darwin linux solaris win)
1383 ifdef VBOX_SINGLE_MAKEFILE
1384 SDK_VBOX_OPENSSL_DEFAULT_INCS := $(PATH_OUT)/obj/crypto-headers/include
1385 else
1386 SDK_VBOX_OPENSSL_DEFAULT_INCS := $(PATH_OUT)/obj/src/libs/openssl-0.9.8h/crypto-headers/include
1387 endif
1388 SDK_VBOX_OPENSSL_INCS ?= $(SDK_VBOX_OPENSSL_DEFAULT_INCS)
1389else
1390 SDK_VBOX_OPENSSL_INCS ?= $(PATH_ROOT)/src/libs/openssl-0.9.7e/include
1391endif
1392SDK_VBOX_OPENSSL_LIBS?= $(PATH_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB)
1393
1394SDK_VBOX_FFMPEG = .
1395if1of ($(KBUILD_TARGET), win os2 darwin)
1396 SDK_VBOX_FFMPEG_INCS ?= \
1397 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavutil \
1398 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavcodec \
1399 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavformat
1400 ifeq ($(KBUILD_TARGET),win)
1401 ## @todo Michael! Where is $(PATH_LIB)/VBoxFFmpegImp$(VBOX_SUFF_LIB) supposed to come from?
1402 #SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpeg.a
1403 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpegImp.lib
1404 else
1405 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_BIN)/VBoxFFmpeg$(SUFF_DLL)
1406 endif
1407else
1408 SDK_VBOX_FFMPEG_INCS ?= /usr/include/ffmpeg /usr/include/libpng
1409 SDK_VBOX_FFMPEG_LIBS ?= avutil avcodec avformat
1410endif
1411
1412#
1413# Special SDK for the problematic NTDLL.LIB.
1414#
1415SDK_VBOX_NTDLL = Requires W2K3DDK
1416SDK_VBOX_NTDLL_LIBS ?= $(PATH_SDK_W2K3DDK_LIB)/ntdll.lib
1417
1418
1419#
1420# Qt build tools and libraries.
1421# For *NIX we require it to be present on the system.
1422#
1423## @todo convert this into SDK and integrate the Qt stuff into kBuild.
1424ifeq ($(KBUILD_TARGET),win)
1425 VBOX_PATH_QT ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v3.*)))
1426 VBOX_DLL_QT ?= $(firstword $(wildcard $(VBOX_PATH_QT)/bin/VBoxQt3*.dll) \
1427 $(wildcard $(VBOX_PATH_QT)/bin/qtmt3*.dll) \
1428 $(wildcard $(VBOX_PATH_QT)/bin/qt-mt3*.dll) \
1429 $(wildcard $(VBOX_PATH_QT)/lib/qt-mt3*.dll))
1430 ifneq ($(wildcard $(VBOX_PATH_QT)/bin/accessible/VBoxQtWidgets100.dll),)
1431 VBOX_QT_BINARIES += \
1432 $(VBOX_PATH_QT)/bin/accessible/VBoxQtWidgets100.dll=>accessible/VBoxQtWidgets100.dll
1433 endif
1434 LIB_QT ?= $(firstword $(wildcard $(VBOX_PATH_QT)/lib/VBoxQt3*.lib) \
1435 $(wildcard $(VBOX_PATH_QT)/lib/qt-mt3*.lib) \
1436 $(wildcard $(VBOX_PATH_QT)/lib/dynamic/qt-mt3*.lib))
1437 LIB_QT_PRL ?= $(firstword $(wildcard $(VBOX_PATH_QT)/lib/VBoxQt.prl) \
1438 $(wildcard $(VBOX_PATH_QT)/lib/qt-mt.prl) \
1439 $(wildcard $(VBOX_PATH_QT)/lib/dynamic/qt-mt.prl))
1440 LIB_QTMAIN ?= $(firstword $(wildcard $(VBOX_PATH_QT)/lib/qtmain.lib) \
1441 $(wildcard $(VBOX_PATH_QT)/lib/dynamic/qtmain.lib))
1442 QTDIR ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/qt/v3.*)))
1443else ifeq ($(KBUILD_TARGET),os2)
1444 QTDIR ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.1
1445 VBOX_PATH_QT ?= $(QTDIR)
1446 VBOX_DLL_QT ?= $(lastword $(sort $(wildcard $(VBOX_PATH_QT)/bin/*qt*.dll)))
1447 LIB_QT ?= $(lastword $(sort $(wildcard $(VBOX_PATH_QT)/lib/*qt*.lib)))
1448 LIB_QT_PRL ?= $(lastword $(sort $(wildcard $(VBOX_PATH_QT)/lib/*qt*.prl)))
1449 QTDIR := $(VBOX_PATH_QT)
1450else ifeq ($(KBUILD_TARGET),darwin)
1451 ifndef VBOX_PATH_QT
1452 VBOX_PATH_QT := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v3.*)))
1453 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.8-r1
1454 endif
1455 VBOX_MUST_INSTALL_LIB_QT ?= 1
1456 LIB_QT ?= $(VBOX_PATH_QT)/lib/libqt-mt.3.dylib
1457 LIB_QTMAIN ?= $(NO_SUCH_VARIABLE)
1458 ifndef QTDIR
1459 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
1460 QTDIR := $(call lastword,$(QTDIR))
1461 endif
1462else
1463 ifndef QTDIR
1464 ifndef VBOX_PATH_QT
1465 # If QTDIR and VBOX_WITH_QTGUI aren't defined, we'll first
1466 # look in the tools tree and then on the system. If in the
1467 # tools, we'll have to install it.
1468 # Results are exported to avoid having to do this for every make file.
1469 VBOX_PATH_QT := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v3.*)))
1470 ifneq ($(VBOX_PATH_QT),)
1471 export VBOX_PATH_QT
1472 export VBOX_MUST_INSTALL_LIB_QT := 1
1473 export LIB_QT := $(VBOX_PATH_QT)/lib/libqt-mt.so.3
1474 export LD_LIBRARY_PATH := $(VBOX_PATH_QT)/lib:$(LD_LIBRARY_PATH)
1475 else
1476 QTDIR := $(wildcard /usr/share/qt3)
1477 ifeq ($(QTDIR),)
1478 QTDIR := $(patsubst %/bin/moc,%,$(firstword $(wildcard /usr/bin/moc /usr/local/bin/moc /usr/X11R6/bin/moc)))
1479 endif
1480 ifneq ($(QTDIR),)
1481 export QTDIR
1482 endif
1483 endif
1484 else
1485 QTDIR := $(VBOX_PATH_QT)
1486 export QTDIR
1487 endif
1488 endif
1489endif
1490ifndef VBOX_PATH_QT
1491 VBOX_PATH_QT ?= $(QTDIR)
1492 LIB_QT ?= qt-mt
1493endif
1494ifeq ($(KBUILD_HOST),$(KBUILD_TARGET))
1495 VBOX_PATH_QT_HOST ?= $(VBOX_PATH_QT)
1496else
1497 VBOX_PATH_QT_HOST ?= $(QTDIR)
1498endif
1499VBOX_UIC ?= $(VBOX_PATH_QT_HOST)/bin/uic$(HOSTSUFF_EXE)
1500VBOX_MOC ?= $(VBOX_PATH_QT_HOST)/bin/moc$(HOSTSUFF_EXE)
1501VBOX_LUPDATE ?= $(VBOX_PATH_QT_HOST)/bin/lupdate$(HOSTSUFF_EXE)
1502VBOX_LRELEASE ?= $(VBOX_PATH_QT_HOST)/bin/lrelease$(HOSTSUFF_EXE)
1503
1504ifeq ($(KBUILD_TARGET),os2)
1505 # search DLLs in the EXE directory first (unless VBOX_DLL_QT is set)
1506 VBOX_DLL_QT_PATH := $(dir $(VBOX_DLL_QT))
1507 VBOX_DLL_QT_PATH := $(if $(VBOX_DLL_QT_PATH),$(VBOX_DLL_QT_PATH);,)
1508 VBOX_UIC := BEGINLIBPATH="$(VBOX_DLL_QT_PATH)$(dir $(VBOX_UIC));$$BEGINLIBPATH" $(VBOX_UIC)
1509 VBOX_MOC := BEGINLIBPATH="$(VBOX_DLL_QT_PATH)$(dir $(VBOX_MOC));$$BEGINLIBPATH" $(VBOX_MOC)
1510 VBOX_LUPDATE := BEGINLIBPATH="$(VBOX_DLL_QT_PATH)$(dir $(VBOX_LUPDATE));$$BEGINLIBPATH" $(VBOX_LUPDATE)
1511 VBOX_LRELEASE := BEGINLIBPATH="$(VBOX_DLL_QT_PATH)$(dir $(VBOX_LRELEASE));$$BEGINLIBPATH" $(VBOX_LRELEASE)
1512endif
1513
1514#
1515# The linux kernel headers(/sources).
1516#
1517if1of ($(KBUILD_TARGET), linux)
1518 ifeq ($(origin VBOX_LINUX_SRC),undefined)
1519 ifneq ($(wildcard /lib/modules/$(shell uname -r)/build/include/linux/autoconf.h),)
1520 export VBOX_LINUX_SRC := /lib/modules/$(shell uname -r)/build
1521 else
1522 export VBOX_LINUX_SRC := /usr/src/linux
1523 endif
1524 endif
1525 ifneq ($(VBOX_LINUX_SRC),)
1526 ifeq ($(origin VBOX_LINUX_INCS),undefined)
1527 export VBOX_LINUX_INCS := $(VBOX_LINUX_SRC)/include
1528 # support splitted Linux kernels (make O=<build directory>)
1529 kernelsrc := $(shell $(SED_EXT) -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(VBOX_LINUX_SRC)/Makefile)
1530 ifneq ($(kernelsrc),)
1531 kernelpath := $(realpath $(VBOX_LINUX_SRC)/$(kernelsrc))
1532 VBOX_LINUX_INCS += $(VBOX_LINUX_SRC)/include2 $(kernelpath)/include
1533 else
1534 kernelpath := $(VBOX_LINUX_SRC)
1535 endif
1536 ifeq ($(KBUILD_TARGET_ARCH),x86)
1537 VBOX_LINUX_INCS += $(kernelpath)/include/asm-i386/mach-default \
1538 $(kernelpath)/include/asm-x86/mach-default
1539 endif
1540 endif
1541 endif
1542endif
1543
1544#
1545# Determine Solaris version.
1546#
1547ifeq ($(KBUILD_TARGET),solaris)
1548 ifeq ($(origin VBOX_SOLARIS_VERSION),undefined)
1549 $(eval export VBOX_SOLARIS_VERSION := $(shell uname -r | $(SED_EXT) 's|\([0-9]*\)\.\([0-9]*\)|$$(int-add $$(int-mul 100, \1), \2)|' ))
1550 endif
1551 ifeq ($(VBOX_SOLARIS_VERSION),510)
1552 DEFS.solaris += RT_OS_SOLARIS_10
1553 # Solaris 10 does not include crossbow.
1554 VBOX_WITH_CROSSBOW =
1555 VBOX_SOLARIS_10 = 1
1556 endif
1557endif
1558
1559
1560#
1561# Template for building GC things.
1562#
1563TEMPLATE_VBOXGC = VBox GC
1564TEMPLATE_VBOXGC_ASTOOL = $(VBOX_ASTOOL)
1565TEMPLATE_VBOXGC_ASFLAGS = $(VBOX_ASFLAGS32)
1566TEMPLATE_VBOXGC_DEFS = IN_GC $(ARCH_BITS_DEFS)
1567TEMPLATE_VBOXGC_SYSSUFF = .gc
1568TEMPLATE_VBOXGC_BLD_TRG_ARCH = x86
1569
1570ifeq ($(VBOX_LDR_FMT32),pe)
1571ifdef VBOX_USE_VCC80
1572 TEMPLATE_VBOXGC_TOOL = VCC80X86
1573 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)
1574else
1575 TEMPLATE_VBOXGC_TOOL = VCC70
1576 TEMPLATE_VBOXGC_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP)
1577endif
1578TEMPLATE_VBOXGC_CFLAGS = $(TEMPLATE_VBOXGC_CXXFLAGS)
1579TEMPLATE_VBOXGC_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Lines -MapInfo:Exports -NoD
1580ifdef VBOX_USE_VCC80
1581 include $(KBUILD_PATH)/sdks/W2K3DDKX86.kmk
1582 TEMPLATE_VBOXGC_LIBS = \
1583 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1584else
1585 TEMPLATE_VBOXGC_LIBS = \
1586 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1587endif
1588endif
1589
1590ifeq ($(VBOX_LDR_FMT32),elf)
1591TEMPLATE_VBOXGC_TOOL = $(VBOX_GCC32_TOOL)
1592TEMPLATE_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)
1593TEMPLATE_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)
1594ifeq ($(KBUILD_TARGET),solaris)
1595 TEMPLATE_VBOXGC_LDFLAGS = -r
1596else
1597 TEMPLATE_VBOXGC_LDFLAGS = -nostdlib -Bsymbolic
1598 # temporarily, must fix the loader.
1599 TEMPLATE_VBOXGC_LDFLAGS += $(if $(VBOX_DO_STRIP_MODULES),-S,)
1600 TEMPLATE_VBOXGC_LDFLAGS.release = $(if $(VBOX_DO_STRIP_MODULES),-S,)
1601endif
1602ifn1of ($(KBUILD_TARGET), solaris freebsd)
1603 TEMPLATE_VBOXGC_LIBS = \
1604 $(VBOX_GCC32_LIBGCC) # instricts
1605endif
1606endif
1607
1608ifeq ($(VBOX_LDR_FMT32),macho)
1609TEMPLATE_VBOXGC_TOOL = GXX4MACHO
1610TEMPLATE_VBOXGC_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
1611TEMPLATE_VBOXGC_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_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
1612TEMPLATE_VBOXGC_CFLAGS = $(VBOX_DARWIN_DEF_SDK_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
1613TEMPLATE_VBOXGC_LDFLAGS = $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -nostdlib
1614#TEMPLATE_VBOXGC_LDFLAGS.release = -Wl,-S ???
1615endif
1616
1617ifeq ($(VBOX_LDR_FMT32),lx)
1618TEMPLATE_VBOXGC_TOOL = GXX3OMF
1619TEMPLATE_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
1620TEMPLATE_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
1621TEMPLATE_VBOXGC_LDFLAGS = -Zdll -nostdlib
1622TEMPLATE_VBOXGC_LIBS = \
1623 $(VBOX_GCC32_LIBGCC) \
1624 $(OBJ_SYS0) \
1625 end
1626endif
1627
1628
1629#
1630# Template for building a GC ring-3 testcase (tstVMStructGC, tstDevStructGC).
1631#
1632TEMPLATE_VBOXGCEXE = VBox GC as ring-3 testcase
1633TEMPLATE_VBOXGCEXE_EXTENDS = VBOXGC
1634
1635ifeq ($(VBOX_LDR_FMT32),pe)
1636 TEMPLATE_VBOXGCEXE_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD -Debug
1637 TEMPLATE_VBOXGCEXE_SDKS = WIN32SDK
1638 ifdef VBOX_USE_VCC80
1639 TEMPLATE_VBOXGCEXE_LIBS = \
1640 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
1641 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib
1642 else
1643 TEMPLATE_VBOXGCEXE_LIBS = \
1644 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
1645 $(PATH_TOOL_VCC70_LIB)/oldnames.lib
1646 endif
1647endif
1648
1649ifeq ($(VBOX_LDR_FMT32),elf)
1650 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1651 TEMPLATE_VBOXGCEXE_LDFLAGS.release = -g
1652endif
1653
1654ifeq ($(VBOX_LDR_FMT32),macho)
1655 TEMPLATE_VBOXGCEXE_CFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CFLAGS))
1656 TEMPLATE_VBOXGCEXE_CXXFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CXXFLAGS))
1657 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1658endif
1659
1660ifeq ($(VBOX_LDR_FMT32),lx)
1661 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1662 TEMPLATE_VBOXGCEXE_LIBS = $(NO_SUCH_VARIABLE)
1663endif
1664
1665
1666#
1667# Template for building R0 things.
1668#
1669TEMPLATE_VBOXR0 = VBox Ring 0
1670TEMPLATE_VBOXR0_ASTOOL = $(VBOX_ASTOOL)
1671TEMPLATE_VBOXR0_ASFLAGS = $(VBOX_ASFLAGS)
1672TEMPLATE_VBOXR0_DEFS = IN_RING0 $(ARCH_BITS_DEFS)
1673
1674ifeq ($(VBOX_LDR_FMT),pe)
1675TEMPLATE_VBOXR0_TOOL = $(VBOX_VCC_TOOL)
1676ifdef VBOX_USE_VCC80
1677 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -W3 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1678else
1679 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1680endif
1681TEMPLATE_VBOXR0_CFLAGS = $(TEMPLATE_VBOXR0_CXXFLAGS)
1682TEMPLATE_VBOXR0_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Exports -NoD
1683ifdef VBOX_USE_VCC80
1684 TEMPLATE_VBOXR0_LIBS.x86 = \
1685 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1686else
1687 TEMPLATE_VBOXR0_LIBS.x86 = \
1688 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1689endif
1690endif # pe
1691
1692ifeq ($(VBOX_LDR_FMT),elf)
1693TEMPLATE_VBOXR0_TOOL = $(VBOX_GCC_TOOL)
1694TEMPLATE_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)
1695TEMPLATE_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)
1696TEMPLATE_VBOXR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding
1697TEMPLATE_VBOXR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables
1698ifeq ($(KBUILD_TARGET),solaris)
1699 TEMPLATE_VBOXR0_LDFLAGS = -r
1700else
1701 TEMPLATE_VBOXR0_LDFLAGS = -nostdlib -Bsymbolic
1702 # temporarily, must fix the loader.
1703 TEMPLATE_VBOXR0_LDFLAGS += $(if $(VBOX_DO_STRIP_MODULES),-S,)
1704 TEMPLATE_VBOXR0_LDFLAGS.release = $(if $(VBOX_DO_STRIP_MODULES),-S,)
1705endif
1706ifn1of ($(KBUILD_TARGET),solaris freebsd)
1707 TEMPLATE_VBOXR0_LIBS = \
1708 $(VBOX_GCC_LIBGCC) # instricts
1709endif
1710endif
1711
1712ifeq ($(VBOX_LDR_FMT),macho)
1713TEMPLATE_VBOXR0_TOOL = GXX4MACHO
1714TEMPLATE_VBOXR0_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
1715TEMPLATE_VBOXR0_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_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
1716TEMPLATE_VBOXR0_CFLAGS = $(VBOX_DARWIN_DEF_SDK_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
1717TEMPLATE_VBOXR0_LDFLAGS = $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -nostdlib
1718#TEMPLATE_VBOXR0_LDFLAGS.release = -Wl,-S ???
1719endif
1720
1721ifeq ($(VBOX_LDR_FMT),lx)
1722TEMPLATE_VBOXR0_TOOL = GXX3OMF
1723TEMPLATE_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
1724TEMPLATE_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
1725TEMPLATE_VBOXR0_LDFLAGS = -Zdll -nostdlib
1726TEMPLATE_VBOXR0_LIBS = \
1727 $(VBOX_GCC_LIBGCC) \
1728 $(OBJ_SYS0) \
1729 end
1730endif
1731
1732
1733#
1734# Template for building SUPDRV R0 things.
1735#
1736TEMPLATE_VBOXR0DRV = VBox SUPDRV Ring 0
1737TEMPLATE_VBOXR0DRV_ASTOOL = $(VBOX_ASTOOL)
1738TEMPLATE_VBOXR0DRV_ASFLAGS = $(VBOX_ASFLAGS)
1739TEMPLATE_VBOXR0DRV_DEFS = IN_RING0 IN_RT_R0 $(ARCH_BITS_DEFS)
1740
1741ifeq ($(KBUILD_TARGET),win)
1742 TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_VCC_TOOL)
1743 TEMPLATE_VBOXR0DRV_RCDEFS = \
1744 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1745 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1746 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1747 VBOX_SVN_REV=\"$(VBOX_SVN_REV)\" \
1748 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1749 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1750 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD) \
1751 VBOX_SVN_REV_NR=$(VBOX_SVN_REV)
1752 TEMPLATE_VBOXR0DRV_DEFS.x86 = _X86_
1753 TEMPLATE_VBOXR0DRV_DEFS.amd64 = _AMD64_
1754 ifdef VBOX_USE_VCC80
1755 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -W3 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1756 else
1757 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -W3 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1758 endif
1759 TEMPLATE_VBOXR0DRV_CFLAGS = $(TEMPLATE_VBOXR0DRV_CXXFLAGS)
1760 TEMPLATE_VBOXR0DRV_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Exports -NoD -Debug
1761 TEMPLATE_VBOXR0DRV_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
1762endif
1763
1764ifeq ($(KBUILD_TARGET),linux)
1765TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1766TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0
1767TEMPLATE_VBOXR0DRV_INCS = $(VBOX_LINUX_INCS)
1768TEMPLATE_VBOXR0DRV_CFLAGS = -nostdinc -iwithprefix include \
1769 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1770 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1771TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mpreferred-stack-boundary=2 -msoft-float
1772TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1773 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1774 -Wno-sign-compare -Wdeclaration-after-statement
1775TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign -ffreestanding -Wdeclaration-after-statement,$(TEMPLATE_VBOXR0DRV_CFLAGS) $(TEMPLATE_VBOXR0DRV_CFLAGS.$(KBUILD_TARGET_ARCH))) -fno-exceptions -fno-rtti
1776 ifndef VBOX_LINUX_VERSION_2_4
1777# 2.6
1778TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1779TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1780TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1781 else
1782# 2.4
1783TEMPLATE_VBOXR0DRV_SYSSUFF = .o
1784TEMPLATE_VBOXR0DRV_LDFLAGS = -r -s
1785 endif
1786endif
1787
1788ifeq ($(KBUILD_TARGET),os2)
1789TEMPLATE_VBOXR0DRV_TOOL = GXX3OMF
1790TEMPLATE_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
1791TEMPLATE_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
1792TEMPLATE_VBOXR0DRV_LIBS = $(VBOX_GCC_LIBGCC)
1793# wlink thinks physdevice doesn't need fixups and should have a stack - stupid!
1794TEMPLATE_VBOXR0DRV_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
1795endif
1796
1797ifeq ($(KBUILD_TARGET),darwin)
1798TEMPLATE_VBOXR0DRV_TOOL = GXX4MACHO
1799TEMPLATE_VBOXR0DRV_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS) KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT RT_USE_VISIBILITY_HIDDEN
1800# I didn't really know why we have to state explicitly the position of the
1801# sdk headers. Maybe it has something to do with the fact that the kernel.framework
1802# isn't a real framework according to http://developer.apple.com/qa/qa2001/qa1096.html.
1803TEMPLATE_VBOXR0DRV_INCS += $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/Kernel.framework/Headers
1804TEMPLATE_VBOXR0DRV_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) \
1805 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1806 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1807 -fapple-kext -fno-rtti -fcheck-new
1808TEMPLATE_VBOXR0DRV_CXXFLAGS.release = $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fasm-blocks
1809TEMPLATE_VBOXR0DRV_CXXFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1810TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1811TEMPLATE_VBOXR0DRV_CFLAGS = $(VBOX_DARWIN_DEF_SDK_CFLAGS) \
1812 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1813 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1814 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1815TEMPLATE_VBOXR0DRV_CFLAGS.release = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1816TEMPLATE_VBOXR0DRV_CFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.profile)
1817TEMPLATE_VBOXR0DRV_CFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile)
1818TEMPLATE_VBOXR0DRV_LDFLAGS = $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -static -nostdlib -r -Wl,-Y,1455 -keep_private_extern
1819TEMPLATE_VBOXR0DRV_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC)
1820endif
1821
1822ifeq ($(KBUILD_TARGET),solaris)
1823## The Solaris /usr/platform/i86pc/include and /usr/include directories.
1824VBOX_SOLARIS_SYS_INCS ?= /usr/platform/i86pc/include /usr/include
1825
1826TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1827TEMPLATE_VBOXR0DRV_DEFS = _KERNEL _STRICT_STDC IN_RING0 IN_RT_R0
1828TEMPLATE_VBOXR0DRV_INCS = $(VBOX_SOLARIS_SYS_INCS)
1829TEMPLATE_VBOXR0DRV_LDFLAGS = -r -dy
1830ifdef VBOX_WITH_SOLARIS_VBI
1831 TEMPLATE_VBOXR0DRV_LDFLAGS += -N misc/vbi
1832endif
1833TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -64
1834# Exclude -Wall because of solaris headers' pragma ident warnings that gcc refuses to supress.
1835TEMPLATE_VBOXR0DRV_CFLAGS = -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1836 -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \
1837 -O2 -ffreestanding -nodefaultlibs -fno-strict-aliasing -fno-common -std=c99
1838TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
1839TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(if $(VBOX_SOLARIS_10),,-msave-args) -mno-red-zone -mcmodel=kernel \
1840 -fno-reorder-blocks -fno-asynchronous-unwind-tables -funit-at-a-time
1841TEMPLATE_VBOXR0DRV_CXXFLAGS = -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1842 -O2 -nodefaultlibs -fno-strict-aliasing -fno-common
1843TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86)
1844TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = $(TEMPLATE_VBOXR0DRV_CFLAGS.amd64)
1845endif # Solaris
1846
1847ifeq ($(KBUILD_TARGET),freebsd)
1848# x86 FreeBSD:
1849# cc -O2 -fno-strict-aliasing -pipe -Werror -D_KERNEL -DKLD_MODULE \
1850# -nostdinc -I- -I. -I@ -I@/contrib/altq -I@/../include -I/usr/include \
1851# -finline-limit=8000 -fno-common -mno-align-long-strings -mpreferred-stack-boundary=2 \
1852# -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -ffreestanding -Wall -Wredundant-decls -Wnested-externs \
1853# -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions \
1854# -std=c99 -c ../my.c
1855# ld -d -warn-common -r -d -o my.kld my.o
1856# :> export_syms
1857# awk -f /usr/src/sys/modules/my/../../conf/kmod_syms.awk my.kld export_syms | xargs -J% objcopy % my.kld
1858# ld -Bsharable -d warn-commnon -o my.ko my.kld
1859#
1860# Note: @ -> /usr/src/sys and machine -> /usr/src/sys/i386/include
1861
1862## The location of the FreeBSD kernel source.
1863VBOX_FREEBSD_SRC ?= /usr/src/sys
1864## The FreeBSD /usr/include.
1865VBOX_FREEBSD_SYS_INCS ?= /usr/include
1866
1867TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1868TEMPLATE_VBOXR0DRV_LDTOOL = FREEBSDKMODLD
1869TEMPLATE_VBOXR0DRV_DEFS = _KERNEL KLD_MODULE IN_RING0 IN_RT_R0
1870TEMPLATE_VBOXR0DRV_INCS = \
1871 $(VBOX_FREEBSD_SRC) \
1872 $(VBOX_FREEBSD_SRC)/contrib/altq \
1873 $(VBOX_FREEBSD_SRC)/../include \
1874 $(VBOX_FREEBSD_SYS_INCS)
1875# omitting: -Wcast-qual, -Wredundant-decls
1876TEMPLATE_VBOXR0DRV_CFLAGS = \
1877 -Wall -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1878 -Wstrict-prototypes -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \
1879 -O2 -fformat-extensions -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
1880 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) \
1881 -nostdinc -std=c99
1882TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2
1883TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 "Port me to amd64 FreeBSD"
1884TEMPLATE_VBOXR0DRV_CXXFLAGS = -fno-exceptions -fno-rtti \
1885 -Wall -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1886 -O2 -fno-format-extensions -fno-strict-aliasing -fno-common -finline-limit=8000 \
1887 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) \
1888 -nostdinc
1889TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1890TEMPLATE_VBOXR0DRV_LDFLAGS = -d --warn-common
1891TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386_fbsd
1892TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 "Port me to amd64 FreeBSD"
1893
1894TOOL_FREEBSDKMODLD = FreeBSD kernel module linker.
1895# See kBuild/tools/GCC3.kmk for docs.
1896TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT = $(outbase).kld
1897TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
1898TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1899TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPORD =
1900define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
1901 @# Link intermediate .kld (a relocatable object).
1902 ld $(flags) -r -o $(outbase).kld $(objs) \
1903 $(foreach p,$(libpath), -L$(p))\
1904 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
1905 @# Strip non-exported symbols private and localize the exported ones.
1906 awk -f $(VBOX_FREEBSD_SRC)/conf/kmod_syms.awk $(outbase).kld $(if $(othersrc), $(othersrc),/dev/null) \
1907 | xargs -J% objcopy % $(outbase).kld
1908 @# Link the final .ko (a shared object).
1909 ld $(flags) -Bshareable -o $(out) $(outbase).kld
1910endef
1911
1912endif # FreeBSD
1913
1914ifdef VBOX_WITH_VBOXDRV
1915 ifndef TEMPLATE_VBOXR0DRV_TOOL
1916 $(warning Warning: VBox Build: Target $(KBUILD_HOST) is not officially supported!)
1917 endif
1918endif
1919
1920
1921
1922#
1923# Template for building R3 executables and static libraries which are linked into executables.
1924# Note! This is the base template for a whole lot of other ones, so be careful when changing it.
1925#
1926TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
1927TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
1928TEMPLATE_VBOXR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
1929TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
1930TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
1931ifeq ($(KBUILD_TARGET),win)
1932 TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
1933 TEMPLATE_VBOXR3EXE_RCDEFS = \
1934 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1935 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1936 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1937 VBOX_SVN_REV=\"$(VBOX_SVN_REV)\" \
1938 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1939 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1940 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD) \
1941 VBOX_SVN_REV_NR=$(VBOX_SVN_REV)
1942 TEMPLATE_VBOXR3EXE_SDKS = WINPSDK
1943 ifdef VBOX_USE_VCC80
1944 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MD -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1945 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
1946 else
1947 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MD -W3 -wd4065 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1948 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -GZ
1949 endif
1950 TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
1951 TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
1952 TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1953 TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1954 TEMPLATE_VBOXR3EXE_LDFLAGS = \
1955 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1956 /DISALLOWLIB:libc.lib \
1957 /DISALLOWLIB:libcd.lib \
1958 /DISALLOWLIB:libcmt.lib \
1959 /DISALLOWLIB:libcmtd.lib \
1960 /DISALLOWLIB:msvcrtd.lib
1961 TEMPLATE_VBOXR3EXE_LIBS = \
1962 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1963 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1964 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib
1965 TEMPLATE_VBOXR3EXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1966
1967else # the gcc guys
1968TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
1969TEMPLATE_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)
1970TEMPLATE_VBOXR3EXE_CXXFLAGS.x86 = -m32
1971TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64 = -m64
1972# L4 currently can't handle exception handling.
1973TEMPLATE_VBOXR3EXE_CXXFLAGS.l4 = -fno-exceptions -nostdinc \
1974 $(addprefix -I,$(VBOX_PATH_GCC_INCS) $(L4_INCDIR) $(FILE_TOOL_GPP3_INCDIR)) \
1975 $(DEBUG_L4)
1976TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
1977TEMPLATE_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)
1978TEMPLATE_VBOXR3EXE_CFLAGS.x86 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.x86)
1979TEMPLATE_VBOXR3EXE_CFLAGS.amd64 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64)
1980TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1981TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1982TEMPLATE_VBOXR3EXE_CFLAGS.l4 = -nostdinc \
1983 $(addprefix -I,$(VBOX_PATH_GCC_INCS) $(L4_INCDIR)) $(DEBUG_L4)
1984TEMPLATE_VBOXR3EXE_DEFS.l4 = L4_THREAD_SAFE
1985TEMPLATE_VBOXR3EXE_LDFLAGS.x86 = -m32
1986TEMPLATE_VBOXR3EXE_LDFLAGS.amd64 = -m64
1987TEMPLATE_VBOXR3EXE_LDFLAGS.l4 = \
1988 $(L4_LIBDIR)/../crt0.o \
1989 -T$(L4_LIBDIR)/../main_dyn.ld -nostdlib \
1990 -Wl,--export-dynamic,--dynamic-linker=libld-l4.s.so \
1991 -Wl,--rpath-link,$(L4_LIBDIR)
1992TEMPLATE_VBOXR3EXE_LDFLAGS.linux = -Wl,-z,noexecstack $(VBOX_LD_as_needed)
1993 ifeq ($(KBUILD_TARGET),linux)
1994TEMPLATE_VBOXR3EXE_LIBS = pthread m rt dl
1995 else ifeq ($(KBUILD_TARGET),l4)
1996TEMPLATE_VBOXR3EXE_LIBS = \
1997 $(L4_LIBDIR)/libvboxserver.s.so \
1998 $(L4_LIBDIR)/libuc++.0.s.so \
1999 supc++ gcc_eh gcc \
2000 $(L4_LIBDIR)/libdl.s.so \
2001 $(L4_LIBDIR)/libuc.0.s.so
2002 else ifeq ($(KBUILD_TARGET),os2)
2003TEMPLATE_VBOXR3EXE_TOOL = GXX3OMF
2004TEMPLATE_VBOXR3EXE_LIBS = socket iconv
2005 else ifeq ($(KBUILD_TARGET),darwin)
2006TEMPLATE_VBOXR3EXE_TOOL = GXX4MACHO
2007TEMPLATE_VBOXR3EXE_LIBS =
2008TEMPLATE_VBOXR3EXE_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_DEFS)
2009TEMPLATE_VBOXR3EXE_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -fno-common
2010TEMPLATE_VBOXR3EXE_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
2011TEMPLATE_VBOXR3EXE_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
2012TEMPLATE_VBOXR3EXE_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -read_only_relocs suppress
2013 else if1of ($(KBUILD_TARGET),freebsd netbsd openbsd)
2014TEMPLATE_VBOXR3EXE_TOOL = GXX3
2015TEMPLATE_VBOXR3EXE_LIBS = pthread
2016TEMPLATE_VBOXR3EXE_INCS += \
2017 /usr/include \
2018 /usr/X11R6/include \
2019 /usr/local/include
2020 else ifeq ($(KBUILD_TARGET),solaris)
2021TEMPLATE_VBOXR3EXE_TOOL = GXX3PLAIN
2022TEMPLATE_VBOXR3EXE_DEFS += LIBICONV_PLUG _REENTRANT # Avoid the GNU libiconv, for now at least.
2023TEMPLATE_VBOXR3EXE_LIBS = rt socket
2024 else
2025$(warning Warning: VBOX Build: Target $(KBUILD_TARGET) is not officially supported!)
2026TEMPLATE_VBOXR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.release)
2027TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease)
2028 endif
2029 ifdef VBOX_WITH_ORIGIN
2030 TEMPLATE_VBOXR3EXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)'
2031 endif
2032endif
2033
2034#
2035# Template for building R3 shared objects / DLLs.
2036# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
2037#
2038TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
2039TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
2040TEMPLATE_VBOXR3_LDFLAGS.l4 = $(L4_LIBDIR)/../crt0.s.o -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
2041TEMPLATE_VBOXR3_DEFS.l4 = $(TEMPLATE_VBOXR3EXE_DEFS.l4) __PIC__
2042TEMPLATE_VBOXR3_DEFS.darwin = $(TEMPLATE_VBOXR3EXE_DEFS.darwin) PIC
2043ifeq ($(filter-out solaris.x86 %.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),)
2044 ifneq ($(KBUILD_TARGET),win)
2045 TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
2046 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
2047 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
2048 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
2049 endif
2050endif
2051
2052#
2053# Template for building static R3 executables and any static
2054# libraries they link with.
2055#
2056TEMPLATE_VBOXR3STATIC = VBox Static Ring 3 EXE
2057TEMPLATE_VBOXR3STATIC_EXTENDS = VBOXR3EXE
2058ifeq ($(KBUILD_TARGET),win)
2059 TEMPLATE_VBOXR3STATIC_CFLAGS = $(filter-out -MD, $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT
2060 TEMPLATE_VBOXR3STATIC_CXXFLAGS = $(filter-out -MD, $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT
2061 TEMPLATE_VBOXR3STATIC_LDFLAGS = $(filter-out /DISALLOWLIB:libcmt.lib, $(TEMPLATE_VBOXR3EXE_LDFLAGS)) \
2062 /DISALLOWLIB:msvcrt.lib \
2063 /DISALLOWLIB:msvcprt.lib
2064 TEMPLATE_VBOXR3STATIC_LIBS = \
2065 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL)_LIB)/oldnames.lib \
2066 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL)_LIB)/libcmt.lib \
2067 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL)_LIB)/libcpmt.lib
2068else # the gcc guys (untested!)
2069 TEMPLATE_VBOXR3STATIC_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -static
2070 TEMPLATE_VBOXR3STATIC_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -static
2071 TEMPLATE_VBOXR3STATIC_OBJCFLAGS= $(TEMPLATE_VBOXR3EXE_OBJCFLAGS) -static
2072 TEMPLATE_VBOXR3STATIC_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -static
2073endif
2074
2075#
2076# Ring-3 testcase.
2077# This is the VBOXR3EXE template only with a different install dir.
2078#
2079TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
2080TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
2081TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
2082TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
2083ifdef VBOX_WITH_ORIGIN
2084 TEMPLATE_VBOXR3TSTEXE_LDFLAGS= '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)/..' $(TEMPLATE_VBOXR3EXE_LDFLAGS)
2085endif
2086ifeq ($(KBUILD_TARGET),win)
2087 ifdef VBOX_SIGNING_MODE
2088 TEMPLATE_VBOXR3TSTEXE_POST_CMDS =
2089 endif
2090endif
2091
2092#
2093# Template for the CppUnit kind of testcases.
2094#
2095TEMPLATE_VBOXCPPUNITEXE = VBox CppUnit Testcase Exe
2096TEMPLATE_VBOXCPPUNITEXE_EXTENDS = VBOXR3TSTEXE
2097## @todo make a CPPUNIT SDK and add cppunit tools packages for windows, mac, solaris and OS/2.
2098#TEMPLATE_VBOXCPPUNITEXE_SDKS = CPPUNIT -
2099TEMPLATE_VBOXCPPUNITEXE_LIBS = \
2100 $(TEMPLATE_VBOXR3TSTEXE_LIBS) \
2101 cppunit
2102
2103#
2104# Template for building bad C/C++ style R3 executables (no -pedantic).
2105#
2106TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
2107TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
2108ifneq ($(KBUILD_TARGET),win) # (only gcc)
2109 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
2110 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
2111 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3EXE_CFLAGS))
2112endif
2113
2114
2115#
2116# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
2117# This is mostly identical to the VBOXR3NPEXE template.
2118#
2119TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
2120TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3NPEXE
2121TEMPLATE_VBOXR3NP_LDFLAGS.l4 = \
2122 $(L4_LIBDIR)/../crt0.s.o \
2123 -T$(L4_LIBDIR)/../main_rel.ld \
2124 -nostdlib
2125TEMPLATE_VBOXR3NP_DEFS.l4 = $(TEMPLATE_VBOXR3NPEXE_DEFS.l4) __PIC__
2126ifeq ($(filter-out solaris.x86 %.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),)
2127 ifneq ($(KBUILD_TARGET),win)
2128 TEMPLATE_VBOXR3NP_DEFS = $(TEMPLATE_VBOXR3NPEXE_DEFS) PIC
2129 TEMPLATE_VBOXR3NP_CFLAGS = $(TEMPLATE_VBOXR3NPEXE_CFLAGS) -fPIC
2130 TEMPLATE_VBOXR3NP_CXXFLAGS = $(TEMPLATE_VBOXR3NPEXE_CXXFLAGS) -fPIC
2131 TEMPLATE_VBOXR3NP_LDFLAGS = $(TEMPLATE_VBOXR3NPEXE_LDFLAGS) -fPIC
2132 endif
2133endif
2134
2135
2136#
2137# Template for building libraries, shared libraries / modules
2138# which only depends on IPRT for crt.
2139#
2140TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
2141TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
2142TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
2143TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno -Wall
2144TEMPLATE_VBOXNOCRTGCC_CFLAGS.x86 = -m32
2145TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -m64 -mcmodel=medium -fno-common
2146TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
2147TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
2148TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
2149ifdef VBOX_TARGET_MAC_OS_X_VERSION_10_5 ## @todo this probably works for 10.4 too, check.
2150 TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -static
2151else
2152 TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -mdynamic-no-pic
2153endif
2154TEMPLATE_VBOXNOCRTGCC_CXXFLAGS = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS)
2155TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(KBUILD_TARGET) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(KBUILD_TARGET))
2156TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(KBUILD_TARGET_ARCH) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(KBUILD_TARGET_ARCH))
2157TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
2158
2159ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
2160 # cross compile to 64-bit ELF (linux).
2161 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
2162 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
2163 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
2164 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
2165 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
2166
2167else ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
2168 # Use the default GCC (MinGW) with the Microsoft linker.
2169 # (Drop all '-g' options as we're unable to strip the debug info.)
2170 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
2171 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
2172 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
2173 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
2174 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
2175 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
2176 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
2177
2178else
2179 # Use the default GCC.
2180 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
2181 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
2182 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
2183 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
2184 TEMPLATE_VBOXNOCRTGCC_CFLAGS += $(VBOX_GCC_fno-stack-protector)
2185 TEMPLATE_VBOXNOCRTGCC_CXXFLAGS += $(VBOX_GCC_fno-stack-protector)
2186 ifeq ($(KBUILD_TARGET_ARCH),amd64)
2187 # in 64-bit mode we'll build a sys-module (VBoxREM2).
2188 if1of ($(KBUILD_TARGET),darwin solaris)
2189 TEMPLATE_VBOXNOCRTGCC_LDFLAGS.solaris= -64 -r
2190 else
2191 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
2192 endif
2193 else # x86:
2194 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
2195 ifn1of ($(KBUILD_TARGET), os2 darwin solaris)
2196 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
2197 endif
2198 endif # x86
2199 TEMPLATE_VBOXNOCRTGCC_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
2200 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
2201endif
2202
2203
2204#
2205# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
2206#
2207TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
2208TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
2209TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
2210ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
2211 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
2212else
2213 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
2214endif
2215TEMPLATE_VBOXNOCRTGAS_ASFLAGS.x86 = -m32
2216TEMPLATE_VBOXNOCRTGAS_ASFLAGS.amd64 = -m64
2217
2218
2219#
2220# Template for building executables that are part of the VBox Main component
2221# (COM/XPCOM interface to VirtualBox).
2222#
2223TEMPLATE_VBOXMAINEXE = VBox Main Executable
2224TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
2225TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
2226TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE NDEBUG=1
2227TEMPLATE_VBOXMAINEXE_DEFS.win = _UNICODE
2228TEMPLATE_VBOXMAINEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
2229TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
2230TEMPLATE_VBOXMAINEXE_INCS = \
2231 $(VBOX_PATH_SDK)/include
2232
2233ifeq ($(KBUILD_TARGET),win)
2234 TEMPLATE_VBOXMAINEXE_SDKS = WINPSDK W2K3DDK
2235 ifdef VBOX_USE_VCC80
2236 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
2237 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GF- -MD -EHsc -W3 -wd4065 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
2238 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
2239 else
2240 TEMPLATE_VBOXMAINEXE_TOOL = VCC70
2241 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GX- -GF- -MD -EHsc -W3 -wd4065 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
2242 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -GZ
2243 endif
2244 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
2245 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
2246 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
2247 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
2248 TEMPLATE_VBOXMAINEXE_INCS += \
2249 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
2250 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
2251 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
2252 /DISALLOWLIB:libc.lib \
2253 /DISALLOWLIB:libcd.lib \
2254 /DISALLOWLIB:msvcrt.lib \
2255 /DISALLOWLIB:msvcrtd.lib \
2256 /DISALLOWLIB:libcmtd.lib \
2257 /DISALLOWLIB:libcmt.lib
2258 TEMPLATE_VBOXMAINEXE_LIBS = \
2259 $(LIB_RUNTIME) \
2260 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
2261 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
2262 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
2263 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
2264 TEMPLATE_VBOXMAINEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2265 TEMPLATE_VBOXMAINEXE_INTERMEDIATES = \
2266 $(VBOX_PATH_SDK)/include/VirtualBox.h
2267
2268else # the GCC guys:
2269
2270TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
2271TEMPLATE_VBOXMAINEXE_CXXFLAGS = -g -Wall -Wno-long-long -Wno-trigraphs -pipe -Wno-non-virtual-dtor -fshort-wchar -fpermissive -fexceptions -frtti $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
2272TEMPLATE_VBOXMAINEXE_CXXFLAGS.x86 = -m32
2273TEMPLATE_VBOXMAINEXE_CXXFLAGS.amd64 = -m64
2274TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
2275TEMPLATE_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)
2276TEMPLATE_VBOXMAINEXE_CFLAGS.x86 = -m32
2277TEMPLATE_VBOXMAINEXE_CFLAGS.amd64 = -m64
2278TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
2279TEMPLATE_VBOXMAINEXE_LDFLAGS.x86 = -m32
2280TEMPLATE_VBOXMAINEXE_LDFLAGS.amd64 = -m64
2281 ifeq ($(KBUILD_TARGET),linux)
2282TEMPLATE_VBOXMAINEXE_LIBS = pthread m rt $(LIB_RUNTIME)
2283TEMPLATE_VBOXMAINEXE_LDFLAGS.linux = $(VBOX_LD_as_needed)
2284 else ifeq ($(KBUILD_TARGET),l4)
2285TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
2286# no libs as yet in l4 target - must be added later
2287 else ifeq ($(KBUILD_TARGET),os2)
2288TEMPLATE_VBOXMAINEXE_TOOL = GXX3OMF
2289TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
2290 else ifeq ($(KBUILD_TARGET),darwin)
2291TEMPLATE_VBOXMAINEXE_TOOL = GXX4MACHO
2292TEMPLATE_VBOXMAINEXE_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
2293TEMPLATE_VBOXMAINEXE_CFLAGS += $(VBOX_DARWIN_DEF_SDK_CFLAGS)
2294TEMPLATE_VBOXMAINEXE_CXXFLAGS += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
2295TEMPLATE_VBOXMAINEXE_OBJCFLAGS += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
2296TEMPLATE_VBOXMAINEXE_LDFLAGS += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -bind_at_load -framework Carbon
2297TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
2298 else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd)
2299TEMPLATE_VBOXMAINEXE_TOOL = GXX3
2300TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
2301 else ifeq ($(KBUILD_TARGET),solaris)
2302TEMPLATE_VBOXMAINEXE_TOOL = GXX3PLAIN
2303TEMPLATE_VBOXMAINEXE_DEFS += _REENTRANT
2304TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt
2305 else
2306$(warning Warning: VBOX Build: Target $(KBUILD_TARGET) is not officially supported!)
2307TEMPLATE_VBOXMAINEXE_LIBS =
2308 endif
2309 ifdef VBOX_WITH_ORIGIN
2310TEMPLATE_VBOXMAINEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)'
2311 endif
2312TEMPLATE_VBOXMAINEXE_INTERMEDIATES = \
2313 $(VBOX_PATH_SDK)/include/VirtualBox_XPCOM.h
2314
2315endif # !win
2316
2317# Add COM/XPCOM stuff
2318TEMPLATE_VBOXMAINEXE_LIBS += \
2319 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
2320ifdef VBOX_WITH_XPCOM
2321 ## @todo may be worth creating the VBOX_XPCOM SDK def
2322 TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
2323 TEMPLATE_VBOXMAINEXE_INCS += \
2324 $(VBOX_XPCOM_INCS)
2325 TEMPLATE_VBOXMAINEXE_LIBS += \
2326 $(LIB_XPCOM)
2327endif
2328
2329#
2330# Template for building the Main DLL modules (such as in-process COM/XPCOM
2331# components for Main).
2332#
2333# This differs from VBOXMAINEXE only in PIC handling and similar DLL stuff.
2334#
2335
2336TEMPLATE_VBOXMAINDLL = VBox Main Component (shared library)
2337TEMPLATE_VBOXMAINDLL_EXTENDS = VBOXMAINEXE
2338ifeq ($(filter-out solaris.x86 %.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),)
2339 ifneq ($(KBUILD_TARGET),win)
2340 TEMPLATE_VBOXMAINDLL_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
2341 TEMPLATE_VBOXMAINDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
2342 TEMPLATE_VBOXMAINDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
2343 TEMPLATE_VBOXMAINDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
2344 endif
2345endif
2346ifeq ($(KBUILD_TARGET),darwin)
2347 TEMPLATE_VBOXMAINDLL_LDFLAGS = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS))
2348endif
2349
2350#
2351# Template for building the Main static libraries.
2352#
2353# This differs from VBOXMAINDLL only that it zeroes out the _LIBS definition.
2354#
2355TEMPLATE_VBOXMAINLIB = VBox Main Component (static library)
2356TEMPLATE_VBOXMAINLIB_EXTENDS = VBOXMAINDLL
2357TEMPLATE_VBOXMAINLIB_LIBS =
2358
2359#
2360# Template for building executables that use the VBox Main component.
2361#
2362TEMPLATE_VBOXMAINCLIENTEXE = VBox Main Client (executable)
2363TEMPLATE_VBOXMAINCLIENTEXE_EXTENDS = VBOXMAINEXE
2364ifeq ($(KBUILD_TARGET),win)
2365 TEMPLATE_VBOXMAINCLIENTEXE_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
2366 $(PATH_SDK_WINPSDK_LIB)/User32.Lib \
2367 $(PATH_SDK_WINPSDK_LIB)/Shell32.Lib \
2368 $(PATH_SDK_WINPSDK_LIB)/ShLwApi.Lib \
2369 $(PATH_SDK_WINPSDK_LIB)/Ole32.Lib \
2370 $(PATH_SDK_WINPSDK_LIB)/OleAut32.Lib \
2371 $(PATH_SDK_WINPSDK_LIB)/Uuid.Lib
2372else
2373 TEMPLATE_VBOXMAINCLIENTEXE_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
2374 NDEBUG TRIMMED
2375 TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
2376 -pthread
2377 ifeq ($(KBUILD_TARGET),darwin)
2378 TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS = $(TEMPLATE_VBOXMAINEXE_LDFLAGS) -bind_at_load -framework Carbon
2379 endif
2380endif
2381
2382#
2383# Template for building shared libraries / DLLs that use the VBox Main component.
2384#
2385# This differs from VBOXMAINCLIENTEXE only in PIC handling and similar DLL stuff.
2386#
2387TEMPLATE_VBOXMAINCLIENTDLL = VBox MAIN Client (shared library)
2388TEMPLATE_VBOXMAINCLIENTDLL_EXTENDS = VBOXMAINCLIENTEXE
2389ifeq ($(filter-out solaris.x86 %.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),)
2390 ifneq ($(KBUILD_TARGET),win)
2391 TEMPLATE_VBOXMAINCLIENTDLL_DEFS = PIC $(TEMPLATE_VBOXMAINCLIENTEXE_DEFS)
2392 TEMPLATE_VBOXMAINCLIENTDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CFLAGS)
2393 TEMPLATE_VBOXMAINCLIENTDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS)
2394 TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)
2395 endif
2396endif
2397ifeq ($(KBUILD_TARGET),darwin)
2398 TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS))
2399endif
2400
2401
2402#
2403# Template for building Qt GUI executables.
2404#
2405TEMPLATE_VBOXQTGUIEXE = VBox Qt GUI Executable
2406TEMPLATE_VBOXQTGUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS)
2407TEMPLATE_VBOXQTGUIEXE_INCS = \
2408 $(VBOX_PATH_SDK)/include \
2409 $(VBOX_PATH_QT)/include
2410
2411ifeq ($(KBUILD_TARGET),win)
2412 # drag in library configuration (we need QMAKE_PRL_DEFINES)
2413 ifneq ($(LIB_QT_PRL),)
2414 include $(LIB_QT_PRL)
2415 endif
2416 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_VCC_TOOL)
2417 TEMPLATE_VBOXQTGUIEXE_DEFS += \
2418 _WIN32_WINNT=0x0500 UNICODE _UNICODE \
2419 QT_DLL _CRT_SECURE_NO_DEPRECATE \
2420 $(QMAKE_PRL_DEFINES)
2421 ## @todo VCC70 flags?
2422 ifdef VBOX_USE_VCC80
2423 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
2424 -nologo -Zm200 -W3 -MD -Zi -EHsc -Zc:wchar_t-
2425 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu
2426 else
2427 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
2428 -nologo -Zm200 -W3 -MD -Zi -GX
2429 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -GZ
2430 endif
2431 TEMPLATE_VBOXQTGUIEXE_INCS += \
2432 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
2433 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = \
2434 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
2435 /DELAYLOAD:oleaut32.dll
2436 TEMPLATE_VBOXQTGUIEXE_SDKS = WINPSDK
2437 TEMPLATE_VBOXQTGUIEXE_LIBS = \
2438 $(LIB_QT) \
2439 $(LIB_QTMAIN) \
2440 $(LIB_RUNTIME) \
2441 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
2442 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
2443 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
2444 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
2445 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
2446 TEMPLATE_VBOXQTGUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2447
2448else # the gcc guys:
2449 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_GCC_TOOL)
2450 TEMPLATE_VBOXQTGUIEXE_DEFS.linux = _REENTRANT
2451 TEMPLATE_VBOXQTGUIEXE_DEFS.solaris = _REENTRANT
2452
2453 TEMPLATE_VBOXQTGUIEXE_INCS += \
2454 $(LIB_SDL_INC)
2455 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
2456 -pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
2457 -Wno-long-long -fshort-wchar -fno-strict-aliasing \
2458 $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
2459 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.x86 = -m32
2460 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.amd64 = -m64
2461 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -pthread
2462 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.x86 = -m32
2463 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.amd64 = -m64
2464 TEMPLATE_VBOXQTGUIEXE_LIBS = \
2465 $(LIB_QT) \
2466 $(LIB_SDL) \
2467 $(LIB_RUNTIME) \
2468 $(LIB_REM) \
2469 $(LIB_VMM)
2470
2471 ifeq ($(KBUILD_TARGET_ARCH),amd64)
2472 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
2473 $(VBOX_PATH_QT)/lib64 $(VBOX_PATH_QT)/lib
2474 else
2475 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
2476 $(VBOX_PATH_QT)/lib
2477 endif
2478
2479 ifeq ($(KBUILD_TARGET),linux)
2480 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += $(VBOX_LD_as_needed)
2481 else ifeq ($(KBUILD_TARGET),darwin)
2482 TEMPLATE_VBOXQTGUIEXE_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
2483 TEMPLATE_VBOXQTGUIEXE_CFLAGS += $(VBOX_DARWIN_DEF_SDK_CFLAGS)
2484 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
2485 TEMPLATE_VBOXQTGUIEXE_OBJCFLAGS += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
2486 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -framework Carbon -framework QuickTime -bind_at_load
2487 TEMPLATE_VBOXQTGUIEXE_LIBS +=
2488 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
2489 else ifeq ($(KBUILD_TARGET),os2)
2490 # drag in library configuration (we need QMAKE_PRL_DEFINES)
2491 ifneq ($(LIB_QT_PRL),)
2492 include $(LIB_QT_PRL)
2493 endif
2494 TEMPLATE_VBOXQTGUIEXE_DEFS += $(QMAKE_PRL_DEFINES)
2495 TEMPLATE_VBOXQTGUIEXE_LIBS +=
2496 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
2497 else
2498 TEMPLATE_VBOXQTGUIEXE_INCS += \
2499 $(VBOX_XCURSOR_INCS)
2500 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2501 $(VBOX_XCURSOR_LIBS) \
2502 Xext \
2503 X11 \
2504 m \
2505 $(LIB_PTHREAD)
2506 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \
2507 $(VBOX_LIBPATH_X11)
2508 ifeq ($(KBUILD_TARGET),freebsd)
2509 TEMPLATE_VBOXQTGUIEXE_INCS += \
2510 /usr/include \
2511 /usr/X11R6/include \
2512 /usr/local/include
2513 endif
2514 ifeq ($(KBUILD_TARGET),solaris)
2515 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2516 rt socket nsl
2517 endif
2518 endif
2519 ifdef VBOX_WITH_ORIGIN
2520 ifeq ($(KBUILD_TARGET),solaris)
2521 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN):$$(VBOX_ORIGIN)/qtgcc/lib'
2522 else
2523 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)'
2524 endif
2525 endif
2526
2527endif # !win
2528
2529# Add COM/XPCOM stuff
2530TEMPLATE_VBOXQTGUIEXE_LIBS += \
2531 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
2532ifdef VBOX_WITH_XPCOM
2533 ## @todo may be worth creating the VBOX_XPCOM SDK def
2534 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM
2535 TEMPLATE_VBOXQTGUIEXE_INCS += \
2536 $(VBOX_XPCOM_INCS)
2537 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2538 $(LIB_XPCOM)
2539 TEMPLATE_VBOXQTGUIEXE_INTERMEDIATES += \
2540 $(VBOX_PATH_SDK)/include/VirtualBox_XPCOM.h
2541else
2542 TEMPLATE_VBOXQTGUIEXE_INTERMEDIATES += \
2543 $(VBOX_PATH_SDK)/include/VirtualBox.h
2544endif
2545
2546#
2547# Template for building Qt GUI components.
2548#
2549TEMPLATE_VBOXQTGUI = VBox Qt GUI Components
2550TEMPLATE_VBOXQTGUI_EXTENDS = VBOXQTGUIEXE
2551TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN),$(TEMPLATE_VBOXQTGUIEXE_LIBS))
2552ifeq ($(KBUILD_TARGET),darwin)
2553 TEMPLATE_VBOXQTGUI_LDFLAGS = $(filter-out -framework Carbon -framework QuickTime -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS))
2554endif
2555ifeq ($(filter-out solaris.x86 %.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),)
2556 ifneq ($(KBUILD_TARGET),win)
2557 TEMPLATE_VBOXQTGUI_DEFS = PIC $(TEMPLATE_VBOXQTGUIEXE_DEFS)
2558 TEMPLATE_VBOXQTGUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CFLAGS)
2559 TEMPLATE_VBOXQTGUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS)
2560 TEMPLATE_VBOXQTGUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_LDFLAGS)
2561 endif
2562endif
2563
2564
2565#
2566# Template for building build bldprogs.
2567#
2568TEMPLATE_VBOXBLDPROG = VBox Build Program
2569TEMPLATE_VBOXBLDPROG_DEFS = IN_RING3
2570ifeq ($(KBUILD_HOST),win)
2571 ifeq ($(KBUILD_HOST_ARCH),x86)
2572 ifdef VBOX_USE_VCC80
2573 TEMPLATE_VBOXBLDPROG_TOOL = VCC80X86
2574 else
2575 TEMPLATE_VBOXBLDPROG_TOOL = VCC70
2576 endif
2577 TEMPLATE_VBOXBLDPROG_SDKS = WIN32SDK
2578 else
2579 TEMPLATE_VBOXBLDPROG_TOOL = VCC80AMD64
2580 TEMPLATE_VBOXBLDPROG_SDKS = WIN64SDK
2581 endif
2582 ifneq ($(TEMPLATE_VBOXBLDPROG_TOOL),VCC70)
2583 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -W3 -wd4996 -Zc:wchar_t-
2584 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -RTCsu
2585 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -Oy- -GS-
2586 else
2587 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -W3
2588 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -GZ
2589 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -Ogitb2 -Oy-
2590 endif
2591 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2592 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2593 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
2594 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
2595 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2596 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
2597 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
2598 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
2599 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
2600 /DISALLOWLIB:libcd.lib \
2601 /DISALLOWLIB:libcmtd.lib \
2602 /DISALLOWLIB:msvcrt.lib \
2603 /DISALLOWLIB:msvcrtd.lib \
2604 /DISALLOWLIB:msvcprt.lib \
2605 /DISALLOWLIB:msvcprtd.lib
2606 TEMPLATE_VBOXBLDPROG_LIBS = \
2607 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
2608 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt.lib \
2609 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt.lib
2610
2611else
2612# (gcc of some kind )
2613TEMPLATE_VBOXBLDPROG_TOOL = GXX3
2614TEMPLATE_VBOXBLDPROG_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
2615TEMPLATE_VBOXBLDPROG_CFLAGS.x86 = -m32
2616TEMPLATE_VBOXBLDPROG_CFLAGS.amd64 = -m64
2617TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2618TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
2619TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
2620TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe
2621TEMPLATE_VBOXBLDPROG_CXXFLAGS.x86 = -m32
2622TEMPLATE_VBOXBLDPROG_CXXFLAGS.amd64 = -m64
2623TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2624TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2625TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2626TEMPLATE_VBOXBLDPROG_LDFLAGS.x86 = -m32
2627TEMPLATE_VBOXBLDPROG_LDFLAGS.amd64 = -m64
2628 ifeq ($(KBUILD_HOST),linux)
2629TEMPLATE_VBOXBLDPROG_LIBS = pthread m rt dl
2630 else ifeq ($(KBUILD_HOST),os2)
2631TEMPLATE_VBOXBLDPROG_TOOL = GXX3OMF
2632TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
2633 else ifeq ($(KBUILD_HOST),darwin)
2634TEMPLATE_VBOXBLDPROG_TOOL = GXX4MACHO
2635TEMPLATE_VBOXBLDPROG_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -fno-common
2636TEMPLATE_VBOXBLDPROG_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
2637TEMPLATE_VBOXBLDPROG_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
2638TEMPLATE_VBOXBLDPROG_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
2639TEMPLATE_VBOXBLDPROG_LIBS =
2640 else if1of ($(KBUILD_HOST), freebsd netbsd openbsd)
2641TEMPLATE_VBOXBLDPROG_TOOL = GXX3
2642TEMPLATE_VBOXBLDPROG_LIBS =
2643 else ifeq ($(KBUILD_HOST),solaris)
2644TEMPLATE_VBOXBLDPROG_TOOL = GXX3PLAIN
2645TEMPLATE_VBOXBLDPROG_LIBS = rt
2646 else
2647$(warning Warning: VBOX Build: Target $(KBUILD_HOST) is not officially supported!)
2648 endif
2649
2650endif # !win
2651
2652
2653#
2654# Windows rc workaround for crosscompiling.
2655# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
2656#
2657ifneq ($(KBUILD_HOST),win)
2658 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2659 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2660 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2661 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
2662else
2663 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
2664 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
2665 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
2666 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
2667 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
2668 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
2669 ) Sorry_Cannot_find_mc_in_the_PSDK)
2670endif
2671
2672
2673#
2674# Template for building Linux host tools (only for KBUILD_TARGET=l4).
2675#
2676TEMPLATE_VBOXLNXHOSTR3EXE = Template for building linux host programs when targeting L4.
2677TEMPLATE_VBOXLNXHOSTR3EXE_INST = $(INST_BIN)
2678TEMPLATE_VBOXLNXHOSTR3EXE_BLD_TRG = linux
2679TEMPLATE_VBOXLNXHOSTR3EXE_TOOL = $(VBOX_GCC_TOOL)
2680TEMPLATE_VBOXLNXHOSTR3EXE_ASTOOL = YASM
2681TEMPLATE_VBOXLNXHOSTR3EXE_DLLSUFF = .so
2682TEMPLATE_VBOXLNXHOSTR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
2683TEMPLATE_VBOXLNXHOSTR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
2684TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe $(VBOX_GCC_fno-stack-protector)
2685TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.debug = -fno-inline
2686TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2687TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release)
2688TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release)
2689TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.release = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release)
2690TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.debug)
2691TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.profile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.profile)
2692TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.kprofile)
2693TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_fno-stack-protector)
2694TEMPLATE_VBOXLNXHOSTR3EXE_LIBS = pthread m rt dl
2695
2696TEMPLATE_VBOXLNXHOSTR3LIB = Template for linux host libraries.
2697TEMPLATE_VBOXLNXHOSTR3LIB_EXTENDS = VBOXLNXHOSTR3EXE
2698TEMPLATE_VBOXLNXHOSTR3LIB_INST = $(INST_LIB)
2699
2700
2701#
2702# Template for building R3 programs for the guest additions.
2703# Note: Make sure you don't break VBOXGUESTR3CPPEXE when changing this.
2704#
2705TEMPLATE_VBOXGUESTR3EXE = VBox Guest Program
2706ifeq ($(KBUILD_TARGET),win)
2707 TEMPLATE_VBOXGUESTR3EXE_EXTENDS = VBOXR3EXE
2708 TEMPLATE_VBOXGUESTR3EXE_CFLAGS = $(filter-out -MD, $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT
2709 TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS = $(filter-out -MD, $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT
2710 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS = $(filter-out /DISALLOWLIB:libcmt.lib, $(TEMPLATE_VBOXR3EXE_LDFLAGS)) \
2711 /DISALLOWLIB:msvcrt.lib \
2712 /DISALLOWLIB:msvcprt.lib
2713 TEMPLATE_VBOXGUESTR3EXE_LIBS = \
2714 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL)_LIB)/oldnames.lib \
2715 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL)_LIB)/libcmt.lib \
2716 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL)_LIB)/libcpmt.lib
2717else # the gcc guys
2718 TEMPLATE_VBOXGUESTR3EXE_EXTENDS = VBOXR3EXE
2719 TEMPLATE_VBOXGUESTR3EXE_TOOL := $(subst GXX,GCC,$(TEMPLATE_VBOXR3EXE_TOOL))
2720 TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fno-exceptions
2721endif
2722TEMPLATE_VBOXGUESTR3EXE_INST = $(INST_ADDITIONS)
2723TEMPLATE_VBOXGUESTR3EXE_DEFS := $(TEMPLATE_VBOXR3EXE_DEFS) IN_GUEST IN_GUEST_R3 IN_RT_R3
2724ifeq ($(KBUILD_TARGET),linux) # As few libs as possible on linux.
2725 TEMPLATE_VBOXGUESTR3EXE_LIBS = pthread rt m
2726endif
2727
2728#
2729# Template for building R3 (dynamic) libraries for the guest additions.
2730#
2731TEMPLATE_VBOXGUESTR3DLL = VBox Guest User Dynamic Libraries
2732TEMPLATE_VBOXGUESTR3DLL_EXTENDS = VBOXGUESTR3EXE
2733## @todo add a INSTFUN that separates dlls and libs.
2734ifn1of ($(KBUILD_TARGET), os2 win)
2735 TEMPLATE_VBOXGUESTR3DLL_DEFS = $(TEMPLATE_VBOXGUESTR3EXE_DEFS) PIC
2736 TEMPLATE_VBOXGUESTR3DLL_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fPIC
2737 TEMPLATE_VBOXGUESTR3DLL_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fPIC -fno-exceptions
2738 TEMPLATE_VBOXGUESTR3DLL_LDFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_LDFLAGS) -fPIC
2739endif
2740
2741#
2742# Template for building R3 (static) libraries for the guest additions.
2743#
2744TEMPLATE_VBOXGUESTR3LIB = VBox Guest User Libraries
2745TEMPLATE_VBOXGUESTR3LIB_EXTENDS = VBOXGUESTR3EXE
2746TEMPLATE_VBOXGUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
2747if1of ($(KBUILD_TARGET), solaris) ## @todo r=bird: Fix the *R3Mini template to VBOXGUESTR3DLL and remove this hack.
2748 TEMPLATE_VBOXGUESTR3LIB_DEFS = $(TEMPLATE_VBOXGUESTR3EXE_DEFS) PIC
2749 TEMPLATE_VBOXGUESTR3LIB_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fPIC
2750 TEMPLATE_VBOXGUESTR3LIB_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fPIC -fno-exceptions
2751endif
2752
2753
2754#
2755# Template for XFree86 guest modules (relocatable module, i.e. sysmod).
2756# This mostly about zapping the VBOXR3EXE linker flags and libraries.
2757#
2758TEMPLATE_VBOXGUESTR3XF86MOD = VBox Guest Program with C++ library dependencies
2759TEMPLATE_VBOXGUESTR3XF86MOD_EXTENDS = VBOXGUESTR3EXE
2760TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
2761TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
2762TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
2763TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
2764TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS = -r
2765if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd) # the gnu ld guys.
2766 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.release = -S
2767 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.x86 = -m elf_i386
2768 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.amd64 = -m elf_x86_64
2769endif
2770TEMPLATE_VBOXGUESTR3XF86MOD_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fno-merge-constants -std=c99
2771TEMPLATE_VBOXGUESTR3XF86MOD_CXXFLAGS= $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fno-merge-constants
2772TEMPLATE_VBOXGUESTR3XF86MOD_SYSSUFF = .o
2773TEMPLATE_VBOXGUESTR3XF86MOD_LIBS = \
2774 $(VBOX_LIB_VBGL_R3_XFREE86)
2775TEMPLATE_VBOXGUESTR3XF86MOD_DEFS = $(TEMPLATE_VBOXGUESTR3DLL_DEFS) LOG_TO_BACKDOOR
2776
2777
2778#
2779# Template for X.org guest modules (shared libs).
2780# This mostly about zapping unnecessary LIBS from VBOXGUESTR3DLL and adding some flags.
2781#
2782TEMPLATE_VBOXGUESTR3XORGMOD = VBox Guest Program with C++ library dependencies
2783TEMPLATE_VBOXGUESTR3XORGMOD_EXTENDS = VBOXGUESTR3DLL
2784TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
2785TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
2786TEMPLATE_VBOXGUESTR3XORGMOD_CFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_CFLAGS) -std=c99
2787TEMPLATE_VBOXGUESTR3XORGMOD_DEFS = $(TEMPLATE_VBOXGUESTR3DLL_DEFS) LOG_TO_BACKDOOR
2788if1of ($(KBUILD_TARGET), linux)
2789 TEMPLATE_VBOXGUESTR3XORGMOD_LDFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_LDFLAGS) -s
2790endif
2791TEMPLATE_VBOXGUESTR3XORGMOD_LIBS = \
2792 $(VBOX_LIB_VBGL_R3_SHARED) \
2793 $(VBOX_LIB_IPRT_GUEST_R3_MINI) \
2794 $(VBOX_LIB_VBGL_R3_SHARED)
2795
2796
2797#
2798# Template for guest stuff that makes use of the C++ library and features.
2799# (This is mostly about undoing what was done to C++ for VBOXGUESTR3EXE.)
2800#
2801TEMPLATE_VBOXGUESTR3CPPEXE = VBox Guest Program with C++ library dependencies
2802TEMPLATE_VBOXGUESTR3CPPEXE_EXTENDS = VBOXGUESTR3EXE
2803ifeq ($(KBUILD_TARGET),win)
2804 # later if necessary
2805else
2806 TEMPLATE_VBOXGUESTR3CPPEXE_TOOL = $(TEMPLATE_VBOXR3EXE_TOOL)
2807 TEMPLATE_VBOXGUESTR3CPPEXE_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
2808endif
2809
2810
2811#
2812# Template for building R0 drivers for the guest additions.
2813#
2814TEMPLATE_VBOXGUESTR0 = VBox Guest Driver
2815TEMPLATE_VBOXGUESTR0_EXTENDS = VBOXR0DRV
2816TEMPLATE_VBOXGUESTR0_INST = $(INST_ADDITIONS)
2817TEMPLATE_VBOXGUESTR0_SDKS.win.x86 = WIN32SDK W2K3DDK
2818TEMPLATE_VBOXGUESTR0_SDKS.win.amd64 = W2K3DDK WINPSDKINCS
2819TEMPLATE_VBOXGUESTR0_LIBS.win.x86 = \
2820 $(PATH_SDK_W2K3DDK_LIB)/int64.lib
2821TEMPLATE_VBOXGUESTR0_DEFS = $(TEMPLATE_VBOXR0DRV_DEFS) IN_GUEST IN_GUEST_R0
2822ifeq ($(KBUILD_TARGET),solaris) # No VBI for the guest additions yet.
2823 TEMPLATE_VBOXGUESTR0_LDFLAGS = -r -dy
2824endif
2825
2826#
2827# Template for building R0 libraries for the guest additions.
2828#
2829TEMPLATE_VBOXGUESTR0LIB = VBox Guest Driver Libraries
2830TEMPLATE_VBOXGUESTR0LIB_EXTENDS = VBOXGUESTR0
2831TEMPLATE_VBOXGUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
2832
2833
2834#
2835# Guest additions libraries (all static).
2836# The _MINI and _SHARED are both compiled as PIC and intended for linking into a .so/.dll/.dylib.
2837#
2838VBOX_LIB_IPRT_GUEST_R3 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3$(VBOX_SUFF_LIB)
2839VBOX_LIB_IPRT_GUEST_R3_MINI = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3Mini$(VBOX_SUFF_LIB)
2840VBOX_LIB_IPRT_GUEST_R0 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR0$(VBOX_SUFF_LIB)
2841ifeq ($(KBUILD_TARGET_ARCH),x86)
2842 VBOX_LIB_IPRT_GUEST_R0_NT4 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR0NT4$(VBOX_SUFF_LIB)
2843else
2844 VBOX_LIB_IPRT_GUEST_R0_NT4 = $(VBOX_LIB_IPRT_GUEST_R0)
2845endif
2846VBOX_LIB_VBGL_R3 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3Lib$(VBOX_SUFF_LIB)
2847VBOX_LIB_VBGL_R3_XFREE86 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibXFree86$(VBOX_SUFF_LIB)
2848VBOX_LIB_VBGL_R3_SHARED = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibShared$(VBOX_SUFF_LIB)
2849VBOX_LIB_VBGL_R0BASE = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0LibBase$(VBOX_SUFF_LIB)
2850VBOX_LIB_VBGL_R0 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0Lib$(VBOX_SUFF_LIB)
2851
2852
2853
2854#
2855# Two targets to coordinate version number changes properly. Note that the
2856# only way to get a really consistent build is to run 'kmk' in the top-level
2857# directory. If you don't run it there, you get a consistent sub-tree only.
2858#
2859VBOX_VERSION_STAMP = $(PATH_OUT)/version-stamp-$(VBOX_VERSION_STRING)
2860VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
2861VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
2862
2863$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
2864 $(call MSG_GENERATE,,$@)
2865 $(QUIET)$(MKDIR) -p $(@D)
2866 $(QUIET)$(RM) -f $(wildcard $(PATH_OUT)/version-stamp-*)
2867 $(QUIET)$(APPEND) $@ $(VBOX_VERSION_STRING)
2868
2869$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
2870 $(call MSG_GENERATE,,$@)
2871 $(QUIET)$(MKDIR) -p $(@D)
2872 $(QUIET)$(RM) -f $@ [email protected]
2873 $(QUIET)$(APPEND) [email protected] '#ifndef ___version_generated_h___'
2874 $(QUIET)$(APPEND) [email protected] '#define ___version_generated_h___'
2875 $(QUIET)$(APPEND) [email protected] ''
2876 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)'
2877 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)'
2878 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)'
2879 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_STRING "$(VBOX_VERSION_STRING)"'
2880 $(QUIET)$(APPEND) [email protected] ''
2881 $(QUIET)$(APPEND) [email protected] '#endif'
2882 $(QUIET)$(MV) -f [email protected] $@
2883
2884
2885VBOX_PACKAGE_HEADER = $(PATH_OUT)/package-generated.h
2886
2887$(VBOX_PACKAGE_HEADER):
2888 $(call MSG_GENERATE,,$@)
2889 $(QUIET)$(MKDIR) -p $(@D)
2890 $(QUIET)$(RM) -f $@ [email protected]
2891 $(QUIET)$(APPEND) [email protected] '#ifndef ___package_generated_h___'
2892 $(QUIET)$(APPEND) [email protected] '#define ___package_generated_h___'
2893 $(QUIET)$(APPEND) [email protected] ''
2894 $(QUIET)$(APPEND) [email protected] '#define VBOX_PACKAGE_STRING "$(VBOX_PACKAGE_STRING)"'
2895 $(QUIET)$(APPEND) [email protected] ''
2896 $(QUIET)$(APPEND) [email protected] '#endif'
2897 $(QUIET)$(MV) -f [email protected] $@
2898
2899#
2900# Used for external makefiles which cannot include Config.kmk
2901#
2902$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
2903 $(call MSG_GENERATE,,$@)
2904 $(QUIET)$(RM) -f $@ [email protected]
2905 $(QUIET)$(MKDIR) -p $(@D)
2906 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)'
2907 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)'
2908 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)'
2909 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_STRING = $(VBOX_VERSION_STRING)'
2910 $(QUIET)$(MV) -f [email protected] $@
2911
2912ifndef VBOX_OSE
2913if1of ($(KBUILD_TARGET),freebsd linux netbsd openbsd solaris)
2914# VBOX_LICENSE_VER is used in several Makefiles
2915VBOX_LICENSE_SRC := $(PATH_ROOT)/doc/License.html
2916VBOX_LICENSE_VER_KMK = $(PATH_OUT)/license-version.kmk
2917$(VBOX_LICENSE_VER_KMK): $(VBOX_LICENSE_SRC)
2918 $(call MSG_GENERATE,,$(VBOX_LICENSE_VER_KMK))
2919 $(QUIET)$(MKDIR) -p $(@D)
2920 $(QUIET)$(SED) -e "s/.*License version \([0-9.]*\),.*/VBOX_LICENSE_VER=\1/;t;d" --output $@ $(VBOX_LICENSE_SRC)
2921-include $(VBOX_LICENSE_VER_KMK)
2922VBOX_LICENSE_BIN = $(PATH_BIN)/License-$(VBOX_LICENSE_VER).html
2923endif
2924endif
2925
2926
2927# Force building of the version header file as the first thing anywhere in
2928# the tree. This eliminates the need for manual dependencies on it.
2929## @todo there gotta be a better way of doing this.
2930Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK) $(VBOX_PACKAGE_HEADER)
2931Makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK) $(VBOX_PACKAGE_HEADER)
2932makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK) $(VBOX_PACKAGE_HEADER)
2933
2934
2935#
2936# Subversion tree revision.
2937#
2938# The VBOX_SVN_REV contains our best guess. Use svn info on the
2939# root of the treeto determin this it if .svn/entries is found,
2940# otherwise fall back on the Config.kmk revision.
2941#
2942SVN ?= svn$(HOSTSUFF_EXE)
2943VBOX_SVN_REV_KMK = $(PATH_OUT)/revision.kmk
2944ifndef VBOX_SVN_REV
2945 VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 10614 $ )
2946 VBOX_SVN_DEP := $(wildcard $(PATH_ROOT)/.svn/entries)
2947 ifeq ($(which $(SVN)),)
2948 VBOX_SVN_DEP :=
2949 endif
2950
2951# Rule for generating a timestamp and updating the real thing on change.
2952$(VBOX_SVN_REV_KMK).ts +| $(VBOX_SVN_REV_KMK): $(if $(VBOX_SVN_DEP), $(VBOX_SVN_DEP), $(PATH_ROOT)/Config.kmk)
2953 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
2954 $(QUIET)$(RM) -f $@ [email protected]
2955 $(QUIET)$(MKDIR) -p $(@D)
2956 ifneq ($(VBOX_SVN_DEP),)
2957 $(REDIRECT) -E 'LC_ALL=C' -wo [email protected] -- $(SVN) info $(PATH_ROOT)
2958 $(SED) -e '/^Revision/!d' -e 's/Revision\: */export VBOX_SVN_REV=/' --output $@ [email protected]
2959 $(QUIET)$(RM) -f [email protected]
2960 else
2961 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV_FALLBACK)'
2962 endif
2963 $(QUIET)$(CP) --changed -fv $@ $(VBOX_SVN_REV_KMK)
2964
2965 include $(VBOX_SVN_REV_KMK)
2966else
2967# allow to overwrite VBOX_SVN_REV externally (mainly for building .debs/.rpms)
2968$(VBOX_SVN_REV_KMK):
2969 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
2970 $(QUIET)$(RM) -f $@
2971 $(QUIET)$(MKDIR) -p $(@D)
2972 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV)'
2973 $(QUIET)echo '* $(VBOX_SVN_REV_KMK) was externally overwritten:'
2974 $(QUIET)$(CAT) $(VBOX_SVN_REV_KMK)
2975endif
2976
2977
2978#
2979# Legacy.
2980#
2981ifneq ($(LOCALCFG),)
2982 include $(LOCALCFG)
2983endif
2984
2985
2986#
2987# Some extra goals.
2988#
2989.PHONY: up update st stat status
2990up update::
2991 $(SVN) up
2992
2993up2 update2::
2994 $(SVN) up --ignore-externals
2995
2996st stat status:
2997 $(SVN) status
2998
2999quick:
3000 $(MAKE) VBOX_QUICK=1
3001
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