VirtualBox

source: vbox/trunk/Config.kmk@ 46541

Last change on this file since 46541 was 46522, checked in by vboxsync, 12 years ago

wine/new: enable by default

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