VirtualBox

source: vbox/trunk/Config.kmk@ 46505

Last change on this file since 46505 was 46474, checked in by vboxsync, 12 years ago

VBoxDef2LazyLoad: Added tool for generating lazy loading of VBoxVMM.dll to prevent it being loaded into VBoxSVC and the VM selector.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 225.4 KB
Line 
1# $Id: Config.kmk 46474 2013-06-10 16:02:12Z 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-2013 Oracle Corporation
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 (GPL) as published by the Free Software
16# Foundation, in version 2 as it comes in the "COPYING" file of the
17# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18# hope that it will 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# Build with umask 022 (requires kBuild r2556 to work, harmless on earlier).
29$(set-umask 022)
30
31# Add our own directories to the search paths.
32KBUILD_TOOL_PATHS = $(KBUILD_DEVTOOLS)/kBuildTools/
33
34
35# Modify the build types.
36KBUILD_BLD_TYPES = release profile debug kprofile
37
38## 'strict' builds
39# Same as release builds, except that RT_STRICT and VBOX_STRICT are defined,
40# meaning all assertions are in action. (Appending means '.strict' props take
41# precedence in argument lists.)
42KBUILD_BLD_TYPES += strict
43BLD_TYPE_strict_EXTENDS = release
44BLD_TYPE_strict_EXTENDS_BY = appending
45
46## 'dbgopt' builds
47# Same as debug builds, except that compiler optimizations are enabled. This
48# intended for cases where all the debug facitities (logging, assertions, ++)
49# is wanted but actual source level debugging as important as execution speed.
50KBUILD_BLD_TYPES += dbgopt
51BLD_TYPE_dbgopt_EXTENDS = debug
52BLD_TYPE_dbgopt_EXTENDS_BY = overriding
53
54# Temporary hack for kBuild ticket #83.
55## @todo kBuild: remove after closing ticket #83.
56PROPS_ACCUMULATE_L_LNK += INTERMEDIATES
57PROPS_PROGRAMS_ACCUMULATE_L += INTERMEDIATES
58PROPS_LIBRARIES_ACCUMULATE_L += INTERMEDIATES
59PROPS_DLLS_ACCUMULATE_L += INTERMEDIATES
60PROPS_SYSMODS_ACCUMULATE_L += INTERMEDIATES
61PROPS_MISCBINS_ACCUMULATE_L += INTERMEDIATES
62
63# Misc names used bye the install paths below.
64VBOX_PUEL_MANGLED_NAME := Oracle_VM_VirtualBox_Extension_Pack
65
66# Install paths
67## @todo This will change after 4.1 is branched off!
68# What is now 'bin' and 'lib' will be moved down under 'staged/', except on
69# darwin where it's currently called 'dist' which will be renamed to 'staged'.
70# When running 'kmk install' files will be copied to 'dist/', on unix systems
71# this will be done in FHS fashion assuming /usr/local or /usr as 'prefix'.
72#
73# Changes related to this are marked VBOX_WITH_NEW_LAYOUT.
74ifndef VBOX_WITH_NEW_LAYOUT
75 PATH_INS = $(PATH_OUT)/dist
76 PATH_STAGE = $(PATH_OUT)
77 INST_DEBUG := stage/debug/
78endif
79
80ifeq ($(KBUILD_TARGET),darwin)
81 ifndef VBOX_WITH_NEW_LAYOUT
82 INST_DIST = dist/
83 else
84 INST_DIST :=
85 endif
86 INST_SDK = $(INST_DIST)sdk/
87
88 # the bundles
89 INST_VIRTUALBOX = $(INST_DIST)VirtualBox.app/
90 INST_VBOXDRV = $(INST_DIST)VBoxDrv.kext/
91 INST_VBOXNETFLT = $(INST_DIST)VBoxNetFlt.kext/
92 INST_VBOXNETADP = $(INST_DIST)VBoxNetAdp.kext/
93 INST_VBOXUSB = $(INST_DIST)VBoxUSB.kext/
94
95 # put everything in the VirtualBox app bundle.
96 INST_BIN = $(INST_VIRTUALBOX)Contents/MacOS/
97 INST_DLL = $(INST_BIN)
98 INST_SYS = $(INST_BIN)
99 INST_TESTCASE = $(INST_BIN)testcase/
100 INST_ADDITIONS = $(INST_DIST)additions/
101 INST_ADDITIONS_ISO = $(INST_BIN)
102
103 # other paths
104 INST_LIB = lib/
105 INST_ADDITIONS_LIB = $(INST_LIB)additions/
106 VBOX_INST_DTRACE_LIB = $(INST_BIN)dtrace/lib/
107 VBOX_INST_DTRACE_TST = $(INST_BIN)dtrace/testcase/
108
109else
110
111 INST_BIN = bin/
112 INST_DIST = $(INST_BIN)
113 INST_SDK = $(INST_BIN)sdk/
114
115 INST_VIRTUALBOX = $(INST_BIN)
116 INST_VBOXDRV = $(INST_BIN)
117 INST_VBOXNETFLT = $(INST_BIN)
118 INST_VBOXNETADP = $(INST_BIN)
119 INST_VBOXUSB = $(INST_BIN)
120
121 INST_DLL = $(INST_BIN)
122 INST_SYS = $(INST_BIN)
123 INST_TESTCASE = $(INST_BIN)testcase/
124 INST_ADDITIONS = $(INST_BIN)additions/
125 INST_ADDITIONS_ISO = $(INST_ADDITIONS)
126
127 INST_LIB = lib/
128 INST_ADDITIONS_LIB = $(INST_LIB)additions/
129 VBOX_INST_DTRACE_LIB = $(INST_BIN)dtrace/lib/
130 VBOX_INST_DTRACE_TST = $(INST_BIN)dtrace/testcase/
131endif
132
133INST_TESTSUITE = testsuite/
134INST_TESTBOXSCRIPT = testboxscript/
135
136INST_DOC = doc/
137INST_EXTPACK = $(INST_BIN)ExtensionPacks/
138INST_EXTPACK_CERTS = $(INST_BIN)ExtPackCertificates/
139INST_EXTPACK_PUEL = $(INST_EXTPACK)$(VBOX_PUEL_MANGLED_NAME)/
140INST_PACKAGES = packages/
141
142VBOX_PATH_SDK = $(patsubst %/,%,$(PATH_STAGE)/$(INST_SDK))
143VBOX_PATH_DIST = $(patsubst %/,%,$(PATH_STAGE)/$(INST_DIST))
144VBOX_PATH_TESTSUITE = $(patsubst %/,%,$(PATH_STAGE)/$(INST_TESTSUITE))
145VBOX_PATH_ADDITIONS = $(patsubst %/,%,$(PATH_STAGE)/$(INST_ADDITIONS))
146VBOX_PATH_ADDITIONS_ISO = $(patsubst %/,%,$(PATH_STAGE)/$(INST_ADDITIONS_ISO))
147VBOX_PATH_ADDITIONS_LIB = $(patsubst %/,%,$(PATH_STAGE)/$(INST_ADDITIONS_LIB))
148VBOX_PATH_EXTPACK_PUEL= $(patsubst %/,%,$(PATH_STAGE)/$(INST_EXTPACK_PUEL))
149VBOX_PATH_PACKAGES = $(patsubst %/,%,$(PATH_STAGE)/$(INST_PACKAGES))
150
151
152# Delete targets on failure.
153.DELETE_ON_ERROR:
154
155# Notify about important kBuild updates.
156if $(KBUILD_VERSION_MAJOR) == 0 \
157 && ( $(KBUILD_VERSION_MINOR) >= 2 \
158 || ( $(KBUILD_VERSION_MINOR) == 1 \
159 && $(KBUILD_VERSION_PATCH) >= 999))
160 if $(KMK_REVISION) >= 2577
161 # OK.
162 else
163 $(error You must update kBuild! Requires kBuild revision 2577 or later, found $(KMK_REVISION) ($(KBUILD_VERSION)))
164 endif
165else
166 $(error You must update kBuild! Requires 0.1.999 or later, found $(KBUILD_VERSION))
167endif
168
169#
170# Define USERNAME early on.
171#
172ifndef USERNAME
173 ifdef USER
174 USERNAME = $(USER)
175 else
176 $(warning Warning: You must have USERNAME or USER in your environment.)
177 endif
178endif
179
180#
181# Detect the darwin host version number so we can disable stuff that doesn't
182# currently build on Lion.
183#
184ifeq ($(KBUILD_HOST),darwin)
185 VBOX_DARWIN_HOST_VERSION := $(subst ., ,$(shell uname -r))
186 VBOX_DARWIN_HOST_VERSION_MAJOR := $(expr $(word 1, $(VBOX_DARWIN_HOST_VERSION)) - 4)
187 VBOX_DARWIN_HOST_VERSION_MINOR := $(word 2, $(VBOX_DARWIN_HOST_VERSION))
188 VBOX_DARWIN_HOST_VERSION_PATCH := $(word 3, $(VBOX_DARWIN_HOST_VERSION))
189 VBOX_DARWIN_HOST_VERSION := 10.$(VBOX_DARWIN_HOST_VERSION_MAJOR).$(VBOX_DARWIN_HOST_VERSION_MINOR)
190endif
191
192
193#
194# The VirtualBox version.
195#
196
197# Major version.
198VBOX_VERSION_MAJOR = 4
199# Minor version.
200VBOX_VERSION_MINOR = 2
201# This is the current build number. It should be increased every time we publish a
202# new build. The define is available in every source file. Only even build numbers
203# will be published, odd numbers are set during development.
204VBOX_VERSION_BUILD = 51
205# The raw version string. This *must not* contain any other information/fields than
206# major, minor and build revision (as it is now) -- also will be used for host/guest version
207# comparison.
208VBOX_VERSION_STRING_RAW = $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
209# This can be overridden in LocalConfig.kmk or elsewhere.
210# For the convension, see checks near the end of Config.kmk.
211VBOX_BUILD_PUBLISHER =
212# Full version string (may include more than just x.y.z, but no spaces or other problematic chars).
213# Note! The BETA[n],ALPHA[n],RC[n] indicators should be inserted before the
214# publisher so that RTStrVersionCompare have a chance of comparing
215# prerelease from different publishers correctly.
216VBOX_VERSION_STRING = $(VBOX_VERSION_STRING_RAW)$(VBOX_BUILD_PUBLISHER)
217
218# Force the additions.sh script to get an exact additions build when we're doing the release.
219ifeq ($(int-mod $(VBOX_VERSION_BUILD),2),0)
220 export VBOX_ADDITIONS_SH_MODE = release
221 export VBOX_DOCUMENTATION_SH_MODE = release
222 export VBOX_EFI_SH_MODE = release
223 export VBOX_EXTPACKS_SH_MODE = release
224endif
225
226# Some info on the vendor
227VBOX_VENDOR = Oracle Corporation
228VBOX_VENDOR_SHORT = Oracle
229VBOX_PRODUCT = Oracle VM VirtualBox
230# Not all could be done automatically. Here is a list of known places which
231# have to be updated manually, please keep this up to date:
232# src/VBox/Devices/PC/PXE/client/uinit.asm
233# src/VBox/RDP/webclient/flash/com/sun/network/rdp/Version.as
234# src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
235# src/VBox/Frontends/VirtualBox/src/settings/global/VBoxGLSettingsLanguage.cpp
236# src/VBox/Frontends/VirtualBox/nls/*.ts
237# debian/control
238# src/VBox/Installer/linux/{debian,rpm}
239# src/VBox/Installer/linux/virtualbox.desktop
240# src/VBox/Additions/WINNT/Installer/ISO/ReadmeDrivers.txt
241# */*.inf, */*.rc
242
243# Maybe we want set this manually.
244VBOX_C_YEAR = $(date-utc %Y)
245
246#
247# The VirtualBox package type.
248#
249ifeq ($(KBUILD_TARGET),win)
250 VBOX_PACKAGE_OS = WINDOWS
251else ifeq ($(KBUILD_TARGET),linux)
252 VBOX_PACKAGE_OS = LINUX
253else ifeq ($(KBUILD_TARGET),darwin)
254 VBOX_PACKAGE_OS = DARWIN
255else ifeq ($(KBUILD_TARGET),solaris)
256 VBOX_PACKAGE_OS = SOLARIS
257else ifeq ($(KBUILD_TARGET),os2)
258 VBOX_PACKAGE_OS = OS2
259else ifeq ($(KBUILD_TARGET),haiku)
260 VBOX_PACKAGE_OS = HAIKU
261else if1of ($(KBUILD_TARGET), dragonfly freebsd netbsd openbsd)
262 VBOX_PACKAGE_OS = BSD
263else
264 $(error Cannot determine VBOX_PACKAGE_OS)
265endif
266ifeq ($(KBUILD_TARGET_ARCH),x86)
267 VBOX_PACKAGE_ARCH = 32BITS
268else
269 VBOX_PACKAGE_ARCH = 64BITS
270endif
271# distribution, mostly for Linux/Solaris where we support different distributions
272# this strip will be overridden by the Linux packaging scripts
273VBOX_PACKAGE_DIST ?= GENERIC
274# Full string
275VBOX_PACKAGE_STRING = $(VBOX_PACKAGE_OS)_$(VBOX_PACKAGE_ARCH)_$(VBOX_PACKAGE_DIST)
276
277
278#
279# The VirtualBox Configuration Defaults.
280#
281# We try to document all the build configuration options here, thing which
282# aren't enabled by default is left commented out just to show that they
283# exist and which value they should have (usually 1, but anyway).
284#
285
286## @name Additions
287## @{
288# This indicates that additions (of some kind or another) is being _built_.
289# VBOX_WITHOUT_ADDITIONS overrides it.
290VBOX_WITH_ADDITIONS = 1
291# Build the optional ring-0 part of the additions for syntax checking.
292# (Except when cross-building on linux since we're using /usr/src/...)
293ifn1of ($(KBUILD_TARGET).$(KBUILD_HOST_ARCH).$(KBUILD_TARGET_ARCH), linux.x86.amd64 linux.amd64.x86)
294 VBOX_WITH_ADDITION_DRIVERS = 1
295endif
296# Build X11 additions. Can be disabled separately.
297if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd solaris)
298 VBOX_WITH_X11_ADDITIONS = 1
299endif
300# Enable the building of shared folders in the windows additions.
301VBOX_WITH_WIN32_ADDITIONS_SHAREDFOLDERS = 1
302# Take the binaries of the OS/2 Additions.
303VBOX_WITH_OS2_ADDITIONS_BIN = 1
304# Use additions from the build server.
305#VBOX_WITH_ADDITIONS_FROM_BUILD_SERVER = 1
306# Include additions in the package
307VBOX_WITH_ADDITIONS_PACKING = 1
308# Only build the additions (for the additions build server).
309#VBOX_ONLY_ADDITIONS = 1
310ifdef VBOX_ADDITIONS_ONLY # typical mistake.
311 $(error It is VBOX_ONLY_ADDITIONS=1 not VBOX_ADDITIONS_ONLY!)
312endif
313# Don't bother with additions, overrides VBOX_WITH_ADDITIONS.
314# This is not used by makefiles, only Config.kmk, see below.
315ifdef VBOX_ONLY_SDK
316 VBOX_WITHOUT_ADDITIONS = 1
317endif
318# Don't create the additions ISO.
319# (Used by the additions build server, don't invert it.)
320#VBOX_WITHOUT_ADDITIONS_ISO = 1
321## @}
322
323## @name Documentation
324## @{
325# The documentation
326VBOX_WITH_DOCS = 1
327# Use documentation from the build server.
328#VBOX_WITH_DOCS_FROM_BUILD_SERVER = 1
329# Include documentation in the package
330VBOX_WITH_DOCS_PACKING = 1
331# Include CHM when building docs (unset in LocalConfig.kmk to suppress CHM)
332ifn1of ($(KBUILD_TARGET), linux)
333 VBOX_WITH_DOCS_CHM = 1
334endif
335# Don't bother with documentation, overrides VBOX_WITH_DOCS.
336# This is not used by makefiles, only Config.kmk, see below.
337#VBOX_WITHOUT_DOCS = 1
338# Only build the documentation (for the documentation build server).
339#VBOX_ONLY_DOCS = 1
340ifdef VBOX_DOCS_ONLY # typical mistake.
341 $(error It is VBOX_ONLY_DOCS=1 not VBOX_DOCS_ONLY!)
342endif
343## @}
344
345## @name VMM related settings.
346## @{
347# Enable the tradition raw-mode virtualization.
348VBOX_WITH_RAW_MODE = 1
349# Enable the ring-1 compression option (mainly for QNX).
350VBOX_WITH_RAW_RING1 = 1
351# Enable safe STR (store task register) emulation for raw-mode.
352VBOX_WITH_SAFE_STR = 1
353# Enable support for 64-bit guests.
354VBOX_WITH_64_BITS_GUESTS = 1
355# Enable multi-core VCPUs.
356VBOX_WITH_MULTI_CORE = 1
357# Activate this to force the VM to pre-allocate the guest RAM before startup
358VBOX_WITH_PREALLOC_RAM_BY_DEFAULT =
359# Enable the debugger.
360VBOX_WITH_DEBUGGER = 1
361# Enable the debugger GUI.
362VBOX_WITH_DEBUGGER_GUI = 1
363# Enable the PDM Lock and let I/O threads call into the PICs.
364# TODO: Eliminate VBOX_WITH_PDM_LOCK.
365VBOX_WITH_PDM_LOCK = 1
366# Activate this to use the old VT-x code.
367VBOX_WITH_OLD_VTX_CODE =
368## @}
369
370
371## @name Devices, Drivers, ...
372## @{
373# Build the Host Guest Communication Manager component.
374VBOX_WITH_HGCM = 1
375## Build the bugcheck detection code.
376#VBOX_WITH_GUEST_BUGCHECK_DETECTION =
377# Enable the USB feature. This includes VBOX_WITH_VUSB!
378VBOX_WITH_USB = 1
379# Enable the USB 1.1 controller plus virtual USB HID devices.
380VBOX_WITH_VUSB = 1
381# Enable the USB 2.0 controller.
382VBOX_WITH_EHCI = 1
383# Enable the ISCSI feature.
384VBOX_WITH_ISCSI = 1
385# Enable INIP support in the ISCSI feature.
386VBOX_WITH_INIP = 1
387# Enable new (pre-1.5.0 release) version of LWIP.
388VBOX_WITH_NEW_LWIP = 1
389# Enable the E1000 feature.
390VBOX_WITH_E1000 = 1
391# Enable the Virtio feature.
392VBOX_WITH_VIRTIO = 1
393# Enable ALSA support for Linux.
394VBOX_WITH_ALSA = 1
395# Enable Pulse support for Linux.
396VBOX_WITH_PULSE = 1
397# Enable PCI passthrough support.
398VBOX_WITH_PCI_PASSTHROUGH = 1
399# Enable statically linked dbus support.
400if1of ($(KBUILD_TARGET), linux solaris)
401 VBOX_WITH_DBUS = 1
402endif
403# Enable building PAM modules.
404if1of ($(KBUILD_TARGET), linux solaris)
405 VBOX_WITH_PAM = 1
406endif
407# Disable WINMM support for Windows (not implemented).
408VBOX_WITH_WINMM =
409# Enabled internal networking.
410VBOX_WITH_INTERNAL_NETWORKING = 1
411# Enable Host Guest Shared Memory Interface.
412VBOX_WITH_HGSMI = 1
413# Enable Video 2D Acceleration.
414if1of ($(KBUILD_TARGET), darwin linux win freebsd)
415 VBOX_WITH_VIDEOHWACCEL = 1
416endif
417# Enable Wddm Video driver for Vista+ guests.
418VBOX_WITH_WDDM = 1
419# Enable Wddm Video driver for Windows 8 guests.
420VBOX_WITH_WDDM_W8 = 1
421# Lazy developer!!
422VBOXWDDM_WITH_VBVA = 1
423# Lazy developer!!
424ifdef VBOX_WITH_WDDM
425 VBOX_WITH_VDMA = 1
426else ifdef VBOX_WITH_VDMA
427 undef VBOX_WITH_VDMA
428endif
429# Disable the Intel PXE ROM (uses Etherboot).
430VBOX_WITH_INTEL_PXE =
431# Enable EFI support
432VBOX_WITH_EFI = 1
433# Fetch EFI firmware image from the build server
434#VBOX_WITH_EFIFW_FROM_BUILD_SERVER = 1
435# Include the EFI firmware into the package
436VBOX_WITH_EFIFW_PACKING = 1
437# Use kStuff for MACH-O and LX binary loading.
438if1of ($(KBUILD_TARGET_ARCH), x86 amd64)
439 IPRT_WITH_KSTUFF = 1
440endif
441# Enable setuid wrapper for Solaris host DVD.
442#VBOX_WITH_SUID_WRAPPER = 1
443# Enable the virtual SATA/AHCI controller
444VBOX_WITH_AHCI = 1
445# Enable the new async completion manager
446VBOX_WITH_PDM_ASYNC_COMPLETION = 1
447# Temporary switch for enabling / disabling the new USB code on Darwin.
448VBOX_WITH_NEW_USB_CODE_ON_DARWIN = 1
449ifdef VBOX_WITH_USB
450 VBOX_WITH_VUSB = 1
451endif
452ifdef VBOX_WITH_EHCI
453 VBOX_WITH_EHCI_IMPL = 1
454endif
455ifdef VBOX_WITH_PCI_PASSTHROUGH
456 VBOX_WITH_PCI_PASSTHROUGH_IMPL = 1
457endif
458# Enable the hal/sysfs USB code on Linux.
459ifeq ($(KBUILD_TARGET),linux)
460 VBOX_USB_WITH_SYSFS = 1
461 # Disabled for now
462 # VBOX_USB_WITH_DBUS = 1
463 VBOX_USB_WITH_INOTIFY = 1
464endif
465# Enable performance API.
466VBOX_WITH_RESOURCE_USAGE_API = 1
467# Use VBoxVolInfo for getting FS dependecies.
468if1of ($(KBUILD_TARGET), linux)
469 VBOX_WITH_DEVMAPPER = 1
470endif
471# Enable BusLogic SCSI host adapter
472VBOX_WITH_BUSLOGIC = 1
473# Enable LsiLogic SCSI host adapter
474VBOX_WITH_LSILOGIC = 1
475# Enable SCSI drivers
476VBOX_WITH_SCSI = 1
477# Enable this setting to force a fallback to default DMI data on configuration errors
478VBOX_BIOS_DMI_FALLBACK =
479# Enable the builtin PXE ROM
480VBOX_WITH_PXE_ROM = 1
481# Enable MSI support in devices
482VBOX_WITH_MSI_DEVICES = 1
483# Enable host network interface API.
484if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
485 VBOX_WITH_HOSTNETIF_API = 1
486endif
487# Emulated USB smart card reader
488VBOX_WITH_USB_CARDREADER = 1
489# Emulated USB webcam
490VBOX_WITH_USB_VIDEO = 1
491## @}
492
493
494## @name Other Component
495## @{
496# Build the installer.
497VBOX_WITH_INSTALLER = 1
498# The kernel driver/module and related runtime libraries.
499VBOX_WITH_VBOXDRV = 1
500# The main api.
501VBOX_WITH_MAIN = 1
502# The recompiler.
503VBOX_WITH_REM = 1
504# Set this to prefix all C symbols in XPCOM, to avoid dynamic linking problems
505# caused by our XPCOM library polluting the symbol namespace for system libs.
506if1of ($(KBUILD_TARGET), linux solaris)
507 VBOX_WITH_XPCOM_NAMESPACE_CLEANUP = 1
508endif
509# Set this to not use COM or XPCOM in places where it can be avoided.
510#VBOX_WITHOUT_COM = 1
511# The webservices api.
512VBOX_WITH_WEBSERVICES = 1
513VBOX_WITH_WEBSERVICES_SSL = 1
514# The Qt 4 GUI.
515VBOX_WITH_QTGUI = 1
516# Indicates the Qt is Cocoa based on the Mac.
517ifeq ($(KBUILD_TARGET),darwin)
518 VBOX_WITH_COCOA_QT = 1
519endif
520# The SDL based GUI.
521VBOX_WITH_VBOXSDL = 1
522# Build VBoxSDL with secure label support.
523ifeq ($(filter win.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) # too much work with freetype and all that.
524VBOX_WITH_SECURELABEL = 1
525endif
526# The headless frontend.
527VBOX_WITH_HEADLESS = 1
528# Enable the build of VRDP server.
529VBOX_WITH_VRDP = 1
530# Build the VRDP authentication modules.
531VBOX_WITH_VRDP_AUTHMOD = 1
532# Build enhanced version of rdesktop.
533VBOX_WITH_VRDP_RDESKTOP = 1
534## The Direct Framebuffer GUI.
535#VBOX_WITH_VBOXFB = 1
536# Enables the Python<->XPCOM and Python<->COM bindings.
537VBOX_WITH_PYTHON ?= 1
538if1of ($(KBUILD_TARGET), darwin linux solaris)
539 # Enable Java<->XPCOM bridge + glue code
540 VBOX_WITH_JXPCOM ?= 1
541endif
542if1of ($(KBUILD_TARGET), )
543 # Enable Java<->MSCOM glue, bridge is provided by an external lib (Jacob)
544 VBOX_WITH_JMSCOM ?= 1
545endif
546if1of ($(KBUILD_TARGET), darwin linux solaris)
547 # Enable Java<->JAX-WS bridge
548 VBOX_WITH_JWS ?= 1
549endif
550# Use XPIDL instead of XSLT stylesheet
551VBOX_WITH_JAVA_SUPPORT_IN_XPIDL ?=
552# Build against multiple Python versions present in the system
553VBOX_WITH_MULTIVERSION_PYTHON ?= 1
554# Enable the kchmviewer.
555VBOX_WITH_KCHMVIEWER = 1
556# Build the testsuite.
557VBOX_WITH_TESTSUITE = 1
558# Build the testcases.
559VBOX_WITH_TESTCASES = 1
560# Enable this to build vditool even if VBOX_WITH_TESTCASES is disabled
561VBOX_WITH_VDITOOL =
562# Enable this to build vbox-img even if VBOX_WITH_TESTCASES is disabled
563VBOX_WITH_VBOX_IMG =
564# Enables the VPX module for VM video capturing
565if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.x86 darwin.amd64 linux.x86 linux.amd64 solaris.amd64 win.x86 win.amd64)
566 VBOX_WITH_VPX = 1
567endif
568# Enable shared folders
569VBOX_WITH_SHARED_FOLDERS = 1
570# Enable shared clipboard
571VBOX_WITH_SHARED_CLIPBOARD = 1
572# Enable the host/guest information service (aka guest properties).
573VBOX_WITH_GUEST_PROPS = 1
574# Enable this to prevent the guest from writing guest properties.
575VBOX_WITH_GUEST_PROPS_RDONLY_GUEST =
576# Compile the host channel
577VBOX_WITH_HOST_CHANNEL = 1
578# Enable the guest control service.
579if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
580 VBOX_WITH_GUEST_CONTROL = 1
581endif
582# Enable ballooning
583VBOX_WITH_MEMBALLOON = 1
584# Enable crOpenGL service
585if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
586 VBOX_WITH_CROGL = 1
587endif
588# Enable the VNC server extension pack (GPL only).
589#VBOX_WITH_EXTPACK_VNC = 1
590# Enable S3 support (requires libcurl)
591VBOX_WITH_S3 = 1
592# Enable Host=>Guest Drag'n'Drop
593if1of ($(KBUILD_TARGET), darwin linux solaris win)
594 VBOX_WITH_DRAG_AND_DROP = 1
595 # Guest=>Host drag'n'drop doesn't work
596 #VBOX_WITH_DRAG_AND_DROP_GH = 1
597endif
598# Enable support for VRDP redirection of Windows Media Player content
599ifeq ($(KBUILD_TARGET),win)
600 VBOX_WITH_MMR = 1
601endif
602## @}
603
604
605## @name Networking
606## @{
607# Use VBoxNetFlt for host interface networking.
608if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
609 VBOX_WITH_NETFLT = 1
610 ifeq ($(KBUILD_TARGET),solaris)
611 # requires snv_159+.
612 VBOX_WITH_NETFLT_CROSSBOW = 1
613 endif
614 # Use VBoxNetAdp for host only networking.
615 if1of ($(KBUILD_TARGET), darwin freebsd linux solaris) ## @todo this should be set and used on windows too.
616 VBOX_WITH_NETADP = 1
617 endif
618endif
619# Enables the UDP tunnel transport.
620VBOX_WITH_UDPTUNNEL = 1
621# Enable the netshaper support
622VBOX_WITH_NETSHAPER = 1
623# Enable Virtual Distributed Ethernet or not.
624if1of ($(KBUILD_TARGET), freebsd linux)
625 VBOX_WITH_VDE = 1
626endif
627## @}
628
629
630## @name Extension pack
631## @{
632# Enables the extension pack feature.
633VBOX_WITH_EXTPACK = 1
634# Enables separating code into the Oracle VM VirtualBox Extension Pack, dubbed PUEL.
635VBOX_WITH_EXTPACK_PUEL = 1
636# Enables building+packing the Oracle VM VirtualBox Extension Pack, includes VBOX_WITH_EXTPACK_PUEL
637VBOX_WITH_EXTPACK_PUEL_BUILD = 1
638## @}
639
640## @name Misc
641## @{
642# Enable Seamless mode
643VBOX_X11_SEAMLESS_GUEST = 1
644# Enables all the doxgen bits.
645VBOX_WITH_ALL_DOXYGEN_TARGETS = 1
646# Set this to skip installing the redistributable compiler runtime.
647#VBOX_WITHOUT_COMPILER_REDIST = 1
648# Enables VMMR0.r0 (++) loading using the native loader on solaris.
649# Good for debugging and analysis. Experimental.
650#VBOX_WITH_NATIVE_SOLARIS_LOADING = 1
651# Set this to enable user mode dtrace probes.
652if1of ($(KBUILD_TARGET), darwin linux solaris)
653 VBOX_WITH_DTRACE_R3 = 1
654endif
655# Set this to enable kernel driver dtrace probes.
656if1of ($(KBUILD_TARGET), darwin solaris)
657 VBOX_WITH_DTRACE_R0DRV = 1
658endif
659# Set this to enable dtrace probes in platform agnostic kernel code.
660ifn1of ($(KBUILD_TARGET), os2)
661 VBOX_WITH_DTRACE_R0 = 1
662endif
663# Set this to enable dtrace probes raw-mode context code.
664if1of ($(KBUILD_TARGET), linux solaris)
665 VBOX_WITH_DTRACE_RC = 1
666endif
667# Set this to enable support for dtrace probes in guest code.
668#VBOX_WITH_DTRACE_GST = 1
669# Set this to indicate that the host ships with DTrace.
670if1of ($(KBUILD_TARGET), darwin solaris freebsd)
671 VBOX_WITH_NATIVE_DTRACE = 1
672endif
673## @}
674
675
676## @name Compiler and linker config
677## @{
678# For treating compiler and linker warnings as errors where possible.
679if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.x86 darwin.amd64 linux.x86 linux.amd64 win.x86 win.amd64)
680 VBOX_WITH_WARNINGS_AS_ERRORS = 1
681endif
682# Whether we can use Open Watcom to build stuff.
683if1of ($(KBUILD_TARGET), darwin linux os2 win)
684 VBOX_WITH_OPEN_WATCOM = 1
685endif
686## @}
687
688
689## @name Hardening
690## @{
691# Enables hardening.
692# Most developers will want to disable this in their LocalConfig.kmk.
693ifn1of ($(KBUILD_TARGET), win)
694 VBOX_WITH_HARDENING = 1
695endif
696# Where the application files are (going to be) installed.
697#VBOX_PATH_APP_PRIVATE = /usr/lib/virtualbox
698ifdef VBOX_WITH_HARDENING
699 if1of ($(KBUILD_TARGET), linux solaris)
700 VBOX_PATH_APP_PRIVATE = /opt/VirtualBox
701 else ifeq ($(KBUILD_TARGET),darwin)
702 VBOX_PATH_APP_PRIVATE = /Applications/VirtualBox.app/Contents/MacOS
703 else ifeq ($(KBUILD_TARGET),freebsd)
704 VBOX_PATH_APP_PRIVATE = /usr/local/lib/virtualbox
705 else ifeq ($(KBUILD_TARGET),haiku)
706 VBOX_PATH_APP_PRIVATE = /boot/apps/VirtualBox
707 endif
708endif
709# Where the architecture specific application files are (going to be) installed.
710#VBOX_PATH_APP_PRIVATE_ARCH = /usr/lib/virtualbox
711ifdef VBOX_WITH_HARDENING
712 if1of ($(KBUILD_TARGET), solaris)
713 VBOX_PATH_APP_PRIVATE_ARCH_TOP = $(VBOX_PATH_APP_PRIVATE)
714 VBOX_PATH_APP_PRIVATE_ARCH = $(VBOX_PATH_APP_PRIVATE_ARCH_TOP)/$(if-expr $(KBUILD_TARGET_ARCH) == "amd64",amd64,i386)
715 else if1of ($(KBUILD_TARGET), darwin)
716 VBOX_PATH_APP_PRIVATE_ARCH = $(VBOX_PATH_APP_PRIVATE)
717 endif
718endif
719# Where the shared libraries are (going to be) installed.
720#VBOX_PATH_SHARED_LIBS = /usr/lib
721ifdef VBOX_WITH_HARDENING
722 if1of ($(KBUILD_TARGET), solaris)
723 VBOX_PATH_SHARED_LIBS = $(VBOX_PATH_APP_PRIVATE)/$(if-expr $(KBUILD_TARGET_ARCH) == "amd64",amd64,i386)
724 else if1of ($(KBUILD_TARGET), darwin)
725 VBOX_PATH_SHARED_LIBS = $(VBOX_PATH_APP_PRIVATE)
726 endif
727endif
728# Where the documentation is (going to be) installed.
729#VBOX_PATH_APP_DOCS = /usr/share/doc/virtualbox
730ifdef VBOX_WITH_HARDENING
731 if1of ($(KBUILD_TARGET), darwin solaris)
732 VBOX_PATH_APP_DOCS = $(VBOX_PATH_APP_PRIVATE)
733 endif
734endif
735# The DT_RPATH/DT_RUNPATH to embed into the binaries (ELF).
736# (This one is used for all binaries, there is no need to adjust this
737# depending on the location of the object.)
738#VBOX_WITH_RUNPATH = /usr/lib/virtualbox
739ifdef VBOX_WITH_HARDENING
740 if1of ($(KBUILD_TARGET), solaris)
741 VBOX_WITH_RUNPATH = $(VBOX_PATH_APP_PRIVATE)/$(if-expr $(KBUILD_TARGET_ARCH) == "amd64",amd64,i386)
742 else if1of ($(KBUILD_TARGET), freebsd linux)
743 VBOX_WITH_RUNPATH = $(VBOX_PATH_APP_PRIVATE)
744 endif
745endif
746# Enable use of the $ORIGIN DT_RPATH/DT_RUNPATH feature (ELF).
747# Because of the setuid usage on all ELF platforms when hardening the build
748# things gets a bit complicated since the $ORIGIN+setuid policy differs.
749#VBOX_WITH_ORIGIN = 1
750ifndef VBOX_WITH_HARDENING
751 if1of ($(KBUILD_TARGET), linux solaris)
752 VBOX_WITH_ORIGIN = 1
753 endif
754endif
755# Enable the system wide support service/daemon.
756# Work in progress, but required for hardening on Windows.
757#VBOX_WITH_SUPSVC = 1
758ifdef VBOX_WITH_HARDENING
759 if1of ($(KBUILD_TARGET), win)
760 VBOX_WITH_SUPSVC = 1
761 endif
762endif
763## @}
764
765
766# Strip binaries of release and profile builds before packing them into the installer
767# archive. When building .deb/.rpms, don't strip the symbols as they are required for
768# the debug packages containing symbols for gdb located in /usr/lib/debug.
769VBOX_DO_STRIP := $(if $(filter release profile,$(KBUILD_TYPE)),1,)
770
771
772#
773# Config items for enabling work in progress.
774#
775# It's good pratice to add stuff here even if it is currently disabled by
776# default.
777#
778# Note! Please, do *not* add stuff to the global DEFS unless it is *really*
779# necessary! The other guys will hate for it you when they have to
780# recompile everything when the feature is enabled or disabled. Put
781# the ifdefs in target or template definitions.
782#
783
784## For experimenting with disabling preemption instead of interrupts
785# when working VT-x/AMD-V in VMMR0.
786## @todo os2? Reconsider perhaps windows? (see defect) This should be made the default.
787if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
788 VBOX_WITH_VMMR0_DISABLE_PREEMPTION = 1
789endif
790# Mask all Local APIC interrupt vectors which are set up to NMI mode when switching
791# to/from the guest in raw mode. Modern Linux kernels use the performance counter
792# to raise an NMI from time to time.
793if1of ($(KBUILD_TARGET), linux)
794 VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI = 1
795endif
796## For testing deadlock detection and lock order validation.
797# If issues are found, create high priority defects and temporarily comment
798# the next line.
799VBOX_WITH_STRICT_LOCKS = 1
800
801
802#
803# Branding
804#
805VBOX_BRAND_BIOS_LOGO := $(PATH_ROOT)/src/VBox/Devices/Graphics/BIOS/puel_logo.bmp
806VBOX_BRAND_LICENSE_HTML := $(PATH_ROOT)/doc/License-gpl-2.0.html
807VBOX_BRAND_LICENSE_RTF := $(PATH_ROOT)/doc/License-gpl-2.0.rtf
808VBOX_BRAND_LICENSE_TXT := $(PATH_ROOT)/doc/License-gpl-2.0.txt
809VBOX_BRAND_LICENSE_VER :=
810VBOX_BRAND_GUI_ABOUT_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about.png
811VBOX_BRAND_GUI_ABOUT_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about_16px.png
812VBOX_BRAND_GUI_VBOX_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_16px.png
813VBOX_BRAND_GUI_VBOX_20PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_20px.png
814VBOX_BRAND_GUI_VBOX_32PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_32px.png
815VBOX_BRAND_GUI_VBOX_40PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_40px.png
816VBOX_BRAND_GUI_VBOX_48PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_48px.png
817VBOX_BRAND_GUI_VBOX_64PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_64px.png
818VBOX_BRAND_WIN_INST_DLGJPG := $(PATH_ROOT)/src/VBox/Installer/win/Binary/Dialog.jpg
819VBOX_BRAND_WIN_INST_EXT :=
820VBOX_BRAND_WIN_ADD_INST_DLGBMP := $(PATH_ROOT)/src/VBox/Additions/WINNT/Installer/welcome.bmp
821VBOX_BRAND_DARWIN_DISKIMAGE_DS_STORE := $(PATH_ROOT)/src/VBox/Installer/darwin/DiskImage/DS_Store
822VBOX_BRAND_DARWIN_DISKIMAGE_BG := $(PATH_ROOT)/src/VBox/Installer/darwin/DiskImage/vbox_folder.tiff
823VBOX_BRAND_DARWIN_INSTALLER_BG := $(PATH_ROOT)/src/VBox/Installer/darwin/VirtualBox_mpkg/background.tif
824
825#
826# Skip stuff.
827#
828
829ifdef VBOX_ONLY_EXTPACKS
830 # Clear some VBOX_WITH_XXX variables instead of adding ifdefs all over the place.
831 VBOX_WITH_DEBUGGER =
832 VBOX_WITH_ADDITIONS =
833 VBOX_WITH_VBOXDRV =
834 VBOX_WITH_TESTCASES =
835endif
836
837# VBOX_QUICK can be used by core developers to speed to the build
838ifdef VBOX_QUICK
839 # undefine variables by assigning blank.
840 VBOX_WITH_TESTSUITE=
841 VBOX_WITH_TESTCASES=
842 VBOX_WITH_MAIN =
843 VBOX_WITH_VBOXSDL =
844 VBOX_WITH_QTGUI =
845 VBOX_WITH_DEBUGGER_GUI =
846 VBOX_WITH_DOCS =
847endif # VBOX_QUICK
848
849ifeq ($(KBUILD_TARGET),darwin)
850 # Don't bother with SDL ttf for now.
851 VBOX_WITH_SECURELABEL=
852 # We'll use the native html/help viewer.
853 VBOX_WITH_KCHMVIEWER=
854 VBOX_WITH_VRDP_RDESKTOP=
855 # Permanent (no working SDL).
856 VBOX_WITH_VBOXSDL=
857endif
858
859ifeq ($(KBUILD_TARGET),freebsd)
860 VBOX_WITH_DOCS=
861endif
862
863ifeq ($(KBUILD_TARGET),haiku)
864 # Don't bother with SDL ttf for now.
865 VBOX_WITH_SECURELABEL=
866 # We'll use the native html/help viewer.
867 VBOX_WITH_KCHMVIEWER=
868 VBOX_WITH_VRDP_RDESKTOP=
869 # Permanent (no working SDL).
870 VBOX_WITH_VBOXSDL=
871 VBOX_WITH_DOCS=
872 VBOX_WITH_VBOXDRV=
873 VBOX_WITH_VRDP=
874 VBOX_WITH_HEADLESS=
875 VBOX_WITH_VBOXSDL=
876 VBOX_WITH_QTGUI=
877# VBOX_WITH_MAIN=
878 VBOX_WITH_DOCS=
879 VBOX_WITH_ISCSI=
880 VBOX_WITH_INIP=
881 VBOX_WITH_INTERNAL_NETWORKING=
882 VBOX_WITH_PDM_ASYNC_COMPLETION=
883 VBOX_WITH_KCHMVIEWER=
884 VBOX_WITH_HARDENING=
885endif
886
887
888ifeq ($(KBUILD_TARGET),os2)
889 VBOX_WITH_WEBSERVICES=
890 VBOX_WITH_INSTALLER=
891 VBOX_WITH_SECURELABEL=
892 VBOX_WITH_VRDP_AUTHMOD=
893 VBOX_WITH_VRDP_RDESKTOP=
894 VBOX_WITH_TESTSUITE=
895 VBOX_WITH_QTGUI=
896 VBOX_WITH_USB=
897 VBOX_WITH_EHCI=
898 VBOX_WITH_DOCS=
899 VBOX_WITH_PDM_ASYNC_COMPLETION=
900 VBOX_WITH_KCHMVIEWER=
901 VBOX_WITH_HARDENING=
902endif
903
904ifeq ($(KBUILD_TARGET),solaris)
905 VBOX_WITH_SECURELABEL=
906 VBOX_WITH_OGL=
907endif
908
909ifeq ($(KBUILD_TARGET),win)
910 VBOX_WITH_VRDP_RDESKTOP=
911 VBOX_WITH_KCHMVIEWER=
912endif
913
914ifn1of ($(KBUILD_TARGET_ARCH), x86 amd64)
915 VBOX_WITH_ADDITION_DRIVERS=
916 VBOX_WITH_CROGL=
917 VBOX_WITH_DEBUGGER=
918 VBOX_WITH_DOCS=
919 VBOX_WITH_EHCI=
920 VBOX_WITH_HARDENING=
921 VBOX_WITH_HEADLESS=
922 VBOX_WITH_HGCM=
923 VBOX_WITH_HGSMI=
924 VBOX_WITH_INIP=
925 VBOX_WITH_INSTALLER=
926 VBOX_WITH_INTERNAL_NETWORKING=
927 VBOX_WITH_ISCSI=
928 VBOX_WITH_KCHMVIEWER=
929 VBOX_WITH_MAIN=
930 VBOX_WITH_PDM_ASYNC_COMPLETION=
931 VBOX_WITH_QTGUI=
932 VBOX_WITH_RAW_MODE=
933 VBOX_WITH_SECURELABEL=
934 VBOX_WITH_TESTSUITE=
935 VBOX_WITH_USB=
936 VBOX_WITH_VBOXDRV=
937 VBOX_WITH_VBOXSDL=
938 VBOX_WITH_WEBSERVICES=
939 VBOX_WITH_XPCOM=
940 VBOX_WITHOUT_HARDENING=1
941 # remove later:
942 VBOX_WITH_VRDP=
943 VBOX_WITH_VRDP_AUTHMOD=
944 VBOX_WITH_VRDP_RDESKTOP=
945endif
946
947
948#
949# Include automatic and local config file to override the above settings
950# and to provide defaults for the settings below this point.
951#
952ifndef AUTOCFG
953 AUTOCFG := $(wildcard $(PATH_ROOT)/AutoConfig.kmk)
954endif
955ifneq ($(AUTOCFG),)
956 include $(AUTOCFG)
957endif
958
959ifndef LOCALCFG
960 LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
961 ifneq ($(LOCALCFG),)
962 include $(LOCALCFG)
963 endif
964else
965 # Ignore it if it doesn't exist.
966 if exists "$(LOCALCFG)"
967 include $(LOCALCFG)
968 else
969 $(warning LOCALCFG='$(LOCALCFG)' does not exist)
970 override LOCALCFG :=
971 endif
972endif
973
974#
975# Allow to overwrite the branding information from an external file
976#
977ifdef VBOX_BRANDING_CFG
978 include $(VBOX_BRANDING_CFG)
979endif
980
981#
982# Bitch about old settings.
983#
984ifdef VBOX_WITHOUT_LINUX_COMPILER_H
985 $(warning VBOX_WITHOUT_LINUX_COMPILER_H was renamed to VBOX_WITH_LINUX_COMPILER_H, the meaning is inverted.)
986endif
987
988#
989# Indicate VBOX_ONLY build if any of the VBOX_ONLY_* variables are set.
990#
991VBOX_ONLY_BUILD := $(strip $(foreach x, ADDITIONS DOCS EXTPACKS SDK TESTSUITE\
992 , $(if-expr defined(VBOX_ONLY_$(x)),VBOX_ONLY_$(x))))
993if $(words $(VBOX_ONLY_BUILD)) > 1
994 $(error VBox: More than one VBOX_ONLY build enabled! $(VBOX_ONLY_BUILD))
995endif
996
997#
998# For the docs build box.
999#
1000ifdef VBOX_ONLY_DOCS
1001 VBOX_WITH_DOCS_CHM = 1
1002endif
1003
1004#
1005# Disable components that are not open sourced.
1006#
1007ifdef VBOX_OSE
1008 VBOX_WITH_VRDP=
1009 VBOX_WITH_EHCI_IMPL=
1010 VBOX_WITH_EXTPACK_PUEL=
1011 VBOX_WITH_EXTPACK_PUEL_BUILD=
1012 VBOX_WITH_PCI_PASSTHROUGH_IMPL=
1013 VBOX_WITH_NEW_LWIP=
1014 VBOX_WITH_OS2_ADDITIONS_BIN=
1015 VBOX_WITH_SECURELABEL=
1016 VBOX_WITH_KCHMVIEWER=
1017 ifn1of ($(KBUILD_TARGET), linux)
1018 VBOX_WITH_DOCS=
1019 VBOX_WITH_DOCS_PACKING=
1020 endif
1021 # Enable any translations in OSE, even partial ones.
1022 VBOX_WITH_DOCS_TRANSLATIONS=1
1023 VBOX_WITH_TESTSUITE=
1024 VBOX_WITH_INTEL_PXE=
1025 VBOX_WITH_DEVMAPPER=
1026 ## @todo remove once the iPXE code is in public tree
1027 VBOX_WITHOUT_IPXE=1
1028 # Disable for OSE, requires snv_159+.
1029 VBOX_WITH_NETFLT_CROSSBOW=
1030 ifn1of ($(KBUILD_TARGET), darwin linux solaris win)
1031 VBOX_WITH_INSTALLER=
1032 endif
1033 if1of ($(KBUILD_TARGET), win)
1034 VBOX_WITH_VPX=
1035 endif
1036 # branding
1037 VBOX_BRAND_LICENSE_HTML := $(PATH_ROOT)/doc/License-gpl-2.0.html
1038 VBOX_BRAND_LICENSE_RTF := $(PATH_ROOT)/doc/License-gpl-2.0.rtf
1039 VBOX_BRAND_LICENSE_TXT := $(PATH_ROOT)/doc/License-gpl-2.0.txt
1040 VBOX_BRAND_BIOS_LOGO := $(PATH_ROOT)/src/VBox/Devices/Graphics/BIOS/ose_logo.bmp
1041 VBOX_BRAND_GUI_ABOUT_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about.png
1042 VBOX_BRAND_GUI_ABOUT_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about_16px.png
1043 VBOX_BRAND_GUI_VBOX_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_16px.png
1044 VBOX_BRAND_GUI_VBOX_20PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_20px.png
1045 VBOX_BRAND_GUI_VBOX_32PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_32px.png
1046 VBOX_BRAND_GUI_VBOX_40PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_40px.png
1047 VBOX_BRAND_GUI_VBOX_48PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_48px.png
1048 VBOX_BRAND_GUI_VBOX_64PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_64px.png
1049 VBOX_BRAND_GUI_CUBE_42PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_cube_42px.png
1050endif
1051
1052#
1053# VBOX_WITHOUT_HARDENING is for developers (put in LocalConfig.kmk).
1054# Note that this is a bit rough since hardening governs more than one
1055# variable... Also note that we allow VBOX_WITH_HARDENING=1 on the
1056# command line to overrule VBOX_WITHOUT_HARDENING (the check below).
1057#
1058ifdef VBOX_WITHOUT_HARDENING
1059 VBOX_WITH_HARDENING=
1060 ifeq ($(VBOX_WITH_HARDENING),)
1061 VBOX_PATH_APP_PRIVATE=
1062 VBOX_PATH_APP_PRIVATE_ARCH=
1063 VBOX_PATH_APP_PRIVATE_ARCH_TOP=
1064 VBOX_PATH_SHARED_LIBS=
1065 VBOX_PATH_APP_DOCS=
1066 VBOX_WITH_RUNPATH=
1067 if1of ($(KBUILD_TARGET), linux solaris)
1068 VBOX_WITH_ORIGIN=1
1069 endif
1070 endif
1071endif
1072
1073#
1074# Sanitize the additions build config variables.
1075#
1076ifdef VBOX_WITH_ADDITIONS_FROM_BUILD_SERVER
1077 VBOX_WITHOUT_ADDITIONS := 1
1078 ifdef VBOX_ONLY_ADDITIONS
1079 $(error VBOX_ONLY_ADDITIONS + VBOX_WITH_ADDITIONS_FROM_BUILD_SERVER does not add up!)
1080 endif
1081endif
1082
1083ifdef VBOX_ONLY_ADDITIONS
1084 ifdef VBOX_WITHOUT_ADDITIONS
1085 $(error VBOX_ONLY_ADDITIONS + VBOX_WITHOUT_ADDITIONS does not add up!)
1086 endif
1087endif
1088
1089ifdef VBOX_WITHOUT_ADDITIONS
1090 # Zap anything that could be contradicting this.
1091 VBOX_WITH_ADDITIONS :=
1092endif
1093
1094#
1095# Sanitize the documentation build config variables.
1096#
1097ifdef VBOX_WITH_DOCS_FROM_BUILD_SERVER
1098 VBOX_WITHOUT_DOCS := 1
1099 ifdef VBOX_ONLY_DOCS
1100 $(error VBOX_ONLY_DOCS + VBOX_WITH_DOCS_FROM_BUILD_SERVER does not add up!)
1101 endif
1102endif
1103
1104ifdef VBOX_ONLY_DOCS
1105 ifdef VBOX_WITHOUT_DOCS
1106 $(error VBOX_ONLY_DOCS + VBOX_WITHOUT_DOCS does not add up!)
1107 endif
1108endif
1109
1110ifdef VBOX_WITHOUT_DOCS
1111 # Zap anything that could be contradicting this.
1112 VBOX_WITH_DOCS :=
1113 VBOX_WITH_DOCS_CHM :=
1114endif
1115
1116#
1117# Disable components for headless
1118#
1119ifdef VBOX_HEADLESS
1120 VBOX_WITH_QTGUI=
1121 VBOX_WITH_VBOXSDL=
1122 VBOX_WITH_OGL=
1123 VBOX_WITH_KCHMVIEWER=
1124 VBOX_WITH_VRDP_RDESKTOP=
1125endif
1126
1127#
1128# Undefined VBOX_WITH_MAIN implies exclusion of a few more items.
1129#
1130ifndef VBOX_WITH_MAIN
1131 VBOX_WITH_VBOXSDL=
1132 VBOX_WITH_QTGUI=
1133 VBOX_WITH_DEBUGGER_GUI=
1134 VBOX_WITH_HEADLESS=
1135 ifdef VBOX_ONLY_DOCS
1136 $(error Oh, does VBOX_ONLY_DOCS actually end up here. sweet.)
1137 endif
1138 VBOX_WITH_DOCS=
1139endif
1140
1141ifndef VBOX_WITH_QTGUI
1142 VBOX_WITH_KCHMVIEWER=
1143endif
1144
1145ifdef VBOX_WITH_EXTPACK_PUEL_BUILD
1146 VBOX_WITH_EXTPACK_PUEL = 1
1147endif
1148
1149#
1150# Mark OSE builds clearly, helps figuring out limitations more easily.
1151#
1152ifdef VBOX_OSE
1153# This can be overridden (e.g. in LocalConfig.kmk) by whoever publishes a set
1154# of VirtualBox binaries. We request though that you always use something that
1155# clearly identifies your build and makes it clear that it is not one done by
1156# the VirtualBox team.
1157 VBOX_BUILD_PUBLISHER = _OSE
1158endif
1159
1160# Keep in sync with G_virtualBoxPackage in glue-jaxws.xsl and glue-java.xsl
1161# Changed with every new version, so beware!
1162if $(VBOX_VERSION_BUILD) < 51
1163 VBOX_API_VERSION = $(VBOX_VERSION_MAJOR)_$(VBOX_VERSION_MINOR)
1164else
1165 VBOX_API_VERSION = $(VBOX_VERSION_MAJOR)_$(expr $(VBOX_VERSION_MINOR) + 1)
1166endif
1167VBOX_API_SUFFIX = _$(VBOX_API_VERSION)
1168VBOX_JAVA_PACKAGE = org.virtualbox$(VBOX_API_SUFFIX)
1169
1170#
1171# Derived / helper config indicators. Not configurable.
1172#
1173
1174# Use the OpenGL module in qt when the video hardware acceleartion feature
1175# is enabled.
1176if defined(VBOX_WITH_VIDEOHWACCEL) && defined(VBOX_WITH_QTGUI)
1177 VBOX_GUI_USE_QGL = 1
1178else
1179 VBOX_GUI_USE_QGL=
1180endif
1181
1182#
1183# Image and object format config.
1184#
1185if1of ($(KBUILD_TARGET), freebsd haiku linux netbsd openbsd solaris)
1186 VBOX_LDR_FMT = elf
1187endif
1188ifeq ($(KBUILD_TARGET),darwin)
1189 VBOX_LDR_FMT = macho
1190endif
1191ifeq ($(KBUILD_TARGET),os2)
1192 VBOX_LDR_FMT = lx
1193 VBOX_LDR_FMT32 = lx
1194 VBOX_LDR_FMT64 = elf
1195 DONT_USE_YASM = 1 # yasm doesn't implement omf yet.
1196endif
1197ifeq ($(KBUILD_TARGET),win)
1198 VBOX_LDR_FMT = pe
1199endif
1200VBOX_LDR_FMT32 ?= $(VBOX_LDR_FMT)
1201VBOX_LDR_FMT64 ?= $(VBOX_LDR_FMT)
1202
1203#
1204# Assembler setup.
1205#
1206# This is a bit complicated since we have to support two different assmblers
1207# (yasm/nasm) and possibly two different formats (32-bit/64-bit).
1208#
1209ifeq ($(VBOX_LDR_FMT),elf)
1210 ifeq ($(KBUILD_TARGET_ARCH),x86)
1211VBOX_ASFLAGS_FMT = -f elf32 -DASM_FORMAT_ELF
1212 else
1213VBOX_ASFLAGS_FMT = -f elf64 -DASM_FORMAT_ELF
1214 endif
1215 VBOX_ASFLAGS_DBFINFO = -g dwarf2
1216endif
1217ifeq ($(VBOX_LDR_FMT),lx)
1218 VBOX_ASFLAGS_FMT = -f obj -DASM_FORMAT_OMF
1219 VBOX_ASFLAGS_DBFINFO = -g stabs
1220endif
1221ifeq ($(VBOX_LDR_FMT),macho)
1222 ifeq ($(KBUILD_TARGET_ARCH),x86)
1223 VBOX_ASFLAGS_FMT = -f macho32 -DASM_FORMAT_MACHO
1224 else
1225 VBOX_ASFLAGS_FMT = -f macho64 -DASM_FORMAT_MACHO
1226 endif
1227 VBOX_ASFLAGS_DBFINFO = -g dwarf2
1228endif
1229ifeq ($(VBOX_LDR_FMT),pe)
1230 ifeq ($(KBUILD_TARGET_ARCH),x86)
1231VBOX_ASFLAGS_FMT = -f win32 -DASM_FORMAT_PE
1232 else
1233VBOX_ASFLAGS_FMT = -f win64 -DASM_FORMAT_PE
1234 endif
1235VBOX_ASFLAGS_DBFINFO = -g cv8
1236endif
1237ifndef VBOX_ASFLAGS_FMT
1238 $(error VBOX_ASFLAGS_FMT is not defined. VBOX_LDR_FMT=$(VBOX_LDR_FMT))
1239endif
1240
1241ifeq ($(VBOX_LDR_FMT32),elf)
1242 VBOX_ASFLAGS_FMT32 = -f elf32 -DASM_FORMAT_ELF
1243 VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
1244endif
1245ifeq ($(VBOX_LDR_FMT32),lx)
1246 VBOX_ASFLAGS_FMT32 = -f obj -DASM_FORMAT_OMF
1247 VBOX_ASFLAGS_DBFINFO32 = -g stabs
1248endif
1249ifeq ($(VBOX_LDR_FMT32),macho)
1250 VBOX_ASFLAGS_FMT32 = -f macho32 -DASM_FORMAT_MACHO
1251 VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
1252endif
1253ifeq ($(VBOX_LDR_FMT32),pe)
1254 VBOX_ASFLAGS_FMT32 = -f win32 -DASM_FORMAT_PE
1255 VBOX_ASFLAGS_DBFINFO32 = -g cv8
1256endif
1257ifndef VBOX_ASFLAGS_FMT32
1258 $(error VBOX_ASFLAGS_FMT32 is not defined. VBOX_LDR_FMT32=$(VBOX_LDR_FMT32))
1259endif
1260
1261ifeq ($(VBOX_LDR_FMT64),elf)
1262 VBOX_ASFLAGS_FMT64 = -f elf64 -DASM_FORMAT_ELF
1263 VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
1264endif
1265ifeq ($(VBOX_LDR_FMT64),macho)
1266 VBOX_ASFLAGS_FMT64 = -f macho64 -DASM_FORMAT_MACHO
1267 VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
1268endif
1269ifeq ($(VBOX_LDR_FMT64),pe)
1270 VBOX_ASFLAGS_FMT64 = -f win64 -DASM_FORMAT_PE
1271 VBOX_ASFLAGS_DBFINFO64 = -g cv8
1272endif
1273ifndef VBOX_ASFLAGS_FMT64
1274 $(error VBOX_ASFLAGS_FMT64 is not defined. VBOX_LDR_FMT64=$(VBOX_LDR_FMT64))
1275endif
1276
1277ifndef DONT_USE_YASM
1278 VBOX_ASTOOL = YASM
1279 VBOX_LDR_FMT_2_YASM_DBGINFO.elf = -g dwarf2
1280 VBOX_LDR_FMT_2_YASM_DBGINFO.lx = -g stabs
1281 VBOX_LDR_FMT_2_YASM_DBGINFO.macho =
1282 VBOX_LDR_FMT_2_YASM_DBGINFO.pe = -g cv8
1283 VBOX_ASFLAGS = $(VBOX_ASFLAGS_FMT) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT))
1284 VBOX_ASFLAGS32 = $(VBOX_ASFLAGS_FMT32) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT32))
1285 VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT64))
1286else
1287 VBOX_ASTOOL = NASM
1288 VBOX_ASFLAGS = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT)) -D__NASM__ -w+orphan-labels -g
1289 VBOX_ASFLAGS32 = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT32)) -D__NASM__ -w+orphan-labels -g
1290 VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__NASM__ -w+orphan-labels -g
1291endif
1292
1293#
1294# Windows only has mingw handy. On *nix we have to deal with cross compiling
1295# 32-bit targets on 64-bit platforms, meaning we'll be using gcc32/g++32.
1296# In the latter case we'll also have to disable all the all the R0 driver related stuff.
1297#
1298ifndef VBOX_GCC_TOOL
1299 ifeq ($(KBUILD_TARGET),win)
1300 ifeq ($(KBUILD_TARGET_ARCH),x86)
1301 VBOX_GCC_TOOL := MINGW32
1302 TOOL_MINGW32_CFLAGS := $(UNDEFINED) # override -g
1303 else
1304 VBOX_GCC_TOOL := MINGWW64
1305 endif
1306 else ifeq ($(KBUILD_TARGET),os2)
1307 VBOX_GCC_TOOL := GXX3OMF
1308 else ifeq ($(KBUILD_TARGET),darwin)
1309 VBOX_GCC_TOOL := GXX4MACHO
1310 else ifeq ($(KBUILD_TARGET),haiku)
1311 # Haiku shouldn't pass '-r' to the linker by default
1312 VBOX_GCC_TOOL := GXX3PLAIN
1313 else ifeq ($(KBUILD_TARGET),solaris)
1314 VBOX_GCC_TOOL := GXX3PLAIN
1315 VBOX_GCC32_TOOL := GXX3PLAIN
1316 ifeq ($(KBUILD_HOST),solaris)
1317 TOOL_GXX3PLAIN_LD_SYSMOD ?= /usr/ccs/bin/ld
1318 endif
1319 else
1320 VBOX_GCC_TOOL := GXX3
1321 ifeq ($(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH),x86.amd64) ## @todo mixing target/host here!
1322 VBOX_GCC_TOOL := GXX32
1323 VBOX_WITH_VBOXDRV=
1324 else ifeq ($(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH),amd64.x86)
1325 VBOX_GCC_TOOL := GXX64
1326 VBOX_WITH_VBOXDRV=
1327 endif
1328 endif
1329endif
1330ifndef VBOX_GCC32_TOOL
1331 ifeq ($(KBUILD_TARGET_ARCH),x86)
1332 VBOX_GCC32_TOOL := $(VBOX_GCC_TOOL)
1333 else ifeq ($(KBUILD_TARGET),win)
1334 VBOX_GCC32_TOOL := MINGW32
1335 else
1336 VBOX_GCC32_TOOL := GXX32
1337 endif
1338endif
1339
1340#
1341# Decide which Visual C++ compiler version we're using by default.
1342#
1343ifndef VBOX_VCC_TOOL_STEM
1344 VBOX_VCC_TOOL_STEM := VCC100
1345else ifn1of ($(VBOX_VCC_TOOL_STEM), VCC100 VCC110)
1346 $(error VBox: VBOX_VCC_TOOL_STEM='$(VBOX_VCC_TOOL_STEM)' is not supported, only VCC100 and VCC110 is)
1347endif
1348ifndef VBOX_VCC_TOOL
1349 VBOX_VCC_TOOL := $(VBOX_VCC_TOOL_STEM)$(toupper $(KBUILD_TARGET_ARCH))
1350endif
1351
1352#
1353# The kBuild tools and SDKs are using PATH_DEVTOOLS, PATH_DEVTOOLS_BLD
1354# and PATH_DEVTOOLS_TRG to find things if we give them specific locations.
1355#
1356PATH_DEVTOOLS ?= $(PATH_ROOT)/tools
1357PATH_DEVTOOLS := $(abspath $(PATH_DEVTOOLS))
1358PATH_DEVTOOLS_BLD ?= $(PATH_DEVTOOLS)/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)
1359PATH_DEVTOOLS_TRG ?= $(PATH_DEVTOOLS)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
1360
1361## @todo Remove the default tool crap here!
1362TOOL = $(VBOX_GCC_TOOL)
1363TOOL.win.x86 = $(VBOX_VCC_TOOL_STEM)X86
1364TOOL.win.amd64 = $(VBOX_VCC_TOOL_STEM)AMD64
1365ASTOOL = $(VBOX_ASTOOL)
1366
1367#
1368# Setup the global defines and includes.
1369#
1370# Note! The __SOMETHING__ #defines are deprecated as they violate the C/C++ specs.
1371#
1372INCS += $(PATH_ROOT)/include $(PATH_OUT)
1373DEFS += VBOX
1374DEFS.debug := DEBUG DEBUG_$(subst $(subst _, ,_),_,$(USERNAME)) DEBUG_USERNAME=$(subst $(subst _, ,_),_,$(USERNAME))
1375DEFS.dbgopt = $(DEFS.debug)
1376DEFS.profile = VBOX_WITH_STATISTICS
1377DEFS.strict = RT_STRICT VBOX_STRICT
1378DEFS.x86 = RT_ARCH_X86 __X86__
1379DEFS.amd64 = RT_ARCH_AMD64 __AMD64__
1380DEFS.darwin = RT_OS_DARWIN __DARWIN__
1381DEFS.freebsd = RT_OS_FREEBSD __FREEBSD__
1382DEFS.haiku = RT_OS_HAIKU
1383DEFS.linux = RT_OS_LINUX _FILE_OFFSET_BITS=64
1384DEFS.netbsd = RT_OS_NETBSD
1385DEFS.openbsd = RT_OS_OPENBSD
1386DEFS.os2 = RT_OS_OS2 __OS2__
1387DEFS.solaris = RT_OS_SOLARIS _FILE_OFFSET_BITS=64
1388DEFS.win = RT_OS_WINDOWS __WIN__
1389DEFS.win.x86 = __WIN32__
1390DEFS.win.amd64 = __WIN64__
1391# optional defines (use environment or make commandline)
1392ifdef VBOX_WITH_DEBUGGER
1393 DEFS += VBOX_WITH_DEBUGGER
1394endif
1395ifdef VBOX_WITH_STATISTICS
1396 DEFS += VBOX_WITH_STATISTICS
1397endif
1398ifdef VBOX_STRICT
1399 DEFS += VBOX_STRICT
1400endif
1401ifdef LOG_ENABLED
1402 DEFS += LOG_ENABLED
1403endif
1404ifdef VBOX_OSE
1405 DEFS += VBOX_OSE
1406endif
1407ifdef VBOX_WITH_64_BITS_GUESTS
1408 DEFS += VBOX_WITH_64_BITS_GUESTS
1409endif
1410ifdef VBOX_WITH_HARDENING
1411 DEFS += VBOX_WITH_HARDENING
1412endif
1413if defined(VBOX_WITH_STRICT_LOCKS) && ($(KBUILD_TYPE) == "debug" || $(KBUILD_TYPE) == "strict")
1414 DEFS += RT_LOCK_STRICT RT_LOCK_STRICT_ORDER
1415endif
1416ifdef VBOX_WITH_EF_WRAPS
1417 DEFS += RTMEM_WRAP_TO_EF_APIS RTMEM_WRAP_SOME_NEW_AND_DELETE_TO_EF
1418endif
1419
1420# Quoted strings should not be passed to the assemblers since they might not
1421# subscribe to C preprocessing semantics.
1422ifdef VBOX_PATH_APP_PRIVATE
1423 CDEFS += RTPATH_APP_PRIVATE=\"$(VBOX_PATH_APP_PRIVATE)\"
1424endif
1425ifdef VBOX_PATH_APP_PRIVATE_ARCH
1426 CDEFS += RTPATH_APP_PRIVATE_ARCH=\"$(VBOX_PATH_APP_PRIVATE_ARCH)\"
1427endif
1428ifdef VBOX_PATH_APP_PRIVATE_ARCH_TOP
1429 CDEFS += RTPATH_APP_PRIVATE_ARCH_TOP=\"$(VBOX_PATH_APP_PRIVATE_ARCH_TOP)\"
1430endif
1431ifdef VBOX_PATH_SHARED_LIBS
1432 CDEFS += RTPATH_SHARED_LIBS=\"$(VBOX_PATH_SHARED_LIBS)\"
1433endif
1434ifdef VBOX_PATH_APP_DOCS
1435 CDEFS += RTPATH_APP_DOCS=\"$(VBOX_PATH_APP_DOCS)\"
1436endif
1437CXXDEFS += $(CDEFS)
1438OBJCDEFS += $(CDEFS)
1439
1440USES += dtrace
1441
1442
1443#
1444# Compiler optimization flags.
1445#
1446VBOX_GCC_WARN ?= -Wall $(VBOX_GCC_Wextra) $(VBOX_GCC_Wno-missing-field-initializers) -Wno-unused -Wno-trigraphs $(VBOX_GCC_fdiagnostics-show-option) $(VBOX_GCC_Wno-unused-parameter)
1447VBOX_GCC_WARN_PEDANTIC = -Wshadow $(VBOX_GCC_WARN) -Wno-long-long
1448ifdef VBOX_WITH_MASOCHISTIC_WARNINGS
1449 VBOX_GCC_WARN_PEDANTIC += -Wunused-variable -Wunused-function -Wunused-label -Wunused-parameter
1450endif
1451VBOX_GCC_PEDANTIC_CXX ?= -pedantic -Wshadow $(VBOX_GCC_WARN_PEDANTIC) -Wno-long-long $(VBOX_GCC_Wno-delete-non-virtual-dtor)
1452VBOX_GCC_PEDANTIC_C ?= -pedantic -Wshadow $(VBOX_GCC_WARN_PEDANTIC) -Wno-long-long -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Werror-implicit-function-declaration
1453ifeq ($(KBUILD_TARGET),win)
1454 VBOX_C_CXX_FLAGS_NO_UNUSED_PARAMETERS = #-Wdxxxx
1455else
1456 VBOX_C_CXX_FLAGS_NO_UNUSED_PARAMETERS = -Wno-unused-parameter
1457endif
1458ifeq ($(KBUILD_TYPE),debug)
1459 VBOX_GCC_FP ?= -fno-omit-frame-pointer
1460 VBOX_GCC_OPT ?= -O0
1461 VBOX_VCC_FP ?= -Oy-
1462 VBOX_VCC_OPT ?=
1463 VBOX_GCC_R0_FP ?= -fno-omit-frame-pointer -fno-optimize-sibling-calls
1464 VBOX_GCC_R0_OPT ?= -O2
1465 VBOX_VCC_R0_FP ?= -Oy-
1466 VBOX_VCC_R0_OPT ?=
1467 VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer -fno-optimize-sibling-calls
1468 VBOX_GCC_GC_OPT ?= -O2
1469 VBOX_VCC_GC_FP ?= -Oy-
1470 VBOX_VCC_GC_OPT ?=
1471else
1472 # We should use -fomit-frame-pointer for GCC / -Oy for VCC.
1473 # -funwind-tables provides support for backtraces in gdb then.
1474 VBOX_GCC_FP ?= -fno-omit-frame-pointer
1475 VBOX_GCC_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
1476 VBOX_VCC_FP ?= -Oy-
1477 VBOX_VCC_OPT ?= -O2
1478 VBOX_GCC_R0_FP ?= -fno-omit-frame-pointer
1479 VBOX_GCC_R0_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
1480 VBOX_VCC_R0_FP ?= -Oy-
1481 VBOX_VCC_R0_OPT ?= -O2
1482 VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer
1483 VBOX_GCC_GC_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
1484 VBOX_VCC_GC_FP ?= -Oy-
1485 VBOX_VCC_GC_OPT ?= -O2
1486endif
1487ifeq ($(KBUILD_TARGET_ARCH),x86)
1488 ifneq ($(KBUILD_TARGET),darwin)
1489 # (The '<=' operator is for prepending (kmk specific).)
1490 VBOX_GCC_OPT <= -march=i586
1491 endif
1492endif
1493
1494
1495#
1496# Select the CRT type we're using with Microsoft Visual C++.
1497#
1498ifdef VBOX_WITH_DEBUG_VCC_CRT
1499 VBOX_VCC_CRT_TYPE = d
1500 VBOX_VCC_CRT_TYPE_N =
1501else
1502 VBOX_VCC_CRT_TYPE =
1503 VBOX_VCC_CRT_TYPE_N = d
1504endif
1505
1506#
1507# Decide which Windows DDK to use by default.
1508#
1509ifeq ($(VBOX_VCC_TOOL_STEM),VCC110)
1510 VBOX_WINDDK ?= WINDDK80
1511else
1512 VBOX_WINDDK ?= WINDDK71
1513endif
1514VBOX_WINDDK_WLH ?= $(VBOX_WINDDK)WLH
1515
1516VBOX_WINDDK_GST ?= $(VBOX_WINDDK)
1517VBOX_WINDDK_GST_W8 ?= WINDDK80W8
1518VBOX_WINDDK_GST_W7 ?= $(VBOX_WINDDK_GST)W7
1519VBOX_WINDDK_GST_WLH ?= $(VBOX_WINDDK_GST)WLH
1520VBOX_WINDDK_GST_W2K3 ?= WINDDK71WNET
1521ifeq ($(KBUILD_TARGET_ARCH),x86)
1522 VBOX_WINDDK_GST_WXP ?= WINDDK71WXP
1523 VBOX_WINDDK_GST_W2K ?= $(VBOX_WINDDK_GST_WXP)
1524 VBOX_WINDDK_GST_NT4 ?= $(VBOX_WINDDK_GST_WXP)
1525else
1526 VBOX_WINDDK_GST_WXP ?= $(VBOX_WINDDK_GST_W2K3)
1527 VBOX_WINDDK_GST_W2K ?= $(VBOX_WINDDK_GST_W2K3)
1528 VBOX_WINDDK_GST_NT4 ?= $(VBOX_WINDDK_GST_W2K3)
1529endif
1530
1531
1532#
1533# Decide which Windows SDK to use by default.
1534#
1535ifeq ($(VBOX_VCC_TOOL_STEM),VCC110)
1536 VBOX_WINPSDK ?= WINPSDK80
1537else
1538 VBOX_WINPSDK ?= WINPSDK71
1539endif
1540VBOX_WINPSDK_GST ?= $(VBOX_WINPSDK)
1541VBOX_WINPSDK_GST_W8 ?= WINPSDK80
1542VBOX_WINPSDK_GST_W7 ?= $(VBOX_WINPSDK_GST)
1543VBOX_WINPSDK_GST_WLH ?= $(VBOX_WINPSDK_GST)
1544VBOX_WINPSDK_GST_WXP ?= $(VBOX_WINPSDK_GST)
1545ifeq ($(KBUILD_TARGET_ARCH),x86)
1546 VBOX_WINPSDK_GST_W2K ?= $(VBOX_WINPSDK_GST)
1547 VBOX_WINPSDK_GST_NT4 ?= $(VBOX_WINPSDK_GST)
1548else
1549 VBOX_WINPSDK_GST_W2K ?= $(VBOX_WINPSDK_GST_WXP)
1550 VBOX_WINPSDK_GST_NT4 ?= $(VBOX_WINPSDK_GST_WXP)
1551endif
1552
1553
1554#
1555# ARCH_BITS_DEFS.
1556#
1557if1of ($(KBUILD_TARGET_ARCH),amd64 sparc64)
1558 VBOX_HC_ARCH_BITS := 64
1559 ARCH_BITS_DEFS := HC_ARCH_BITS=64
1560else if1of ($(KBUILD_TARGET_ARCH),x86 sparc32)
1561 VBOX_HC_ARCH_BITS := 32
1562 ARCH_BITS_DEFS := HC_ARCH_BITS=32
1563else
1564 $(error VBox: KBUILD_TARGET_ARCH=$(KBUILD_TARGET_ARCH))
1565endif
1566
1567ifdef VBOX_WITH_64_BITS_GUESTS
1568 VBOX_GC_ARCH_BITS_DEFS := GC_ARCH_BITS=64
1569else
1570 VBOX_GC_ARCH_BITS_DEFS := GC_ARCH_BITS=32
1571endif
1572ARCH_BITS_DEFS += $(VBOX_GC_ARCH_BITS_DEFS)
1573
1574#
1575# Add the output dir(s) to the dynamic loader search path.
1576#
1577if1of ($(KBUILD_HOST), freebsd linux netbsd openbsd solaris)
1578 export LD_LIBRARY_PATH:=$(PATH_STAGE_BIN):$(PATH_STAGE_LIB):$(LD_LIBRARY_PATH)
1579endif
1580ifeq ($(KBUILD_HOST),haiku)
1581 export LIBRARY_PATH:=$(PATH_STAGE_BIN):$(PATH_STAGE_LIB):$(LIBRARY_PATH)
1582endif
1583ifeq ($(KBUILD_HOST),os2)
1584 #fixme! export BEGINLIBPATH:=$(PATH_STAGE_BIN);$(PATH_STAGE_LIB);$(BEGINLIBPATH)
1585endif
1586ifeq ($(KBUILD_HOST),win)
1587 # This check is a bit hacky, but avoids problems with PATH being changed
1588 # again when the makefiles are reread because some automatically generated
1589 # makefile has been modified.
1590 ifeq ($(findstring $(PATH_STAGE_BIN);$(PATH_STAGE_LIB);,$(PATH)),)
1591 export PATH:=$(PATH_STAGE_BIN);$(PATH_STAGE_LIB);$(PATH)
1592 endif
1593endif
1594
1595#
1596# Common libraries and tools.
1597#
1598ifeq ($(KBUILD_TARGET),darwin)
1599 LIB_RUNTIME = $(PATH_STAGE_BIN)/VBoxRT.dylib
1600 LIB_RUNTIME_EF = #$(PATH_STAGE_LIB)/RuntimeEFCPP.a
1601 LIB_KPROFILE = $(PATH_STAGE_BIN)/kPrf2.dylib
1602 LIB_VMM = $(PATH_STAGE_BIN)/VBoxVMM.dylib
1603 LIB_VMMGC = $(PATH_STAGE_BIN)/VMMGC.gc
1604 LIB_REM = $(PATH_STAGE_LIB)/VBoxREM.dylib
1605 LIB_XPCOM = $(PATH_STAGE_BIN)/VBoxXPCOM.dylib
1606 LIB_DDU = $(PATH_STAGE_BIN)/VBoxDDU.dylib
1607endif
1608if1of ($(KBUILD_TARGET), freebsd haiku linux netbsd openbsd solaris)
1609 LIB_RUNTIME = $(PATH_STAGE_BIN)/VBoxRT.so
1610 LIB_RUNTIME_EF = $(PATH_STAGE_LIB)/RuntimeEFCPP.a
1611 LIB_KPROFILE = $(PATH_STAGE_BIN)/kPrf2.so
1612 LIB_VMM = $(PATH_STAGE_BIN)/VBoxVMM.so
1613 LIB_VMMGC = $(PATH_STAGE_BIN)/VMMGC.gc
1614 LIB_REM = $(PATH_STAGE_LIB)/VBoxREM.so
1615 LIB_XPCOM = $(PATH_STAGE_BIN)/VBoxXPCOM.so
1616 LIB_DDU = $(PATH_STAGE_BIN)/VBoxDDU.so
1617endif
1618ifeq ($(KBUILD_TARGET),os2)
1619 LIB_RUNTIME = $(PATH_STAGE_BIN)/VBoxRT.dll
1620 LIB_RUNTIME_EF = #$(PATH_STAGE_LIB)/RuntimeEFCPP.a
1621 LIB_KPROFILE = $(PATH_STAGE_BIN)/kPrf2.dll
1622 LIB_VMM = $(PATH_STAGE_BIN)/VBoxVMM.dll
1623 LIB_VMMGC = $(PATH_STAGE_LIB)/VMMRCImp.lib
1624 LIB_REM = $(PATH_STAGE_LIB)/VBoxREMImp.lib
1625 LIB_XPCOM = $(PATH_STAGE_BIN)/VBoxXCOM.dll
1626 LIB_DDU = $(PATH_STAGE_BIN)/VBoxDDU.dll
1627 VBOX_OBJ_SYS0 = $(PATH_OBJ)/RuntimeR0/os2/sys0.obj
1628endif
1629ifeq ($(KBUILD_TARGET),win)
1630 LIB_RUNTIME = $(PATH_STAGE_LIB)/VBoxRT.lib
1631 LIB_RUNTIME_EF = #$(PATH_STAGE_LIB)/RuntimeEFCPP.lib
1632 LIB_KPROFILE = $(PATH_STAGE_LIB)/kPrf2.lib
1633 LIB_VMM = $(PATH_STAGE_LIB)/VBoxVMM.lib
1634 LIB_VMMGC = $(PATH_OBJ)/VMMRC/VMMGC.lib
1635 LIB_REM = $(PATH_STAGE_LIB)/VBoxREMImp.lib
1636 LIB_XPCOM = $(PATH_STAGE_BIN)/VBoxXPCOM.dll
1637 LIB_DDU = $(PATH_STAGE_LIB)/VBoxDDU.lib
1638endif
1639if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), win.amd64)
1640 VBOX_LIB_VMM_LAZY = $(PATH_STAGE_LIB)/VMMR3LazyImp$(VBOX_SUFF_LIB)
1641else
1642 VBOX_LIB_VMM_LAZY = $(LIB_VMM)
1643endif
1644VBOX_LIB_SUPHARDENED = $(PATH_STAGE_LIB)/SUPR3HardenedStatic$(VBOX_SUFF_LIB)
1645VBOX_LIB_RUNTIME_STATIC = $(PATH_STAGE_LIB)/RuntimeR3$(VBOX_SUFF_LIB)
1646
1647ifndef VBOX_WITH_REM
1648 LIB_REM :=
1649endif
1650
1651# Python
1652ifndef VBOX_BLD_PYTHON
1653 if1of ($(KBUILD_HOST), win)
1654 VBOX_BLD_PYTHON := $(firstword $(rsort $(wildcard $(PATH_DEVTOOLS)/win.x86/python/v*/python$(HOSTSUFF_EXE))) python-not-found.exe)
1655 else
1656 VBOX_BLD_PYTHON := python$(HOSTSUFF_EXE)
1657 endif
1658endif
1659
1660# Define the macro for win path conversion.
1661ifndef VBOX_ONLY_SDK
1662 VBOX_FN_MAKE_WIN_PATH = $(subst /,\\,$(1))
1663else
1664 # on Wine Z: is always FS root
1665 VBOX_FN_MAKE_WIN_PATH = $(subst /,\\,$(patsubst /%,Z:/%,$(1)))
1666endif #!VBOX_ONLY_SDK
1667
1668# The kprofile build automagically links with kProfile.
1669ifeq ($(KBUILD_TYPE),kprofile)
1670 LIB_RUNTIME += $(LIB_KPROFILE)
1671endif
1672
1673# Enable C++ electric fence heap. (Warning: will easily run out of virtual memory / kernel stuff on Linux/Windows.)
1674ifdef VBOX_WITH_CPP_EF
1675 LIB_RUNTIME <= $(LIB_RUNTIME_EF)
1676endif
1677
1678# Overridable libraries (unix).
1679LIB_PTHREAD ?= pthread
1680
1681# Xcursor (consider an SDK for this).
1682ifeq ($(VBOX_XCURSOR_LIBS),)
1683 ifeq ($(KBUILD_TARGET),solaris)
1684 VBOX_XCURSOR_LIBS := $(lastword $(wildcard $(PATH_DEVTOOLS_TRG)/libXcursor/*/lib/libXcursor.a))
1685 ifneq ($(VBOX_XCURSOR_LIBS),)
1686 VBOX_XCURSOR_INCS := $(patsubst %/lib/libXcursor.a,%/include, $(VBOX_XCURSOR_LIBS))
1687 VBOX_XCURSOR_LIBS += X11 Xrender Xfixes
1688 endif
1689 endif
1690 ifeq ($(VBOX_XCURSOR_LIBS),)
1691 VBOX_XCURSOR_LIBS := Xcursor
1692 endif
1693endif
1694
1695
1696# Intel ASL compiler for ACPI
1697VBOX_IASLCMD ?= $(firstword $(wildcard $(PATH_DEVTOOLS_BLD)/bin/iasl$(HOSTSUFF_EXE)) iasl$(HOSTSUFF_EXE))
1698
1699# libxslt XSLT processor. (see PATH_TOOL_YASM for explanation why it's temporarily located in bin.)
1700ifeq ($(KBUILD_HOST),win)
1701# VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/win.x86/libxslt/10114/xsltproc.exe
1702 VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/win.x86/bin/xsltproc.exe
1703else ifeq ($(KBUILD_HOST),os2)
1704 VBOX_XSLTPROC ?= BEGINLIBPATH="$(PATH_DEVTOOLS_BLD)/bin;$$BEGINLIBPATH" $(PATH_DEVTOOLS_BLD)/bin/xsltproc.exe
1705else ifeq ($(KBUILD_HOST),haiku)
1706 VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/haiku.x86/bin/xsltproc
1707else
1708 VBOX_XSLTPROC ?= xsltproc$(HOSTSUFF_EXE)
1709endif
1710
1711# bin2c (convert binary files into C arrays)
1712VBOX_BIN2C ?= $(PATH_OBJ)/bin2c/bin2c$(HOSTSUFF_EXE)
1713
1714# RTManifest (extension pack manifest utility)
1715VBOX_RTMANIFEST ?= $(PATH_OBJ)/bldRTManifest/bldRTManifest$(HOSTSUFF_EXE)
1716
1717# VBoxCmp (simple /bin/cmp with more sensible output)
1718VBOX_VBOXCMP ?= $(PATH_OBJ)/VBoxCmp/VBoxCmp$(HOSTSUFF_EXE)
1719
1720# VBoxCPP (special purpose C preprocessor)
1721VBOX_VBOXCPP ?= $(PATH_OBJ)/VBoxCPP/VBoxCPP$(HOSTSUFF_EXE)
1722
1723# VBoxTpG (tracepoint generator)
1724VBOX_VBOXTPG ?= $(PATH_OBJ)/VBoxTpG/VBoxTpG$(HOSTSUFF_EXE)
1725
1726# VBoxPeSetVersion (changes the minimum OS version of an image)
1727VBOX_PE_SET_VERSION ?= $(PATH_OBJ)/VBoxPeSetVersion/VBoxPeSetVersion$(HOSTSUFF_EXE)
1728
1729# filesplitter (splits java files)
1730VBOX_FILESPLIT ?= $(PATH_OBJ)/filesplitter/filesplitter$(HOSTSUFF_EXE)
1731
1732# biossums (set BIOS checksums)
1733VBOX_BIOSSUMS ?= $(PATH_OBJ)/biossums/biossums$(HOSTSUFF_EXE)
1734
1735# MakeAlternativeSource (for BIOSes)
1736VBOX_MAKE_ALTERNATIVE_SOURCE ?= $(PATH_OBJ)/MakeAlternativeSource/MakeAlternativeSource$(HOSTSUFF_EXE)
1737
1738# VBoxDef2LazyLoad (lazy dynamic library loader assembly generator)
1739VBOX_DEF_2_LAZY_LOAD ?= $(PATH_OBJ)/VBoxDef2LazyLoad/VBoxDef2LazyLoad$(HOSTSUFF_EXE)
1740
1741# GNU tar if present.
1742if1of ($(KBUILD_TARGET), linux os2 win)
1743 VBOX_GTAR ?= tar
1744else if1of ($(KBUILD_TARGET), freebsd solaris)
1745 VBOX_GTAR ?= gtar
1746endif
1747
1748# mkisofs
1749ifeq ($(KBUILD_HOST),win)
1750 VBOX_MKISOFS ?= $(PATH_DEVTOOLS_BLD)/bin/mkisofs.exe
1751else
1752 VBOX_MKISOFS ?= mkisofs
1753endif
1754
1755# Makeself for the linux installers.
1756VBOX_MAKESELF ?= $(PATH_DEVTOOLS)/common/makeself/v2.1.5/makeself.sh
1757
1758# Microsoft HTML Help Workshop.
1759VBOX_PATH_HTML_HELP_WORKSHOP ?= $(PATH_DEVTOOLS)/win.x86/HTML_Help_Workshop/v1.3/
1760
1761# Path to the null soft installer.
1762VBOX_PATH_NSIS ?= $(PATH_DEVTOOLS)/win.x86/nsis/v2.46-log-nsscm-r1
1763
1764# Path to AutoIt3.
1765VBOX_PATH_AUTOIT3 ?= $(PATH_DEVTOOLS)/win.x86/autoit/v3.2.10.0
1766
1767# Windows install tools...
1768# Note! The scripts has been moved to Bin in v8.0.
1769VBOX_PATH_WIX ?= $(PATH_DEVTOOLS)/win.x86/wix/v3.5.2519.0
1770VBOX_PATH_MSITRAN ?= $(PATH_DEVTOOLS)/win.x86/sdk/v7.1/Bin/MsiTran.Exe
1771VBOX_PATH_MSIDB ?= $(PATH_DEVTOOLS)/win.x86/sdk/v7.1/Bin/MsiDb.Exe
1772VBOX_PATH_WISUBSTG ?= $(PATH_DEVTOOLS)/win.x86/sdk/v7.1/Samples/sysmgmt/msi/scripts/WiSubStg.vbs
1773VBOX_PATH_WISUMINFO ?= $(PATH_DEVTOOLS)/win.x86/sdk/v7.1/Samples/sysmgmt/msi/scripts/WiSumInf.vbs
1774VBOX_PATH_DIFX ?= $(PATH_DEVTOOLS)/win.$(KBUILD_TARGET_ARCH)/DIFx/v2.1-r3
1775VBOX_PATH_CABSDK ?= $(PATH_DEVTOOLS)/win.x86/cabsdk/r1
1776VBOX_PATH_MAKECAB ?= $(VBOX_PATH_CABSDK)/BIN/MAKECAB.EXE
1777
1778# We need to export YASM for OSE, but since it was converted to .zip we need to
1779# allow for the location used by the zip to be properly cleaned up first.
1780if1of ($(KBUILD_HOST).$(KBUILD_HOST_ARCH), linux.x86 solaris.x86 win.x86)
1781 PATH_TOOL_YASM ?= $(PATH_DEVTOOLS_BLD)/bin
1782endif
1783
1784# The Microsoft IDL compiler (the SDK build needs this on non-Windows).
1785VBOX_WIN_MIDL ?= $(EXEC_X86_WIN32) $(call VBOX_FN_MAKE_WIN_PATH,$(firstword $(wildcard \
1786 $(PATH_SDK_$(VBOX_WINPSDK)_BIN)/[Mm][Ii][Dd][Ll].[Ee][Xx][Ee]\
1787 $(PATH_SDK_$(VBOX_WINPSDK))/[Bb][Ii][Nn]/[Mm][Ii][Dd][Ll].[Ee][Xx][Ee]\
1788 $(PATH_SDK_WINPSDK_BIN)/[Mm][Ii][Dd][Ll].[Ee][Xx][Ee]\
1789 $(PATH_SDK_WINPSDK)/[Bb][Ii][Nn]/[Mm][Ii][Dd][Ll].[Ee][Xx][Ee]\
1790 $(PATH_DEVTOOLS)/win.x86/bin/[Mm][Ii][Dd][Ll].[Ee][Xx][Ee]\
1791 ) Sorry_Cannot_Find_The_Midl_Compiler_In_The_PSDK))
1792
1793# XPCOM setup for all but win32.
1794ifneq ($(KBUILD_TARGET),win)
1795 VBOX_WITH_XPCOM = 1
1796 # if updating, also update xpidl_INST var in src/libs/xpcom18a4/Makefile.kmk
1797 VBOX_XPIDL ?= $(PATH_STAGE_BIN)/xpidl$(HOSTSUFF_EXE)
1798 ifeq ($(KBUILD_TARGET),os2)
1799 VBOX_XPIDL_ENV = BEGINLIBPATH="$(dir $(VBOX_XPIDL));$$BEGINLIBPATH"$(SP)
1800 endif
1801 VBOX_PATH_XPCOM_IDL ?= $(VBOX_PATH_SDK)/bindings/xpcom/idl
1802 VBOX_XPCOM_INCS ?= \
1803 $(VBOX_PATH_SDK)/bindings/xpcom/include \
1804 $(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom \
1805 $(VBOX_PATH_SDK)/bindings/xpcom/include/string \
1806 $(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom \
1807 $(VBOX_PATH_SDK)/bindings/xpcom/include/nsprpub \
1808 $(VBOX_PATH_SDK)/bindings/xpcom/include/ipcd
1809 ifneq ($(KBUILD_TARGET),os2)
1810 # libIDL-config (for xpcom18a4)
1811 ifeq ($(origin VBOX_LIBIDL_CONFIG),undefined)
1812 export VBOX_LIBIDL_CONFIG := $(firstword $(shell which libIDL-config-2 libIDL-config 2> /dev/null))
1813 endif
1814 endif
1815endif
1816
1817# The X11 LIBPATH. (The amd64 hack is for RHEL4.)
1818ifeq ($(KBUILD_TARGET_ARCH),amd64)
1819 VBOX_LIBPATH_X11 ?= /usr/X11R6/lib64 /usr/X11R6/lib
1820else
1821 VBOX_LIBPATH_X11 ?= /usr/X11R6/lib
1822endif
1823
1824# 32bit X11 LIBPATH for building 32bit guest additions
1825VBOX_LIBPATH32_X11 ?= /usr/X11R6/lib32 /usr/X11R6/lib
1826
1827#
1828# Macros dealing with the darwin version we're targeting.
1829# The DEF in VBOX_DEF_MACOSX_VERSION_MIN mean default. The default min
1830# version is assumed to be the
1831#
1832ifeq ($(KBUILD_TARGET),darwin)
1833 VBOX_PATH_MACOSX_DEVEL_ROOT ?= /Developer
1834 VBOX_PATH_MACOSX_SDK_ROOT ?= $(VBOX_PATH_MACOSX_DEVEL_ROOT)/SDKs
1835
1836 ifeq ($(VBOX_DEF_MACOSX_VERSION_MIN),10.4)
1837 ifeq ($(origin VBOX_DARWIN_CLASSIC_LINKER),undefined)
1838 VBOX_DARWIN_CLASSIC_LINKER := $(shell ld -v 2>&1 )
1839 ifneq ($(filter ld64%, $(subst :, , $(VBOX_DARWIN_CLASSIC_LINKER))),)
1840 export VBOX_DARWIN_CLASSIC_LINKER := -Wl,-classic_linker
1841 else
1842 export VBOX_DARWIN_CLASSIC_LINKER :=
1843 endif
1844 endif
1845 VBOX_PATH_MACOSX_SDK ?= $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN)u.sdk
1846 else
1847 VBOX_PATH_MACOSX_SDK ?= $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN).sdk
1848 endif
1849
1850 ## The Xcode version.
1851 ifeq ($(KBUILD_HOST),darwin)
1852 ifndef VBOX_XCODE_VERSION
1853 ifdef VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL
1854 VBOX_XCODE_VERSION := $(word 2, $(shell $(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/xcodebuild -version))
1855 else
1856 VBOX_XCODE_VERSION := $(word 2, $(shell xcodebuild -version))
1857 endif
1858 VBOX_XCODE_VERSION ?= 4.1
1859 endif
1860 ifeq ($(VBOX_XCODE_VERSION),4.2)
1861 $(warning Xcode 4.2 is not able to correctly build the recompiler!)
1862 $(warning Please downgrade to Xcode 4.1 if you want a working VMM!)
1863 endif
1864 else
1865 VBOX_XCODE_VERSION ?= 4.1
1866 endif
1867 VBOX_XCODE_VERSION_MAJOR := $(word 1, $(subst ., ,$(VBOX_XCODE_VERSION)))
1868 VBOX_XCODE_VERSION_MINOR := $(word 2, $(subst ., ,$(VBOX_XCODE_VERSION)))
1869 VBOX_XCODE_VERSION := $(VBOX_XCODE_VERSION_MAJOR).$(VBOX_XCODE_VERSION_MINOR)
1870
1871 VBOX_DEF_MACOSX_VERSION_MIN ?= 10.6
1872 ifeq ($(KBUILD_TARGET_ARCH),x86)
1873 if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4 10.5)
1874 VBOX_DARWIN_NO_COMPACT_LINKEDIT ?= $(VBOX_LD_no_compact_linkedit)
1875 TOOL_GXX4MACHO_SUFFIX ?= -4.0
1876 endif
1877 else
1878 if $(VBOX_XCODE_VERSION_MAJOR) < 4 && "$(VBOX_XCODE_VERSION)" != "3.2"
1879 $(error VBox: 64-bit darwin builds require Xcode 3.2 or later, you have $(VBOX_XCODE_VERSION))
1880 endif
1881 endif
1882 if $(VBOX_XCODE_VERSION_MAJOR) == 4 && $(VBOX_XCODE_VERSION_MINOR) >= 2
1883 TOOL_GXX4MACHO_PREFIX ?= llvm-
1884 endif
1885 TOOL_GXX4MACHO_SUFFIX ?= -4.2
1886 VBOX_DARWIN_NO_COMPACT_LINKEDIT ?=
1887
1888 TOOL_GCC4MACHO_SUFFIX ?= $(TOOL_GXX4MACHO_SUFFIX)$(HOSTSUFF_EXE)
1889 TOOL_GCC4MACHO_PREFIX ?= $(TOOL_GXX4MACHO_PREFIX)
1890 ifdef VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL
1891 TOOL_GCC4MACHO_PREFIX := $(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/$(TOOL_GCC4MACHO_PREFIX)
1892 TOOL_GXX4MACHO_PREFIX := $(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/$(TOOL_GXX4MACHO_PREFIX)
1893 TOOL_GCC4MACHO_SUFFIX := $(TOOL_GCC4MACHO_SUFFIX) -isysroot $(VBOX_PATH_MACOSX_SDK)
1894 TOOL_GXX4MACHO_SUFFIX := $(TOOL_GXX4MACHO_SUFFIX) -isysroot $(VBOX_PATH_MACOSX_SDK)
1895 ifndef SVN # must expand first so we won't be using old svn.
1896 SVN := $(firstword $(which svn) svn)
1897 endif
1898 export PATH:=$(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/:$(PATH)
1899 endif
1900 ## @todo WTF do we do the -m32/64 stuff here for these compilers? Also the visibility should be elsewhere...
1901 TOOL_GXX4MACHO_OBJC = $(TOOL_GCC4MACHO_PREFIX)gcc$(TOOL_GCC4MACHO_SUFFIX) $(if-expr $(KBUILD_TARGET_ARCH) == "x86",-m32,-m64) -fvisibility=hidden
1902 TOOL_GXX4MACHO_OBJCXX = $(TOOL_GCC4MACHO_PREFIX)gcc$(TOOL_GCC4MACHO_SUFFIX) $(if-expr $(KBUILD_TARGET_ARCH) == "x86",-m32,-m64) -fvisibility=hidden -fvisibility-inlines-hidden
1903
1904 VBOX_DARWIN_DEF_SDK_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=$(subst .,,$(VBOX_DEF_MACOSX_VERSION_MIN))0 \
1905 MAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(VBOX_DEF_MACOSX_VERSION_MIN))0
1906 VBOX_DARWIN_DEF_SDK_CFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
1907 VBOX_DARWIN_DEF_SDK_CXXFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
1908 VBOX_DARWIN_DEF_SDK_OBJCFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
1909 VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
1910 VBOX_DARWIN_DEF_SDK_LDFLAGS = -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK) \
1911 -Wl,-headerpad_max_install_names $(VBOX_DARWIN_CLASSIC_LINKER) $(VBOX_DARWIN_NO_COMPACT_LINKEDIT)
1912
1913 # specific versions.
1914 ## @todo s/VBOX_DARWIN_DEF_SDK_10/VBOX_DARWIN_SDK_10/g
1915
1916 if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4) # classic linker detection is bust otherwise
1917 VBOX_PATH_MACOSX_SDK_10_4 ?= $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.4u.sdk
1918 VBOX_DARWIN_DEF_SDK_10_4_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=1040 MAC_OS_X_VERSION_MAX_ALLOWED=1040
1919 VBOX_DARWIN_DEF_SDK_10_4_CFLAGS := -mmacosx-version-min=10.4 -isysroot $(VBOX_PATH_MACOSX_SDK_10_4)
1920 VBOX_DARWIN_DEF_SDK_10_4_CXXFLAGS := -mmacosx-version-min=10.4 -isysroot $(VBOX_PATH_MACOSX_SDK_10_4)
1921 VBOX_DARWIN_DEF_SDK_10_4_OBJCFLAGS := -mmacosx-version-min=10.4 -isysroot $(VBOX_PATH_MACOSX_SDK_10_4)
1922 VBOX_DARWIN_DEF_SDK_10_4_OBJCXXFLAGS := -mmacosx-version-min=10.4 -isysroot $(VBOX_PATH_MACOSX_SDK_10_4)
1923 VBOX_DARWIN_DEF_SDK_10_4_LDFLAGS := -mmacosx-version-min=10.4 -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK_10_4) \
1924 -Wl,-headerpad_max_install_names $(VBOX_DARWIN_CLASSIC_LINKER)
1925 else
1926 VBOX_DARWIN_DEF_SDK_10_4_CXXFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.4 SDK)
1927 VBOX_DARWIN_DEF_SDK_10_4_LDFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.4 SDK)
1928 endif
1929
1930 if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4 10.5)
1931 VBOX_PATH_MACOSX_SDK_10_5 ?= $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.5.sdk
1932 VBOX_DARWIN_DEF_SDK_10_5_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=1050 MAC_OS_X_VERSION_MAX_ALLOWED=1050
1933 VBOX_DARWIN_DEF_SDK_10_5_CFLAGS := -mmacosx-version-min=10.5 -isysroot $(VBOX_PATH_MACOSX_SDK_10_5)
1934 VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS := -mmacosx-version-min=10.5 -isysroot $(VBOX_PATH_MACOSX_SDK_10_5)
1935 VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS := -mmacosx-version-min=10.5 -isysroot $(VBOX_PATH_MACOSX_SDK_10_5)
1936 VBOX_DARWIN_DEF_SDK_10_5_OBJCXXFLAGS := -mmacosx-version-min=10.5 -isysroot $(VBOX_PATH_MACOSX_SDK_10_5)
1937 VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS := -mmacosx-version-min=10.5 -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK_10_5) \
1938 -Wl,-headerpad_max_install_names $(VBOX_DARWIN_NO_COMPACT_LINKEDIT)
1939 else
1940 VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.5 SDK)
1941 VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.5 SDK)
1942 endif
1943
1944 if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4 10.5 10.6)
1945 VBOX_PATH_MACOSX_SDK_10_6 ?= $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.6.sdk
1946 VBOX_DARWIN_DEF_SDK_10_6_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=1060 MAC_OS_X_VERSION_MAX_ALLOWED=1060
1947 VBOX_DARWIN_DEF_SDK_10_6_CFLAGS := -mmacosx-version-min=10.6 -isysroot $(VBOX_PATH_MACOSX_SDK_10_6)
1948 VBOX_DARWIN_DEF_SDK_10_6_CXXFLAGS := -mmacosx-version-min=10.6 -isysroot $(VBOX_PATH_MACOSX_SDK_10_6)
1949 VBOX_DARWIN_DEF_SDK_10_6_OBJCFLAGS := -mmacosx-version-min=10.6 -isysroot $(VBOX_PATH_MACOSX_SDK_10_6)
1950 VBOX_DARWIN_DEF_SDK_10_6_OBJCXXFLAGS := -mmacosx-version-min=10.6 -isysroot $(VBOX_PATH_MACOSX_SDK_10_6)
1951 VBOX_DARWIN_DEF_SDK_10_6_LDFLAGS := -mmacosx-version-min=10.6 -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK_10_6) \
1952 -Wl,-headerpad_max_install_names
1953 else
1954 VBOX_DARWIN_DEF_SDK_10_6_CXXFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.6 SDK)
1955 VBOX_DARWIN_DEF_SDK_10_6_LDFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.6 SDK)
1956 endif
1957
1958 if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4 10.5 10.6 10.7)
1959 ifndef VBOX_PATH_MACOSX_SDK_10_7
1960 ifneq ($(wildcard $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.7.sdk),)
1961 VBOX_PATH_MACOSX_SDK_10_7 = $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.7.sdk
1962 else
1963 VBOX_PATH_MACOSX_SDK_10_7 = $(PATH_DEVTOOLS)/darwin.x86/SDKs/MacOSX10.7.sdk
1964 endif
1965 endif
1966 VBOX_DARWIN_DEF_SDK_10_7_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=1070 MAC_OS_X_VERSION_MAX_ALLOWED=1070
1967 VBOX_DARWIN_DEF_SDK_10_7_CFLAGS := -mmacosx-version-min=10.7 -isysroot $(VBOX_PATH_MACOSX_SDK_10_7)
1968 VBOX_DARWIN_DEF_SDK_10_7_CXXFLAGS := -mmacosx-version-min=10.7 -isysroot $(VBOX_PATH_MACOSX_SDK_10_7)
1969 VBOX_DARWIN_DEF_SDK_10_7_OBJCFLAGS := -mmacosx-version-min=10.7 -isysroot $(VBOX_PATH_MACOSX_SDK_10_7)
1970 VBOX_DARWIN_DEF_SDK_10_7_OBJCXXFLAGS := -mmacosx-version-min=10.7 -isysroot $(VBOX_PATH_MACOSX_SDK_10_7)
1971 VBOX_DARWIN_DEF_SDK_10_7_LDFLAGS := -mmacosx-version-min=10.7 -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK_10_7) \
1972 -Wl,-headerpad_max_install_names
1973 else
1974 VBOX_DARWIN_DEF_SDK_10_7_CXXFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.7 SDK)
1975 VBOX_DARWIN_DEF_SDK_10_7_LDFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.7 SDK)
1976 endif
1977
1978
1979endif # target=darwin
1980
1981#
1982# Macro switching between @executable_path, @rpath and /Applications/VirtualBox.app
1983# depending on whether the build is hardened or not (dylib install_name).
1984#
1985ifeq ($(KBUILD_TARGET),darwin)
1986 ifndef VBOX_DYLD_EXECUTABLE_PATH
1987 ifdef VBOX_WITH_HARDENING
1988 VBOX_DYLD_EXECUTABLE_PATH = $(VBOX_PATH_APP_PRIVATE_ARCH)
1989 else if 0
1990 VBOX_DYLD_EXECUTABLE_PATH = @executable_path
1991 else
1992 VBOX_DYLD_EXECUTABLE_PATH = @rpath
1993 VBOX_WITH_RELATIVE_RUNPATH = @loader_path/
1994 endif
1995 endif
1996endif
1997
1998#
1999# Check for incompatible rpath combinations.
2000#
2001if defined(VBOX_WITH_RUNPATH) && defined(VBOX_WITH_ORIGIN)
2002 $(error VBox: VBOX_WITH_RUNPATH and VBOX_WITH_ORIGIN are mutually exclusive)
2003endif
2004if defined(VBOX_WITH_RELATIVE_RUNPATH) && defined(VBOX_WITH_ORIGIN)
2005 $(error VBox: VBOX_WITH_RELATIVE_RUNPATH and VBOX_WITH_ORIGIN are mutually exclusive)
2006endif
2007if defined(VBOX_WITH_RUNPATH) && defined(VBOX_WITH_RELATIVE_RUNPATH)
2008 $(error VBox: VBOX_WITH_RUNPATH and VBOX_WITH_RELATIVE_RUNPATH are mutually exclusive)
2009endif
2010if defined(VBOX_WITH_RELATIVE_RUNPATH) && defined(VBOX_WITH_HARDENING)
2011 $(error VBox: VBOX_WITH_RELATIVE_RUNPATH and VBOX_WITH_HARDENING are mutually exclusive)
2012endif
2013
2014#
2015# VBOX_WITH_ORIGIN translates into VBOX_WITH_RELATIVE_RUNPATH.
2016#
2017# We use two helper variables for the VBOX_WITH_ORIGIN stuff:
2018# VBOX_ORIGIN - Indirect expansion trick.
2019# VBOX_GCC_RPATH_OPT - Different GCC/LD combinations needs different options.
2020#
2021VBOX_ORIGIN = $$ORIGIN
2022ifeq ($(KBUILD_TARGET),solaris)
2023 VBOX_GCC_RPATH_OPT = -R
2024else
2025 VBOX_GCC_RPATH_OPT = -Wl,-rpath,
2026 VBOX_GCC_ORIGIN_OPT = -Wl,-z,origin
2027endif
2028ifdef VBOX_WITH_ORIGIN
2029 VBOX_WITH_RELATIVE_RUNPATH = $$(VBOX_ORIGIN)
2030endif
2031
2032
2033#
2034# The X11 headers.
2035#
2036VBOX_PATH_X11_ROOT = $(PATH_ROOT)/src/VBox/Additions/x11/x11include
2037VBOX_PATH_X11_XFREE_4_3 = $(VBOX_PATH_X11_ROOT)/4.3
2038VBOX_PATH_X11_XORG_7_0 = $(VBOX_PATH_X11_ROOT)/7.0
2039VBOX_PATH_X11_XORG_7_1 = $(VBOX_PATH_X11_ROOT)/7.1
2040
2041
2042#
2043# crOpenGL related paths and variables.
2044#
2045ifdef VBOX_WITH_CROGL
2046 ifdef VBOX_WITH_WDDM
2047 VBOX_WITH_CRHGSMI = 1
2048 endif
2049 VBOX_PATH_CROGL_GLAPI = $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/glapi_parser
2050 VBOX_PATH_CROGL_GENFILES = $(PATH_OBJ)/VBoxOGLgen
2051 VBOX_PATH_CROGL_INCLUDE = $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/include
2052 VBOX_CROGL_API_FILES = $(VBOX_PATH_CROGL_GLAPI)/apiutil.py $(VBOX_PATH_CROGL_GLAPI)/APIspec.txt
2053 VBOX_CROGL_PYTHON_ENV = $(REDIRECT) $(if $1,-E 'PYTHONPATH=$1',) $(if $2,-o $2,) $(if $3,-i $3) --
2054
2055 if1of ($(KBUILD_HOST), os2 win)
2056 VBOX_PATH_CROGL_PYTHON_INCLUDE = $(VBOX_PATH_CROGL_GLAPI);$(PATH_ROOT)/src/VBox/GuestHost/OpenGL/packer;$(PATH_ROOT)/src/VBox/HostServices/SharedOpenGL/crserverlib
2057 else
2058 VBOX_PATH_CROGL_PYTHON_INCLUDE = $(VBOX_PATH_CROGL_GLAPI):$(PATH_ROOT)/src/VBox/GuestHost/OpenGL/packer:$(PATH_ROOT)/src/VBox/HostServices/SharedOpenGL/crserverlib
2059 endif
2060
2061 ifeq ($(KBUILD_TARGET),win)
2062 VBOX_LIB_OGL_CRUTIL = $(PATH_OBJ)/VBoxOGLcrutil/VBoxOGLcrutil$(VBOX_SUFF_LIB)
2063 VBOX_LIB_OGL_HOSTCRUTIL = $(PATH_OBJ)/VBoxOGLhostcrutil/VBoxOGLhostcrutil$(VBOX_SUFF_LIB)
2064 ifeq ($(KBUILD_TARGET),x86)
2065 VBOX_LIB_OGL_CRUTIL_X86 = $(VBOX_LIB_OGL_CRUTIL)
2066 else
2067 VBOX_LIB_OGL_CRUTIL_X86 = $(PATH_OBJ)/VBoxOGLcrutil-x86/VBoxOGLcrutil-x86$(VBOX_SUFF_LIB)
2068 endif
2069 else
2070 VBOX_LIB_OGL_CRUTIL = $(VBOX_PATH_ADDITIONS)/VBoxOGLcrutil$(VBOX_SUFF_DLL)
2071 VBOX_LIB_OGL_HOSTCRUTIL = $(PATH_STAGE_BIN)/VBoxOGLhostcrutil$(VBOX_SUFF_DLL)
2072 endif
2073
2074 if1of ($(KBUILD_TARGET), freebsd linux solaris)
2075 # VBOX_PATH_MESA_SOURCE = $(PATH_ROOT)/src/libs/mesa-7.2
2076 VBOX_PATH_MESA_SOURCE = $(VBOX_PATH_X11_ROOT)/mesa-7.2
2077 VBOX_MESA_INCS = \
2078 $(VBOX_PATH_MESA_SOURCE) \
2079 $(VBOX_PATH_MESA_SOURCE)/include \
2080 $(VBOX_PATH_MESA_SOURCE)/src/mesa/ \
2081 $(VBOX_PATH_MESA_SOURCE)/src/mesa/glapi \
2082 $(VBOX_PATH_MESA_SOURCE)/src/mesa/main \
2083 $(VBOX_PATH_MESA_SOURCE)/src/mesa/drivers/dri/common
2084 endif
2085
2086 VBOX_DARWIN_OPENGL_INST = obj/VBoxOGL/GL/
2087 VBOX_DARWIN_OPENGL_HEADERS = gl.h glu.h
2088 SDK_DARWIN-OPENGL = Workaround SDK for the darwin OpenGL include directorly layout layout.
2089 SDK_DARWIN-OPENGL_INCS = $(PATH_OUT)/obj/VBoxOGL
2090 SDK_DARWIN-OPENGL_ORDERDEPS = $(addprefix $(PATH_OUT)/obj/VBoxOGL/GL/,$(VBOX_DARWIN_OPENGL_HEADERS))
2091 ## @todo kBuild: Using INTERMEDIATES doesn't work!
2092endif
2093
2094# The icons to use.
2095ifdef VBOX_OSE
2096 VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_win.ico
2097 VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_win.ico
2098 VBOX_NSIS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_win.ico
2099 VBOX_MACOSX_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox.icns
2100else
2101 ifeq ($(KBUILD_HOST),win)
2102 VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox-vista.ico
2103 VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBoxGA-vista.ico
2104 VBOX_NSIS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBoxGA-nsis.ico
2105 TOOL_VCC80X86_RC := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
2106 TOOL_VCC80AMD64_RC := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
2107 TOOL_VCC70_RC := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
2108 else
2109 VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox-winxp.ico
2110 VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBoxGA-winxp.ico
2111 VBOX_NSIS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox-nsis.ico
2112 endif
2113 VBOX_MACOSX_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox.icns
2114endif
2115
2116
2117ifndef VBOX_NOINC_GCC_CONFIG_KMK
2118#
2119# GCC stuff properties.
2120# Most of this is resolved on first kmk invocation and cached in PATH_OUT.
2121#
2122# Note! That a harmless warning is printed if the file doesn't exist.
2123# Note! Changes in GCC are not detected automatically (yet).
2124#
2125include $(KBUILD_PATH)/tools/$(VBOX_GCC_TOOL).kmk
2126ifneq ($(VBOX_GCC_TOOL),$(VBOX_GCC32_TOOL))
2127 include $(KBUILD_PATH)/tools/$(VBOX_GCC32_TOOL).kmk
2128endif
2129
2130# These tests never worked on Windows because of /dev/null, so, there
2131# can be no harm in just dropping them until cygwin is mp safe.
2132ifeq ($(KBUILD_HOST),win)
2133VBOX_GCC_CHECK_CC = $(2)
2134VBOX_GCC_CHECK_CXX = $(2)
2135VBOX_GCC_CHECK_LD = $(2)
2136VBOX_GCC32_CHECK_CXX = $(2)
2137else
2138VBOX_GCC_CHECK_CC = $(shell \
2139 if $(TOOL_$(VBOX_GCC_TOOL)_CC) $(subst -Wno-,-W,$(1)) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
2140 then echo "$(1)"; \
2141 else echo "$(2)"; fi; )
2142
2143VBOX_GCC_CHECK_CXX = $(shell \
2144 if $(TOOL_$(VBOX_GCC_TOOL)_CXX) $(subst -Wno-,-W,$(1)) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
2145 then echo "$(1)"; \
2146 else echo "$(2)"; fi; )
2147
2148VBOX_GCC_CHECK_LD = $(shell \
2149 if $(TOOL_$(VBOX_GCC_TOOL)_LD) -Wl,$(1) $(if $(eq $(KBUILD_HOST),darwin),-Wl$(COMMA)-u$(COMMA)start -Wl$(COMMA)-undefined$(COMMA)dynamic_lookup,) -nostdlib -o /dev/null -xc /dev/null > /dev/null 2>&1 ;\
2150 then echo "-Wl,$(1)"; \
2151 else echo "$(2)"; fi; )
2152
2153VBOX_GCC32_CHECK_CXX = $(shell \
2154 if $(TOOL_$(VBOX_GCC32_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
2155 then echo "$(1)"; \
2156 else echo "$(2)"; fi; )
2157endif
2158
2159ifeq ($(KBUILD_HOST),win)
2160# This isn't important (yet) on windows, so cook the result until
2161# cygwin is feeling better.
2162VBOX_GCC_VERSION := $(int-add $(int-mul 10000, 3), $(int-mul 100, 3), 3)
2163else
2164# This is kind of bad, the returned string needs to be re-evaluated before use.
2165# The reason for this hack is that the windows kmk_ash cannot deal with $((1+1)).
2166# Some versions of gcc (e.g. openSUSE11) return only major.minor on `gcc -dumpversion`.
2167VBOX_GCC_VERSION = $(shell \
2168 $(1) -dumpversion | $(SED_EXT) 's|\([0-9]\)\.\([0-9]\)\.\{0,1\}\([0-9]\{0,1\}\).*|$$(int-add $$(int-mul 10000, \1), $$(int-mul 100, \2), $$(firstword \3 0))|' )
2169endif
2170
2171# No $(QUIET) here as it's interesting to see what goes into the file.
2172$(PATH_OUT)/GCCConfig.kmk: \
2173 $(PATH_ROOT)/Config.kmk \
2174 $(LOCALCFG) \
2175 $(AUTOCFG) \
2176 $(VBOX_GCC_PATH_CC) \
2177 $(VBOX_GCC_PATH_CXX) \
2178 $(VBOX_GCC32_PATH_CC) \
2179 $(VBOX_GCC32_PATH_CXX)
2180 $(call MSG_GENERATE,,$@,)
2181 $(QUIET)$(RM) -f '$@'
2182 $(QUIET)$(MKDIR) -p $(@D)
2183
2184# HC compiler switch detection.
2185 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_PATH_CC ?= $(which $(TOOL_$(VBOX_GCC_TOOL)_CC))'
2186 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_PATH_CXX ?= $(which $(TOOL_$(VBOX_GCC_TOOL)_CXX))'
2187 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CC))'
2188 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CXX))'
2189 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)'
2190 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-pointer-sign ?= $(call VBOX_GCC_CHECK_CC,-Wno-pointer-sign,)'
2191 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-array_bounds ?= $(call VBOX_GCC_CHECK_CC,-Wno-array-bounds,)'
2192# -Wextra produces additional useful warnings but includes -Wno-missing-field-initializers (too noisy)
2193 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wextra ?= $(call VBOX_GCC_CHECK_CC,-Wextra,)'
2194 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wlogical-op ?= $(call VBOX_GCC_CHECK_CC,-Wlogical-op,)'
2195 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-address ?= $(call VBOX_GCC_CHECK_CXX,-Wno-address,)'
2196 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-delete-non-virtual-dtor ?= $(call VBOX_GCC_CHECK_CXX,-Wno-delete-non-virtual-dtor,)'
2197 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-int-to-pointer-cast ?= $(call VBOX_GCC_CHECK_CC,-Wno-int-to-pointer-cast,)'
2198 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-invalid-offsetof ?= $(call VBOX_GCC_CHECK_CXX,-Wno-invalid-offsetof,)'
2199 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-missing-field-initializers ?= $(call VBOX_GCC_CHECK_CC,-Wno-missing-field-initializers,)'
2200 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-pointer-to-int-cast ?= $(call VBOX_GCC_CHECK_CC,-Wno-pointer-to-int-cast,)'
2201 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-variadic-macros ?= $(call VBOX_GCC_CHECK_CXX,-Wno-variadic-macros,)'
2202 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-vla ?= $(call VBOX_GCC_CHECK_CXX,-Wno-vla,)'
2203 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_fno-stack-protector ?= $(call VBOX_GCC_CHECK_CC,-fno-stack-protector,)'
2204 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_fno-dwarf2-cfi-asm ?= $(call VBOX_GCC_CHECK_CC,-fno-dwarf2-cfi-asm,)'
2205 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_fdiagnostics-show-option ?= $(call VBOX_GCC_CHECK_CC,-fdiagnostics-show-option,)'
2206# Produce code optimized for the most common IA32/AMD64/EM64T processors. Introduced with gcc version 4.2.
2207 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_mtune-generic ?= $(call VBOX_GCC_CHECK_CC,-mtune=generic,)'
2208 $(QUIET)$(APPEND) '$@' 'VBOX_LD_as_needed ?= $(call VBOX_GCC_CHECK_LD,--as-needed,)'
2209# gcc version < 3.4 has a bug in handling __attribute__((regparm(3))).
2210# See http://osdir.com/ml/gcc.prs/2002-08/msg00223.html and probably http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20004
2211 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_BUGGY_REGPARM ?= $$(int-lt $$(VBOX_GCC_VERSION_CC),30400)'
2212# Set default attribute for ELF and MACH-O symbols to ``hidden'' to reduce the number
2213# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
2214 $(QUIET)$(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CC),)'
2215 $(QUIET)$(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CC),40000),)'
2216 $(QUIET)$(APPEND) '$@' ' VBOX_GCC_fvisibility-hidden ?= $(call VBOX_GCC_CHECK_CC,-fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN -DRT_USE_VISIBILITY_DEFAULT,)'
2217 $(QUIET)$(APPEND) '$@' ' endif'
2218 $(QUIET)$(APPEND) '$@' 'endif'
2219ifn1of ($(KBUILD_TARGET),haiku)
2220# Set default attribute for inline functions to ``hidden'' to reduce the number
2221# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
2222 $(QUIET)$(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CXX),)'
2223 $(QUIET)$(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CXX),40000),)'
2224 $(QUIET)$(APPEND) '$@' ' VBOX_GCC_fvisibility-inlines-hidden ?= $(call VBOX_GCC_CHECK_CXX,-fvisibility-inlines-hidden,)'
2225 $(QUIET)$(APPEND) '$@' ' endif'
2226 $(QUIET)$(APPEND) '$@' 'endif'
2227endif
2228# Prevent warnings about unused parameters as of gcc-4.8 as this warning is now very verbose
2229 $(QUIET)$(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CXX),)'
2230 $(QUIET)$(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CXX),40800),)'
2231 $(QUIET)$(APPEND) '$@' ' VBOX_GCC_Wno-unused-parameter ?= -Wno-unused-parameter'
2232 $(QUIET)$(APPEND) '$@' ' endif'
2233 $(QUIET)$(APPEND) '$@' 'endif'
2234ifeq ($(KBUILD_TARGET),solaris)
2235 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_msave-args ?= $(call VBOX_GCC_CHECK_CXX,-msave-args,)'
2236# Detect the solaris assembler. It is used by the the 4.x gcc compilers,
2237# apparently. It will not be able to handle IEMAll via a -pipe, only when
2238# passed a file. The solaris assmbler rulez ... not!
2239 $(QUIET)$(APPEND) '$@' 'VBOX_AS_VERSION ?= $(shell `gcc -print-prog-name=as` -V -o /dev/null < /dev/null 2>&1 | kmk_sed -e '1!d' -e 's/^as: *//' )'
2240 $(QUIET)$(APPEND) '$@' 'if $$(pos Sun Compiler Common,$$(VBOX_AS_VERSION)) > 0'
2241 $(QUIET)$(APPEND) '$@' ' VBOX_GCC_USING_SOLARIS_AS=1'
2242 $(QUIET)$(APPEND) '$@' 'endif'
2243 $(QUIET)$(APPEND) '$@' 'ifndef VBOX_GCC_USING_SOLARIS_AS'
2244 $(QUIET)$(APPEND) '$@' ' VBOX_GCC_pipe ?= -pipe'
2245 $(QUIET)$(APPEND) '$@' 'endif'
2246else
2247 $(QUIET)$(APPEND) '$@' 'VBOX_GCC_pipe ?= -pipe'
2248endif
2249# Find the compiler includes for IPRT no-crt.
2250# Note that `$(dir $(gcc -print-libgcc-file-name))/include does not work for a 64-bit cross build on a 32-bit build host.
2251ifeq ($(KBUILD_HOST),win)
2252# With the cygwin issues and gcc on windows returning a useless path, just skip this on windows.
2253 $(QUIET)$(APPEND) '$@' 'VBOX_PATH_GCC_INCS ?= '
2254else
2255 $(QUIET)$(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'
2256endif
2257# 32-bit (GC) compiler switch detection.
2258 $(QUIET)$(APPEND) '$@' 'VBOX_GCC32_PATH_CC ?= $(which $(TOOL_$(VBOX_GCC32_TOOL)_CC))'
2259 $(QUIET)$(APPEND) '$@' 'VBOX_GCC32_PATH_CXX ?= $(which $(TOOL_$(VBOX_GCC32_TOOL)_CXX))'
2260 $(QUIET)$(APPEND) '$@' 'VBOX_GCC32_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CC))'
2261 $(QUIET)$(APPEND) '$@' 'VBOX_GCC32_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CXX))'
2262 $(QUIET)$(APPEND) '$@' 'VBOX_GCC32_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC32_TOOL)_CC) -print-libgcc-file-name)'
2263 $(QUIET)$(APPEND) '$@' 'VBOX_GCC32_Wno-variadic-macros ?= $(call VBOX_GCC32_CHECK_CXX,-Wno-variadic-macros,)'
2264# darwin no_compact_linkedit starting at Xcode 3.2
2265ifeq ($(KBUILD_HOST),darwin)
2266 $(QUIET)$(APPEND) '$@' 'VBOX_LD_no_compact_linkedit ?= $(call VBOX_GCC_CHECK_LD,-no_compact_linkedit,)'
2267endif
2268 $(QUIET)$(ECHO) '========= START OF $@ ========='
2269 $(QUIET)$(CAT) $@
2270 $(QUIET)$(ECHO) '=========== END OF $@ ========='
2271
2272include $(PATH_OUT)/GCCConfig.kmk
2273endif # !VBOX_NOINC_GCC_CONFIG_KMK
2274
2275#
2276# Warnings as errors.
2277#
2278# GCC: We disable warnings on non-X86 systems because of the variadic
2279# macro usage in the logger.
2280#
2281ifdef VBOX_WITH_WARNINGS_AS_ERRORS
2282 if $(VBOX_GCC_VERSION_CXX) >= 40000
2283 VBOX_GCC_WERR ?= -Werror
2284 endif
2285 VBOX_VCC_WERR ?= -WX
2286 VBOX_VCC_LD_WERR ?= ## @todo later also: -WX
2287endif
2288
2289
2290#
2291# Misc macros.
2292#
2293
2294##
2295# Edits VirtualBox version, vendor and package strings in a text file.
2296#
2297# The rule using this must list $(VBOX_SVN_REV_KMK) as a prerequisite.
2298#
2299# @param 1 The input filename.
2300# @param 2 The output filename.
2301#
2302VBOX_EDIT_VERSION_CMD_FN = $(SED) \
2303 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
2304 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
2305 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
2306 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
2307 -e 's/@VBOX_SVN_REV@/$(VBOX_SVN_REV)/g' \
2308 -e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
2309 -e 's/@VBOX_VENDOR_SHORT@/$(VBOX_VENDOR_SHORT)/g' \
2310 -e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
2311 -e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
2312 -e 's/@VBOX_PACKAGE_STRING@/$(VBOX_PACKAGE_STRING)/g' \
2313 --output $(2) $(1)
2314
2315##
2316# Generates a rule for editing a file using VBOX_EDIT_VERSION_CMD_FN.
2317#
2318# @param 1 The target name.
2319# @param 2 The input filename relative to the current sub-makefile.
2320# @param 3 The output filename relative to the target output dir.
2321# Optional, defaults to 2.
2322#
2323VBOX_EDIT_VERSION_RULE_FN = $(eval $(value VBOX_EDIT_VERSION_RULE_DEF))
2324define VBOX_EDIT_VERSION_RULE_DEF
2325$$($(1)_0_OUTDIR)/$(if $(3),$(3),$(2)): $(PATH_SUB_CURRENT)/$(2) $(VBOX_SVN_REV_KMK) | $$(dir $$@)
2326 $(call MSG_GENERATE,$(1),$@,$<)
2327 $(QUIET)$(call VBOX_EDIT_VERSION_CMD_FN,$<,$@)
2328endef
2329
2330
2331##
2332# Fill in am import library target based on a somewhat special windows .def file.
2333#
2334# @param 1 The target name of the import library.
2335# @param 2 The name of the real library.
2336# @param 3 The .def-file paths relative to the current makefile.
2337#
2338VBOX_GENERATE_IMPORT_TARGET_FN = $(eval $(VBOX_GENERATE_IMPORT_TARGET_DEF))
2339define VBOX_GENERATE_IMPORT_TARGET_DEF
2340$(1)_TEMPLATE = VBoxR3Dll
2341$(1)_INST = $(INST_LIB)
2342if $(KBUILD_TARGET) == "darwin"
2343 $(1)_LDFLAGS = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/$(2)$(SUFF_DLL)
2344else ifn1of ($(KBUILD_TARGET), os2 win)
2345 $(1)_SONAME = $(2)$(SUFF_DLL)
2346endif
2347if1of ($(KBUILD_TARGET), os2 win)
2348 $(1)_SOURCES = $$($(1)_0_OUTDIR)/$(1)Imp.def
2349 $(1)_CLEAN = $$($(1)_0_OUTDIR)/$(1)Imp.def
2350else
2351 $(1)_SOURCES = $$($(1)_0_OUTDIR)/$(1)Imp.c
2352 $(1)_CLEAN = $$($(1)_0_OUTDIR)/$(1)Imp.c
2353endif
2354
2355$$$$($(1)_SOURCES): $(addprefix $(PATH_SUB_CURRENT)/,$(3)) $(PATH_ROOT)/src/bldprogs/deftoimp.sed | $$$$(dir $$$$@)
2356 $$(call MSG_GENERATE,,$$@)
2357ifeq ($(KBUILD_TARGET),os2)
2358 $$(SED) \
2359 -e '/not-$(KBUILD_TARGET)/d' \
2360 -e '/not-$(KBUILD_TARGET_ARCH)/d' \
2361 -e 's/^LIBRARY[[:space:]][[:space:]]*\(.*\)\.dll/LIBRARY \1 INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
2362 -e 's/^[ \t][ \t]*\([_a-zA-Z]\)/ _\1/' \
2363 -e 's/[ \t]DATA[ \t]*/ /' \
2364 --output $$@ $(addprefix $(PATH_SUB_CURRENT)/,$(3))
2365else ifeq ($(KBUILD_TARGET),win)
2366 $$(SED) \
2367 -e '/not-$(KBUILD_TARGET)/d' \
2368 -e '/not-$(KBUILD_TARGET_ARCH)/d' \
2369 --output $$@ $(addprefix $(PATH_SUB_CURRENT)/,$(3))
2370else
2371 $$(QUIET)$$(APPEND) -tn $$@ \
2372 '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN' \
2373 '# define EXPORT __attribute__((visibility("default")))' \
2374 '# define EXPORT_DATA __attribute__((visibility("default")))' \
2375 '#else' \
2376 '# define EXPORT' \
2377 '# define EXPORT_DATA' \
2378 '#endif' \
2379 ''
2380 $$(SED) \
2381 -e '/not-$(KBUILD_TARGET)/d' \
2382 -e '/not-$(KBUILD_TARGET_ARCH)/d' \
2383 -f $(PATH_ROOT)/src/bldprogs/deftoimp.sed \
2384 --append $$@ $(addprefix $(PATH_SUB_CURRENT)/,$(3))
2385endif
2386endef # VBOX_GENERATE_IMPORT_TARGET_DEF
2387
2388
2389#
2390# Code Signing.
2391#
2392ifdef VBOX_SIGNING_MODE
2393 ifeq ($(KBUILD_HOST),win)
2394 #
2395 # Windows
2396 #
2397
2398 # VBOX_PATH_SELFSIGN points to the Vista WDK bin/SelfSign directory.
2399 ifndef VBOX_PATH_SELFSIGN
2400 VBOX_PATH_SELFSIGN := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS)/win.x86/selfsign/*)))
2401 ifeq ($(VBOX_PATH_SELFSIGN),)
2402 VBOX_PATH_SELFSIGN := $(PATH_DEVTOOLS)/win.x86/selfsign/r1
2403 endif
2404 endif
2405 VBOX_SIGNTOOL ?= $(PATH_DEVTOOLS)/bin/retry.cmd $(VBOX_PATH_SELFSIGN)/SignTool.exe
2406 VBOX_INF2CAT ?= $(VBOX_PATH_SELFSIGN)/Inf2Cat.exe
2407
2408 # There are three signing modes; 'test', 'development' and 'release'.
2409 ifeq ($(strip $(VBOX_SIGNING_MODE)),test)
2410 VBOX_CERTIFICATE_SUBJECT_NAME ?= MyTestCertificate
2411 VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
2412 else if1of ($(VBOX_SIGNING_MODE), release development)
2413 VBOX_CERTIFICATE_SUBJECT_NAME ?= Oracle Corporation
2414 VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
2415 VBOX_CROSS_CERTIFICATE_FILE ?= $(VBOX_PATH_SELFSIGN)/MSCV-VSClass3.cer
2416 VBOX_CROSS_CERTIFICATE_FILE_ARGS ?= /ac "$(VBOX_CROSS_CERTIFICATE_FILE)"
2417 VBOX_TSA_URL ?= http://timestamp.verisign.com/scripts/timestamp.dll
2418 VBOX_TSA_URL_ARGS ?= /t "$(VBOX_TSA_URL)"
2419 else
2420 $(error VBox: Unknown VBOX_SIGNING_MODE: $(VBOX_SIGNING_MODE))
2421 endif
2422 VBOX_CERTIFICATE_STORE ?= my
2423 VBOX_CERTIFICATE_STORE_ARGS ?= /s "$(VBOX_CERTIFICATE_STORE)"
2424
2425 ## Commands for signing a driver image after link.
2426 VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_FILE_FN,$(out)))
2427 ## Sign a file.
2428 # @param 1 The file to sign.
2429 # @param 2 File description. Optional.
2430 VBOX_SIGN_FILE_FN ?= $(VBOX_SIGNTOOL) sign \
2431 $(VBOX_CROSS_CERTIFICATE_FILE_ARGS) \
2432 $(VBOX_CERTIFICATE_STORE_ARGS) \
2433 $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
2434 $(VBOX_TSA_URL_ARGS) \
2435 $(if $(strip $(2)),/d "$(strip $(2))",) \
2436 $(1)
2437 ## Create a security catalog file.
2438 # @param 1 The directory containing the stuff to sign.
2439 # @param 2 The expected .cat name. (Inf2Cat lowercases it)
2440 # @param 3 The list of OSes, separated by ';'.
2441 VBOX_MAKE_CAT_HLP_FN ?= \
2442 $(RM) -f $(2)\
2443 $(NL)$(TAB)$(VBOX_INF2CAT) /driver:$(strip $(1)) /os:$(strip $(subst ;,$(COMMA),$(3))) /verbose \
2444 $(NL)$(TAB)$(MV) $(2) $(2) \
2445 $(NL)$(TAB)$(call VBOX_SIGN_FILE_FN,$(2))
2446 VBOX_MAKE_CAT64_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),XP_X64;Server2003_X64;Vista_X64)
2447 VBOX_MAKE_CAT32_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),2000;XP_X86;Server2003_X86;Vista_X86)
2448 ifeq ($(KBUILD_TARGET_ARCH),x86)
2449 VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT32_FN,$(1),$(2))
2450 else
2451 VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT64_FN,$(1),$(2))
2452 endif
2453
2454 # Go nuts, sign everything.
2455 ifeq ($(strip $(VBOX_SIGNING_MODE)),release)
2456 ## Commands for signing an executable or a dll image after link.
2457 VBOX_SIGN_IMAGE_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_FILE_FN,$(out)))
2458 endif
2459 ## Enable signing of the additions.
2460 VBOX_SIGN_ADDITIONS ?= 1
2461
2462 else ifeq ($(KBUILD_HOST),darwin)
2463 #
2464 # Darwin code signing.
2465 #
2466 # Currently release signing is done when packing. This may change later.
2467 # (Installer package signing is done elsewhere (VBOX_MACOSX_INSTALLER_SIGN).)
2468 #
2469 ifeq ($(strip $(VBOX_SIGNING_MODE)),test)
2470 VBOX_CERTIFICATE_SUBJECT_NAME ?= $(error You, need to set VBOX_CERTIFICATE_SUBJECT_NAME in LocalConfig.kmk.)
2471 VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= --sign "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
2472 else if1of ($(VBOX_SIGNING_MODE), release development)
2473 VBOX_CERTIFICATE_SUBJECT_NAME ?= Developer ID Application: Oracle America, Inc.
2474 VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= --sign "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
2475 else
2476 $(error VBox: Unknown VBOX_SIGNING_MODE: $(VBOX_SIGNING_MODE))
2477 endif
2478
2479 VBOX_CODESIGN ?= codesign
2480 ## Sign an application bundle, framework or kernel extension.
2481 # @param 1 The bundle to sign.
2482 # @param 2 Identifier, optional.
2483 VBOX_SIGN_BUNDLE_FN = $(VBOX_CODESIGN) \
2484 --verbose=9 \
2485 --force \
2486 --file-list - \
2487 $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
2488 $(1) $(if $(2),--identifier "$(2)",)
2489
2490 ## Sign a Mach-O image.
2491 # @param 1 The bundle to sign.
2492 # @param 2 Identifier, optional.
2493 VBOX_SIGN_MACHO_FN = $(VBOX_CODESIGN) \
2494 --verbose=9 \
2495 --force \
2496 --file-list - \
2497 $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
2498 $(1) \
2499 $(if $(2),--identifier "$(2)",)
2500
2501 ## Sign a VMM Mach-O image.
2502 # @param 1 The bundle to sign.
2503 # @param 2 Identifier, optional.
2504 VBOX_SIGN_VMM_MOD_FN = $(VBOX_CODESIGN) \
2505 --verbose=9 \
2506 --force \
2507 --file-list - \
2508 $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
2509 $(1) -D $(1).codesign \
2510 $(if $(2),--identifier "$(2)",)
2511
2512 else
2513 # Not Windows or mac os x build host, ignore.
2514 VBOX_SIGNING_MODE :=
2515 endif
2516endif
2517
2518#
2519# Windows .inf editing.
2520#
2521ifeq ($(KBUILD_TARGET_ARCH),x86)
2522 VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF32_FN,$(1),$(2))
2523else
2524 VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF64_FN,$(1),$(2))
2525endif
2526## Edit an inf file an x86 target.
2527# @param 1 The inf file to edit.
2528# @param 2 The output file.
2529VBOX_EDIT_INF32_FN = $(SED) $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d') \
2530 -e 's/^;x86 *//' \
2531 -e '/^;amd64 /d' \
2532 -e 's/^;edit-DriverVer.*/DriverVer = $(date-utc %m\/%d\/%Y),$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)/' \
2533 --output $(2) \
2534 $(1)
2535## Edit an inf file an x86 target.
2536# @param 1 The inf file to edit.
2537# @param 2 The output file.
2538VBOX_EDIT_INF64_FN = $(SED) \
2539 $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d')\
2540 -e 's/^;amd64 *//' \
2541 -e '/^;x86 /d' \
2542 -e 's/^;edit-DriverVer.*/DriverVer = $(date-utc %m\/%d\/%Y),$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)/' \
2543 --output $(2) \
2544 $(1)
2545
2546#
2547# Adjust kBuild defaults.
2548#
2549kBuildGlobalDefaults_DEBUG_NOSTAGE.win = true
2550kBuildGlobalDefaults_DEBUG_NOSTAGE.os2 = true
2551if1of ($(KBUILD_TARGET), darwin win)
2552 kBuildGlobalDefaults_LD_DEBUG = split
2553endif
2554
2555
2556#
2557# Haiku resource and version generation.
2558#
2559ifeq ($(KBUILD_HOST),haiku)
2560 VBOX_HAIKU_RCTOOL := rc
2561 VBOX_HAIKU_XRESTOOL := xres
2562 VBOX_HAIKU_SETVERSIONTOOL := setversion
2563 # XXX: install won't preserve attributes...
2564 VBOX_HAIKU_MIMESETTOOL := mimeset
2565
2566 ## Add optional resources to the program, set its version info, and sniff its mime properties.
2567 # @param 1 The file to add resources to.
2568 # @param 2 The resource files.
2569 # @param 3 The target name.
2570define VBOX_HAIKU_XRES_SETVER_FN
2571 $(if $(2),$(call MSG_TOOL,HaikuAddResources,$(3),$(2))
2572 $(QUIET)$(VBOX_HAIKU_XRESTOOL) -o $(1) $(2),)
2573 $(call MSG_TOOL,HaikuSetVersion,$(3))
2574 $(QUIET)$(VBOX_HAIKU_SETVERSIONTOOL) $(1) \
2575 -app $(VBOX_VERSION_MAJOR) $(VBOX_VERSION_MINOR) $(VBOX_VERSION_BUILD) d $(VBOX_SVN_REV) \
2576 -short "$(VBOX_PRODUCT)" \
2577 -long "$(VBOX_PRODUCT) $(VBOX_VERSION_STRING) $(shell /bin/echo -e '\xC2\xA9')2009-$(VBOX_C_YEAR) $(VBOX_VENDOR)"
2578 $(call MSG_TOOL,HaikuMimeSet,$(3))
2579 $(QUIET)$(VBOX_HAIKU_MIMESETTOOL) -f $(1)
2580endef
2581
2582 VBOX_HAIKU_XRES_SETVER_CMDS ?= $(if $(eq $(tool_do),LINK_PROGRAM),$(call VBOX_HAIKU_XRES_SETVER_FN,$(out),$($(target)_RSRCS),$(target)),)
2583endif
2584
2585#
2586# Default prefixes and suffixes.
2587#
2588VBOX_PREF_LIB =
2589if1of ($(KBUILD_TARGET), os2 win)
2590VBOX_SUFF_LIB = .lib
2591else
2592VBOX_SUFF_LIB = .a
2593endif
2594VBOX_SUFF_DLL = $(SUFF_DLL)
2595ifeq ($(KBUILD_TARGET),os2) # GXX3OMF produces out .o at the moment.
2596VBOX_SUFF_OBJ = .o
2597else
2598VBOX_SUFF_OBJ = $(SUFF_OBJ)
2599endif
2600VBOXW32GUEST_SUFF_LIB = .lib
2601VBOXLNX32GUEST_SUFF_LIB = .a
2602
2603#
2604# SDKs for external libraries.
2605#
2606SDK_VBOX_LIBXML2 = .
2607SDK_VBOX_LIBXML2_INCS ?= $(PATH_ROOT)/src/libs/libxml2-2.6.31/include
2608SDK_VBOX_LIBXML2_DEFS ?= _REENTRANT
2609SDK_VBOX_LIBXML2_DEFS.win += WIN32 _WINDOWS _MBCS
2610# note: no linking to LIB here, we do that explicitly in src/VBox/Runtime/Makefile.kmk to link
2611# libxml against VBoxRT
2612
2613SDK_VBOX_LIBPNG = .
2614SDK_VBOX_LIBPNG_INCS ?= $(PATH_ROOT)/src/libs/libpng-1.2.8
2615SDK_VBOX_LIBPNG_LIBS ?= $(PATH_STAGE_LIB)/VBox-libpng$(VBOX_SUFF_LIB)
2616
2617SDK_VBOX_ZLIB = .
2618if1of ($(KBUILD_TARGET), os2 solaris win)
2619 SDK_VBOX_ZLIB_INCS ?= $(PATH_ROOT)/src/libs/zlib-1.2.6
2620 SDK_VBOX_ZLIB_LIBS ?= $(PATH_STAGE_LIB)/VBox-zlib$(VBOX_SUFF_LIB)
2621else
2622 SDK_VBOX_ZLIB_INCS ?=
2623 SDK_VBOX_ZLIB_LIBS ?= z
2624 SDK_VBOX_ZLIB_DEFS.linux ?= _LARGEFILE64_SOURCE
2625endif
2626
2627SDK_VBOX_ZLIB_STATIC = .
2628SDK_VBOX_ZLIB_STATIC_EXTENDS ?= VBOX_ZLIB
2629if1of ($(KBUILD_TARGET), os2 win) # Not required on solaris.
2630 SDK_VBOX_ZLIB_STATIC_LIBS ?= $(PATH_STAGE_LIB)/VBox-zlib-static$(VBOX_SUFF_LIB)
2631endif
2632
2633SDK_VBOX_OPENSSL = Only for VBoxRT and/or statically linked programs.
2634SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS := $(PATH_OUT)/obj/crypto-headers/include
2635SDK_VBOX_OPENSSL_INCS ?= $(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)
2636SDK_VBOX_OPENSSL_ORDERDEPS ?= $(crypto-headers_1_TARGET)
2637SDK_VBOX_OPENSSL_LIBS ?= \
2638 $(PATH_STAGE_LIB)/VBox-libssl$(VBOX_SUFF_LIB) \
2639 $(PATH_STAGE_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB)
2640
2641SDK_VBOX_OPENSSL2 = What you should be using.
2642SDK_VBOX_OPENSSL2_EXTENDS = VBOX_OPENSSL
2643if "$(SDK_VBOX_OPENSSL_INCS)" == "$(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)"
2644 SDK_VBOX_OPENSSL2_LIBS = $(NO_SUCH_VARIABLE)
2645endif
2646
2647SDK_VBoxOpenSslExtPack = Internal use only.
2648SDK_VBoxOpenSslExtPack_INCS = $(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)
2649SDK_VBoxOpenSslExtPack_ORDERDEPS = $(crypto-headers_1_TARGET)
2650SDK_VBoxOpenSslExtPack_LIBS = \
2651 $(PATH_STAGE_LIB)/VBoxExtPack-libssl$(VBOX_SUFF_LIB) \
2652 $(PATH_STAGE_LIB)/VBoxExtPack-libcrypto$(VBOX_SUFF_LIB)
2653
2654SDK_VBOX_BLD_OPENSSL = .
2655SDK_VBOX_BLD_OPENSSL_EXTENDS = VBOX_OPENSSL
2656SDK_VBOX_BLD_OPENSSL_LIBS ?= \
2657 $(PATH_STAGE_LIB)/VBoxBldProg-libcrypto$(VBOX_SUFF_LIB)
2658SDK_VBOX_BLD_OPENSSL_LIBS.linux ?= \
2659 crypt
2660
2661ifdef VBOX_WITH_S3
2662VBOX_WITH_LIBCURL = 1
2663SDK_VBOX_LIBCURL = .
2664SDK_VBOX_LIBCURL_INCS ?= $(PATH_ROOT)/src/libs/curl-7.27.0/include
2665SDK_VBOX_LIBCURL_LIBS ?= $(PATH_STAGE_LIB)/VBox-libcurl$(VBOX_SUFF_LIB)
2666SDK_VBOX_LIBCURL_DEFS ?= BUILDING_LIBCURL
2667endif
2668
2669SDK_VBOX_VPX = .
2670SDK_VBOX_VPX_DEFAULT_INCS := $(PATH_ROOT)/src/libs/libvpx
2671SDK_VBOX_VPX_INCS ?= $(SDK_VBOX_VPX_DEFAULT_INCS)
2672SDK_VBOX_VPX_LIBS ?= $(PATH_STAGE_LIB)/VBox-libvpx$(VBOX_SUFF_LIB)
2673
2674SDK_VBOX_BOOST = .
2675SDK_VBOX_BOOST_DEFS ?= BOOST_DISABLE_ASSERTS
2676SDK_VBOX_BOOST_INCS ?= $(PATH_ROOT)/src/libs/boost-1.37.0
2677
2678#
2679# Special SDK for the problematic NTDLL.LIB.
2680#
2681SDK_VBOX_NTDLL = Mini NTDLL import library, required IPRT.
2682SDK_VBOX_NTDLL_LIBS.x86 ?= $(PATH_STAGE_LIB)/RuntimeR3NtDll-x86.lib
2683SDK_VBOX_NTDLL_LIBS.amd64 ?= $(PATH_STAGE_LIB)/RuntimeR3NtDll-amd64.lib
2684
2685#
2686# The linux kernel headers(/sources).
2687#
2688if1of ($(KBUILD_TARGET), linux)
2689 ifeq ($(origin VBOX_LINUX_SRC),undefined)
2690 ifneq ($(wildcard /lib/modules/$(shell uname -r)/build/include/linux/autoconf.h /lib/modules/$(shell uname -r)/build/include/generated/autoconf.h),)
2691 export VBOX_LINUX_SRC := /lib/modules/$(shell uname -r)/build
2692 else
2693 export VBOX_LINUX_SRC := /usr/src/linux
2694 endif
2695 endif
2696 ifneq ($(VBOX_LINUX_SRC),)
2697 ifeq ($(origin VBOX_LINUX_INCS),undefined)
2698 export VBOX_LINUX_INCS := $(VBOX_LINUX_SRC)/include
2699 # XXX hack alert! Support split Linux kernels (make O=<build directory>). kernelpath points to
2700 # the obj directory while VBOX_LINUX_SRC points to the virgin source directory.
2701 # XXX put this crap elsewhere
2702 kernelpath := $(shell $(SED_EXT) -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(VBOX_LINUX_SRC)/Makefile)
2703 ifeq ($(kernelpath),)
2704 # Linux >= 2.6.25
2705 kernelpath := $(shell $(SED_EXT) -ne 's+^MAKEARGS *:= *-C *\(\S*\).*+\1+p' $(VBOX_LINUX_SRC)/Makefile)
2706 endif
2707 ifneq ($(kernelpath),)
2708 # absolute path?
2709 ifneq ($(patsubst /%,,$(kernelpath)),)
2710 # no, relative path
2711 kernelpath := $(realpath $(VBOX_LINUX_SRC)/$(kernelpath))
2712 endif
2713 endif
2714 ifneq ($(kernelpath),)
2715 VBOX_LINUX_INCS += $(VBOX_LINUX_SRC)/include2 $(kernelpath)/include
2716 else
2717 kernelpath := $(VBOX_LINUX_SRC)
2718 endif
2719 #
2720 VBOX_LINUX_INCS += $(kernelpath)/include/asm-i386/mach-default \
2721 $(kernelpath)/include/asm-x86/mach-default \
2722 $(kernelpath)/arch/x86/include \
2723 $(kernelpath)/arch/x86/include/asm/mach-default \
2724 $(kernelpath)/arch/x86/include/uapi \
2725 $(VBOX_LINUX_SRC)/arch/x86/include/generated \
2726 $(VBOX_LINUX_SRC)/arch/x86/include/generated/uapi \
2727 $(kernelpath)/include/uapi \
2728 $(VBOX_LINUX_SRC)/include/generated/uapi \
2729 $(kernelpath)/include
2730 endif
2731 endif
2732 # Since Linux 2.6.15, <linux/autoconf.h> is included like this. It cannot hurt to do the
2733 # same for older Linux kernels
2734 ifneq ($(wildcard $(kernelpath)/include/linux/kconfig.h),)
2735 # Linux >= 3.1
2736 export VBOX_LINUX_INCLUDE := -include $(kernelpath)/include/linux/kconfig.h
2737 else ifneq ($(wildcard $(VBOX_LINUX_SRC)/include/generated/autoconf.h),)
2738 # Linux >= 2.6.33
2739 export VBOX_LINUX_INCLUDE := -include $(VBOX_LINUX_SRC)/include/generated/autoconf.h
2740 else ifneq ($(wildcard $(VBOX_LINUX_SRC)/include/linux/autoconf.h),)
2741 # Linux < 2.6.33
2742 export VBOX_LINUX_INCLUDE := -include $(VBOX_LINUX_SRC)/include/linux/autoconf.h
2743 endif
2744endif
2745
2746#
2747# Determine Solaris version.
2748#
2749ifeq ($(KBUILD_TARGET),solaris)
2750 ifeq ($(origin VBOX_SOLARIS_VERSION),undefined)
2751 $(eval export VBOX_SOLARIS_VERSION := $(shell uname -r | $(SED_EXT) 's|\([0-9]*\)\.\([0-9]*\)|$$(int-add $$(int-mul 100, \1), \2)|' ))
2752 endif
2753 ifeq ($(VBOX_SOLARIS_VERSION),510)
2754 DEFS.solaris += RT_OS_SOLARIS_10
2755 # Solaris 10 does not include crossbow.
2756 VBOX_SOLARIS_10 = 1
2757 # We cannot compile additions on Solaris 10, due kernel interface deps
2758 VBOX_WITHOUT_ADDITIONS := 1
2759 VBOX_WITH_ADDITIONS =
2760 else ifeq ($(VBOX_SOLARIS_VERSION),511)
2761 # uname -v can report "snv_XYZ" or "11.X"
2762 VBOX_SOLARIS_11_VERSION = $(shell uname -v | sed 's/snv_//' | cut -f1 -d'.')
2763 ifeq ($(VBOX_SOLARIS_11_VERSION),11)
2764 VBOX_SOLARIS_11_FULLVERSION = $(shell pkg contents -H -t set -o pkg.fmri entire | $(SED_EXT) -e '1!d' -e 's/^.*\@//;s/\:.*//;s/.*,//')
2765 # FULLVERSION format e.g. "5.11-0.175.1.0.0.16.0", we're interested in 175 (VERSION), 1 (UPDATE), 16 (BUILD).
2766 VBOX_SOLARIS_11_VERSION = $(word 2, $(subst ., ,$(word 2,$(subst -, ,$(VBOX_SOLARIS_11_FULLVERSION)))))
2767 VBOX_SOLARIS_11_UPDATE_VERSION = $(word 3, $(subst ., ,$(word 2,$(subst -, ,$(VBOX_SOLARIS_11_FULLVERSION)))))
2768 VBOX_SOLARIS_11_BUILD_VERSION = $(word 6, $(subst ., ,$(word 2,$(subst -, ,$(VBOX_SOLARIS_11_FULLVERSION)))))
2769 endif
2770
2771 # OSS audio support for Solaris
2772 VBOX_WITH_SOLARIS_OSS := $(if-expr $(VBOX_SOLARIS_11_VERSION) >= 115,1,)
2773 endif
2774endif
2775
2776#
2777# VBoxTpG tool.
2778#
2779TOOL_VBoxTpG = The VirtualBox Tracepoint Generator
2780TOOL_VBoxTpG_DTRACE_DEPORD = $(VBOX_VBOXTPG)
2781TOOL_VBoxTpG_DTRACE_HDR_FLAGS := \
2782 $(if-expr $(intersects $(KBUILD_TARGET_ARCH),$(KBUILD_ARCHES_64)),-64,-32) \
2783 -h --host-$(VBOX_HC_ARCH_BITS)-bit #-vvv
2784define TOOL_VBoxTpG_DTRACE_HDR_CMDS
2785 $(QUIET)$(VBOX_VBOXTPG) $(flags) -o "$(out)" -s "$(source)"
2786endef
2787TOOL_VBoxTpG_DTRACE_OBJ_NOT_NEEDED :=
2788TOOL_VBoxTpG_DTRACE_OBJ_FLAGS := -G --host-$(VBOX_HC_ARCH_BITS)-bit #-vvv
2789define TOOL_VBoxTpG_DTRACE_OBJ_CMDS
2790 $(QUIET)$(VBOX_VBOXTPG) \
2791 $(if-expr $(intersects $(bld_trg_arch),$(KBUILD_ARCHES_64)),-64,-32) \
2792 $(flags) \
2793 -o "$(out)" -s "$(source)"
2794endef
2795
2796
2797#
2798# VBoxTpG tool - Disabled, only generate the header.
2799#
2800TOOL_VBoxTpG-Disabled = The VirtualBox Tracepoint Generator, disabled.
2801TOOL_VBoxTpG-Disabled_DTRACE_DEPORD = $(VBOX_VBOXTPG)
2802TOOL_VBoxTpG-Disabled_DTRACE_HDR_FLAGS := -h
2803define TOOL_VBoxTpG-Disabled_DTRACE_HDR_CMDS
2804 $(QUIET)$(VBOX_VBOXTPG) $(flags) -o "$(out)" -s "$(source)"
2805endef
2806TOOL_VBoxTpG-Disabled_DTRACE_OBJ_NOT_NEEDED := $(KBUILD_OSES)
2807
2808
2809#
2810# dtrace+VBoxTpG tool for ring-3 to ring-0 pointer conversion.
2811#
2812TOOL_DTraceAndVBoxTpG = DTrace and the VirtualBox Tracepoint Generator working together on static ring-3 probes.
2813TOOL_DTraceAndVBoxTpG_EXTENDS = StandardDTrace
2814TOOL_DTraceAndVBoxTpG_DTRACE_DEPORD = $(VBOX_VBOXTPG)
2815TOOL_DTraceAndVBoxTpG_DTRACE_HDR_CMDS =
2816define TOOL_DTraceAndVBoxTpG_DTRACE_HDR_CMDS
2817 $(TOOL_StandardDTrace_DTRACE_HDR_CMDS)
2818 $(QUIET)$(VBOX_VBOXTPG) --generate-wrapper-header --host-$(VBOX_HC_ARCH_BITS)-bit --ring-3-context \
2819 $(filter-out -C, $(filter-out -h,$(flags))) \
2820 -o "$(out).tmp" -s "$(source)"
2821 $(APPEND) "$(out).tmp"
2822 $(SED) -e 's/\(#define.*\)(arg0/\1_ORIGINAL(arg0/' --append "$(out).tmp" "$(out)"
2823 $(MV) -f -- "$(out).tmp" "$(out)"
2824endef
2825TOOL_DTraceAndVBoxTpG_DTRACE_OBJ_NOT_NEEDED = $(TOOL_StandardDTrace_DTRACE_OBJ_NOT_NEEDED)
2826TOOL_DTraceAndVBoxTpG_DTRACE_OBJ_CMDS = $(TOOL_StandardDTrace_DTRACE_OBJ_CMDS)
2827
2828
2829ifdef VBOX_WITH_RAW_MODE
2830 #
2831 # Template for building RC things.
2832 #
2833 TEMPLATE_VBoxRc = VBox Raw-Mode Context
2834 TEMPLATE_VBoxRc_ASTOOL = $(VBOX_ASTOOL)
2835 TEMPLATE_VBoxRc_ASFLAGS = $(VBOX_ASFLAGS32)
2836 TEMPLATE_VBoxRc_DEFS = IN_RC IPRT_NO_CRT RT_WITH_NOCRT_ALIASES $(ARCH_BITS_DEFS)
2837 TEMPLATE_VBoxRc_INCS = $(PATH_ROOT)/include/iprt/nocrt
2838 TEMPLATE_VBoxRc_SYSSUFF = .gc
2839 TEMPLATE_VBoxRc_BLD_TRG_ARCH = x86
2840 TEMPLATE_VBoxRc_MODE = a+r,u+w
2841
2842 TEMPLATE_VBoxRc_USES += dtrace
2843 TEMPLATE_VBoxRc_DTRACE_HDR_FLAGS = --raw-mode-context
2844 TEMPLATE_VBoxRc_DTRACE_OBJ_FLAGS = --raw-mode-context --probe-fn-name "VMMRCProbeFire"
2845 ifdef VBOX_WITH_DTRACE_RC
2846 TEMPLATE_VBoxRc_DTRACETOOL = VBoxTpG
2847 TEMPLATE_VBoxRc_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_RC
2848 else
2849 TEMPLATE_VBoxRc_DTRACETOOL = VBoxTpG-Disabled
2850 endif
2851
2852 ifeq ($(VBOX_LDR_FMT32),pe)
2853 TEMPLATE_VBoxRc_TOOL = $(VBOX_VCC_TOOL_STEM)X86
2854 ifdef TODO_MORE_WARNINGS
2855 TEMPLATE_VBoxRc_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -GS- -Zc:wchar_t- -Gs8192 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP) -W4 -wd4244 -wd4996 -wd4127 -wd4100 -wd4214 -wd4706 $(VBOX_VCC_WERR)
2856 else
2857 TEMPLATE_VBoxRc_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -GS- -Zc:wchar_t- -Gs8192 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP) -W3 -wd4244 -wd4996 $(VBOX_VCC_WERR)
2858 endif
2859 TEMPLATE_VBoxRc_CFLAGS = $(TEMPLATE_VBoxRc_CXXFLAGS)
2860 TEMPLATE_VBoxRc_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Exports -NoD $(VBOX_VCC_LD_WERR) -Debug
2861 TEMPLATE_VBoxRc_LIBS = \
2862 $(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/int64.lib
2863 TEMPLATE_VBoxRc_LIBS += \
2864 $(PATH_STAGE_LIB)/RuntimeRCStub$(VBOX_SUFF_LIB)
2865 TEMPLATE_VBoxRc_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2866 endif # pe
2867
2868 ifeq ($(VBOX_LDR_FMT32),elf)
2869 TEMPLATE_VBoxRc_TOOL = $(VBOX_GCC32_TOOL)
2870 TEMPLATE_VBoxRc_CXXFLAGS = -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC32_Wno-variadic-macros) -fno-exceptions $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) -fno-rtti
2871 TEMPLATE_VBoxRc_CFLAGS = -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC32_Wno-variadic-macros) -fno-exceptions $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden)
2872 ifeq ($(KBUILD_TARGET),solaris)
2873 TEMPLATE_VBoxRc_LDFLAGS = -r
2874 else
2875 TEMPLATE_VBoxRc_LDFLAGS = -nostdlib -Bsymbolic -g
2876 ## @todo WTF doesn't the globals work? Debug info is supposed to be split everywhere. GRR
2877 TEMPLATE_VBoxRc_LD_DEBUG = split
2878 endif
2879 ifn1of ($(KBUILD_TARGET), solaris freebsd)
2880 TEMPLATE_VBoxRc_LIBS = \
2881 $(VBOX_GCC32_LIBGCC) # instricts
2882 endif
2883 endif
2884
2885 ifeq ($(VBOX_LDR_FMT32),macho)
2886 TEMPLATE_VBoxRc_TOOL = GXX4MACHO
2887 TEMPLATE_VBoxRc_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
2888 TEMPLATE_VBoxRc_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) -m32 -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC32_Wno-variadic-macros) -fno-common -msoft-float -static $(VBOX_GCC_fno-stack-protector) -fno-exceptions $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing -fno-rtti
2889 TEMPLATE_VBoxRc_CFLAGS = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -m32 -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC32_Wno-variadic-macros) -fno-common -msoft-float -static $(VBOX_GCC_fno-stack-protector) -fno-exceptions $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing
2890 TEMPLATE_VBoxRc_LDFLAGS = $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -m32 -nostdlib
2891 #TEMPLATE_VBoxRc_LDFLAGS.release = -Wl,-S ???
2892 endif
2893
2894 ifeq ($(VBOX_LDR_FMT32),lx)
2895 TEMPLATE_VBoxRc_TOOL = GXX3OMF
2896 TEMPLATE_VBoxRc_CXXFLAGS = -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC32_Wno-variadic-macros) $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing -fno-exceptions -fno-rtti
2897 TEMPLATE_VBoxRc_CFLAGS = -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC32_Wno-variadic-macros) $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing -fno-exceptions
2898 TEMPLATE_VBoxRc_LDFLAGS = -Zdll -nostdlib
2899 TEMPLATE_VBoxRc_LIBS = \
2900 $(VBOX_GCC32_LIBGCC) \
2901 $(VBOX_OBJ_SYS0) \
2902 end
2903 endif
2904
2905
2906 #
2907 # Template for building a RC ring-3 testcase (tstVMStructGC, tstDevStructGC).
2908 #
2909 TEMPLATE_VBoxRcExe = VBox Raw-Mode as ring-3 testcase
2910 TEMPLATE_VBoxRcExe_EXTENDS = VBoxRc
2911 TEMPLATE_VBoxRcExe_DEFS = $(filter-out IPRT_NO_CRT RT_WITH_NOCRT_ALIASES,$(TEMPLATE_VBoxRc_DEFS))
2912 TEMPLATE_VBoxRcExe_INCS = $(NO_SUCH_VARIABLE)
2913 TEMPLATE_VBoxRcExe_MODE = $(NO_SUCH_VARIABLE)
2914
2915 ifeq ($(VBOX_LDR_FMT32),pe)
2916 TEMPLATE_VBoxRcExe_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD -Debug
2917 TEMPLATE_VBoxRcExe_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK)
2918 TEMPLATE_VBoxRcExe_LIBS = \
2919 $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_LIB)/libcmt.lib \
2920 $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_LIB)/oldnames.lib
2921 endif
2922
2923 ifeq ($(VBOX_LDR_FMT32),elf)
2924 TEMPLATE_VBoxRcExe_CFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CFLAGS)) -O0
2925 TEMPLATE_VBoxRcExe_CXXFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CXXFLAGS)) -O0
2926 TEMPLATE_VBoxRcExe_LDFLAGS = -g
2927 TEMPLATE_VBoxRcExe_LDFLAGS.dbgopt = -g
2928 TEMPLATE_VBoxRcExe_LDFLAGS.strict = -g
2929 TEMPLATE_VBoxRcExe_LDFLAGS.release = -g
2930 if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), freebsd.amd64)
2931 # The FreeBSD port of gcc isn't picking up -m32 where it should.
2932 TEMPLATE_VBoxRcExe_DEFS.$(KBUILD_TARGET) = $(TEMPLATE_VBoxRc_DEFS.$(KBUILD_TARGET)) IPRT_DONT_USE_SYSTEM_STDINT_H
2933 TEMPLATE_VBoxRcExe_LDFLAGS.$(KBUILD_TARGET) = /usr/lib32/crt1.o /usr/lib32/crti.o /usr/lib32/crtbegin.o $(TEMPLATE_VBoxRc_LDFLAGS.$(KBUILD_TARGET)) -nostdlib -v
2934 TEMPLATE_VBoxRcExe_LIBPATH.$(KBUILD_TARGET) = /usr/lib32
2935 TEMPLATE_VBoxRcExe_LIBS.$(KBUILD_TARGET) = /usr/lib32/crtend.o /usr/lib32/crtn.o /usr/lib32/libc.so
2936 endif
2937 endif
2938
2939 ifeq ($(VBOX_LDR_FMT32),macho)
2940 TEMPLATE_VBoxRcExe_CFLAGS = $(filter-out -static -nostdinc,$(TEMPLATE_VBoxRc_CFLAGS))
2941 TEMPLATE_VBoxRcExe_CXXFLAGS = $(filter-out -static -nostdinc,$(TEMPLATE_VBoxRc_CXXFLAGS))
2942 TEMPLATE_VBoxRcExe_LDFLAGS = -g -m32
2943 endif
2944
2945 ifeq ($(VBOX_LDR_FMT32),lx)
2946 TEMPLATE_VBoxRcExe_CFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CFLAGS))
2947 TEMPLATE_VBoxRcExe_CXXFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CXXFLAGS))
2948 TEMPLATE_VBoxRcExe_LDFLAGS = -g
2949 TEMPLATE_VBoxRcExe_LIBS = $(NO_SUCH_VARIABLE)
2950 endif
2951endif # VBOX_WITH_RAW_MODE
2952
2953
2954#
2955# Template for building R0 things.
2956#
2957TEMPLATE_VBoxR0 = VBox Ring 0
2958TEMPLATE_VBoxR0_ASTOOL = $(VBOX_ASTOOL)
2959TEMPLATE_VBoxR0_ASFLAGS = $(VBOX_ASFLAGS)
2960TEMPLATE_VBoxR0_DEFS = IN_RING0 IN_RING0_AGNOSTIC IPRT_NO_CRT RT_WITH_NOCRT_ALIASES $(ARCH_BITS_DEFS)
2961TEMPLATE_VBoxR0_INCS = $(PATH_ROOT)/include/iprt/nocrt
2962TEMPLATE_VBoxR0_SYSSUFF = .r0
2963TEMPLATE_VBoxR0_MODE = a+r,u+w
2964
2965TEMPLATE_VBoxR0_USES += dtrace
2966TEMPLATE_VBoxR0_DTRACE_HDR_FLAGS = --ring-0-context-agnostic
2967TEMPLATE_VBoxR0_DTRACE_OBJ_FLAGS = --ring-0-context-agnostic
2968ifdef VBOX_WITH_DTRACE_R0
2969 TEMPLATE_VBoxR0_DTRACETOOL = VBoxTpG
2970 TEMPLATE_VBoxR0_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R0
2971else
2972 TEMPLATE_VBoxR0_DTRACETOOL = VBoxTpG-Disabled
2973endif
2974
2975ifeq ($(VBOX_LDR_FMT),pe)
2976TEMPLATE_VBoxR0_TOOL = $(VBOX_VCC_TOOL)
2977 ifdef TODO_MORE_WARNINGS
2978TEMPLATE_VBoxR0_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -GS- -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP) -W4 -wd4244 -wd4127 -wd4100 -wd4214 -wd4706 -wd4996 $(VBOX_VCC_WERR)
2979 else
2980TEMPLATE_VBoxR0_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -GS- -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP) -W3 -wd4244 -wd4996 $(VBOX_VCC_WERR)
2981 endif
2982TEMPLATE_VBoxR0_CFLAGS = $(TEMPLATE_VBoxR0_CXXFLAGS)
2983TEMPLATE_VBoxR0_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:4096 -MapInfo:Exports -NoD $(VBOX_VCC_LD_WERR) -Debug
2984 ifdef VBOX_WITH_DTRACE_R0
2985TEMPLATE_VBoxR0_LDFLAGS += -Merge:VTGPrLc.Data=VTGPrLc.Begin -Merge:VTGPrLc.End=VTGPrLc.Begin -Merge:VTGPrLc.Begin=VTGObj
2986 endif
2987TEMPLATE_VBoxR0_LIBS = \
2988 $(PATH_STAGE_LIB)/RuntimeR0Stub$(VBOX_SUFF_LIB)
2989 include $(KBUILD_PATH)/sdks/$(VBOX_WINDDK).kmk ## TODO: Add a kBuild feature for loading SDKs.
2990TEMPLATE_VBoxR0_LIBS.x86 = \
2991 $(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/int64.lib
2992TEMPLATE_VBoxR0_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
2993endif # pe
2994
2995ifeq ($(VBOX_LDR_FMT),elf)
2996TEMPLATE_VBoxR0_TOOL = $(VBOX_GCC_TOOL)
2997TEMPLATE_VBoxR0_CFLAGS = -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions $(VBOX_GCC_fno-stack-protector) -fno-common $(VBOX_GCC_fvisibility-hidden) -std=gnu99
2998TEMPLATE_VBoxR0_CXXFLAGS = -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions $(VBOX_GCC_fno-stack-protector) -fno-common $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden) -fno-rtti
2999TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding
3000TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables
3001ifeq ($(KBUILD_TARGET),solaris)
3002 TEMPLATE_VBoxR0_LDFLAGS = -r
3003 TEMPLATE_VBoxR0_LDFLAGS.solaris = -u _init -u _info
3004 TEMPLATE_VBoxR0_LIBS.solaris = \
3005 $(PATH_STAGE_LIB)/RuntimeR0Stub$(VBOX_SUFF_LIB)
3006 ifdef VBOX_GCC_USING_SOLARIS_AS
3007 TEMPLATE_VBoxR0_CFLAGS.amd64 += -Wa,-xmodel=kernel
3008 TEMPLATE_VBoxR0_CXXFLAGS.amd64 += -Wa,-xmodel=kernel
3009 endif
3010else
3011 TEMPLATE_VBoxR0_LDFLAGS = -nostdlib -Bsymbolic -g
3012 ## @todo WTF doesn't the globals work? Debug info is supposed to be split everywhere. GRR
3013 TEMPLATE_VBoxR0_LD_DEBUG = split
3014endif
3015ifn1of ($(KBUILD_TARGET),solaris freebsd)
3016 TEMPLATE_VBoxR0_LIBS = \
3017 $(VBOX_GCC_LIBGCC) # instricts
3018endif
3019endif
3020
3021ifeq ($(VBOX_LDR_FMT),macho)
3022TEMPLATE_VBoxR0_TOOL = GXX4MACHO
3023TEMPLATE_VBoxR0_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
3024TEMPLATE_VBoxR0_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) \
3025 -fno-common -msoft-float -static -fno-rtti -fno-exceptions $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing \
3026 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_fno-stack-protector)
3027TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mno-sse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -fno-unwind-tables
3028TEMPLATE_VBoxR0_CXXFLAGS.x86 = -m32
3029TEMPLATE_VBoxR0_CFLAGS = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) \
3030 -fno-common -msoft-float -static -fno-exceptions $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing \
3031 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_fno-stack-protector)
3032TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -mno-red-zone -mno-sse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -fno-unwind-tables
3033TEMPLATE_VBoxR0_CFLAGS.x86 = -m32
3034TEMPLATE_VBoxR0_LDFLAGS = $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -nostdlib
3035#TEMPLATE_VBoxR0_LDFLAGS.release = -Wl,-S ???
3036TEMPLATE_VBoxR0_LDFLAGS.amd64 = -m64 -static
3037TEMPLATE_VBoxR0_LDFLAGS.x86 = -m32
3038endif
3039
3040ifeq ($(VBOX_LDR_FMT),lx)
3041TEMPLATE_VBoxR0_TOOL = GXX3OMF
3042TEMPLATE_VBoxR0_CFLAGS = -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions -fno-common
3043TEMPLATE_VBoxR0_CXXFLAGS = -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions -fno-common -fno-rtti
3044TEMPLATE_VBoxR0_LDFLAGS = -nostdlib -Zdll
3045TEMPLATE_VBoxR0_LIBS = \
3046 $(VBOX_GCC_LIBGCC) \
3047 $(VBOX_OBJ_SYS0) \
3048 end
3049endif
3050
3051
3052#
3053# Template for building SUPDRV R0 things.
3054#
3055TEMPLATE_VBOXR0DRV = VBox SUPDRV Ring 0
3056TEMPLATE_VBOXR0DRV_ASTOOL = $(VBOX_ASTOOL)
3057TEMPLATE_VBOXR0DRV_ASFLAGS = $(VBOX_ASFLAGS)
3058TEMPLATE_VBOXR0DRV_DEFS = IN_RING0 IN_RT_R0 $(ARCH_BITS_DEFS)
3059TEMPLATE_VBOXR0DRV_USES += dtrace
3060ifdef VBOX_WITH_DTRACE_R0DRV
3061 TEMPLATE_VBOXR0DRV_DTRACETOOL = VBoxTpG
3062 TEMPLATE_VBOXR0DRV_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R0DRV
3063 ifdef VBOX_WITH_NATIVE_DTRACE
3064 TEMPLATE_VBOXR0DRV_DEFS += VBOX_WITH_NATIVE_DTRACE
3065 endif
3066else
3067 TEMPLATE_VBOXR0DRV_DTRACETOOL = VBoxTpG-Disabled
3068endif
3069
3070ifeq ($(KBUILD_TARGET),win)
3071 TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_VCC_TOOL)
3072 TEMPLATE_VBOXR0DRV_RCDEFS = \
3073 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
3074 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
3075 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
3076 VBOX_SVN_REV=\"$(VBOX_SVN_REV)\" \
3077 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
3078 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
3079 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD) \
3080 VBOX_SVN_REV_NR=$(VBOX_SVN_REV)
3081 TEMPLATE_VBOXR0DRV_DEFS.x86 = _X86_
3082 TEMPLATE_VBOXR0DRV_DEFS.x86 += NO_INTERLOCKED_INTRINSICS # Avoids intrisic VC/WDK trouble
3083 TEMPLATE_VBOXR0DRV_DEFS.x86 += WIN9X_COMPAT_SPINLOCK # Avoid multiply defined _KeInitializeSpinLock@4
3084 TEMPLATE_VBOXR0DRV_DEFS.amd64 = _AMD64_
3085 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -Gz -W3 -GS- -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
3086 TEMPLATE_VBOXR0DRV_CFLAGS = $(TEMPLATE_VBOXR0DRV_CXXFLAGS)
3087 TEMPLATE_VBOXR0DRV_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:4096 -MapInfo:Exports -NoD -Debug
3088 ifdef VBOX_WITH_DTRACE_R0DRV
3089 TEMPLATE_VBOXR0DRV_LDFLAGS += -Merge:VTGPrLc.Data=VTGPrLc.Begin -Merge:VTGPrLc.End=VTGPrLc.Begin -Merge:VTGPrLc.Begin=VTGObj
3090 endif
3091 TEMPLATE_VBOXR0DRV_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
3092endif
3093
3094ifeq ($(KBUILD_TARGET),linux)
3095TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
3096TEMPLATE_VBOXR0DRV_INSTTYPE.linux = none
3097TEMPLATE_VBOXR0DRV_DEFS += __KERNEL__ MODULE
3098TEMPLATE_VBOXR0DRV_INCS = $(VBOX_LINUX_INCS)
3099TEMPLATE_VBOXR0DRV_CFLAGS = -nostdinc -iwithprefix include $(VBOX_LINUX_INCLUDE) \
3100 $(VBOX_GCC_WARN) -Wstrict-prototypes $(VBOX_GCC_Wno-pointer-sign) -Wno-sign-compare $(VBOX_GCC_fdiagnostics-show-option) \
3101 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
3102 -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
3103TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mpreferred-stack-boundary=2 -msoft-float
3104TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
3105 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
3106 -Wno-sign-compare -Wdeclaration-after-statement
3107TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign -ffreestanding -Wdeclaration-after-statement -Werror-implicit-function-declaration,$(TEMPLATE_VBOXR0DRV_CFLAGS) $(TEMPLATE_VBOXR0DRV_CFLAGS.$(KBUILD_TARGET_ARCH))) -fno-exceptions -fno-rtti
3108 ifndef VBOX_LINUX_VERSION_2_4
3109# 2.6
3110TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
3111TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
3112TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
3113 else
3114# 2.4
3115TEMPLATE_VBOXR0DRV_SYSSUFF = .o
3116TEMPLATE_VBOXR0DRV_LDFLAGS = -r -s
3117 endif
3118endif
3119
3120ifeq ($(KBUILD_TARGET),os2)
3121TEMPLATE_VBOXR0DRV_TOOL = GXX3OMF
3122TEMPLATE_VBOXR0DRV_CXXFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions -fno-rtti
3123TEMPLATE_VBOXR0DRV_CFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions
3124TEMPLATE_VBOXR0DRV_LIBS = $(VBOX_GCC_LIBGCC)
3125# wlink thinks physdevice doesn't need fixups and should have a stack - stupid!
3126TEMPLATE_VBOXR0DRV_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
3127endif
3128
3129ifeq ($(KBUILD_TARGET),darwin)
3130TEMPLATE_VBOXR0DRV_TOOL = GXX4MACHO
3131TEMPLATE_VBOXR0DRV_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS) KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT
3132TEMPLATE_VBOXR0DRV_INCS += $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/Kernel.framework/Headers
3133## @todo try use VBOX_GCC_PEDANTIC_CXX
3134TEMPLATE_VBOXR0DRV_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) \
3135 -g $(VBOX_GCC_pipe) $(VBOX_GCC_WARN) -Wno-long-long $(VBOX_GCC_fdiagnostics-show-option) \
3136 -fno-common -nostdinc -fno-builtin -finline $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden) \
3137 -fno-keep-inline-functions -fno-exceptions -msoft-float \
3138 -fapple-kext -fno-rtti -fcheck-new -force_cpusubtype_ALL \
3139 $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fasm-blocks
3140TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = -m64 -mkernel -mno-red-zone -gdwarf-2
3141TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = -m32 -static
3142TEMPLATE_VBOXR0DRV_CFLAGS = $(VBOX_DARWIN_DEF_SDK_CFLAGS) \
3143 -g $(VBOX_GCC_pipe) $(VBOX_GCC_WARN) -Wno-long-long -fno-common -nostdinc -fno-builtin -finline \
3144 -fno-keep-inline-functions -fno-exceptions $(VBOX_GCC_fvisibility-hidden) -msoft-float \
3145 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations \
3146 -Werror-implicit-function-declaration -force_cpusubtype_ALL \
3147 $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fasm-blocks
3148TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mkernel -mno-red-zone -gdwarf-2
3149TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -static
3150TEMPLATE_VBOXR0DRV_LDFLAGS = $(filter-out $(VBOX_DARWIN_NO_COMPACT_LINKEDIT),$(VBOX_DARWIN_DEF_SDK_LDFLAGS)) \
3151 -nostdlib -Wl,-kext,-new_linker -Wl,-Y,1455 -keep_private_extern
3152TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m64
3153TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m32
3154TEMPLATE_VBOXR0DRV_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC)
3155endif
3156
3157ifeq ($(KBUILD_TARGET),solaris)
3158## The Solaris /usr/platform/i86pc/include and /usr/include directories.
3159VBOX_SOLARIS_SYS_INCS ?= /usr/platform/i86pc/include /usr/include
3160
3161TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
3162TEMPLATE_VBOXR0DRV_DEFS += _MACHDEP _KERNEL _STRICT_STDC
3163TEMPLATE_VBOXR0DRV_INCS = $(VBOX_SOLARIS_SYS_INCS)
3164TEMPLATE_VBOXR0DRV_LDFLAGS = -r -dy
3165TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = $(if $(eq $(KBUILD_HOST),solaris),-64,-m elf_x86_64)
3166# Exclude -Wall because of solaris headers' pragma ident warnings that gcc refuses to supress.
3167TEMPLATE_VBOXR0DRV_CFLAGS = -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
3168 -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_fdiagnostics-show-option) \
3169 -Wshadow -Wuninitialized -Wunused-function -Wunused-label -Wunused-value -Wunused-variable \
3170 -Wformat -Wimplicit-int -Wimplicit-function-declaration -Werror-implicit-function-declaration -Wparentheses \
3171 -O2 -fno-omit-frame-pointer -ffreestanding -nodefaultlibs -fno-strict-aliasing -fno-common -std=c99
3172TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
3173TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_msave-args) \
3174 -mno-red-zone -mcmodel=kernel $(if-expr defined(VBOX_GCC_USING_SOLARIS_AS),-Wa$(COMMA)-xmodel=kernel,) \
3175 -fno-reorder-blocks -fno-asynchronous-unwind-tables -funit-at-a-time
3176TEMPLATE_VBOXR0DRV_CXXFLAGS = -Wpointer-arith -Winline \
3177 -Wshadow -Wuninitialized -Wunused-function -Wunused-label -Wunused-value -Wunused-variable \
3178 -Wformat \
3179 -O2 -nodefaultlibs -fno-omit-frame-pointer -fno-strict-aliasing -fno-common -fno-exceptions -fno-rtti
3180TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86)
3181TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = $(TEMPLATE_VBOXR0DRV_CFLAGS.amd64)
3182endif # Solaris
3183
3184ifeq ($(KBUILD_TARGET),freebsd)
3185# x86 FreeBSD (6.2 or something):
3186# cc -O2 -fno-strict-aliasing -pipe -Werror -D_KERNEL -DKLD_MODULE \
3187# -nostdinc -I- -I. -I@ -I@/contrib/altq -I@/../include -I/usr/include \
3188# -finline-limit=8000 -fno-common -mno-align-long-strings -mpreferred-stack-boundary=2 \
3189# -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -ffreestanding -Wall -Wredundant-decls -Wnested-externs \
3190# -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions \
3191# -std=c99 -c ../my.c
3192# ld -d -warn-common -r -d -o my.kld my.o
3193# :> export_syms
3194# awk -f /usr/src/sys/modules/my/../../conf/kmod_syms.awk my.kld export_syms | xargs -J% objcopy % my.kld
3195# ld -Bsharable -d warn-commnon -o my.ko my.kld
3196#
3197# AMD64 FreeBSD (7.1):
3198# cc -O2 -fno-strict-aliasing -pipe -D_KERNEL -DKLD_MODULE -std=c99 -nostdinc -I. -I@ -I@/contrib/altq \
3199# -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common \
3200# -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx \
3201# -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -ffreestanding \
3202# -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign \
3203# -fformat-extensions -c /usr/src/sys/modules/my/../../dev/my/if_my.c
3204# ld -d -warn-common -r -d -o if_my.ko if_my.o
3205# :> export_syms
3206# awk -f /usr/src/sys/modules/my/../../conf/kmod_syms.awk if_my.ko export_syms | xargs -J% objcopy % if_my.ko
3207
3208# Note: @ -> /usr/src/sys and machine -> /usr/src/sys/i386/include
3209
3210## The location of the FreeBSD kernel source.
3211VBOX_FREEBSD_SRC ?= /usr/src/sys
3212## The FreeBSD /usr/include.
3213VBOX_FREEBSD_SYS_INCS ?= /usr/include
3214
3215TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
3216TEMPLATE_VBOXR0DRV_LDTOOL = FREEBSDKMODLD
3217TEMPLATE_VBOXR0DRV_DEFS += _KERNEL KLD_MODULE
3218TEMPLATE_VBOXR0DRV_INCS = \
3219 $(VBOX_FREEBSD_SRC) \
3220 $(VBOX_FREEBSD_SRC)/contrib/altq \
3221 $(VBOX_FREEBSD_SRC)/../include \
3222 $(VBOX_FREEBSD_SYS_INCS)
3223# omitting: -Wcast-qual, -Wredundant-decls
3224TEMPLATE_VBOXR0DRV_CFLAGS = \
3225 $(VBOX_GCC_WARN) -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) $(VBOX_GCC_fdiagnostics-show-option) \
3226 -Wstrict-prototypes -Wmissing-prototypes -Wstrict-prototypes \
3227 -Wimplicit-function-declaration -Werror-implicit-function-declaration \
3228 -O2 -fformat-extensions -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
3229 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
3230 -nostdinc -std=c99
3231TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2
3232TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 --param inline-unit-growth=100 --param large-function-growth=1000 \
3233 -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx \
3234 -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -Wundef
3235TEMPLATE_VBOXR0DRV_CXXFLAGS = -fno-exceptions -fno-rtti \
3236 $(VBOX_GCC_WARN) -Wpointer-arith -Winline \
3237 -O2 -fno-format-extensions -fno-strict-aliasing -fno-common -finline-limit=8000 \
3238 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
3239 -nostdinc
3240TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86)
3241TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = $(TEMPLATE_VBOXR0DRV_CFLAGS.amd64)
3242TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
3243TEMPLATE_VBOXR0DRV_LDFLAGS = -d --warn-common
3244TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386_fbsd
3245TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64_fbsd
3246
3247TOOL_FREEBSDKMODLD = FreeBSD kernel module linker.
3248# See kBuild/tools/GCC3.kmk for docs.
3249TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
3250TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
3251TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPORD =
3252 ifeq ($(KBUILD_TARGET_ARCH),amd64)
3253TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT =
3254define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
3255# Link intermediate .kld (a relocatable object).
3256 ld $(flags) -r -o $(out) $(objs) \
3257 $(foreach p,$(libpath), -L$(p))\
3258 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
3259# Strip non-exported symbols private and localize the exported ones.
3260 awk -f $(VBOX_FREEBSD_SRC)/conf/kmod_syms.awk $(out) $(if $(othersrc), $(othersrc),/dev/null) \
3261 | xargs -J% objcopy % $(out)
3262
3263## Strip debug info (comment out if debugging or something).
3264 objcopy --strip-debug $(out)
3265endef
3266 else # x86
3267TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT = $(outbase).kld
3268define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
3269# Link intermediate .kld (a relocatable object).
3270 ld $(flags) -r -o $(outbase).kld $(objs) \
3271 $(foreach p,$(libpath), -L$(p))\
3272 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
3273# Strip non-exported symbols private and localize the exported ones.
3274 awk -f $(VBOX_FREEBSD_SRC)/conf/kmod_syms.awk $(outbase).kld $(if $(othersrc), $(othersrc),/dev/null) \
3275 | xargs -J% objcopy % $(outbase).kld
3276
3277# Link the final .ko (a shared object).
3278 ld $(flags) -Bshareable -o $(out) $(outbase).kld
3279endef
3280 endif # x86
3281
3282endif # FreeBSD
3283
3284ifeq ($(KBUILD_TARGET),haiku)
3285## The Haiku include directories
3286VBOX_HAIKU_SYS_INCS ?= /boot/develop/headers/os/kernel /boot/develop/headers/os/drivers
3287
3288TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
3289TEMPLATE_VBOXR0DRV_LDTOOL = $(VBOX_GCC_TOOL)
3290TEMPLATE_VBOXR0DRV_DEFS = _KERNEL_MODE=1 _STRICT_STDC IN_RING0 IN_RT_R0
3291TEMPLATE_VBOXR0DRV_INCS = $(VBOX_HAIKU_SYS_INCS)
3292#TODO: sort this out
3293TEMPLATE_VBOXR0DRV_LDFLAGS = -shared -no-undefined -dc -dy -nostdlib -rpath-link /boot/develop/lib/x86 --no-add-needed /boot/develop/lib/x86/_KERNEL_ --no-add-needed /boot/develop/lib/x86/haiku_version_glue.o
3294TEMPLATE_VBOXR0DRV_CFLAGS = -no-fpic \
3295 $(VBOX_GCC_WARN) -Wstrict-prototypes $(VBOX_GCC_Wno-pointer-sign) -Wno-sign-compare \
3296 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
3297TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
3298TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
3299TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
3300 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
3301 -Wno-sign-compare -Wdeclaration-after-statement
3302TEMPLATE_VBOXR0DRV_CXXFLAGS = -no-fpic -Wpointer-arith \
3303 -Wshadow -Wuninitialized -Wunused-function -Wunused-label -Wunused-value -Wunused-variable \
3304 -Wformat \
3305 -O2 -nodefaultlibs -fno-omit-frame-pointer -fno-strict-aliasing -fno-common -fno-exceptions -fno-rtti
3306TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86) -fno-exceptions -fno-rtti
3307TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = $(TEMPLATE_VBOXR0DRV_CFLAGS.amd64) -fno-exceptions -fno-rtti
3308endif # Haiku
3309
3310ifdef VBOX_WITH_VBOXDRV
3311 ifndef TEMPLATE_VBOXR0DRV_TOOL
3312 $(warning Warning: VBox Build: Target $(KBUILD_HOST) is not officially supported!)
3313 endif
3314endif
3315
3316ifn1of ($(KBUILD_TARGET), darwin os2 win solaris)
3317 # This doesn't work if supdrv is natively loading VMMR0.r0 et al, but
3318 # fortunately it isn't really necessary.
3319 TEMPLATE_VBOXR0DRV_CFLAGS += -include $(PATH_ROOT)/include/VBox/SUPDrvMangling.h
3320 TEMPLATE_VBOXR0DRV_CXXFLAGS += -include $(PATH_ROOT)/include/VBox/SUPDrvMangling.h
3321endif
3322
3323#
3324# Template for building libraries used by ring-0 drivers.
3325#
3326TEMPLATE_VBoxR0DrvLib = VBox Ring 0 Driver Library
3327TEMPLATE_VBoxR0DrvLib_EXTENDS = VBOXR0DRV
3328TEMPLATE_VBoxR0DrvLib_INSTTYPE = stage
3329TEMPLATE_VBoxR0DrvLib_INSTTYPE.linux = stage
3330
3331
3332#
3333# Template for building R3 executables and static libraries which are linked into executables.
3334# Note! This is the base template for a whole lot of other ones, so be careful when changing it.
3335#
3336TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
3337TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
3338TEMPLATE_VBOXR3EXE_ASFLAGS.x86 = $(VBOX_ASFLAGS32)
3339TEMPLATE_VBOXR3EXE_ASFLAGS.amd64 = $(VBOX_ASFLAGS64)
3340TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
3341TEMPLATE_VBOXR3EXE_DEFS.win = _CRT_SECURE_NO_DEPRECATE
3342TEMPLATE_VBOXR3EXE_USES = dtrace
3343if defined(VBOX_WITH_DTRACE_R3) && defined(VBOX_WITH_NATIVE_DTRACE)
3344 TEMPLATE_VBOXR3EXE_DTRACETOOL = DTraceAndVBoxTpG
3345 TEMPLATE_VBOXR3EXE_DTRACE_OBJ_FLAGS = -C
3346 TEMPLATE_VBOXR3EXE_DTRACE_HDR_FLAGS = -C
3347 TEMPLATE_VBOXR3EXE_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R3 VBOX_WITH_NATIVE_DTRACE
3348else
3349 TEMPLATE_VBOXR3EXE_DTRACE_HDR_FLAGS = --ring-3-context
3350 TEMPLATE_VBOXR3EXE_DTRACE_OBJ_FLAGS = --ring-3-context --pic --probe-fn-imported --probe-fn-name "SUPTracerFireProbe"
3351 if defined(VBOX_WITH_DTRACE_R3)
3352 TEMPLATE_VBOXR3EXE_DTRACETOOL = VBoxTpG
3353 TEMPLATE_VBOXR3EXE_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R3
3354 else
3355 TEMPLATE_VBOXR3EXE_DTRACETOOL = VBoxTpG-Disabled
3356 endif
3357endif
3358TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
3359ifeq ($(KBUILD_TARGET),win)
3360# TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
3361 TEMPLATE_VBOXR3EXE_TOOL.win.x86 = $(VBOX_VCC_TOOL_STEM)X86
3362 TEMPLATE_VBOXR3EXE_TOOL.win.amd64 = $(VBOX_VCC_TOOL_STEM)AMD64
3363 TEMPLATE_VBOXR3EXE_RCDEFS = \
3364 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
3365 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
3366 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
3367 VBOX_SVN_REV=\"$(VBOX_SVN_REV)\" \
3368 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
3369 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
3370 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD) \
3371 VBOX_SVN_REV_NR=$(VBOX_SVN_REV)
3372 TEMPLATE_VBOXR3EXE_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK)
3373 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHsc -GF -MD$(VBOX_VCC_CRT_TYPE) -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
3374 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
3375 TEMPLATE_VBOXR3EXE_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE)
3376 TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
3377 TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
3378 TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
3379 TEMPLATE_VBOXR3EXE_CFLAGS.dbgopt = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.dbgopt)
3380 TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
3381 TEMPLATE_VBOXR3EXE_LDFLAGS = \
3382 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
3383 /DISALLOWLIB:libc.lib \
3384 /DISALLOWLIB:libcd.lib \
3385 /DISALLOWLIB:libcmt.lib \
3386 /DISALLOWLIB:libcmtd.lib \
3387 /DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE_N).lib \
3388 /DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE_N).lib
3389 ifdef VBOX_WITH_DTRACE_R3
3390 TEMPLATE_VBOXR3EXE_LDFLAGS += -Merge:VTGPrLc.Data=VTGPrLc.Begin -Merge:VTGPrLc.End=VTGPrLc.Begin -Merge:VTGPrLc.Begin=VTGObj
3391 endif
3392
3393 TEMPLATE_VBOXR3EXE_LIBS.x86 = \
3394 $(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.x86)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
3395 $(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.x86)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
3396 $(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.x86)_LIB)/oldnames.lib
3397 TEMPLATE_VBOXR3EXE_LIBS.amd64 = \
3398 $(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.amd64)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
3399 $(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.amd64)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
3400 $(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.amd64)_LIB)/oldnames.lib
3401 TEMPLATE_VBOXR3EXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
3402
3403else # the gcc guys
3404TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
3405TEMPLATE_VBOXR3EXE_CXXFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
3406TEMPLATE_VBOXR3EXE_CXXFLAGS.x86 = -m32
3407TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64 = -m64
3408TEMPLATE_VBOXR3EXE_CXXFLAGS.sparc32 = -m32
3409TEMPLATE_VBOXR3EXE_CXXFLAGS.sparc64 = -m64
3410TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
3411TEMPLATE_VBOXR3EXE_CFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-hidden)
3412TEMPLATE_VBOXR3EXE_CFLAGS.x86 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.x86)
3413TEMPLATE_VBOXR3EXE_CFLAGS.amd64 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64)
3414TEMPLATE_VBOXR3EXE_CFLAGS.sparc32 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.sparc32)
3415TEMPLATE_VBOXR3EXE_CFLAGS.sparc64 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.sparc64)
3416TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
3417TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
3418TEMPLATE_VBOXR3EXE_OBJCFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS)
3419TEMPLATE_VBOXR3EXE_OBJCFLAGS.x86 = $(TEMPLATE_VBOXR3EXE_CFLAGS.x86)
3420TEMPLATE_VBOXR3EXE_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXR3EXE_CFLAGS.amd64)
3421TEMPLATE_VBOXR3EXE_OBJCFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CFLAGS.debug)
3422TEMPLATE_VBOXR3EXE_OBJCFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CFLAGS.kprofile)
3423TEMPLATE_VBOXR3EXE_OBJCXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
3424TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.x86)
3425TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64)
3426TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
3427TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.kprofile= $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
3428TEMPLATE_VBOXR3EXE_LDFLAGS.x86 = -m32
3429TEMPLATE_VBOXR3EXE_LDFLAGS.amd64 = -m64
3430TEMPLATE_VBOXR3EXE_LDFLAGS.sparc32 = -m32
3431TEMPLATE_VBOXR3EXE_LDFLAGS.sparc64 = -m64
3432TEMPLATE_VBOXR3EXE_LDFLAGS.linux = -Wl,-z,noexecstack $(VBOX_LD_as_needed)
3433TEMPLATE_VBOXR3EXE_LDFLAGS.solaris = -Wl,-z,ignore # same as VBOX_LD_as_needed
3434
3435 ifeq ($(KBUILD_TARGET),linux)
3436TEMPLATE_VBOXR3EXE_LIBS = pthread m rt dl
3437 else ifeq ($(KBUILD_TARGET),os2)
3438TEMPLATE_VBOXR3EXE_TOOL = GXX3OMF
3439TEMPLATE_VBOXR3EXE_LIBS = socket iconv
3440 else ifeq ($(KBUILD_TARGET),darwin)
3441TEMPLATE_VBOXR3EXE_TOOL = GXX4MACHO
3442TEMPLATE_VBOXR3EXE_LIBS =
3443TEMPLATE_VBOXR3EXE_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_DEFS)
3444TEMPLATE_VBOXR3EXE_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -fno-common
3445TEMPLATE_VBOXR3EXE_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
3446TEMPLATE_VBOXR3EXE_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
3447TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS)
3448TEMPLATE_VBOXR3EXE_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
3449TEMPLATE_VBOXR3EXE_LDFLAGS.darwin.x86 = -read_only_relocs suppress
3450 ifdef VBOX_WITH_DTRACE_R3
3451 TEMPLATE_VBOXR3EXE_CXXFLAGS := $(filter-out -pedantic,$(TEMPLATE_VBOXR3EXE_CXXFLAGS)) -fdollars-in-identifiers # annoying gcc option precedence.
3452 endif
3453 else ifeq ($(KBUILD_TARGET),haiku)
3454TEMPLATE_VBOXR3EXE_TOOL = GXX3
3455TEMPLATE_VBOXR3EXE_POST_CMDS = $(VBOX_HAIKU_XRES_SETVER_CMDS)
3456TEMPLATE_VBOXR3EXE_LIBS = network iconv stdc++ supc++
3457TEMPLATE_VBOXR3EXE_LIBPATH += \
3458 /boot/common/lib
3459# Haiku uses PIC by default...
3460TEMPLATE_VBOXR3EXE_CFLAGS += -fno-pic
3461TEMPLATE_VBOXR3EXE_CXXFLAGS += -fno-pic
3462TEMPLATE_VBOXR3EXE_LDFLAGS += -fno-pic
3463 else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd)
3464TEMPLATE_VBOXR3EXE_TOOL = GXX3
3465TEMPLATE_VBOXR3EXE_LIBS = pthread
3466TEMPLATE_VBOXR3EXE_INCS += \
3467 /usr/include \
3468 /usr/X11R6/include \
3469 /usr/local/include
3470TEMPLATE_VBOXR3EXE_LIBPATH += \
3471 /usr/lib \
3472 /usr/X11R6/lib \
3473 /usr/local/lib
3474 else ifeq ($(KBUILD_TARGET),solaris)
3475TEMPLATE_VBOXR3EXE_TOOL = GXX3PLAIN
3476TEMPLATE_VBOXR3EXE_DEFS += LIBICONV_PLUG _REENTRANT # Avoid the GNU libiconv, for now at least.
3477
3478TEMPLATE_VBOXR3EXE_LIBS = rt socket
3479 else
3480$(warning Warning: VBOX Build: Target $(KBUILD_TARGET) is not officially supported!)
3481TEMPLATE_VBOXR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.release)
3482TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease)
3483 endif
3484 ifdef VBOX_WITH_RUNPATH
3485 TEMPLATE_VBOXR3EXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
3486 else ifdef VBOX_WITH_RELATIVE_RUNPATH
3487 TEMPLATE_VBOXR3EXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
3488 endif
3489 ifdef VBOX_WITH_ORIGIN
3490 TEMPLATE_VBOXR3EXE_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT)
3491 endif
3492endif
3493
3494#
3495# Template for building R3 shared objects / DLLs.
3496# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
3497# -
3498TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
3499TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
3500TEMPLATE_VBOXR3_DEFS.darwin = $(TEMPLATE_VBOXR3EXE_DEFS.darwin) PIC
3501TEMPLATE_VBOXR3_LDFLAGS.darwin = $(TEMPLATE_VBOXR3EXE_LDFLAGS.darwin) \
3502 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
3503 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
3504ifn1of ($(KBUILD_TARGET), darwin win os2)
3505 TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
3506 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
3507 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
3508 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
3509endif
3510ifeq ($(KBUILD_TARGET),haiku)
3511 # Haiku uses PIC by default...
3512 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fno-pic
3513 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fno-pic
3514 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fno-pic
3515endif
3516
3517#
3518# Temporary: Renaming the template and warnings will be errors (soon).
3519#
3520TEMPLATE_VBoxR3Dll += VBox ring-3 SO/DLLs, no warnings
3521TEMPLATE_VBoxR3Dll_EXTENDS += VBOXR3
3522TEMPLATE_VBoxR3Dll_EXTENDS_BY += appending
3523ifeq ($(KBUILD_TARGET),win)
3524 TEMPLATE_VBoxR3Dll_CFLAGS += $(VBOX_VCC_WERR)
3525 TEMPLATE_VBoxR3Dll_CXXFLAGS += $(VBOX_VCC_WERR)
3526 TEMPLATE_VBoxR3Dll_LDFLAGS += $(VBOX_VCC_LD_WERR)
3527else
3528 TEMPLATE_VBoxR3Dll_CFLAGS += $(VBOX_GCC_WERR)
3529 TEMPLATE_VBoxR3Dll_CXXFLAGS += $(VBOX_GCC_WERR)
3530endif
3531
3532#
3533# Template for building performance critical stuff with warnings-as-errors.
3534#
3535TEMPLATE_VBoxR3DllNoPic = VBox ring-3 SO/DLLs without PIC, without warnings.
3536TEMPLATE_VBoxR3DllNoPic_EXTENDS = VBOXR3
3537if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), linux.x86 freebsd.x86)
3538 TEMPLATE_VBoxR3DllNoPic_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS)
3539 TEMPLATE_VBoxR3DllNoPic_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) $(VBOX_GCC_WERR)
3540 TEMPLATE_VBoxR3DllNoPic_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) $(VBOX_GCC_WERR)
3541 TEMPLATE_VBoxR3DllNoPic_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS)
3542else ifeq ($(KBUILD_TARGET),win)
3543 TEMPLATE_VBoxR3DllNoPic_CFLAGS = $(TEMPLATE_VBOXR3_CFLAGS) $(VBOX_VCC_WERR)
3544 TEMPLATE_VBoxR3DllNoPic_CFLAGS.debug = $(filter-out -RTC%,$(TEMPLATE_VBOXR3_CFLAGS.debug))
3545 TEMPLATE_VBoxR3DllNoPic_CFLAGS.release = $(TEMPLATE_VBOXR3_CFLAGS.release) -GS-
3546 TEMPLATE_VBoxR3DllNoPic_CXXFLAGS = $(TEMPLATE_VBOXR3_CXXFLAGS) $(VBOX_VCC_WERR)
3547 TEMPLATE_VBoxR3DllNoPic_CXXFLAGS.debug = $(filter-out -RTC%,$(TEMPLATE_VBOXR3_CXXFLAGS.debug)) # RTCsu Prevents IEM opt.
3548 TEMPLATE_VBoxR3DllNoPic_CXXFLAGS.release = $(TEMPLATE_VBOXR3_CXXFLAGS.release) -GS-
3549 TEMPLATE_VBoxR3DllNoPic_LDFLAGS = $(TEMPLATE_VBOXR3_LDFLAGS) $(VBOX_VCC_LD_WERR)
3550else
3551 TEMPLATE_VBoxR3DllNoPic_CFLAGS = $(TEMPLATE_VBOXR3_CFLAGS) $(VBOX_GCC_WERR)
3552 TEMPLATE_VBoxR3DllNoPic_CXXFLAGS = $(TEMPLATE_VBOXR3_CXXFLAGS) $(VBOX_GCC_WERR)
3553endif
3554
3555#
3556# Template for building performance critical stuff without warnings-as-errors.
3557#
3558TEMPLATE_VBoxR3DllWarnNoPic = VBox ring-3 SO/DLLs without PIC, with warnings.
3559TEMPLATE_VBoxR3DllWarnNoPic_EXTENDS = VBOXR3
3560if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), linux.x86 freebsd.x86)
3561 TEMPLATE_VBoxR3DllWarnNoPic_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS)
3562 TEMPLATE_VBoxR3DllWarnNoPic_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS)
3563 TEMPLATE_VBoxR3DllWarnNoPic_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
3564 TEMPLATE_VBoxR3DllWarnNoPic_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS)
3565else ifeq ($(KBUILD_TARGET),win)
3566 TEMPLATE_VBoxR3DllNoPic_CFLAGS.release = $(TEMPLATE_VBOXR3_CFLAGS.release) -GS-
3567 TEMPLATE_VBoxR3DllNoPic_CXXFLAGS.release = $(TEMPLATE_VBOXR3_CXXFLAGS.release) -GS-
3568endif
3569
3570#
3571# Template for building static R3 executables and any static
3572# libraries they link with.
3573#
3574TEMPLATE_VBOXR3STATIC = VBox Static Ring 3 EXE
3575TEMPLATE_VBOXR3STATIC_EXTENDS = VBOXR3EXE
3576TEMPLATE_VBOXR3STATIC_DEFS = IN_RT_STATIC $(TEMPLATE_VBOXR3EXE_DEFS)
3577ifeq ($(KBUILD_TARGET),win)
3578 TEMPLATE_VBOXR3STATIC_CFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
3579 TEMPLATE_VBOXR3STATIC_CXXFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
3580 TEMPLATE_VBOXR3STATIC_LDFLAGS = $(filter-out /DISALLOWLIB:libcmt$(VBOX_VCC_CRT_TYPE).lib /DISALLOWLIB:libcpmt$(VBOX_VCC_CRT_TYPE).lib, $(TEMPLATE_VBOXR3EXE_LDFLAGS)) \
3581 /DISALLOWLIB:msvcrt.lib \
3582 /DISALLOWLIB:msvcrtd.lib \
3583 /DISALLOWLIB:msvcprt.lib \
3584 /DISALLOWLIB:msvcprtd.lib
3585 TEMPLATE_VBOXR3STATIC_LIBS.x86 = \
3586 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.x86)_LIB)/oldnames.lib \
3587 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
3588 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
3589 TEMPLATE_VBOXR3STATIC_LIBS.amd64 = \
3590 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
3591 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \
3592 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/oldnames.lib
3593else ifn1of ($(KBUILD_TARGET), darwin solaris)
3594 # The gcc guys sans darwin and solaris.
3595 TEMPLATE_VBOXR3STATIC_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -static
3596 TEMPLATE_VBOXR3STATIC_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -static
3597 TEMPLATE_VBOXR3STATIC_OBJCFLAGS = $(TEMPLATE_VBOXR3EXE_OBJCFLAGS) -static
3598 TEMPLATE_VBOXR3STATIC_OBJCXXFLAGS = $(TEMPLATE_VBOXR3EXE_OBJCXXFLAGS) -static
3599 TEMPLATE_VBOXR3STATIC_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -static
3600else ifeq ($(KBUILD_TARGET),solaris)
3601 TEMPLATE_VBOXR3STATIC_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS) nsl
3602endif
3603
3604#
3605# Temporary: Renaming the template and warnings will be errors (soon).
3606#
3607TEMPLATE_VBoxR3Static = New name for VBOXR3STATIC
3608TEMPLATE_VBoxR3Static_EXTENDS = VBOXR3STATIC
3609TEMPLATE_VBoxR3Static_EXTENDS_BY = appending
3610ifeq ($(KBUILD_TARGET),win)
3611 TEMPLATE_VBoxR3Static_CFLAGS += $(VBOX_VCC_WERR)
3612 TEMPLATE_VBoxR3Static_CXXFLAGS += $(VBOX_VCC_WERR)
3613 TEMPLATE_VBoxR3Static_LDFLAGS += $(VBOX_VCC_LD_WERR)
3614else
3615 TEMPLATE_VBoxR3Static_CFLAGS += $(VBOX_GCC_WERR)
3616 TEMPLATE_VBoxR3Static_CXXFLAGS += $(VBOX_GCC_WERR)
3617endif
3618
3619#
3620# Same as VBOXR3EXE but without C++ exceptions.
3621#
3622# VBOXR3EXE does C++ exceptions and may assumes that extern "C" functions
3623# doesn't throw them. Use this template (and VBOXR3DLLNOXCPT) with care
3624# and only where the C++ overhead is really unwanted.
3625#
3626TEMPLATE_VBOXR3EXENOXCPT = VBox Ring 3 Exe without C++ exception
3627TEMPLATE_VBOXR3EXENOXCPT_EXTENDS = VBOXR3EXE
3628ifeq ($(KBUILD_TARGET),win)
3629 TEMPLATE_VBOXR3EXENOXCPT_CFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3EXE_CFLAGS) ) -EHs-
3630 TEMPLATE_VBOXR3EXENOXCPT_CXXFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3EXE_CXXFLAGS)) -EHs-
3631else
3632 TEMPLATE_VBOXR3EXENOXCPT_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fno-exceptions
3633endif
3634
3635#
3636# Same as VBOXR3 but without C++ exceptions.
3637#
3638TEMPLATE_VBOXR3DLLNOXCPT = VBox Ring 3 SO/DLLs without C++ exception
3639TEMPLATE_VBOXR3DLLNOXCPT_EXTENDS = VBOXR3
3640ifeq ($(KBUILD_TARGET),win)
3641 TEMPLATE_VBOXR3DLLNOXCPT_CFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3_CFLAGS) ) -EHs-
3642 TEMPLATE_VBOXR3DLLNOXCPT_CXXFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3_CXXFLAGS)) -EHs-
3643else
3644 TEMPLATE_VBOXR3DLLNOXCPT_CXXFLAGS = $(TEMPLATE_VBOXR3_CXXFLAGS) -fno-exceptions
3645endif
3646
3647#
3648# Template for building hardened Ring-3 executables.
3649# These shall have no extra runpaths, esp. not origin ones.
3650#
3651TEMPLATE_VBOXR3HARDENEDEXE = Hardened VBox Ring-3 EXE
3652TEMPLATE_VBOXR3HARDENEDEXE_EXTENDS = VBOXR3EXE
3653TEMPLATE_VBOXR3HARDENEDEXE_LIBS = $(VBOX_LIB_SUPHARDENED) $(TEMPLATE_VBOXR3EXE_LIBS)
3654TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.darwin = $(TEMPLATE_VBOXR3EXE_LDFLAGS.darwin) -framework IOKit
3655ifeq ($(KBUILD_TARGET),linux)
3656# not necessary except USE_LIB_PCAP is defined in SUPR3HardenedMain.cpp
3657# TEMPLATE_VBOXR3HARDENEDEXE_LIBS += cap
3658endif
3659ifn1of ($(KBUILD_TARGET), win os2)
3660 TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%,$(TEMPLATE_VBOXR3EXE_LDFLAGS))
3661 TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBOXR3EXE_LDFLAGS.linux))
3662endif
3663
3664#
3665# Template for building hardened Ring-3 libraries.
3666#
3667TEMPLATE_VBOXR3HARDENEDLIB = Hardened VBox Ring-3 LIB
3668TEMPLATE_VBOXR3HARDENEDLIB_EXTENDS = VBOXR3HARDENEDEXE
3669TEMPLATE_VBOXR3HARDENEDLIB_LIBS = $(NO_SUCH_VARIABLE)
3670
3671
3672#
3673# Template for building set-uid-to-root helper programs.
3674# In hardened builds, these may only contain absolute runpaths!
3675#
3676TEMPLATE_VBoxR3SetUidToRoot = Set-uid-to-root helper program.
3677TEMPLATE_VBoxR3SetUidToRoot_EXTENDS = VBOXR3HARDENEDEXE
3678TEMPLATE_VBoxR3SetUidToRoot_LIBS = $(NO_SUCH_VARIABLE)
3679ifdef VBOX_WITH_RUNPATH
3680 TEMPLATE_VBoxR3SetUidToRoot_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
3681endif
3682ifndef VBOX_WITH_HARDENING
3683 ifdef VBOX_WITH_RELATIVE_RUNPATH
3684 TEMPLATE_VBoxR3SetUidToRoot_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
3685 endif
3686 ifdef VBOX_WITH_ORIGIN
3687 TEMPLATE_VBoxR3SetUidToRoot_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT)
3688 endif
3689endif
3690
3691
3692#
3693# Template for building R3 shared objects / DLLs with the 10.5 Mac OS X SDK.
3694# Identical to VBOXR3EXE, except for the DYLIB, the classic_linker and SDK bits.
3695#
3696TEMPLATE_VBOXR3OSX105 = VBox Ring 3 SO/DLLs for OS X 10.5
3697TEMPLATE_VBOXR3OSX105_EXTENDS = VBOXR3EXE
3698TEMPLATE_VBOXR3OSX105_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_DEFS) PIC
3699TEMPLATE_VBOXR3OSX105_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CFLAGS) -fno-common
3700TEMPLATE_VBOXR3OSX105_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS)
3701TEMPLATE_VBOXR3OSX105_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS)
3702TEMPLATE_VBOXR3OSX105_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS)
3703TEMPLATE_VBOXR3OSX105_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS) \
3704 -read_only_relocs suppress \
3705 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
3706 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
3707
3708
3709#
3710# Ring-3 testcase, running automatically during the build.
3711# This is the VBOXR3EXE template only with a different install dir.
3712#
3713TEMPLATE_VBOXR3AUTOTST = VBox Ring 3 Testcase Exe
3714TEMPLATE_VBOXR3AUTOTST_EXTENDS = $(if-expr "$(KBUILD_TARGET)" == "win",VBoxR3Static,VBOXR3EXE)
3715TEMPLATE_VBOXR3AUTOTST_INST = $(INST_TESTCASE)
3716TEMPLATE_VBOXR3AUTOTST_LIBS = $(TEMPLATE_$(TEMPLATE_VBOXR3AUTOTST_EXTENDS)_LIBS)
3717if "$(KBUILD_TARGET)" == "win" && defined(VBOX_SIGNING_MODE)
3718 TEMPLATE_VBOXR3AUTOTST_POST_CMDS = $(NO_SUCH_VARIABLE)
3719endif
3720
3721#
3722# Ring-3 testcase.
3723# This is the VBOXR3EXE template only with a different install dir.
3724#
3725TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
3726TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
3727TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
3728TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
3729ifdef VBOX_WITH_RUNPATH
3730 TEMPLATE_VBOXR3TSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' $(TEMPLATE_VBOXR3EXE_LDFLAGS)
3731else ifdef VBOX_WITH_RELATIVE_RUNPATH
3732 TEMPLATE_VBOXR3TSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..' $(TEMPLATE_VBOXR3EXE_LDFLAGS)
3733endif
3734if "$(KBUILD_TARGET)" == "win" && defined(VBOX_SIGNING_MODE)
3735 TEMPLATE_VBOXR3TSTEXE_POST_CMDS =
3736endif
3737
3738#
3739# Ring-3 testcase (no -pedantic)
3740#
3741TEMPLATE_VBOXR3TSTNPEXE = VBox Ring 3 Testcase Exe Non-pedantic
3742TEMPLATE_VBOXR3TSTNPEXE_EXTENDS = VBOXR3TSTEXE
3743ifneq ($(KBUILD_TARGET),win) # (only gcc)
3744 TEMPLATE_VBOXR3TSTNPEXE_TOOL = $(VBOX_GCC_TOOL)
3745 TEMPLATE_VBOXR3TSTNPEXE_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3TSTEXE_CXXFLAGS)) -Wno-sign-compare
3746 TEMPLATE_VBOXR3TSTNPEXE_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3TSTEXE_CFLAGS)) -Wno-sign-compare
3747endif
3748
3749
3750#
3751# Template for the CppUnit kind of testcases.
3752#
3753TEMPLATE_VBOXCPPUNITEXE = VBox CppUnit Testcase Exe
3754TEMPLATE_VBOXCPPUNITEXE_EXTENDS = VBOXR3TSTEXE
3755## @todo make a CPPUNIT SDK and add cppunit tools packages for windows, mac, solaris and OS/2.
3756#TEMPLATE_VBOXCPPUNITEXE_SDKS = CPPUNIT -
3757TEMPLATE_VBOXCPPUNITEXE_LIBS = \
3758 $(TEMPLATE_VBOXR3TSTEXE_LIBS) \
3759 cppunit
3760
3761#
3762# Template for building bad C/C++ style R3 executables (no -pedantic).
3763#
3764TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
3765TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
3766ifneq ($(KBUILD_TARGET),win) # (only gcc)
3767 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
3768 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3EXE_CXXFLAGS)) -Wno-sign-compare
3769 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3EXE_CFLAGS)) \
3770 -Wno-sign-compare -Werror-implicit-function-declaration
3771endif
3772
3773
3774#
3775# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
3776# (Same transformation as for VBOXR3NPEXE.)
3777#
3778TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
3779TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3
3780ifneq ($(KBUILD_TARGET),win) # (only gcc)
3781 TEMPLATE_VBOXR3NP_TOOL = $(VBOX_GCC_TOOL)
3782 TEMPLATE_VBOXR3NP_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3_CXXFLAGS)) -Wno-sign-compare
3783 TEMPLATE_VBOXR3NP_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3_CFLAGS)) \
3784 -Wno-sign-compare -Werror-implicit-function-declaration
3785endif
3786
3787
3788#
3789# Template for building libraries, shared libraries / modules
3790# which only depends on IPRT for crt.
3791#
3792TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
3793TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
3794TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
3795TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno $(VBOX_GCC_WARN) -Werror-implicit-function-declaration
3796TEMPLATE_VBOXNOCRTGCC_CFLAGS.x86 = -m32
3797TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -m64 -mcmodel=medium -fno-common
3798TEMPLATE_VBOXNOCRTGCC_CFLAGS.sparc32 = -m32
3799TEMPLATE_VBOXNOCRTGCC_CFLAGS.sparc64 = -m64
3800TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
3801TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
3802TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
3803TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -static
3804TEMPLATE_VBOXNOCRTGCC_CXXFLAGS = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS)
3805TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(KBUILD_TARGET) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(KBUILD_TARGET))
3806TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(KBUILD_TARGET_ARCH) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(KBUILD_TARGET_ARCH))
3807TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
3808
3809ifeq (disabled-by-mingw-w64 $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
3810 # cross compile to 64-bit ELF (linux).
3811 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
3812 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
3813 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
3814 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
3815 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
3816
3817else if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), win.x86 win.amd64)
3818 # Use the default GCC (MinGW) with the Microsoft linker.
3819 # (Drop all '-g' options as we're unable to strip the debug info.)
3820 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
3821 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
3822 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
3823 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
3824 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
3825 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
3826 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
3827 TEMPLATE_VBOXNOCRTGCC_CXXFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CXXFLAGS)) -s
3828
3829else
3830 # Use the default GCC.
3831 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
3832 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
3833 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
3834 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
3835 TEMPLATE_VBOXNOCRTGCC_CFLAGS += $(VBOX_GCC_fno-stack-protector)
3836 TEMPLATE_VBOXNOCRTGCC_CXXFLAGS += $(VBOX_GCC_fno-stack-protector)
3837 ifeq ($(KBUILD_TARGET_ARCH),amd64)
3838 # in 64-bit mode we'll build a sys-module (VBoxREM2).
3839 if1of ($(KBUILD_TARGET), darwin solaris)
3840 TEMPLATE_VBOXNOCRTGCC_LDFLAGS.solaris= -64 -r
3841 else
3842 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
3843 endif
3844 else # x86:
3845 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
3846 ifn1of ($(KBUILD_TARGET), os2 darwin solaris)
3847 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
3848 endif
3849 endif # x86
3850 TEMPLATE_VBOXNOCRTGCC_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
3851 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
3852endif
3853
3854
3855#
3856# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
3857#
3858TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
3859TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
3860TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
3861ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
3862 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
3863else
3864 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
3865endif
3866TEMPLATE_VBOXNOCRTGAS_ASFLAGS.x86 = -m32
3867TEMPLATE_VBOXNOCRTGAS_ASFLAGS.amd64 = -m64
3868
3869
3870#
3871# Template for building executables that are part of the VBox Main component
3872# (COM/XPCOM interface to VirtualBox).
3873#
3874TEMPLATE_VBOXMAINEXE = VBox Main Executable
3875TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
3876TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
3877TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE NDEBUG=1
3878TEMPLATE_VBOXMAINEXE_DEFS.win = _UNICODE
3879TEMPLATE_VBOXMAINEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
3880TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
3881
3882ifeq ($(KBUILD_TARGET),win)
3883 TEMPLATE_VBOXMAINEXE_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK)
3884 # Note: C4250 is the dominance warning, see r32789.
3885 # C4065 is about default only switches.
3886 # C4996 is about deprected function (CRT only?).
3887 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
3888 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -EHsc -GF -MD$(VBOX_VCC_CRT_TYPE) -W3 -wd4065 -wd4996 -wd4250 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
3889 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
3890 TEMPLATE_VBOXMAINEXE_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE)
3891 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
3892 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
3893 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
3894 TEMPLATE_VBOXMAINEXE_CFLAGS.dbgopt = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.dbgopt)
3895 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
3896 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
3897 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
3898 /DISALLOWLIB:libc.lib \
3899 /DISALLOWLIB:libcd.lib \
3900 /DISALLOWLIB:libcmt.lib \
3901 /DISALLOWLIB:libcmtd.lib \
3902 /DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE_N).lib \
3903 /DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE_N).lib
3904 TEMPLATE_VBOXMAINEXE_LIBS = \
3905 $(LIB_RUNTIME) \
3906 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
3907 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
3908 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
3909 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls$(VBOX_VCC_CRT_TYPE).lib
3910 TEMPLATE_VBOXMAINEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
3911
3912else # the GCC guys:
3913
3914TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
3915TEMPLATE_VBOXMAINEXE_CXXFLAGS = -g $(VBOX_GCC_pipe) \
3916 $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) -Wno-long-long -Wno-non-virtual-dtor -Wshadow \
3917 -fshort-wchar -fpermissive -fexceptions -frtti $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing \
3918 $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
3919TEMPLATE_VBOXMAINEXE_CXXFLAGS.x86 = -m32
3920TEMPLATE_VBOXMAINEXE_CXXFLAGS.amd64 = -m64
3921TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
3922TEMPLATE_VBOXMAINEXE_CFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) \
3923 $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-hidden)
3924TEMPLATE_VBOXMAINEXE_CFLAGS.x86 = -m32
3925TEMPLATE_VBOXMAINEXE_CFLAGS.amd64 = -m64
3926TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
3927TEMPLATE_VBOXMAINEXE_OBJCFLAGS = $(TEMPLATE_VBOXMAINEXE_CFLAGS)
3928TEMPLATE_VBOXMAINEXE_OBJCFLAGS.x86 = $(TEMPLATE_VBOXMAINEXE_CFLAGS.x86)
3929TEMPLATE_VBOXMAINEXE_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXMAINEXE_CFLAGS.amd64)
3930TEMPLATE_VBOXMAINEXE_OBJCFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile)
3931TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
3932TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.x86)
3933TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.amd64)
3934TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS.kprofile= $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
3935TEMPLATE_VBOXMAINEXE_LDFLAGS.x86 = -m32
3936TEMPLATE_VBOXMAINEXE_LDFLAGS.amd64 = -m64
3937 ifeq ($(KBUILD_TARGET),linux)
3938TEMPLATE_VBOXMAINEXE_LIBS = pthread m rt $(LIB_RUNTIME) dl
3939TEMPLATE_VBOXMAINEXE_LDFLAGS.linux = $(VBOX_LD_as_needed)
3940 else ifeq ($(KBUILD_TARGET),os2)
3941TEMPLATE_VBOXMAINEXE_TOOL = GXX3OMF
3942TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
3943 else ifeq ($(KBUILD_TARGET),darwin)
3944TEMPLATE_VBOXMAINEXE_TOOL = GXX4MACHO
3945TEMPLATE_VBOXMAINEXE_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
3946TEMPLATE_VBOXMAINEXE_CFLAGS += $(VBOX_DARWIN_DEF_SDK_CFLAGS)
3947TEMPLATE_VBOXMAINEXE_CXXFLAGS += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
3948TEMPLATE_VBOXMAINEXE_OBJCFLAGS += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
3949TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS += $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS)
3950TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin += -bind_at_load
3951TEMPLATE_VBOXMAINEXE_LDFLAGS += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -framework Carbon
3952TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
3953 else ifeq ($(KBUILD_TARGET),haiku)
3954TEMPLATE_VBOXMAINEXE_TOOL = GXX3
3955TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) network stdc++ supc++
3956 else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd)
3957TEMPLATE_VBOXMAINEXE_TOOL = GXX3
3958TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
3959TEMPLATE_VBOXMAINEXE_INCS += \
3960 /usr/include \
3961 /usr/X11R6/include \
3962 /usr/local/include
3963TEMPLATE_VBOXMAINEXE_LIBPATH += \
3964 /usr/lib \
3965 /usr/X11R6/lib \
3966 /usr/local/lib
3967else ifeq ($(KBUILD_TARGET),solaris)
3968TEMPLATE_VBOXMAINEXE_TOOL = GXX3PLAIN
3969TEMPLATE_VBOXMAINEXE_DEFS += _REENTRANT
3970TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt thread
3971 else
3972$(warning Warning: VBOX Build: Target $(KBUILD_TARGET) is not officially supported!)
3973TEMPLATE_VBOXMAINEXE_LIBS =
3974 endif
3975TEMPLATE_VBOXMAINEXE_LDFLAGS.solaris = -Wl,-z,ignore # Same as VBOX_LD_as_needed.
3976 ifdef VBOX_WITH_RUNPATH
3977TEMPLATE_VBOXMAINEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
3978 else ifdef VBOX_WITH_RELATIVE_RUNPATH
3979TEMPLATE_VBOXMAINEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
3980 endif
3981 ifdef VBOX_WITH_ORIGIN
3982TEMPLATE_VBOXMAINEXE_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT)
3983 endif
3984
3985endif # !win
3986
3987# Add COM/XPCOM stuff
3988TEMPLATE_VBOXMAINEXE_LIBS += \
3989 $(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
3990ifdef VBOX_WITH_XPCOM
3991 ## @todo may be worth creating the VBOX_XPCOM SDK def
3992 TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
3993 ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
3994 TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
3995 endif
3996 TEMPLATE_VBOXMAINEXE_INCS += \
3997 $(VBOX_XPCOM_INCS)
3998 TEMPLATE_VBOXMAINEXE_LIBS += \
3999 $(LIB_XPCOM)
4000 TEMPLATE_VBOXMAINEXE_INTERMEDIATES += \
4001 $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h
4002
4003else # COM
4004 TEMPLATE_VBOXMAINEXE_INCS += \
4005 $(VBOX_PATH_SDK)/bindings/mscom/include
4006 TEMPLATE_VBOXMAINEXE_INTERMEDIATES += \
4007 $(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h
4008endif # COM
4009
4010#
4011# Template for building the Main DLL modules (such as in-process COM/XPCOM
4012# components for Main).
4013#
4014# This differs from VBOXMAINEXE only in PIC handling and similar DLL stuff.
4015#
4016TEMPLATE_VBOXMAINDLL = VBox Main Component (shared library)
4017TEMPLATE_VBOXMAINDLL_EXTENDS = VBOXMAINEXE
4018ifn1of ($(KBUILD_TARGET), darwin haiku os2 win)
4019 TEMPLATE_VBOXMAINDLL_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
4020 TEMPLATE_VBOXMAINDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
4021 TEMPLATE_VBOXMAINDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
4022 TEMPLATE_VBOXMAINDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
4023endif
4024TEMPLATE_VBOXMAINDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin)) \
4025 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
4026 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
4027
4028#
4029# Template identical to VBOXMAINDLL except for where the stuff is
4030# installed when using XPCOM (components/).
4031#
4032# Note! In the hardened build this gets a bit ugly since $ORIGIN/..
4033# doesn't work. So, we keep the $ORIGIN from VBOXMAINEXE and let
4034# the installers do the necessary .so symlinking.
4035#
4036# (No difference when building against COM on Windows.)
4037#
4038TEMPLATE_VBOXMAINCOMP = VBox Main COM/XPCOM Component (shared library)
4039TEMPLATE_VBOXMAINCOMP_EXTENDS = VBOXMAINEXE
4040ifn1of ($(KBUILD_TARGET), win)
4041 TEMPLATE_VBOXMAINCOMP_INST = $(INST_BIN)components/
4042endif
4043ifneq ($(KBUILD_TARGET),win)
4044 ifeq ($(filter-out solaris.x86 %.amd64 %.sparc32 %.sparc64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) ## TODO: cleanup!
4045 TEMPLATE_VBOXMAINCOMP_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
4046 TEMPLATE_VBOXMAINCOMP_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
4047 TEMPLATE_VBOXMAINCOMP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
4048 if defined(VBOX_WITH_RELATIVE_RUNPATH) && !defined(VBOX_WITH_HARDENING)
4049 TEMPLATE_VBOXMAINCOMP_LDFLAGS = -fPIC $(filter-out '$(VBOX_GCC_RPATH_OPT)%',$(TEMPLATE_VBOXMAINEXE_LDFLAGS)) '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..'
4050 else
4051 TEMPLATE_VBOXMAINCOMP_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
4052 endif
4053 else ifndef VBOX_WITH_HARDENING
4054 ifdef VBOX_WITH_RELATIVE_RUNPATH
4055 TEMPLATE_VBOXMAINCOMP_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%',$(TEMPLATE_VBOXMAINEXE_LDFLAGS)) '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..'
4056 endif
4057 endif
4058endif
4059TEMPLATE_VBOXMAINCOMP_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin)) \
4060 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
4061 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
4062
4063#
4064# Template for building the Main static libraries.
4065#
4066# This differs from VBOXMAINDLL only that it zeroes out the _LIBS definition.
4067#
4068TEMPLATE_VBOXMAINLIB = VBox Main Component (static library)
4069TEMPLATE_VBOXMAINLIB_EXTENDS = VBOXMAINDLL
4070TEMPLATE_VBOXMAINLIB_LIBS =
4071
4072#
4073# Template for building executables that use the VBox Main component.
4074#
4075TEMPLATE_VBOXMAINCLIENTEXE = VBox Main Client (executable)
4076TEMPLATE_VBOXMAINCLIENTEXE_EXTENDS = VBOXMAINEXE
4077ifeq ($(KBUILD_TARGET),win)
4078 TEMPLATE_VBOXMAINCLIENTEXE_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
4079 $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/User32.Lib \
4080 $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/Shell32.Lib \
4081 $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/ShLwApi.Lib \
4082 $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/Ole32.Lib \
4083 $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/OleAut32.Lib \
4084 $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/Uuid.Lib
4085else
4086 TEMPLATE_VBOXMAINCLIENTEXE_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
4087 NDEBUG TRIMMED
4088 TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
4089 -pthread
4090endif
4091
4092#
4093# Template for building shared libraries / DLLs that use the VBox Main component.
4094#
4095# This differs from VBOXMAINCLIENTEXE only in PIC handling and similar DLL stuff.
4096#
4097TEMPLATE_VBOXMAINCLIENTDLL = VBox MAIN Client (shared library)
4098TEMPLATE_VBOXMAINCLIENTDLL_EXTENDS = VBOXMAINCLIENTEXE
4099ifn1of ($(KBUILD_TARGET), darwin os2 win)
4100 TEMPLATE_VBOXMAINCLIENTDLL_DEFS = PIC $(TEMPLATE_VBOXMAINCLIENTEXE_DEFS)
4101 TEMPLATE_VBOXMAINCLIENTDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CFLAGS)
4102 TEMPLATE_VBOXMAINCLIENTDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS)
4103 TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)
4104endif
4105TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin))
4106
4107
4108
4109#
4110# Templates used for building the extension packs.
4111#
4112ifdef VBOX_WITH_EXTPACK
4113 # Base templates (native or portable).
4114 TEMPLATE_VBoxR3ExtPack = For the ring-3 context extension pack modules.
4115 if 1 # Native for now.
4116 TEMPLATE_VBoxR3ExtPack_EXTENDS = VBOXR3DLLNOXCPT
4117 TEMPLATE_VBoxR3ExtPack_DEFS = $(TEMPLATE_VBOXR3DLLNOXCPT_DEFS) VBOX_IN_EXTPACK VBOX_IN_EXTPACK_R3
4118 else
4119 TEMPLATE_VBoxR3ExtPack_EXTENDS = VBOXNOCRTGCC
4120 TEMPLATE_VBoxR3ExtPack_DEFS = $(TEMPLATE_VBOXNOCRTGCC_DEFS) VBOX_IN_EXTPACK VBOX_IN_EXTPACK_R3 IPRT_NO_CRT IN_RING3
4121 TEMPLATE_VBoxR3ExtPack_INCS = $(PATH_ROOT)/include/iprt/nocrt $(TEMPLATE_VBOXR3DLLNOXCPT_INCS)
4122 endif
4123 ifneq ($(KBUILD_TARGET),win)
4124 TEMPLATE_VBoxR3ExtPack_CXXFLAGS = $(TEMPLATE_VBOXR3DLLNOXCPT_CXXFLAGS) -fno-rtti
4125 endif
4126 TEMPLATE_VBoxR3ExtPack_INST = $(INST_EXTPACK)YouShallOverrideThis/
4127 ifeq ($(KBUILD_TARGET),linux)
4128 TEMPLATE_VBoxR3ExtPack_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)', $(TEMPLATE_VBOXR3DLLNOXCPT_LDFLAGS))
4129 else
4130 if !defined(VBOX_WITH_RUNPATH) && defined(VBOX_WITH_RELATIVE_RUNPATH)
4131 TEMPLATE_VBoxR3ExtPack_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/../../..' $(filter-out '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)', $(TEMPLATE_VBOXR3DLLNOXCPT_LDFLAGS))
4132 endif
4133 endif
4134 ifdef VBOX_ONLY_EXTPACKS_USE_IMPLIBS
4135 if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), win.amd64)
4136 TEMPLATE_VBoxR3ExtPack_LIBS = \
4137 $(TEMPLATE_LIBS_VBOXR3) \
4138 $(VBOX_LIB_VMM_LAZY) \
4139 $(PATH_STAGE_LIB)/VBoxRTImp$(VBOX_SUFF_LIB)
4140 else if1of ($(KBUILD_TARGET), win os2)
4141 TEMPLATE_VBoxR3ExtPack_LIBS = \
4142 $(TEMPLATE_LIBS_VBOXR3) \
4143 $(PATH_STAGE_LIB)/VMMR3Imp$(VBOX_SUFF_LIB) \
4144 $(PATH_STAGE_LIB)/VBoxRTImp$(VBOX_SUFF_LIB)
4145 else
4146 TEMPLATE_VBoxR3ExtPack_LIBS = \
4147 $(TEMPLATE_LIBS_VBOXR3) \
4148 $(PATH_STAGE_LIB)/VMMR3Imp$(VBOX_SUFF_DLL) \
4149 $(PATH_STAGE_LIB)/VBoxRTImp$(VBOX_SUFF_DLL)
4150 endif
4151 else
4152 TEMPLATE_VBoxR3ExtPack_LIBS = \
4153 $(TEMPLATE_LIBS_VBOXR3) \
4154 $(LIB_RUNTIME) \
4155 $(VBOX_LIB_VMM_LAZY)
4156 endif
4157
4158 TEMPLATE_VBoxR0ExtPack = For the ring-0 context extension pack modules.
4159 TEMPLATE_VBoxR0ExtPack_EXTENDS = VBoxR0
4160 TEMPLATE_VBoxR0ExtPack_EXTENDS_BY = appending
4161 TEMPLATE_VBoxR0ExtPack_INST = $(INST_EXTPACK)YouShallOverrideThis/
4162 TEMPLATE_VBoxR0ExtPack_DEFS = VBOX_IN_EXTPACK VBOX_IN_EXTPACK_R0
4163 if1of ($(VBOX_LDR_FMT), pe lx)
4164 TEMPLATE_VBoxR0ExtPack_LIBS = \
4165 $(PATH_STAGE_LIB)/VMMR0Imp$(VBOX_SUFF_LIB) \
4166 $(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
4167 endif
4168
4169 TEMPLATE_VBoxRcExtPack = For the raw-mode context extension pack modules.
4170 TEMPLATE_VBoxRcExtPack_EXTENDS = VBoxRc
4171 TEMPLATE_VBoxRcExtPack_EXTENDS_BY = appending
4172 TEMPLATE_VBoxRcExtPack_SYSSUFF = .rc
4173 TEMPLATE_VBoxRcExtPack_INST = $(INST_EXTPACK)YouShallOverrideThis/
4174 TEMPLATE_VBoxRcExtPack_DEFS = VBOX_IN_EXTPACK VBOX_IN_EXTPACK_RC
4175 if1of ($(VBOX_LDR_FMT32), pe lx)
4176 TEMPLATE_VBoxRcExtPack_LIBS = \
4177 $(PATH_STAGE_LIB)/VMMRCBuiltin$(VBOX_SUFF_LIB) \
4178 $(PATH_STAGE_LIB)/VMMRCImp$(VBOX_SUFF_LIB)
4179 endif
4180
4181 TEMPLATE_VBoxInsExtPack = For the install targets of an extension pack.
4182 TEMPLATE_VBoxInsExtPack_MODE = 0644
4183 TEMPLATE_VBoxInsExtPack_INST = $(INST_EXTPACK)YouShallOverrideThis/
4184
4185 # For each individual extension pack
4186 ifdef VBOX_WITH_EXTPACK_PUEL
4187 TEMPLATE_VBoxR3ExtPackPuel = For the ring-3 context modules in the PUEL extension pack.
4188 TEMPLATE_VBoxR3ExtPackPuel_EXTENDS = VBoxR3ExtPack
4189 TEMPLATE_VBoxR3ExtPackPuel_INST = $(INST_EXTPACK_PUEL)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
4190
4191 TEMPLATE_VBoxR0ExtPackPuel = For the ring-0 context modules in the PUEL extension pack.
4192 TEMPLATE_VBoxR0ExtPackPuel_EXTENDS = VBoxR0ExtPack
4193 TEMPLATE_VBoxR0ExtPackPuel_INST = $(INST_EXTPACK_PUEL)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
4194
4195 TEMPLATE_VBoxRcExtPackPuel = For the raw-mode context modules in the PUEL extension pack.
4196 TEMPLATE_VBoxRcExtPackPuel_EXTENDS = VBoxRcExtPack
4197 TEMPLATE_VBoxRcExtPackPuel_INST = $(INST_EXTPACK_PUEL)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
4198
4199 TEMPLATE_VBoxInsExtPackPuel = For the install targets of an extension pack.
4200 TEMPLATE_VBoxInsExtPackPuel_EXTENDS = VBoxR0ExtPack
4201 TEMPLATE_VBoxInsExtPackPuel_INST = $(INST_EXTPACK_PUEL)
4202endif
4203endif # VBOX_WITH_EXTPACK
4204
4205
4206#
4207# Qt 4
4208# Qt 4
4209# Qt 4
4210#
4211ifdef VBOX_WITH_QTGUI
4212
4213 # Guess VBOX_WITH_QT4_SUN
4214 ifndef VBOX_WITH_QT4_SUN
4215 ifndef VBOX_OSE
4216 if1of ($(KBUILD_TARGET), darwin solaris win)
4217 VBOX_WITH_QT4_SUN := 1
4218 endif
4219 endif
4220 endif
4221
4222 #
4223 # Handmade configuration of qt4 - very annoying, this needs to
4224 # be cleaned up properly later some time (not important now).
4225 #
4226 ifeq ($(VBOX_PATH_QT4),)
4227 ifeq ($(KBUILD_TARGET),darwin)
4228 VBOX_PATH_QT4 := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
4229 ifeq ($(VBOX_PATH_QT4),)
4230 ifneq ($(wildcard /Library/Frameworks/QtCore.framework),)
4231 # Using the global installation (for OSE).
4232 VBOX_PATH_QT4 ?= /usr
4233 VBOX_PATH_QT4_FRAMEWORKS ?= /Library/Frameworks
4234 endif
4235 endif
4236 else if1of ($(KBUILD_TARGET), win)
4237 VBOX_PATH_QT4 ?= $(lastword $(filter %-$(tolower $(VBOX_VCC_TOOL_STEM)),$(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*))))
4238 else if1of ($(KBUILD_TARGET), linux solaris)
4239 VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
4240 ifneq ($(VBOX_PATH_QT4),)
4241 VBOX_WITH_QT4_SUN = 1
4242 endif
4243 endif
4244 endif
4245 ifeq ($(VBOX_PATH_QT4),)
4246 if1of ($(USERNAME), bird)
4247 # gentoo (64-bit)
4248 VBOX_PATH_QT4 ?= /usr
4249 VBOX_PATH_QT4_LIB ?= /usr/lib/qt4
4250 endif
4251 endif
4252 VBOX_PATH_QT4 ?= /usr
4253 VBOX_PATH_QT4_LIB ?= $(VBOX_PATH_QT4)/lib
4254
4255 ifdef VBOX_WITH_QT4_SUN
4256 VBOX_QT4_INFIX=VBox
4257 endif
4258
4259 VBOX_QT4_MOD = QtCore QtGui QtNetwork $(if $(VBOX_GUI_USE_QGL),QtOpenGL,)
4260 VBOX_QT4_MOD_NAMES = $(foreach qtmod,$(VBOX_QT4_MOD),$(qtmod)$(VBOX_QT4_INFIX))
4261
4262 # Hack LD_LIBRARY_PATH for stuff in tools.
4263 ifdef VBOX_WITH_QT4_SUN
4264 if1of ($(KBUILD_TARGET), linux)
4265 export LD_LIBRARY_PATH := $(VBOX_PATH_QT4_LIB):$(LD_LIBRARY_PATH)
4266 endif
4267 endif
4268
4269
4270 #
4271 # Template for building Qt GUI executables.
4272 #
4273 TEMPLATE_VBOXQT4GUIEXE = VBox Qt GUI Executable
4274 TEMPLATE_VBOXQT4GUIEXE_USES = qt4
4275 TEMPLATE_VBOXQT4GUIEXE_QTTOOL = QT4
4276 TEMPLATE_VBOXQT4GUIEXE_MOCTOOL = QT4
4277 TEMPLATE_VBOXQT4GUIEXE_UICTOOL = QT4
4278 TEMPLATE_VBOXQT4GUIEXE_RCCTOOL = QT4
4279 TEMPLATE_VBOXQT4GUIEXE_LRCTOOL = QT4
4280 TEMPLATE_VBOXQT4GUIEXE_SDKS = QT4
4281 TEMPLATE_VBOXQT4GUIEXE_QT_INFIX = $(VBOX_QT4_INFIX)
4282 TEMPLATE_VBOXQT4GUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT QT_SHARED HAVE_CONFIG_H $(ARCH_BITS_DEFS)
4283 TEMPLATE_VBOXQT4GUIEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
4284
4285 ifeq ($(KBUILD_TARGET),win)
4286 # Note! No use of VBOX_VCC_CRT_TYPE here yet as it requires a /MDd build of Qt as well.
4287 TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_VCC_TOOL)
4288 TEMPLATE_VBOXQT4GUIEXE_DEFS += \
4289 _WIN32_WINNT=0x0500 UNICODE _UNICODE \
4290 QT_DLL _CRT_SECURE_NO_DEPRECATE \
4291 $(QMAKE_PRL_DEFINES)
4292 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = -nologo -Zm200 -W3 -MD -Zi -EHsc -Zc:wchar_t-
4293 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.debug = -RTCsu
4294 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE)
4295 TEMPLATE_VBOXQT4GUIEXE_INCS += \
4296 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
4297 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS = \
4298 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG
4299 TEMPLATE_VBOXQT4GUIEXE_SDKS += $(VBOX_WINPSDK)
4300 TEMPLATE_VBOXQT4GUIEXE_LIBS = \
4301 $(VBOX_LIBS_QT4) \
4302 $(LIB_RUNTIME) \
4303 $(VBOX_LIB_VMM_LAZY) \
4304 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
4305 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
4306 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
4307 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
4308 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
4309 ifdef VBOX_WITH_DEBUG_VCC_CRT # VBoxCOM (static) is causing trouble of course.
4310 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
4311 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
4312 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib
4313 endif
4314 TEMPLATE_VBOXQT4GUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
4315 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.win.x86 += /LARGEADDRESSAWARE
4316
4317 else # the gcc guys:
4318 TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_GCC_TOOL)
4319 TEMPLATE_VBOXQT4GUIEXE_DEFS.linux = _REENTRANT
4320
4321 TEMPLATE_VBOXQT4GUIEXE_DEFS.solaris = _REENTRANT
4322
4323 TEMPLATE_VBOXQT4GUIEXE_INCS += \
4324 $(LIB_SDL_INC)
4325 ## @todo Use VBOX_GCC_PEDANTIC_CXX?
4326 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
4327 -g $(VBOX_GCC_pipe) $(filter-out -Wno-unused,$(VBOX_GCC_WARN)) -frtti -fno-exceptions -Wno-non-virtual-dtor \
4328 -Wno-long-long -fshort-wchar -fno-strict-aliasing \
4329 $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) \
4330 $(VBOX_GCC_Wno-delete-non-virtual-dtor)
4331 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.x86 = -m32
4332 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.amd64 = -m64
4333 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.linux = -pthread
4334 TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_C) -Wno-long-long -fno-exceptions
4335 TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS.x86 = $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.x86)
4336 TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.amd64)
4337 TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS = \
4338 -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_CXX) -Wno-non-virtual-dtor -Wno-long-long \
4339 -frtti -fno-exceptions $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
4340 TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.x86)
4341 TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.amd64)
4342 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.x86 = -m32
4343 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.amd64 = -m64
4344 TEMPLATE_VBOXQT4GUIEXE_LIBS = \
4345 $(VBOX_LIBS_QT4) \
4346 $(LIB_SDL) \
4347 $(LIB_RUNTIME) \
4348 $(if-expr "$(LIB_VMM)" == "$(VBOX_LIB_VMM_LAZY)",$(LIB_REM),) \
4349 $(VBOX_LIB_VMM_LAZY)
4350
4351 ifeq ($(KBUILD_TARGET),linux)
4352 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += $(VBOX_LD_as_needed)
4353 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
4354 $(VBOX_XCURSOR_LIBS) \
4355 Xext \
4356 X11
4357 TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
4358 $(VBOX_LIBPATH_X11)
4359 else ifeq ($(KBUILD_TARGET),darwin)
4360 TEMPLATE_VBOXQT4GUIEXE_DEFS.darwin += $(VBOX_DARWIN_DEF_SDK_DEFS)
4361 TEMPLATE_VBOXQT4GUIEXE_CFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CFLAGS)
4362 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
4363 TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
4364 TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS)
4365 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -bind_at_load
4366 TEMPLATE_VBOXQT4GUIEXE_LIBS +=
4367 TEMPLATE_VBOXQT4GUIEXE_LIBPATH +=
4368 else
4369 TEMPLATE_VBOXQT4GUIEXE_INCS += \
4370 $(VBOX_XCURSOR_INCS)
4371 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
4372 $(VBOX_XCURSOR_LIBS) \
4373 Xext \
4374 X11 \
4375 m \
4376 $(LIB_PTHREAD)
4377 TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
4378 $(VBOX_LIBPATH_X11)
4379 ifeq ($(KBUILD_TARGET),freebsd)
4380 TEMPLATE_VBOXQT4GUIEXE_INCS += \
4381 /usr/include \
4382 /usr/X11R6/include \
4383 /usr/local/include
4384 TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
4385 /usr/lib \
4386 /usr/X11R6/lib \
4387 /usr/local/lib
4388 endif
4389 ifeq ($(KBUILD_TARGET),solaris)
4390 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.solaris = -Wl,-z,ignore # Same as VBOX_LD_as_needed.
4391 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
4392 rt socket nsl
4393 endif
4394 endif
4395 # Assume the Qt shared objects are in the same directory as the executable, on Solaris too.
4396 ifdef VBOX_WITH_RUNPATH
4397 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
4398 else ifdef VBOX_WITH_RELATIVE_RUNPATH
4399 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
4400 endif
4401
4402 endif
4403
4404 # Add COM/XPCOM stuff
4405 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
4406 $(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
4407 ifdef VBOX_WITH_XPCOM
4408 ## @todo may be worth creating the VBOX_XPCOM SDK def, or just a SDK_VBOXXPCOM.
4409 TEMPLATE_VBOXQT4GUIEXE_DEFS += VBOX_WITH_XPCOM
4410 ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
4411 TEMPLATE_VBOXQT4GUIEXE_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
4412 endif
4413 TEMPLATE_VBOXQT4GUIEXE_INCS += \
4414 $(VBOX_XPCOM_INCS)
4415 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
4416 $(LIB_XPCOM)
4417 TEMPLATE_VBOXQT4GUIEXE_INTERMEDIATES += \
4418 $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h
4419 else # COM
4420 TEMPLATE_VBOXQT4GUIEXE_INCS += \
4421 $(VBOX_PATH_SDK)/bindings/mscom/include
4422 TEMPLATE_VBOXQT4GUIEXE_INTERMEDIATES += \
4423 $(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h
4424 endif # COM
4425
4426
4427 #
4428 # Template for building Qt GUI components.
4429 #
4430 TEMPLATE_VBOXQT4GUI = VBox Qt GUI Components
4431 TEMPLATE_VBOXQT4GUI_EXTENDS = VBOXQT4GUIEXE
4432 TEMPLATE_VBOXQT4GUI_LIBS = $(filter-out $(QTMAIN),$(TEMPLATE_VBOXQT4GUIEXE_LIBS))
4433 ifeq ($(KBUILD_TARGET),darwin)
4434 TEMPLATE_VBOXQT4GUI_LDFLAGS.darwin += $(filter-out -bind_at_load,$(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.darwin)) \
4435 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
4436 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
4437 endif
4438 ifn1of ($(KBUILD_TARGET), darwin os2 win)
4439 TEMPLATE_VBOXQT4GUI_DEFS = PIC $(TEMPLATE_VBOXQT4GUIEXE_DEFS)
4440 TEMPLATE_VBOXQT4GUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CFLAGS)
4441 TEMPLATE_VBOXQT4GUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS)
4442 TEMPLATE_VBOXQT4GUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS)
4443 endif
4444
4445endif # VBOX_WITH_QTGUI
4446
4447
4448#
4449# Template for building build bldprogs.
4450#
4451# HACK ALERT! The BLD_TRG_* is a hack to allow building libraries as well.
4452#
4453TEMPLATE_VBOXBLDPROG = VBox Build Program
4454TEMPLATE_VBOXBLDPROG_BLD_TRG := $(KBUILD_HOST)
4455TEMPLATE_VBOXBLDPROG_BLD_TRG_ARCH := $(KBUILD_HOST_ARCH)
4456TEMPLATE_VBOXBLDPROG_BLD_TRG_CPU := $(KBUILD_HOST_CPU)
4457TEMPLATE_VBOXBLDPROG_DEFS := IN_RING3 LOG_DISABLED
4458TEMPLATE_VBOXBLDPROG_DEFS.win := _CRT_SECURE_NO_DEPRECATE
4459TEMPLATE_VBOXBLDPROG_ASTOOL := $(VBOX_ASTOOL)
4460TEMPLATE_VBOXBLDPROG_ASFLAGS.x86 := $(VBOX_ASFLAGS32)
4461TEMPLATE_VBOXBLDPROG_ASFLAGS.amd64 := $(VBOX_ASFLAGS64)
4462ifeq ($(KBUILD_HOST),win)
4463 TEMPLATE_VBOXBLDPROG_TOOL := $(VBOX_VCC_TOOL_STEM)$(toupper $(KBUILD_HOST_ARCH))
4464 TEMPLATE_VBOXBLDPROG_SDKS := ReorderCompilerIncs $(VBOX_WINPSDK)
4465 TEMPLATE_VBOXBLDPROG_CXXFLAGS := -Zi -Zl -GR- -EHsc -GF -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP) -MT$(VBOX_VCC_CRT_TYPE)
4466 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug := -RTCsu
4467 TEMPLATE_VBOXBLDPROG_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE)
4468 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
4469 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
4470 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
4471 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
4472 TEMPLATE_VBOXBLDPROG_CFLAGS.dbgopt = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.dbgopt)
4473 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
4474 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
4475 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
4476 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
4477 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
4478 /DISALLOWLIB:libc$(VBOX_VCC_CRT_TYPE_N).lib \
4479 /DISALLOWLIB:libcmt$(VBOX_VCC_CRT_TYPE_N).lib \
4480 /DISALLOWLIB:msvcrt.lib \
4481 /DISALLOWLIB:msvcrtd.lib \
4482 /DISALLOWLIB:msvcprt.lib \
4483 /DISALLOWLIB:msvcprtd.lib
4484 TEMPLATE_VBOXBLDPROG_LIBS = \
4485 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
4486 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
4487 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
4488
4489else
4490# (gcc of some kind )
4491TEMPLATE_VBOXBLDPROG_TOOL = GXX3
4492TEMPLATE_VBOXBLDPROG_CFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros)
4493TEMPLATE_VBOXBLDPROG_CFLAGS.x86 = -m32
4494TEMPLATE_VBOXBLDPROG_CFLAGS.sparc32 = -m32
4495TEMPLATE_VBOXBLDPROG_CFLAGS.amd64 = -m64
4496TEMPLATE_VBOXBLDPROG_CFLAGS.sparc64 = -m64
4497TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
4498TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
4499TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
4500TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros)
4501TEMPLATE_VBOXBLDPROG_CXXFLAGS.x86 = -m32
4502TEMPLATE_VBOXBLDPROG_CXXFLAGS.sparc32 = -m32
4503TEMPLATE_VBOXBLDPROG_CXXFLAGS.amd64 = -m64
4504TEMPLATE_VBOXBLDPROG_CXXFLAGS.sparc64 = -m64
4505TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
4506TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
4507TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
4508TEMPLATE_VBOXBLDPROG_OBJCFLAGS = $(TEMPLATE_VBOXBLDPROG_CFLAGS)
4509TEMPLATE_VBOXBLDPROG_OBJCFLAGS.x86 = $(TEMPLATE_VBOXBLDPROG_CFLAGS.x86)
4510TEMPLATE_VBOXBLDPROG_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXBLDPROG_CFLAGS.amd64)
4511TEMPLATE_VBOXBLDPROG_OBJCFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CFLAGS.release)
4512TEMPLATE_VBOXBLDPROG_OBJCFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CFLAGS.profile)
4513TEMPLATE_VBOXBLDPROG_OBJCFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile)
4514TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
4515TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.x86)
4516TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.amd64)
4517TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
4518TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
4519TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.kprofile= $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
4520TEMPLATE_VBOXBLDPROG_LDFLAGS.x86 = -m32
4521TEMPLATE_VBOXBLDPROG_LDFLAGS.sparc32 = -m32
4522TEMPLATE_VBOXBLDPROG_LDFLAGS.amd64 = -m64
4523TEMPLATE_VBOXBLDPROG_LDFLAGS.sparc64 = -m64
4524 ifeq ($(KBUILD_HOST),linux)
4525TEMPLATE_VBOXBLDPROG_LIBS = pthread m rt dl
4526 else ifeq ($(KBUILD_HOST),os2)
4527TEMPLATE_VBOXBLDPROG_TOOL = GXX3OMF
4528TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
4529 else ifeq ($(KBUILD_HOST),darwin)
4530TEMPLATE_VBOXBLDPROG_TOOL = GXX4MACHO
4531 if "$(VBOX_DEF_MACOSX_VERSION_MIN)" == "10.7" || "$(VBOX_DARWIN_HOST_VERSION_MAJOR)" == "7"
4532TEMPLATE_VBOXBLDPROG_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_DEFS)
4533TEMPLATE_VBOXBLDPROG_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_CFLAGS) -fno-common
4534TEMPLATE_VBOXBLDPROG_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_CXXFLAGS)
4535TEMPLATE_VBOXBLDPROG_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
4536TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
4537TEMPLATE_VBOXBLDPROG_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_LDFLAGS)
4538 else if "$(VBOX_DEF_MACOSX_VERSION_MIN)" == "10.6" || "$(VBOX_DARWIN_HOST_VERSION_MAJOR)" == "6"
4539TEMPLATE_VBOXBLDPROG_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_DEFS)
4540TEMPLATE_VBOXBLDPROG_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_CFLAGS) -fno-common
4541TEMPLATE_VBOXBLDPROG_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_CXXFLAGS)
4542TEMPLATE_VBOXBLDPROG_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
4543TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
4544TEMPLATE_VBOXBLDPROG_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_LDFLAGS)
4545 else if "$(VBOX_DEF_MACOSX_VERSION_MIN)" == "10.5" || "$(VBOX_DARWIN_HOST_VERSION_MAJOR)" == "5" || defined(VBOX_MACOS_10_5_WORKAROUND)
4546TEMPLATE_VBOXBLDPROG_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_DEFS)
4547TEMPLATE_VBOXBLDPROG_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CFLAGS) -fno-common
4548TEMPLATE_VBOXBLDPROG_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS)
4549TEMPLATE_VBOXBLDPROG_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
4550TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
4551TEMPLATE_VBOXBLDPROG_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS)
4552 else
4553TEMPLATE_VBOXBLDPROG_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_DEFS)
4554TEMPLATE_VBOXBLDPROG_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -fno-common
4555TEMPLATE_VBOXBLDPROG_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
4556TEMPLATE_VBOXBLDPROG_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
4557TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
4558TEMPLATE_VBOXBLDPROG_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
4559 endif
4560TEMPLATE_VBOXBLDPROG_LIBS =
4561 else ifeq ($(KBUILD_HOST),haiku)
4562TEMPLATE_VBOXBLDPROG_TOOL = GXX3
4563TEMPLATE_VBOXBLDPROG_LIBS = network iconv
4564TEMPLATE_VBOXBLDPROG_LIBPATH += \
4565 /boot/common/lib
4566 else if1of ($(KBUILD_HOST), freebsd netbsd openbsd)
4567TEMPLATE_VBOXBLDPROG_TOOL = GXX3
4568TEMPLATE_VBOXBLDPROG_LIBS = pthread
4569TEMPLATE_VBOXBLDPROG_INCS += \
4570 /usr/include \
4571 /usr/X11R6/include \
4572 /usr/local/include
4573TEMPLATE_VBOXBLDPROG_LIBPATH += \
4574 /usr/lib \
4575 /usr/X11R6/lib \
4576 /usr/local/lib
4577 else ifeq ($(KBUILD_HOST),solaris)
4578TEMPLATE_VBOXBLDPROG_TOOL = GXX3PLAIN
4579TEMPLATE_VBOXBLDPROG_LIBS = rt
4580 else
4581$(warning Warning: VBOX Build: Target $(KBUILD_HOST) is not officially supported!)
4582 endif
4583
4584endif # !win
4585
4586
4587#
4588# Advanced build programs using IPRT, openssl and worse stuff.
4589#
4590TEMPLATE_VBoxAdvBldProg = Advanced VBox Build Program
4591TEMPLATE_VBoxAdvBldProg_EXTENDS = VBOXBLDPROG
4592TEMPLATE_VBoxAdvBldProg_SDKS = $(TEMPLATE_VBOXBLDPROG_SDKS) VBOX_BLD_OPENSSL
4593TEMPLATE_VBoxAdvBldProg_SDKS.win= $(TEMPLATE_VBOXBLDPROG_SDKS.win) VBOX_NTDLL
4594TEMPLATE_VBoxAdvBldProg_DEFS = $(TEMPLATE_VBOXBLDPROG_DEFS) IN_RT_R3
4595ifeq ($(KBUILD_HOST),win)
4596 TEMPLATE_VBoxAdvBldProg_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CFLAGS) $(VBOX_VCC_WERR)
4597 TEMPLATE_VBoxAdvBldProg_CXXFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS) $(VBOX_VCC_WERR)
4598endif
4599TEMPLATE_VBoxAdvBldProg_LIBS = \
4600 $(PATH_STAGE_LIB)/RuntimeBldProg$(VBOX_SUFF_LIB) \
4601 $(if-expr defined(IPRT_WITH_KSTUFF), \
4602 $(PATH_STAGE_LIB)/VBox-kStuffStaticBldProg$(VBOX_SUFF_LIB) \
4603 $(PATH_STAGE_LIB)/RuntimeBldProg$(VBOX_SUFF_LIB) \
4604 ,) \
4605 $(TEMPLATE_VBOXBLDPROG_LIBS)
4606TEMPLATE_VBoxAdvBldProg_LIBS.darwin = \
4607 $(TEMPLATE_VBOXBLDPROG_LIBS) \
4608 iconv \
4609 $(TEMPLATE_VBOXBLDPROG_LIBS.darwin)
4610TEMPLATE_VBoxAdvBldProg_LIBS.freebsd = \
4611 $(TEMPLATE_VBOXBLDPROG_LIBS) \
4612 iconv \
4613 rt \
4614 $(TEMPLATE_VBOXBLDPROG_LIBS.freebsd)
4615TEMPLATE_VBoxAdvBldProg_LIBS.linux = \
4616 $(TEMPLATE_VBOXBLDPROG_LIBS) \
4617 crypt \
4618 $(TEMPLATE_VBOXBLDPROG_LIBS.linux)
4619TEMPLATE_VBoxAdvBldProg_LIBS.solaris = \
4620 $(TEMPLATE_VBOXBLDPROG_LIBS) \
4621 contract \
4622 kstat \
4623 rt \
4624 socket \
4625 nsl \
4626 $(TEMPLATE_VBOXBLDPROG_LIBS.solaris)
4627
4628
4629#
4630# Windows rc workaround for crosscompiling.
4631# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
4632#
4633ifneq ($(KBUILD_HOST),win)
4634 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
4635 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
4636 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
4637 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
4638else
4639 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
4640 $(PATH_SDK_$(VBOX_WINPSDK)_BIN)/MC.Exe\
4641 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
4642 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
4643 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
4644 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
4645 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
4646 ) Sorry_Cannot_find_mc_in_the_PSDK)
4647endif
4648
4649
4650#
4651# Template for building R3 programs for the guest additions.
4652#
4653TEMPLATE_VBOXGUESTR3EXE = VBox Guest Program
4654ifeq ($(KBUILD_TARGET),win)
4655 TEMPLATE_VBOXGUESTR3EXE_EXTENDS = VBOXR3EXE
4656 TEMPLATE_VBOXGUESTR3EXE_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK_GST) VBOX_NTDLL
4657 TEMPLATE_VBOXGUESTR3EXE_CFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
4658 TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
4659 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS = $(filter-out /DISALLOWLIB:libcmt$(VBOX_VCC_CRT_TYPE).lib /DISALLOWLIB:libcpmt$(VBOX_VCC_CRT_TYPE).lib, $(TEMPLATE_VBOXR3EXE_LDFLAGS)) \
4660 /DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE).lib \
4661 /DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE).lib
4662 TEMPLATE_VBOXGUESTR3EXE_LIBS.x86 = \
4663 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.x86)_LIB)/oldnames.lib \
4664 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
4665 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
4666 TEMPLATE_VBOXGUESTR3EXE_LIBS.amd64 = \
4667 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.amd64)_LIB)/oldnames.lib \
4668 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.amd64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
4669 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
4670 # Hack for running on NT4, W2K and XP w/o SP: Change OS and subsystem version in the image.
4671 # HACK ALERT! Double expansion of $$(NLTAB).
4672 TEMPLATE_VBOXGUESTR3EXE_POST_CMDS.win.x86 = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION) $(out)$$(NLTAB)$(TEMPLATE_VBOXR3EXE_POST_CMDS))
4673 TEMPLATE_VBOXGUESTR3EXE_LNK_DEPS.win.x86 = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION))
4674else # the gcc guys
4675 ifneq ($(VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE),)
4676 ifneq ($(KBUILD_TARGET),linux)
4677 override VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE :=
4678 endif
4679 endif
4680 TEMPLATE_VBOXGUESTR3EXE_EXTENDS = VBOXR3EXE
4681 TEMPLATE_VBOXGUESTR3EXE_TOOL := $(subst GXX,GCC,$(TEMPLATE_VBOXR3EXE_TOOL))
4682 TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fno-exceptions
4683 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBOXR3EXE_LDFLAGS.linux))
4684 ifneq ($(VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE),)
4685 ifeq ($(KBUILD_TARGET_ARCH),x86)
4686 TEMPLATE_VBOXGUESTR3EXE_TOOL := VBoxXGccX86RedHatLinux
4687 else ifeq ($(KBUILD_TARGET_ARCH),amd64)
4688 TEMPLATE_VBOXGUESTR3EXE_TOOL := VBoxXGccAmd64LinuxGnu
4689 TEMPLATE_VBOXGUESTR3EXE_TOOL.x86 := VBoxXGccX86RedHatLinux
4690 endif
4691 TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS := $(filter-out $(VBOX_GCC_pipe) $(VBOX_GCC_Wextra) $(VBOX_GCC_Wno-missing-field-initializers) $(VBOX_GCC_fdiagnostics-show-option) $(VBOX_GCC_Wno-delete-non-virtual-dtor) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden),$(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS)) -pipe
4692 TEMPLATE_VBOXGUESTR3EXE_CFLAGS := $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS)
4693 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux := $(filter-out $(VBOX_GCC_ORIGIN_OPT) $(VBOX_LD_as_needed),$(TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux))
4694 endif
4695 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%,$(TEMPLATE_VBOXR3EXE_LDFLAGS))
4696endif
4697TEMPLATE_VBOXGUESTR3EXE_INST = $(INST_ADDITIONS)
4698TEMPLATE_VBOXGUESTR3EXE_DEFS := $(filter-out $(ARCH_BITS_DEFS), $(TEMPLATE_VBOXR3EXE_DEFS)) IN_GUEST IN_GUEST_R3 IN_RT_R3 $(VBOX_GC_ARCH_BITS_DEFS)
4699TEMPLATE_VBOXGUESTR3EXE_DEFS.linux := $(TEMPLATE_VBOXR3EXE_DEFS.linux) LOG_USE_C99 RT_WITHOUT_EXEC_ALLOC
4700ifeq ($(KBUILD_TARGET),linux) # As few libs as possible on linux.
4701 TEMPLATE_VBOXGUESTR3EXE_LIBS = pthread rt m dl
4702else if1of ($(KBUILD_TARGET), darwin freebsd netbsd openbsd)
4703 TEMPLATE_VBOXGUESTR3EXE_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS) iconv
4704else ifeq ($(KBUILD_TARGET), solaris)
4705 TEMPLATE_VBOXGUESTR3EXE_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS) nsl
4706endif
4707
4708#
4709# Template for building normal R3 programs for the guest additions.
4710#
4711TEMPLATE_NewVBoxGuestR3Exe = VBox Guest Program w/ IPRT and VBGL.
4712TEMPLATE_NewVBoxGuestR3Exe_EXTENDS = VBOXGUESTR3EXE
4713TEMPLATE_NewVBoxGuestR3Exe_LIBS = \
4714 $(VBOX_LIB_IPRT_GUEST_R3) \
4715 $(VBOX_LIB_VBGL_R3) \
4716 $(VBOX_LIB_IPRT_GUEST_R3) \
4717 $(TEMPLATE_VBOXGUESTR3EXE_LIBS)
4718ifeq ($(KBUILD_TARGET),linux)
4719 TEMPLATE_NewVBoxGuestR3Exe_LIBS += crypt
4720endif
4721
4722#
4723# Template for building normal 32-bit R3 programs for the guest additions.
4724#
4725TEMPLATE_NewVBoxGuestR3Exe_X86 = 32-bit VBox Guest Program w/ IPRT and VBGL.
4726TEMPLATE_NewVBoxGuestR3Exe_X86_EXTENDS = NewVBoxGuestR3Exe
4727TEMPLATE_NewVBoxGuestR3Exe_X86_BLD_TRG_ARCH = x86
4728TEMPLATE_NewVBoxGuestR3Exe_X86_LIBS = \
4729 $(VBOX_LIB_IPRT_GUEST_R3_X86) \
4730 $(VBOX_LIB_VBGL_R3_X86) \
4731 $(VBOX_LIB_IPRT_GUEST_R3_X86) \
4732 $(TEMPLATE_VBOXGUESTR3EXE_LIBS)
4733ifeq ($(KBUILD_TARGET),linux)
4734 TEMPLATE_NewVBoxGuestR3Exe_X86_LIBS += crypt
4735endif
4736TEMPLATE_NewVBoxGuestR3Exe_X86_INST = $(INST_ADDITIONS)/32/
4737
4738#
4739# Template for building R3 (dynamic) libraries for the guest additions.
4740#
4741TEMPLATE_VBOXGUESTR3DLL = VBox Guest User Dynamic Libraries
4742TEMPLATE_VBOXGUESTR3DLL_EXTENDS = VBOXGUESTR3EXE
4743## @todo add a INSTFUN that separates dlls and libs.
4744ifn1of ($(KBUILD_TARGET), darwin os2 win)
4745 TEMPLATE_VBOXGUESTR3DLL_DEFS = $(TEMPLATE_VBOXGUESTR3EXE_DEFS) PIC
4746 TEMPLATE_VBOXGUESTR3DLL_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fPIC
4747 TEMPLATE_VBOXGUESTR3DLL_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fPIC -fno-exceptions
4748 TEMPLATE_VBOXGUESTR3DLL_LDFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_LDFLAGS) -fPIC
4749endif
4750
4751#
4752# Template for building normal 32-bit R3 programs for the guest additions.
4753#
4754TEMPLATE_VBOXGUESTR3DLL_X86 = 32-bit VBox Guest User Dynamic Libraries
4755TEMPLATE_VBOXGUESTR3DLL_X86_EXTENDS = VBOXGUESTR3DLL
4756TEMPLATE_VBOXGUESTR3DLL_X86_BLD_TRG_ARCH = x86
4757TEMPLATE_VBOXGUESTR3DLL_X86_INST = $(INST_ADDITIONS)/32/
4758
4759#
4760# Template for building normal R3 (dynamic) libraries for the guest additions, allows warnings.
4761#
4762## @todo rename to VBoxGuestR3DllWarn
4763TEMPLATE_NewVBoxGuestR3Dll = VBox Guest User Dynamic Libraries w/ IPRT and VBGL.
4764TEMPLATE_NewVBoxGuestR3Dll_EXTENDS = VBOXGUESTR3DLL
4765TEMPLATE_NewVBoxGuestR3Dll_LIBS = \
4766 $(VBOX_LIB_IPRT_GUEST_R3_SHARED) \
4767 $(VBOX_LIB_VBGL_R3_SHARED) \
4768 $(VBOX_LIB_IPRT_GUEST_R3_SHARED) \
4769 $(TEMPLATE_VBOXGUESTR3EXE_LIBS)
4770
4771#
4772# Template for building normal R3 (dynamic) libraries for the guest additions, strict.
4773#
4774TEMPLATE_VBoxGuestR3Dll = VBox Guest User Dynamic Libraries w/ IPRT and VBGL.
4775TEMPLATE_VBoxGuestR3Dll_EXTENDS = NewVBoxGuestR3Dll
4776TEMPLATE_VBoxGuestR3Dll_EXTENDS_BY = appending
4777ifeq ($(KBUILD_TARGET),win)
4778 TEMPLATE_VBoxGuestR3Dll_CFLAGS += $(VBOX_VCC_WERR)
4779 TEMPLATE_VBoxGuestR3Dll_CXXFLAGS += $(VBOX_VCC_WERR)
4780 TEMPLATE_VBoxGuestR3Dll_LDFLAGS += $(VBOX_VCC_LD_WERR)
4781else ifeq ($(VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE),)
4782 TEMPLATE_VBoxGuestR3Dll_CFLAGS += $(VBOX_GCC_WERR)
4783 TEMPLATE_VBoxGuestR3Dll_CXXFLAGS += $(VBOX_GCC_WERR)
4784endif
4785
4786#
4787# Template for building R3 (static) libraries for the guest additions, allows warnings.
4788#
4789## @todo rename to VBoxGuestR3LibWarn.
4790TEMPLATE_VBOXGUESTR3LIB = VBox Guest User Libraries
4791TEMPLATE_VBOXGUESTR3LIB_EXTENDS = VBOXGUESTR3EXE
4792TEMPLATE_VBOXGUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
4793if1of ($(KBUILD_TARGET), solaris) ## @todo r=bird: Fix the *R3Mini template to VBOXGUESTR3DLL and remove this hack.
4794 TEMPLATE_VBOXGUESTR3LIB_DEFS = $(TEMPLATE_VBOXGUESTR3EXE_DEFS) PIC
4795 TEMPLATE_VBOXGUESTR3LIB_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fPIC
4796 TEMPLATE_VBOXGUESTR3LIB_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fPIC -fno-exceptions
4797endif
4798
4799#
4800# Template for building R3 (static) libraries for the guest additions, strict.
4801#
4802TEMPLATE_VBoxGuestR3Lib = VBox Guest User Dynamic Libraries w/ IPRT and VBGL.
4803TEMPLATE_VBoxGuestR3Lib_EXTENDS = VBOXGUESTR3LIB
4804TEMPLATE_VBoxGuestR3Lib_EXTENDS_BY = appending
4805ifeq ($(KBUILD_TARGET),win)
4806 TEMPLATE_VBoxGuestR3Lib_CFLAGS += $(VBOX_VCC_WERR)
4807 TEMPLATE_VBoxGuestR3Lib_CXXFLAGS += $(VBOX_VCC_WERR)
4808 TEMPLATE_VBoxGuestR3Lib_LDFLAGS += $(VBOX_VCC_LD_WERR)
4809else ifeq ($(VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE),)
4810 TEMPLATE_VBoxGuestR3Lib_CFLAGS += $(VBOX_GCC_WERR)
4811 TEMPLATE_VBoxGuestR3Lib_CXXFLAGS += $(VBOX_GCC_WERR)
4812endif
4813
4814#
4815# Template for building R3 programs for the guest additions (no -pedantic)
4816#
4817TEMPLATE_VBOXGUESTR3NPEXE = VBox Guest Program Non-pedantic
4818TEMPLATE_VBOXGUESTR3NPEXE_EXTENDS = VBOXGUESTR3EXE
4819ifneq ($(KBUILD_TARGET),win) # gcc only
4820TEMPLATE_VBOXGUESTR3NPEXE_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS)) -Wno-sign-compare
4821TEMPLATE_VBOXGUESTR3NPEXE_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXGUESTR3EXE_CFLAGS)) -Wno-sign-compare
4822endif
4823
4824#
4825# Template for building R3 (dynamic) libraries for the guest additions (no -pedantic)
4826#
4827TEMPLATE_VBOXGUESTR3NPDLL = VBox Guest User Dynamic Libraries Non-pedantic
4828TEMPLATE_VBOXGUESTR3NPDLL_EXTENDS = VBOXGUESTR3NPEXE
4829## @todo add a INSTFUN that separates dlls and libs.
4830ifn1of ($(KBUILD_TARGET), darwin os2 win)
4831 TEMPLATE_VBOXGUESTR3NPDLL_DEFS = $(TEMPLATE_VBOXGUESTR3NPEXE_DEFS) PIC
4832 TEMPLATE_VBOXGUESTR3NPDLL_CFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CFLAGS) -fPIC
4833 TEMPLATE_VBOXGUESTR3NPDLL_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CXXFLAGS) -fPIC -fno-exceptions
4834 TEMPLATE_VBOXGUESTR3NPDLL_LDFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_LDFLAGS) -fPIC
4835endif
4836
4837#
4838# Template for building R3 (static) libraries for the guest additions (no -pedantic)
4839#
4840TEMPLATE_VBOXGUESTR3NPLIB = VBox Guest User Libraries Non-pedantic
4841TEMPLATE_VBOXGUESTR3NPLIB_EXTENDS = VBOXGUESTR3NPEXE
4842TEMPLATE_VBOXGUESTR3NPLIB_INST = $(INST_ADDITIONS_LIB)
4843## @todo r=bird: Fix the *R3Mini template to VBOXGUESTR3DLL and remove this hack.
4844ifeq ($(filter-out solaris.x86 %.amd64 %.sparc32 %.sparc64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) ## TODO: Remove these checks!
4845 ifn1of ($(KBUILD_TARGET), darwin os2 win)
4846 TEMPLATE_VBOXGUESTR3NPLIB_DEFS = $(TEMPLATE_VBOXGUESTR3NPEXE_DEFS) PIC
4847 TEMPLATE_VBOXGUESTR3NPLIB_CFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CFLAGS) -fPIC
4848 TEMPLATE_VBOXGUESTR3NPLIB_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CXXFLAGS) -fPIC -fno-exceptions
4849 endif
4850endif
4851
4852
4853#
4854# Template for XFree86 guest modules (relocatable module, i.e. sysmod).
4855# This mostly about zapping the VBOXR3EXE linker flags and libraries.
4856#
4857TEMPLATE_VBOXGUESTR3XF86MOD = VBox XFree86 Guest Module
4858TEMPLATE_VBOXGUESTR3XF86MOD_EXTENDS = VBOXGUESTR3EXE
4859TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
4860TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
4861TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
4862TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
4863TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS = -r
4864if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd) # the gnu ld guys.
4865 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.release = -S
4866 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.x86 = -m elf_i386
4867 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.amd64 = -m elf_x86_64
4868endif
4869TEMPLATE_VBOXGUESTR3XF86MOD_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fno-merge-constants -std=c99 -ffreestanding
4870TEMPLATE_VBOXGUESTR3XF86MOD_CXXFLAGS= $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fno-merge-constants -ffreestanding
4871ifeq ($(VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE),)
4872 TEMPLATE_VBOXGUESTR3XF86MOD_CFLAGS += $(VBOX_GCC_fno-stack-protector)
4873 TEMPLATE_VBOXGUESTR3XF86MOD_CXXFLAGS += $(VBOX_GCC_fno-stack-protector)
4874endif
4875TEMPLATE_VBOXGUESTR3XF86MOD_SYSSUFF = .o
4876TEMPLATE_VBOXGUESTR3XF86MOD_LIBS = \
4877 $(VBOX_LIB_VBGL_R3_XFREE86)
4878TEMPLATE_VBOXGUESTR3XF86MOD_DEFS = $(TEMPLATE_VBOXGUESTR3DLL_DEFS) VBOX_GUESTR3XF86MOD RTMEM_NO_WRAP_TO_EF_APIS
4879
4880
4881#
4882# Template for XFree86 guest libraries.
4883#
4884TEMPLATE_VBOXGUESTR3XF86LIB = VBox XFree86 Guest Library
4885TEMPLATE_VBOXGUESTR3XF86LIB_EXTENDS = VBOXGUESTR3XF86MOD
4886TEMPLATE_VBOXGUESTR3XF86LIB_INST = $(INST_ADDITIONS_LIB)
4887
4888
4889#
4890# Template for 32-bit XFree86 guest modules (relocatable module, i.e. sysmod).
4891#
4892TEMPLATE_VBOXGUESTR3XF86MOD_X86 = 32-bit VBox X.org Guest Module
4893TEMPLATE_VBOXGUESTR3XF86MOD_X86_EXTENDS = VBOXGUESTR3XF86MOD
4894TEMPLATE_VBOXGUESTR3XF86MOD_X86_BLD_TRG_ARCH = x86
4895TEMPLATE_VBOXGUESTR3XF86MOD_X86_DEFS = \
4896 $(filter-out _XSERVER64,$(TEMPLATE_VBOXGUESTR3XF86MOD_DEFS))
4897TEMPLATE_VBOXGUESTR3XF86MOD_X86_LIBS = \
4898 $(VBOX_LIB_VBGL_R3_XFREE86_X86)
4899TEMPLATE_VBOXGUESTR3XF86MOD_X86_INST = $(INST_ADDITIONS)/32/
4900
4901
4902#
4903# Template for 32-bit XFree86 guest libraries.
4904#
4905TEMPLATE_VBOXGUESTR3XF86LIB_X86 = 32-bit VBox XFree86 Guest Library
4906TEMPLATE_VBOXGUESTR3XF86LIB_X86_EXTENDS = VBOXGUESTR3XF86LIB
4907TEMPLATE_VBOXGUESTR3XF86LIB_X86_BLD_TRG_ARCH = x86
4908
4909
4910#
4911# Template for X.org guest modules (shared libs).
4912# This mostly about zapping unnecessary LIBS from VBOXGUESTR3DLL and adding some flags.
4913#
4914TEMPLATE_VBOXGUESTR3XORGMOD = VBox X.org Guest Module
4915TEMPLATE_VBOXGUESTR3XORGMOD_EXTENDS = VBOXGUESTR3DLL
4916TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
4917TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
4918TEMPLATE_VBOXGUESTR3XORGMOD_CFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_CFLAGS) -std=c99
4919if1of ($(KBUILD_TARGET), linux)
4920 TEMPLATE_VBOXGUESTR3XORGMOD_CFLAGS += -Wno-conversion -Wno-unused-parameter
4921 ifeq ($(VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE),)
4922 TEMPLATE_VBOXGUESTR3XORGMOD_CFLAGS += $(VBOX_GCC_Wno-variadic-macros)
4923 endif
4924endif
4925TEMPLATE_VBOXGUESTR3XORGMOD_DEFS = $(TEMPLATE_VBOXGUESTR3DLL_DEFS) LOG_TO_BACKDOOR VBOX_GUESTR3XORGMOD RTMEM_NO_WRAP_TO_EF_APIS
4926ifeq ($(KBUILD_TARGET_ARCH),amd64)
4927 TEMPLATE_VBOXGUESTR3XORGMOD_DEFS += _XSERVER64
4928endif
4929if1of ($(KBUILD_TARGET), linux)
4930 TEMPLATE_VBOXGUESTR3XORGMOD_LDFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_LDFLAGS)
4931endif
4932TEMPLATE_VBOXGUESTR3XORGMOD_LIBS = \
4933 $(VBOX_LIB_VBGL_R3_SHARED) \
4934 $(VBOX_LIB_IPRT_GUEST_R3_MINI) \
4935 $(VBOX_LIB_VBGL_R3_SHARED) \
4936 $(VBOX_LIB_IPRT_GUEST_R3_MINI)
4937TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.freebsd += \
4938 iconv
4939
4940
4941#
4942# Template for 32-bit X.org guest modules (shared libs).
4943#
4944TEMPLATE_VBOXGUESTR3XORGMOD_X86 = 32-bit VBox X.org Guest Module
4945TEMPLATE_VBOXGUESTR3XORGMOD_X86_EXTENDS = VBOXGUESTR3XORGMOD
4946TEMPLATE_VBOXGUESTR3XORGMOD_X86_BLD_TRG_ARCH = x86
4947TEMPLATE_VBOXGUESTR3XORGMOD_X86_DEFS = \
4948 $(filter-out _XSERVER64,$(TEMPLATE_VBOXGUESTR3XORGMOD_DEFS))
4949TEMPLATE_VBOXGUESTR3XORGMOD_X86_LIBS = \
4950 $(VBOX_LIB_VBGL_R3_SHARED_X86) \
4951 $(VBOX_LIB_IPRT_GUEST_R3_MINI_X86) \
4952 $(VBOX_LIB_VBGL_R3_SHARED_X86) \
4953 $(VBOX_LIB_IPRT_GUEST_R3_MINI_X86)
4954TEMPLATE_VBOXGUESTR3XORGMOD_X86_INST = $(INST_ADDITIONS)/32/
4955
4956
4957#
4958# Template for building R0 drivers for the guest additions.
4959#
4960TEMPLATE_VBOXGUESTR0 = VBox Guest Driver
4961TEMPLATE_VBOXGUESTR0_EXTENDS = VBOXR0DRV
4962TEMPLATE_VBOXGUESTR0_INST = $(INST_ADDITIONS)
4963TEMPLATE_VBOXGUESTR0_SDKS.win.x86 = ReorderCompilerIncs $(VBOX_WINDDK_GST) $(VBOX_WINPSDK_GST)INCS
4964TEMPLATE_VBOXGUESTR0_SDKS.win.amd64 = ReorderCompilerIncs $(VBOX_WINDDK_GST) $(VBOX_WINPSDK_GST)INCS
4965TEMPLATE_VBOXGUESTR0_LIBS.win.x86 = \
4966 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/int64.lib
4967TEMPLATE_VBOXGUESTR0_DEFS = $(TEMPLATE_VBOXR0DRV_DEFS) IN_GUEST IN_GUEST_R0
4968ifeq ($(KBUILD_TARGET),solaris)
4969 TEMPLATE_VBOXGUESTR0_LDFLAGS = -r -dy
4970endif
4971ifn1of (darwin os2 win, $(KBUILD_TARGET))
4972 TEMPLATE_VBOXGUESTR0_CFLAGS = $(patsubst %/VBox/SUPDrvMangling.h,%/VBox/VBoxGuestMangling.h,$(TEMPLATE_VBOXR0DRV_CFLAGS))
4973 TEMPLATE_VBOXGUESTR0_CXXFLAGS = $(patsubst %/VBox/SUPDrvMangling.h,%/VBox/VBoxGuestMangling.h,$(TEMPLATE_VBOXR0DRV_CXXFLAGS))
4974endif
4975
4976#
4977# Template for building R0 libraries for the guest additions.
4978#
4979TEMPLATE_VBOXGUESTR0LIB = VBox Guest Driver Libraries
4980TEMPLATE_VBOXGUESTR0LIB_EXTENDS = VBOXGUESTR0
4981TEMPLATE_VBOXGUESTR0LIB_INSTTYPE = stage
4982TEMPLATE_VBOXGUESTR0LIB_INSTTYPE.linux = stage
4983TEMPLATE_VBOXGUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
4984ifeq ($(KBUILD_TARGET),haiku)
4985 TEMPLATE_VBOXGUESTR0LIB_LDFLAGS = -r -dy
4986endif
4987
4988#
4989# Template for building OpenGL host dlls.
4990#
4991TEMPLATE_VBOXCROGLR3HOSTDLL = VBox OpenGL Host DLLs
4992TEMPLATE_VBOXCROGLR3HOSTDLL_EXTENDS = VBOXR3NP
4993TEMPLATE_VBOXCROGLR3HOSTDLL_EXTENDS_BY = prepending
4994TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS = CHROMIUM_THREADSAFE VBOX_WITH_HGCM UNPACKS
4995TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.win = _WIN32_WINNT=0x0500 WINDOWS=1
4996TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.linux = Linux=1 _GNU_SOURCE
4997TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.solaris = SunOS=1 _GNU_SOURCE #GLEXT_64_TYPES_DEFINED
4998TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE VBOX_WITH_COCOA_QT
4999TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.darwin = -framework AppKit
5000TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.freebsd = FreeBSD=1 _GNU_SOURCE
5001TEMPLATE_VBOXCROGLR3HOSTDLL_INCS = $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES)
5002TEMPLATE_VBOXCROGLR3HOSTDLL_SDKS.darwin = DARWIN-OPENGL
5003TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.darwin += \
5004 -framework OpenGL \
5005 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
5006 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
5007TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.linux = -Wl,--no-as-needed
5008TEMPLATE_VBOXCROGLR3HOSTDLL_BLDDIRS = $(VBOX_PATH_CROGL_GENFILES)/
5009
5010#
5011# Template for building OpenGL host libraries.
5012#
5013TEMPLATE_VBOXCROGLR3HOSTLIB = VBox OpenGL Host Libraries
5014TEMPLATE_VBOXCROGLR3HOSTLIB_EXTENDS = VBOXCROGLR3HOSTDLL
5015TEMPLATE_VBOXCROGLR3HOSTLIB_INST = $(INST_LIB)
5016
5017#
5018# Template for building OpenGL guest dlls.
5019#
5020TEMPLATE_VBOXCROGLR3GUESTDLL = VBox OpenGL Guest DLLs
5021TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS = VBOXGUESTR3NPDLL
5022TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS_BY = prepending
5023TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS = CHROMIUM_THREADSAFE VBOX_WITH_HGCM
5024TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.win = WINDOWS=1
5025TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.linux = Linux=1 _GNU_SOURCE
5026TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.solaris = SunOS=1 _GNU_SOURCE #GLEXT_64_TYPES_DEFINED
5027TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE VBOX_WITH_COCOA_QT
5028TEMPLATE_VBOXCROGLR3GUESTDLL_LDFLAGS.darwin = -framework AppKit
5029TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.freebsd = FreeBSD=1 _GNU_SOURCE
5030TEMPLATE_VBOXCROGLR3GUESTDLL_INCS = $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES)
5031TEMPLATE_VBOXCROGLR3GUESTDLL_SDKS.darwin = DARWIN-OPENGL
5032TEMPLATE_VBOXCROGLR3GUESTDLL_LDFLAGS.darwin += \
5033 -framework OpenGL \
5034 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
5035 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
5036TEMPLATE_VBOXCROGLR3GUESTDLL_BLDDIRS = $(VBOX_PATH_CROGL_GENFILES)/
5037
5038#
5039# Template for building OpenGL guest libraries.
5040#
5041TEMPLATE_VBOXCROGLR3GUESTLIB = VBox OpenGL Guest Libraries
5042TEMPLATE_VBOXCROGLR3GUESTLIB_EXTENDS = VBOXCROGLR3GUESTDLL
5043TEMPLATE_VBOXCROGLR3GUESTLIB_INST = $(INST_ADDITIONS_LIB)
5044
5045
5046#
5047# Template for building Mesa guest library, Linux-only so far.
5048#
5049TEMPLATE_VBOXMESAR3GUESTLIB = VBox Mesa Guest Library
5050TEMPLATE_VBOXMESAR3GUESTLIB_EXTENDS = VBOXCROGLR3GUESTDLL
5051TEMPLATE_VBOXMESAR3GUESTLIB_INST = $(INST_ADDITIONS_LIB)
5052TEMPLATE_VBOXMESAR3GUESTLIB_DEFS.linux = Linux=1
5053TEMPLATE_VBOXMESAR3GUESTLIB_DEFS.solaris = SunOS=1
5054TEMPLATE_VBOXMESAR3GUESTLIB_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY
5055ifeq ($(KBUILD_TARGET),linux)
5056 TEMPLATE_VBOXMESAR3GUESTLIB_ASTOOL = $(TEMPLATE_VBOXCROGLR3GUESTDLL_TOOL)
5057 TEMPLATE_VBOXMESAR3GUESTLIB_ASFLAGS = $(NO_SUCH_VARIABLE)
5058 TEMPLATE_VBOXMESAR3GUESTLIB_ASFLAGS.x86 = -m32
5059 TEMPLATE_VBOXMESAR3GUESTLIB_ASFLAGS.amd64 = -m64
5060 TEMPLATE_VBOXMESAR3GUESTLIB_ASDEFS = $(NO_SUCH_VARIABLE)
5061endif
5062
5063
5064#
5065# Guest additions libraries (all static).
5066# The _MINI and _SHARED are both compiled as PIC and intended for linking into a .so/.dll/.dylib.
5067#
5068VBOX_LIB_IPRT_GUEST_R3 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3$(VBOX_SUFF_LIB)
5069VBOX_LIB_IPRT_GUEST_R3_MINI = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3Mini$(VBOX_SUFF_LIB)
5070VBOX_LIB_IPRT_GUEST_R3_SHARED = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3Shared$(VBOX_SUFF_LIB)
5071VBOX_LIB_IPRT_GUEST_R0 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR0$(VBOX_SUFF_LIB)
5072ifeq ($(KBUILD_TARGET_ARCH),x86)
5073 VBOX_LIB_IPRT_GUEST_R0_NT4 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR0NT4$(VBOX_SUFF_LIB)
5074else
5075 VBOX_LIB_IPRT_GUEST_R0_NT4 = $(VBOX_LIB_IPRT_GUEST_R0)
5076endif
5077VBOX_LIB_VBGL_R3 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3Lib$(VBOX_SUFF_LIB)
5078VBOX_LIB_VBGL_R3_XFREE86 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibXFree86$(VBOX_SUFF_LIB)
5079VBOX_LIB_VBGL_R3_SHARED = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibShared$(VBOX_SUFF_LIB)
5080VBOX_LIB_VBGL_R0BASE = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0LibBase$(VBOX_SUFF_LIB)
5081VBOX_LIB_VBGL_R0 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0Lib$(VBOX_SUFF_LIB)
5082ifeq ($(KBUILD_TARGET),x86)
5083 VBOX_LIB_IPRT_GUEST_R3_X86 = $(VBOX_LIB_IPRT_GUEST_R3)
5084 VBOX_LIB_IPRT_GUEST_R3_MINI_X86 = $(VBOX_LIB_IPRT_GUEST_R3_MINI)
5085 VBOX_LIB_VBGL_R3_XFREE86_X86 = $(VBOX_LIB_VBGL_R3_XFREE86)
5086 VBOX_LIB_IPRT_GUEST_R3_SHARED_X86 = $(VBOX_LIB_IPRT_GUEST_R3_SHARED)
5087 VBOX_LIB_VBGL_R3_X86 = $(VBOX_LIB_VBGL_R3)
5088 VBOX_LIB_VBGL_R3_SHARED_X86 = $(VBOX_LIB_VBGL_R3_SHARED)
5089else
5090 VBOX_LIB_IPRT_GUEST_R3_X86 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3-x86$(VBOX_SUFF_LIB)
5091 VBOX_LIB_IPRT_GUEST_R3_MINI_X86 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3Mini-x86$(VBOX_SUFF_LIB)
5092 VBOX_LIB_VBGL_R3_XFREE86_X86 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibXFree86-x86$(VBOX_SUFF_LIB)
5093 VBOX_LIB_IPRT_GUEST_R3_SHARED_X86 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3Shared-x86$(VBOX_SUFF_LIB)
5094 VBOX_LIB_VBGL_R3_X86 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3Lib-x86$(VBOX_SUFF_LIB)
5095 VBOX_LIB_VBGL_R3_SHARED_X86 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibShared-x86$(VBOX_SUFF_LIB)
5096endif
5097
5098
5099#
5100# Check the publisher and version string.
5101#
5102# We are being very strict because the version string is visible in various
5103# APIs and logs and must be machine readable.
5104#
5105VBOX_VERSION_COMP_VALID_CHAR_SET = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz()[]{}+-.,
5106ifneq ($(VBOX_BUILD_PUBLISHER),)
5107 if $(length $(VBOX_BUILD_PUBLISHER)) > 10
5108 $(error VBox: VBOX_BUILD_PUBLISHER must not be longer than 10 characters!)
5109 endif
5110 if "$(substr $(VBOX_BUILD_PUBLISHER), 1, 1)" != "_"
5111 $(error VBox: VBOX_BUILD_PUBLISHER must start with an underscore!)
5112 endif
5113 if "$(translate $(substr $(VBOX_BUILD_PUBLISHER),2),$(VBOX_VERSION_COMP_VALID_CHAR_SET),)" != ""
5114 $(error VBox: VBOX_BUILD_PUBLISHER='$(VBOX_BUILD_PUBLISHER)' contains bad characters! Valid set is:$(NLTAB)$(VBOX_VERSION_COMP_VALID_CHAR_SET))
5115 endif
5116endif
5117
5118if $(words $(VBOX_VERSION_STRING)) != 1
5119 $(error VBox: VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' contains spaces or is empty.)
5120endif
5121if "$(subst __,-,$(VBOX_VERSION_STRING))" != "$(VBOX_VERSION_STRING)"
5122 $(error VBox: VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' contains double underscores.)
5123endif
5124
5125VBOX_VER_TMP1 := $(subst _,$(SP),$(VBOX_VERSION_STRING))
5126
5127if $(words $(VBOX_VER_TMP1)) > 3
5128 $(error VBox: VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' contains too many parts (underscores), max 3!)
5129endif
5130if "$(translate $(word 1,$(VBOX_VER_TMP1)),0123456789,)" != ".."
5131 $(error VBox: The x.y.z part of VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' is malformed: '$(word 1,$(VBOX_VER_TMP1))')
5132endif
5133if "$(word 1,$(VBOX_VER_TMP1))" != "$(VBOX_VERSION_STRING_RAW)"
5134 $(error VBox: VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' does not start with VBOX_VERSION_STRING_RAW='$(VBOX_VERSION_STRING_RAW)')
5135endif
5136
5137if $(words $(VBOX_VER_TMP1)) == 3 || ($(words $(VBOX_VER_TMP1)) == 2 && "$(VBOX_BUILD_PUBLISHER)" == "")
5138 if "$(substr $(word 2,$(VBOX_VER_TMP1)),1,4)" == "BETA"
5139 VBOX_VER_TMP2 = 5
5140 else if "$(substr $(word 2,$(VBOX_VER_TMP1)),1,5)" == "ALPHA"
5141 VBOX_VER_TMP2 = 6
5142 else if "$(substr $(word 2,$(VBOX_VER_TMP1)),1,2)" == "RC"
5143 VBOX_VER_TMP2 = 3
5144 else
5145 $(error VBox: VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' uses an unknown build type: '$(word 2,$(VBOX_VER_TMP1))')
5146 endif
5147 if "$(translate $(substr $(word 2,$(VBOX_VER_TMP1)),$(VBOX_VER_TMP2)),0123456789)" != ""
5148 $(error VBox: VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' uses an unknown build type: '$(word 2,$(VBOX_VER_TMP1))')
5149 endif
5150endif
5151
5152VBOX_VER_TMP1 :=
5153VBOX_VER_TMP2 :=
5154
5155
5156#
5157# Two targets to coordinate version number changes properly. Note that the
5158# only way to get a really consistent build is to run 'kmk' in the top-level
5159# directory. If you don't run it there, you get a consistent sub-tree only.
5160#
5161VBOX_BAD_CHAR_SET = ,;:/\$(SP)$(TAB)$(HASH)=![]@%&''()*""<>?^{}|~
5162VBOX_VERSION_STAMP = $(PATH_OUT)/version-stamp-raw-api-$(translate $(VBOX_VERSION_STRING)-$(VBOX_C_YEAR)-$(VBOX_VENDOR)-$(VBOX_PRODUCT)-$(VBOX_API_VERSION)-$(VBOX_BUILD_PUBLISHER),$(VBOX_BAD_CHAR_SET),,_)
5163VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
5164VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
5165
5166$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
5167 $(call MSG_GENERATE,,$@)
5168 $(QUIET)$(MKDIR) -p $(@D)
5169 $(QUIET)$(RM) -f $(wildcard $(PATH_OUT)/version-stamp-*)
5170 $(QUIET)$(APPEND) $@ $(VBOX_VERSION_STRING)
5171
5172$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
5173 $(call MSG_GENERATE,,$@)
5174 $(QUIET)$(MKDIR) -p $(@D)
5175 $(QUIET)$(RM) -f $@ [email protected]
5176 $(QUIET)$(APPEND) [email protected] '#ifndef ___version_generated_h___'
5177 $(QUIET)$(APPEND) [email protected] '#define ___version_generated_h___'
5178 $(QUIET)$(APPEND) [email protected] ''
5179 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)'
5180 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)'
5181 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)'
5182 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_STRING_RAW "$(VBOX_VERSION_STRING_RAW)"'
5183 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_STRING "$(VBOX_VERSION_STRING)"'
5184 $(QUIET)$(APPEND) [email protected] '#define VBOX_API_VERSION_STRING "$(VBOX_API_VERSION)"'
5185 $(QUIET)$(APPEND) [email protected] ''
5186 $(QUIET)$(APPEND) [email protected] '#endif'
5187 $(QUIET)$(MV) -f [email protected] $@
5188
5189
5190VBOX_PACKAGE_HEADER = $(PATH_OUT)/package-generated.h
5191
5192$(VBOX_PACKAGE_HEADER):
5193 $(call MSG_GENERATE,,$@)
5194 $(QUIET)$(MKDIR) -p $(@D)
5195 $(QUIET)$(RM) -f $@ [email protected]
5196 $(QUIET)$(APPEND) [email protected] '#ifndef ___package_generated_h___'
5197 $(QUIET)$(APPEND) [email protected] '#define ___package_generated_h___'
5198 $(QUIET)$(APPEND) [email protected] ''
5199 $(QUIET)$(APPEND) [email protected] '#define VBOX_PACKAGE_STRING "$(VBOX_PACKAGE_STRING)"'
5200 $(QUIET)$(APPEND) [email protected] ''
5201 $(QUIET)$(APPEND) [email protected] '#endif'
5202 $(QUIET)$(MV) -f [email protected] $@
5203
5204VBOX_PRODUCT_HEADER = $(PATH_OUT)/product-generated.h
5205
5206$(VBOX_PRODUCT_HEADER): $(VBOX_VERSION_STAMP)
5207 $(call MSG_GENERATE,,$@)
5208 $(QUIET)$(MKDIR) -p $(@D)
5209 $(QUIET)$(RM) -f $@ [email protected]
5210 $(QUIET)$(APPEND) [email protected] '#ifndef ___product_generated_h___'
5211 $(QUIET)$(APPEND) [email protected] '#define ___product_generated_h___'
5212 $(QUIET)$(APPEND) [email protected] ''
5213 $(QUIET)$(APPEND) [email protected] '#define VBOX_VENDOR "$(VBOX_VENDOR)"'
5214 $(QUIET)$(APPEND) [email protected] '#define VBOX_VENDOR_SHORT "$(VBOX_VENDOR_SHORT)"'
5215 $(QUIET)$(APPEND) [email protected] '#define VBOX_PRODUCT "$(VBOX_PRODUCT)"'
5216 $(QUIET)$(APPEND) [email protected] '#define VBOX_BUILD_PUBLISHER "$(VBOX_BUILD_PUBLISHER)"'
5217 $(QUIET)$(APPEND) [email protected] '#define VBOX_C_YEAR "$(VBOX_C_YEAR)"'
5218 $(QUIET)$(APPEND) [email protected] ''
5219 $(QUIET)$(APPEND) [email protected] '#endif'
5220 $(QUIET)$(MV) -f [email protected] $@
5221
5222#
5223# Used for external makefiles which cannot include Config.kmk
5224#
5225$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
5226 $(call MSG_GENERATE,,$@)
5227 $(QUIET)$(RM) -f $@ [email protected]
5228 $(QUIET)$(MKDIR) -p $(@D)
5229 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)'
5230 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)'
5231 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)'
5232 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_STRING = $(VBOX_VERSION_STRING)'
5233 $(QUIET)$(APPEND) [email protected] 'VBOX_VENDOR = $(VBOX_VENDOR)'
5234 $(QUIET)$(APPEND) [email protected] 'VBOX_VENDOR_SHORT = $(VBOX_VENDOR_SHORT)'
5235 $(QUIET)$(APPEND) [email protected] 'VBOX_PRODUCT = $(VBOX_PRODUCT)'
5236 $(QUIET)$(APPEND) [email protected] 'VBOX_C_YEAR = $(VBOX_C_YEAR)'
5237 $(QUIET)$(MV) -f [email protected] $@
5238
5239if !defined(VBOX_OSE) && !defined(VBOX_NOINC_LICENSE_VER_KMK)
5240 if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris)
5241 # VBOX_LICENSE_VER is used in several Makefiles
5242 VBOX_LICENSE_VER_KMK = $(PATH_OUT)/license-version.kmk
5243$(VBOX_LICENSE_VER_KMK): $(VBOX_BRAND_LICENSE_HTML)
5244 $(call MSG_GENERATE,,$(VBOX_LICENSE_VER_KMK))
5245 $(QUIET)$(MKDIR) -p $(@D)
5246 ifdef VBOX_BRAND_LICENSE_VER
5247 $(QUIET)$(RM) -f '$@'
5248 $(APPEND) '$@' 'VBOX_LICENSE_VER=$(VBOX_BRAND_LICENSE_VER)'
5249 else
5250 $(QUIET)$(SED) -e "s/.*License version \([0-9.]*\) *[,&].*/VBOX_LICENSE_VER=\1/;t;d" --output $@ $(VBOX_BRAND_LICENSE_HTML)
5251 endif
5252 -include $(VBOX_LICENSE_VER_KMK)
5253 ifdef VBOX_LICENSE_VER
5254 VBOX_LICENSE_FILES = \
5255 License-$(VBOX_LICENSE_VER).html \
5256 $(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES),License-$(VBOX_LICENSE_VER)-$(f).html)
5257 VBOX_LICENSE_BINS = $(addprefix $(PATH_STAGE_BIN)/,$(VBOX_LICENSE_FILES))
5258 endif
5259 endif
5260endif
5261
5262
5263ifndef VBOX_NOINC_MISC
5264# Force building of the version header file as the first thing anywhere in
5265# the tree. This eliminates the need for manual dependencies on it.
5266## @todo there gotta be a better way of doing this.
5267Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK) $(VBOX_PRODUCT_HEADER) $(VBOX_PACKAGE_HEADER)
5268endif
5269
5270
5271#
5272# Subversion tree revision.
5273#
5274# The VBOX_SVN_REV contains our best guess. Use svn info on the root of the
5275# tree to determine this it if .svn/wc.db or .svn/entries is found (the former
5276# also up to two directory levels higher to allow for checkouts of the entire
5277# repository), otherwise fall back on the Config.kmk revision.
5278#
5279# Makefile rules using this information shall list $(VBOX_SVN_REV_KMK) as a
5280# prerequisite.
5281#
5282SVN ?= svn$(HOSTSUFF_EXE)
5283VBOX_SVN_REV_KMK = $(PATH_OUT)/revision.kmk
5284ifndef VBOX_SVN_REV
5285 VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 46474 $ )
5286 VBOX_SVN_DEP := $(firstword $(wildcard $(PATH_ROOT)/.svn/wc.db $(abspath $(PATH_ROOT)/../.svn/wc.db) $(abspath $(PATH_ROOT)/../../.svn/wc.db) $(PATH_ROOT)/.svn/entries))
5287 ifeq ($(which $(SVN)),)
5288 VBOX_SVN_DEP :=
5289 endif
5290
5291# Rule for generating a timestamp and updating the real thing on change.
5292$(VBOX_SVN_REV_KMK).ts +| $(VBOX_SVN_REV_KMK): $(if $(VBOX_SVN_DEP), $(VBOX_SVN_DEP), $(PATH_ROOT)/Config.kmk)
5293 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
5294 $(QUIET)$(RM) -f $@ [email protected]
5295 $(QUIET)$(MKDIR) -p $(@D)
5296 ifneq ($(VBOX_SVN_DEP),)
5297 $(REDIRECT) -E 'LC_ALL=C' -wo [email protected] -- $(SVN) info $(PATH_ROOT)
5298 ifeq ($(int-mod $(VBOX_VERSION_BUILD), 2),0)
5299 $(SED) -e '/^Last Changed Rev/!d' -e 's/Last Changed Rev\: */export VBOX_SVN_REV=/' --output $@ [email protected]
5300 else
5301 $(SED) -e '/^Revision/!d' -e 's/Revision\: */export VBOX_SVN_REV=/' --output $@ [email protected]
5302 endif
5303 $(QUIET)$(RM) -f [email protected]
5304 else
5305 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV_FALLBACK)'
5306 endif
5307 $(QUIET)$(CP) --changed -fv $@ $(VBOX_SVN_REV_KMK)
5308
5309 ifndef VBOX_NOINC_SVN_REV_KMK
5310 include $(VBOX_SVN_REV_KMK)
5311 endif
5312else
5313# allow to overwrite VBOX_SVN_REV externally (mainly for building .debs/.rpms)
5314$(VBOX_SVN_REV_KMK):
5315 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
5316 $(QUIET)$(RM) -f $@
5317 $(QUIET)$(MKDIR) -p $(@D)
5318 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV)'
5319 $(QUIET)echo '* $(VBOX_SVN_REV_KMK) was externally overwritten:'
5320 $(QUIET)$(CAT) $(VBOX_SVN_REV_KMK)
5321endif
5322
5323# only needed for VBoxGuest for Linux/FreeBSD guests
5324VBOX_SVN_REV_HEADER = $(PATH_OUT)/revision-generated.h
5325$(VBOX_SVN_REV_HEADER): $(VBOX_SVN_REV_KMK)
5326 $(call MSG_GENERATE,,$@)
5327 $(QUIET)$(RM) -f $@ [email protected]
5328 $(QUIET)$(MKDIR) -p $(@D)
5329 $(QUIET)$(APPEND) [email protected] '#define VBOX_SVN_REV $(VBOX_SVN_REV)'
5330 $(QUIET)$(MV) -f [email protected] $@
5331
5332#
5333# Shared definitions of the XIDL file to use as a source for
5334# generating various other files (VBoxSVC, webservice, docs, front-ends, ...)
5335#
5336
5337# Real XIDL source file; from this we strip the <desc> elements to generate
5338# a second XIDL file, from which the COM/XPCOM IDL files are then generated:
5339VBOX_XIDL_FILE_SRC = $(PATH_ROOT)/src/VBox/Main/idl/VirtualBox.xidl
5340# second XIDL file to use as source for COM/XPCOM IDL (with stripped docs):
5341VBOX_XIDL_FILE = $(PATH_OUT)/obj/VirtualBox_stripped.xidl
5342
5343# Java stuff.
5344ifeq ($(KBUILD_TARGET), darwin)
5345 VBOX_JAVA_COMMANDS = $(firstword $(wildcard \
5346 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands \
5347 /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands \
5348 $(if-expr $(VBOX_XCODE_VERSION_MAJOR) >= 4,/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands,) \
5349 ) /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands)
5350 VBOX_JAVAC = $(VBOX_JAVA_COMMANDS)/javac
5351 VBOX_JAVAH = $(VBOX_JAVA_COMMANDS)/javah
5352 VBOX_JAR = $(VBOX_JAVA_COMMANDS)/jar
5353 VBOX_JAVADOC = $(VBOX_JAVA_COMMANDS)/javadoc
5354 VBOX_WSIMPORT = $(VBOX_JAVA_COMMANDS)/wsimport
5355 if $(VBOX_XCODE_VERSION_MAJOR) >= 4 # Lion (4.1-preview 5) has a broken CurrentJDK link. Blindly applying it to 4.0.
5356 VBOX_JAVA_INC = $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers
5357 else
5358 VBOX_JAVA_INC = $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Headers
5359 endif
5360
5361else
5362
5363 ifeq ($(KBUILD_TARGET),linux)
5364 ifeq ($(origin VBOX_JAVA_HOME),undefined)
5365 # Add correct detection for you distro after the /usr/../java-6-sun line.
5366 VBOX_JAVA_HOME := $(firstword $(wildcard \
5367 $(PATH_DEVTOOLS)/linux.x86/jdk1.6.0_27 \
5368 /usr/lib/jvm/java-6-sun \
5369 /usr/lib/jvm/java-6-openjdk \
5370 /usr/lib/jvm/java-6-openjdk-i386 \
5371 /usr/lib/jvm/java-6-openjdk-amd64 \
5372 /usr/lib/jvm/java-7-openjdk-i386 \
5373 /usr/lib/jvm/java-7-openjdk-amd64 \
5374 /usr/lib/jvm/default-java \
5375 /usr/lib/jvm/java \
5376 \
5377 /usr/lib/jvm/sun-jdk-1.6 \
5378 ) /usr/lib/jvm/java-6-sun)
5379 endif
5380 endif
5381
5382 ifeq ($(KBUILD_TARGET),solaris)
5383 # VBOX_JAVA_HOME ?= /usr/jdk/jdk1.6.0
5384 VBOX_JAVA_HOME ?= /usr/java
5385 endif
5386
5387 ifeq ($(KBUILD_TARGET),win)
5388 VBOX_JAVA_HOME ?= c:/jdk
5389 endif
5390
5391 VBOX_JAVAC = $(VBOX_JAVA_HOME)/bin/javac
5392 VBOX_JAVAH = $(VBOX_JAVA_HOME)/bin/javah
5393 VBOX_JAR = $(VBOX_JAVA_HOME)/bin/jar
5394 VBOX_JAVADOC = $(VBOX_JAVA_HOME)/bin/javadoc
5395 VBOX_WSIMPORT = $(VBOX_JAVA_HOME)/bin/wsimport
5396 # correct for targets we care about
5397 VBOX_MD_OS = $(KBUILD_TARGET)
5398 VBOX_JAVA_INC = \
5399 $(VBOX_JAVA_HOME)/include \
5400 $(VBOX_JAVA_HOME)/include/$(VBOX_MD_OS)
5401endif
5402
5403ifeq ($(KBUILD_TARGET), win)
5404 VBOX_SEP=\;
5405else
5406 VBOX_SEP=:
5407endif
5408VBOX_JAVAC_OPTS = -encoding UTF-8 -source 1.5 -target 1.5 -Xlint:unchecked
5409VBOX_JAVADOC_OPTS = -encoding UTF-8
5410
5411#
5412# Legacy.
5413#
5414## @todo try remove this.
5415ifneq ($(LOCALCFG),)
5416 include $(LOCALCFG)
5417endif
5418
5419
5420#
5421# Some extra goals.
5422#
5423.PHONY: up update st stat status
5424up update::
5425 $(SVN) up
5426
5427up2 update2::
5428 $(SVN) up --ignore-externals
5429
5430st stat status:
5431 $(SVN) status
5432
5433quick:
5434 $(MAKE) VBOX_QUICK=1
5435
5436
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