Config.kmk revision 0dd04aaaddd3b919138a2c0223403806e0fd4ca1
# $Id$
## @file
# The global build configuration file for VBox.
#
# This file gets included by all makefiles through the
# include $(KBUILD_PATH)/header.kmk statement.
#
#
# Copyright (C) 2006-2015 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
# Marker.
VBOX_ROOT_CONFIG_KMK_INCLUDED = 1
#
# kBuild stuff
#
# Build with umask 022 (requires kBuild r2556 to work, harmless on earlier).
$(set-umask 022)
# Add our own directories to the search paths.
KBUILD_TOOL_PATHS = $(KBUILD_DEVTOOLS)/kBuildTools/
# Modify the build types.
KBUILD_BLD_TYPES = release profile debug kprofile
## 'strict' builds
# Same as release builds, except that RT_STRICT and VBOX_STRICT are defined,
# meaning all assertions are in action. (Appending means '.strict' props take
# precedence in argument lists.)
KBUILD_BLD_TYPES += strict
BLD_TYPE_strict_EXTENDS = release
BLD_TYPE_strict_EXTENDS_BY = appending
## 'dbgopt' builds
# Same as debug builds, except that compiler optimizations are enabled. This
# intended for cases where all the debug facitities (logging, assertions, ++)
# is wanted but actual source level debugging as important as execution speed.
KBUILD_BLD_TYPES += dbgopt
BLD_TYPE_dbgopt_EXTENDS = debug
BLD_TYPE_dbgopt_EXTENDS_BY = overriding
# Temporary hack for kBuild ticket #83.
## @todo kBuild: remove after closing ticket #83.
PROPS_ACCUMULATE_L_LNK += INTERMEDIATES
PROPS_PROGRAMS_ACCUMULATE_L += INTERMEDIATES
PROPS_LIBRARIES_ACCUMULATE_L += INTERMEDIATES
PROPS_DLLS_ACCUMULATE_L += INTERMEDIATES
PROPS_SYSMODS_ACCUMULATE_L += INTERMEDIATES
PROPS_MISCBINS_ACCUMULATE_L += INTERMEDIATES
# Misc names used by the install paths below.
VBOX_PUEL_MANGLED_NAME := Oracle_VM_VirtualBox_Extension_Pack
# Install paths
## @todo This will change after 4.1 is branched off!
# What is now 'bin' and 'lib' will be moved down under 'staged/', except on
# darwin where it's currently called 'dist' which will be renamed to 'staged'.
# When running 'kmk install' files will be copied to 'dist/', on unix systems
# this will be done in FHS fashion assuming /usr/local or /usr as 'prefix'.
#
# Changes related to this are marked VBOX_WITH_NEW_LAYOUT.
ifndef VBOX_WITH_NEW_LAYOUT
PATH_INS = $(PATH_OUT)/dist
PATH_STAGE = $(PATH_OUT)
INST_DEBUG := stage/debug/
endif
ifeq ($(KBUILD_TARGET),darwin)
ifndef VBOX_WITH_NEW_LAYOUT
INST_DIST = dist/
else
INST_DIST :=
endif
INST_SDK = $(INST_DIST)sdk/
# the bundles
INST_VIRTUALBOX = $(INST_DIST)VirtualBox.app/
INST_VBOXDRV = $(INST_DIST)VBoxDrv.kext/
INST_VBOXNETFLT = $(INST_DIST)VBoxNetFlt.kext/
INST_VBOXNETADP = $(INST_DIST)VBoxNetAdp.kext/
INST_VBOXUSB = $(INST_DIST)VBoxUSB.kext/
# put everything in the VirtualBox app bundle.
INST_BIN = $(INST_VIRTUALBOX)Contents/MacOS/
INST_DLL = $(INST_BIN)
INST_SYS = $(INST_BIN)
INST_TESTCASE = $(INST_BIN)testcase/
INST_ADDITIONS = $(INST_DIST)additions/
INST_ADDITIONS_ISO = $(INST_BIN)
INST_VBOXDBG_SYMS = $(INST_VIRTUALBOX)Contents/Resources/VBoxDbgSyms/
# other paths
INST_LIB = lib/
INST_ADDITIONS_LIB = $(INST_LIB)additions/
VBOX_INST_DTRACE_LIB = $(INST_BIN)dtrace/lib/
VBOX_INST_DTRACE_TST = $(INST_BIN)dtrace/testcase/
VBOX_INST_TOOLS = $(INST_BIN)tools/
else
INST_BIN = bin/
INST_DIST = $(INST_BIN)
INST_SDK = $(INST_BIN)sdk/
INST_VIRTUALBOX = $(INST_BIN)
INST_VBOXDRV = $(INST_BIN)
INST_VBOXNETFLT = $(INST_BIN)
INST_VBOXNETADP = $(INST_BIN)
INST_VBOXUSB = $(INST_BIN)
INST_DLL = $(INST_BIN)
INST_SYS = $(INST_BIN)
INST_TESTCASE = $(INST_BIN)testcase/
INST_ADDITIONS = $(INST_BIN)additions/
INST_ADDITIONS_ISO = $(INST_ADDITIONS)
INST_LIB = lib/
INST_ADDITIONS_LIB = $(INST_LIB)additions/
VBOX_INST_DTRACE_LIB = $(INST_BIN)dtrace/lib/
VBOX_INST_DTRACE_TST = $(INST_BIN)dtrace/testcase/
INST_VBOXDBG_SYMS = $(INST_BIN)VBoxDbgSyms/
VBOX_INST_TOOLS = $(INST_BIN)tools/
endif
INST_VALIDATIONKIT = validationkit/
INST_TESTBOXSCRIPT = testboxscript/
INST_DOC = doc/
INST_EXTPACK = $(INST_BIN)ExtensionPacks/
INST_EXTPACK_CERTS = $(INST_BIN)ExtPackCertificates/
INST_EXTPACK_PUEL = $(INST_EXTPACK)$(VBOX_PUEL_MANGLED_NAME)/
INST_PACKAGES = packages/
VBOX_PATH_SDK = $(patsubst %/,%,$(PATH_STAGE)/$(INST_SDK))
VBOX_PATH_DIST = $(patsubst %/,%,$(PATH_STAGE)/$(INST_DIST))
VBOX_PATH_VALIDATIONKIT = $(patsubst %/,%,$(PATH_STAGE)/$(INST_VALIDATIONKIT))
VBOX_PATH_ADDITIONS = $(patsubst %/,%,$(PATH_STAGE)/$(INST_ADDITIONS))
VBOX_PATH_ADDITIONS_ISO = $(patsubst %/,%,$(PATH_STAGE)/$(INST_ADDITIONS_ISO))
VBOX_PATH_ADDITIONS_LIB = $(patsubst %/,%,$(PATH_STAGE)/$(INST_ADDITIONS_LIB))
VBOX_PATH_EXTPACK_PUEL= $(patsubst %/,%,$(PATH_STAGE)/$(INST_EXTPACK_PUEL))
VBOX_PATH_PACKAGES = $(patsubst %/,%,$(PATH_STAGE)/$(INST_PACKAGES))
# Delete targets on failure.
.DELETE_ON_ERROR:
# Notify about important kBuild updates.
if $(KBUILD_VERSION_MAJOR) == 0 \
&& ( $(KBUILD_VERSION_MINOR) >= 2 \
|| ( $(KBUILD_VERSION_MINOR) == 1 \
&& $(KBUILD_VERSION_PATCH) >= 999))
if $(KMK_REVISION) >= 2689
# OK.
else
$(error You must update kBuild! Requires kBuild revision 2577 or later, found $(KMK_REVISION) ($(KBUILD_VERSION)))
endif
else
$(error You must update kBuild! Requires 0.1.999 or later, found $(KBUILD_VERSION))
endif
#
# Define USERNAME early on.
#
ifndef USERNAME
ifdef USER
USERNAME = $(USER)
else
$(warning Warning: You must have USERNAME or USER in your environment.)
endif
endif
#
# Detect the darwin host version number so we can disable stuff that doesn't
# currently build on Lion.
#
ifeq ($(KBUILD_HOST),darwin)
VBOX_DARWIN_HOST_VERSION := $(subst ., ,$(shell uname -r))
VBOX_DARWIN_HOST_VERSION_MAJOR := $(expr $(word 1, $(VBOX_DARWIN_HOST_VERSION)) - 4)
VBOX_DARWIN_HOST_VERSION_MINOR := $(word 2, $(VBOX_DARWIN_HOST_VERSION))
VBOX_DARWIN_HOST_VERSION_PATCH := $(word 3, $(VBOX_DARWIN_HOST_VERSION))
VBOX_DARWIN_HOST_VERSION := 10.$(VBOX_DARWIN_HOST_VERSION_MAJOR).$(VBOX_DARWIN_HOST_VERSION_MINOR)
endif
#
# The VirtualBox version.
#
# Major version.
VBOX_VERSION_MAJOR = 5
# Minor version.
VBOX_VERSION_MINOR = 0
# This is the current build number. It should be increased every time we publish a
# new build. The define is available in every source file. Only even build numbers
# will be published, odd numbers are set during development.
VBOX_VERSION_BUILD = 0
# The raw version string. This *must not* contain any other information/fields than
# major, minor and build revision (as it is now) -- also will be used for host/guest version
# comparison.
VBOX_VERSION_STRING_RAW = $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
# This can be overridden in LocalConfig.kmk or elsewhere.
# For the convension, see checks near the end of Config.kmk.
VBOX_BUILD_PUBLISHER =
# Full version string (may include more than just x.y.z, but no spaces or other problematic chars).
# Note! The BETA[n],ALPHA[n],RC[n] indicators should be inserted before the
# publisher so that RTStrVersionCompare have a chance of comparing
# prerelease from different publishers correctly.
VBOX_VERSION_STRING = $(VBOX_VERSION_STRING_RAW)_BETA2$(VBOX_BUILD_PUBLISHER)
# Force the additions.sh script to get an exact additions build when we're doing the release.
ifeq ($(int-mod $(VBOX_VERSION_BUILD),2),0)
VBOX_RELEASE_EXACT_MATCH=1
endif
ifneq ($(VBOX_RELEASE_EXACT_MATCH),)
# export VBOX_ADDITIONS_SH_MODE = release
# export VBOX_DOCUMENTATION_SH_MODE = release
# export VBOX_EFI_SH_MODE = release
# export VBOX_EXTPACKS_SH_MODE = release
endif
# Some info on the vendor
VBOX_VENDOR = Oracle Corporation
VBOX_VENDOR_SHORT = Oracle
VBOX_PRODUCT = Oracle VM VirtualBox
# Not all could be done automatically. Here is a list of known places which
# have to be updated manually, please keep this up to date:
# src/VBox/Installer/linux/{debian,rpm}
# */*.inf, */*.rc
# Maybe we want set this manually.
VBOX_C_YEAR = $(date-utc %Y)
#
# The VirtualBox package type.
#
ifeq ($(KBUILD_TARGET),win)
VBOX_PACKAGE_OS = WINDOWS
else ifeq ($(KBUILD_TARGET),linux)
VBOX_PACKAGE_OS = LINUX
else ifeq ($(KBUILD_TARGET),darwin)
VBOX_PACKAGE_OS = DARWIN
else ifeq ($(KBUILD_TARGET),solaris)
VBOX_PACKAGE_OS = SOLARIS
else ifeq ($(KBUILD_TARGET),os2)
VBOX_PACKAGE_OS = OS2
else ifeq ($(KBUILD_TARGET),haiku)
VBOX_PACKAGE_OS = HAIKU
else if1of ($(KBUILD_TARGET), dragonfly freebsd netbsd openbsd)
VBOX_PACKAGE_OS = BSD
else
$(error Cannot determine VBOX_PACKAGE_OS)
endif
ifeq ($(KBUILD_TARGET_ARCH),x86)
VBOX_PACKAGE_ARCH = 32BITS
else
VBOX_PACKAGE_ARCH = 64BITS
endif
# distribution, mostly for Linux/Solaris where we support different distributions
# this strip will be overridden by the Linux packaging scripts
VBOX_PACKAGE_DIST ?= GENERIC
# Full string
VBOX_PACKAGE_STRING = $(VBOX_PACKAGE_OS)_$(VBOX_PACKAGE_ARCH)_$(VBOX_PACKAGE_DIST)
#
# The VirtualBox Configuration Defaults.
#
# We try to document all the build configuration options here, thing which
# aren't enabled by default is left commented out just to show that they
# exist and which value they should have (usually 1, but anyway).
#
## @name Additions
## @{
# This indicates that additions (of some kind or another) is being _built_.
# VBOX_WITHOUT_ADDITIONS overrides it.
VBOX_WITH_ADDITIONS = 1
# Build the optional ring-0 part of the additions for syntax checking.
# (Except when cross-building on linux since we're using /usr/src/...)
ifn1of ($(KBUILD_TARGET).$(KBUILD_HOST_ARCH).$(KBUILD_TARGET_ARCH), linux.x86.amd64 linux.amd64.x86)
VBOX_WITH_ADDITION_DRIVERS = 1
endif
# Build X11 additions. Can be disabled separately.
if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd solaris)
VBOX_WITH_X11_ADDITIONS = 1
endif
# Enable the building of shared folders in the windows additions.
VBOX_WITH_WIN32_ADDITIONS_SHAREDFOLDERS = 1
# Take the binaries of the OS/2 Additions.
VBOX_WITH_OS2_ADDITIONS_BIN = 1
# Use additions from the build server.
#VBOX_WITH_ADDITIONS_FROM_BUILD_SERVER = 1
# Include additions in the package
VBOX_WITH_ADDITIONS_PACKING = 1
# Only build the additions (for the additions build server).
#VBOX_ONLY_ADDITIONS = 1
ifdef VBOX_ADDITIONS_ONLY # typical mistake.
$(error It is VBOX_ONLY_ADDITIONS=1 not VBOX_ADDITIONS_ONLY!)
endif
# Don't bother with additions, overrides VBOX_WITH_ADDITIONS.
# This is not used by makefiles, only Config.kmk, see below.
ifdef VBOX_ONLY_SDK
VBOX_WITHOUT_ADDITIONS = 1
endif
# Don't create the additions ISO.
# (Used by the additions build server, don't invert it.)
#VBOX_WITHOUT_ADDITIONS_ISO = 1
## @}
## @name Documentation
## @{
# The documentation
VBOX_WITH_DOCS = 1
# Use documentation from the build server.
#VBOX_WITH_DOCS_FROM_BUILD_SERVER = 1
# Include documentation in the package
VBOX_WITH_DOCS_PACKING = 1
# Include CHM when building docs (unset in LocalConfig.kmk to suppress CHM)
ifn1of ($(KBUILD_TARGET), linux)
VBOX_WITH_DOCS_CHM = 1
endif
# By default only include translations in documentation-only builds
ifdef VBOX_ONLY_DOCS
ifndef VBOX_NO_DOCS_TRANSLATIONS
VBOX_WITH_DOCS_TRANSLATIONS = 1
endif
endif
# Default languages
VBOX_MANUAL_LANGUAGES = en_US
ifdef VBOX_WITH_DOCS_TRANSLATIONS
VBOX_MANUAL_ADD_LANGUAGES = fr_FR
endif
# Don't bother with documentation, overrides VBOX_WITH_DOCS.
# This is not used by makefiles, only Config.kmk, see below.
#VBOX_WITHOUT_DOCS = 1
# Only build the documentation (for the documentation build server).
#VBOX_ONLY_DOCS = 1
ifdef VBOX_DOCS_ONLY # typical mistake.
$(error It is VBOX_ONLY_DOCS=1 not VBOX_DOCS_ONLY!)
endif
## @}
## @name VMM related settings.
## @{
# Enable the tradition raw-mode virtualization.
VBOX_WITH_RAW_MODE = 1
# Enable the ring-1 compression option (mainly for QNX).
VBOX_WITH_RAW_RING1 = 1
# Enable safe STR (store task register) emulation for raw-mode.
VBOX_WITH_SAFE_STR = 1
# Enable support for 64-bit guests.
VBOX_WITH_64_BITS_GUESTS = 1
# Enable multi-core VCPUs.
VBOX_WITH_MULTI_CORE = 1
# Activate this to force the VM to pre-allocate the guest RAM before startup
VBOX_WITH_PREALLOC_RAM_BY_DEFAULT =
# Enable the debugger.
VBOX_WITH_DEBUGGER = 1
# Enable the debugger GUI.
VBOX_WITH_DEBUGGER_GUI = 1
# Enables the first step using IEM (the interpreter).
VBOX_WITH_FIRST_IEM_STEP = 1
## @}
## @name Devices, Drivers, ...
## @{
# Build the Host Guest Communication Manager component.
VBOX_WITH_HGCM = 1
## Build the bugcheck detection code.
#VBOX_WITH_GUEST_BUGCHECK_DETECTION =
# Enable the USB feature. This includes VBOX_WITH_VUSB!
VBOX_WITH_USB = 1
# Enable the USB 1.1 controller plus virtual USB HID devices.
VBOX_WITH_VUSB = 1
# Enable the USB 2.0 controller.
VBOX_WITH_EHCI = 1
# Enable the ISCSI feature.
VBOX_WITH_ISCSI = 1
# Enable INIP support in the ISCSI feature.
VBOX_WITH_INIP = 1
# Enable new (pre-1.5.0 release) version of LWIP.
VBOX_WITH_NEW_LWIP = 1
# Enables lwip as a core of NAT service
VBOX_WITH_LWIP_NAT = 1
# Enables compilation of NAT service
VBOX_WITH_NAT_SERVICE = 1
# Enable the E1000 feature.
VBOX_WITH_E1000 = 1
# Enable the Virtio feature.
VBOX_WITH_VIRTIO = 1
# Enable new PS/2 mouse emulation.
VBOX_WITH_NEW_PS2M = 1
# Enable ALSA support for Linux.
VBOX_WITH_ALSA = 1
# Enable Pulse support for Linux.
VBOX_WITH_PULSE = 1
# Enable PCI passthrough support.
VBOX_WITH_PCI_PASSTHROUGH = 1
# Enable PDM based audio driver
VBOX_WITH_PDM_AUDIO_DRIVER = 1
# Enable statically linked dbus support.
if1of ($(KBUILD_TARGET), linux solaris)
VBOX_WITH_DBUS = 1
endif
# Enable building PAM modules.
if1of ($(KBUILD_TARGET), linux solaris)
VBOX_WITH_PAM = 1
endif
# Disable WINMM support for Windows (not implemented).
VBOX_WITH_WINMM =
# Enable internal networking.
VBOX_WITH_INTERNAL_NETWORKING = 1
# Enable vmsvga (svga2) graphics device variant, 2D part
VBOX_WITH_VMSVGA = 1
# Enable vmsvga (svga2) graphics device variant, 3D part
if1of ($(KBUILD_TARGET), darwin win)
VBOX_WITH_VMSVGA3D = 1
endif
# Enable Host Guest Shared Memory Interface.
VBOX_WITH_HGSMI = 1
# Enable Video 2D Acceleration.
if1of ($(KBUILD_TARGET), darwin linux win freebsd)
VBOX_WITH_VIDEOHWACCEL = 1
endif
# Enable Wddm Video driver for Vista+ guests.
VBOX_WITH_WDDM = 1
# Enable Wddm Video driver for Windows 8 guests.
VBOX_WITH_WDDM_W8 = 1
# Lazy developer!!
VBOXWDDM_WITH_VBVA = 1
# Lazy developer!!
ifdef VBOX_WITH_WDDM
VBOX_WITH_VDMA = 1
else ifdef VBOX_WITH_VDMA
undef VBOX_WITH_VDMA
endif
# Disable the Intel PXE ROM (uses Etherboot).
VBOX_WITH_INTEL_PXE =
# Enable EFI support
VBOX_WITH_EFI = 1
# Fetch EFI firmware image from the build server
#VBOX_WITH_EFIFW_FROM_BUILD_SERVER = 1
# Include the EFI firmware into the package
VBOX_WITH_EFIFW_PACKING = 1
# Use kStuff for MACH-O and LX binary loading.
if1of ($(KBUILD_TARGET_ARCH), x86 amd64)
IPRT_WITH_KSTUFF = 1
endif
# Enable setuid wrapper for Solaris host DVD.
#VBOX_WITH_SUID_WRAPPER = 1
# Enable the virtual SATA/AHCI controller
VBOX_WITH_AHCI = 1
# Enable the new async completion manager
VBOX_WITH_PDM_ASYNC_COMPLETION = 1
# Temporary switch for enabling / disabling the new USB code on Darwin.
VBOX_WITH_NEW_USB_CODE_ON_DARWIN = 1
ifdef VBOX_WITH_USB
VBOX_WITH_VUSB = 1
VBOX_WITH_XHCI_IMPL=1
endif
ifdef VBOX_WITH_EHCI
VBOX_WITH_EHCI_IMPL = 1
endif
ifdef VBOX_WITH_PCI_PASSTHROUGH
VBOX_WITH_PCI_PASSTHROUGH_IMPL = 1
endif
ifndef VBOX_WITHOUT_HOSTWEBCAM
VBOX_WITH_USB_VIDEO_IMPL = 1
endif
# Enable the hal/sysfs USB code on Linux.
ifeq ($(KBUILD_TARGET),linux)
VBOX_USB_WITH_SYSFS = 1
# Disabled for now
# VBOX_USB_WITH_DBUS = 1
VBOX_USB_WITH_INOTIFY = 1
endif
# Enable performance API.
VBOX_WITH_RESOURCE_USAGE_API = 1
# Use VBoxVolInfo for getting FS dependecies.
if1of ($(KBUILD_TARGET), linux)
VBOX_WITH_DEVMAPPER = 1
endif
# Enable BusLogic SCSI host adapter
VBOX_WITH_BUSLOGIC = 1
# Enable LsiLogic SCSI host adapter
VBOX_WITH_LSILOGIC = 1
# Enable SCSI drivers
VBOX_WITH_SCSI = 1
# Enable this setting to force a fallback to default DMI data on configuration errors
VBOX_BIOS_DMI_FALLBACK =
# Enable the builtin PXE ROM
VBOX_WITH_PXE_ROM = 1
# Enable MSI support in devices
VBOX_WITH_MSI_DEVICES = 1
# Enable host network interface API.
if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
VBOX_WITH_HOSTNETIF_API = 1
endif
# Emulated USB smart card reader
VBOX_WITH_USB_CARDREADER = 1
# Disk crypt plugin
VBOX_WITH_PLUGIN_CRYPT = 1
# VirtualKD stub/loader device, only relevant on Windows host
VBOX_WITH_VIRTUALKD = 1
## @}
# legacy
ifdef VBOX_ONLY_TESTSUITE
$(warning VBOX_ONLY_TESTSUITE was renamed to VBOX_ONLY_VALIDATIONKIT)
VBOX_ONLY_VALIDATIONKIT = $(VBOX_ONLY_TESTSUITE)
endif
## @name Other Component
## @{
# Build the installer.
VBOX_WITH_INSTALLER = 1
# The kernel driver/module and related runtime libraries.
VBOX_WITH_VBOXDRV = 1
# The main api.
VBOX_WITH_MAIN = 1
# Whether to also ship 32-bit main API on 64-bit systems.
if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), solaris.amd64 win.amd64)
if !defined(VBOX_ONLY_VALIDATIONKIT) && !defined(VBOX_ONLY_ADDITIONS) && !defined(VBOX_ONLY_DOCS)
VBOX_WITH_32_ON_64_MAIN_API = 1
endif
endif
# The recompiler.
VBOX_WITH_REM = 1
# Set this to prefix all C symbols in XPCOM, to avoid dynamic linking problems
# caused by our XPCOM library polluting the symbol namespace for system libs.
if1of ($(KBUILD_TARGET), linux solaris)
VBOX_WITH_XPCOM_NAMESPACE_CLEANUP = 1
endif
# Set this to not use COM or XPCOM in places where it can be avoided.
#VBOX_WITHOUT_COM = 1
# The webservices api.
VBOX_WITH_WEBSERVICES = 1
VBOX_WITH_WEBSERVICES_SSL = 1
# The Qt 4 GUI.
VBOX_WITH_QTGUI = 1
# Indicates the Qt is Cocoa based on the Mac.
ifeq ($(KBUILD_TARGET),darwin)
VBOX_WITH_COCOA_QT = 1
endif
# HiDPI support for OS X
VBOX_GUI_WITH_HIDPI = 1
# The SDL based GUI.
VBOX_WITH_VBOXSDL = 1
# Build VBoxSDL with secure label support.
ifeq ($(filter win.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) # too much work with freetype and all that.
VBOX_WITH_SECURELABEL = 1
endif
# The headless frontend.
VBOX_WITH_HEADLESS = 1
# Enable the build of VRDP server.
VBOX_WITH_VRDP = 1
# Build the VRDP authentication modules.
VBOX_WITH_VRDP_AUTHMOD = 1
# Build enhanced version of rdesktop.
VBOX_WITH_VRDP_RDESKTOP = 1
## The Direct Framebuffer GUI.
#VBOX_WITH_VBOXFB = 1
# Enables the Python<->XPCOM and Python<->COM bindings.
VBOX_WITH_PYTHON ?= 1
if1of ($(KBUILD_TARGET), darwin linux solaris)
# Enable Java<->XPCOM bridge + glue code
VBOX_WITH_JXPCOM ?= 1
endif
if1of ($(KBUILD_TARGET), )
# Enable Java<->MSCOM glue, bridge is provided by an external lib (Jacob)
VBOX_WITH_JMSCOM ?= 1
endif
if1of ($(KBUILD_TARGET), darwin linux solaris)
# Enable Java<->JAX-WS bridge
VBOX_WITH_JWS ?= 1
endif
# Use XPIDL instead of XSLT stylesheet
VBOX_WITH_JAVA_SUPPORT_IN_XPIDL ?=
# Build against multiple Python versions present in the system
VBOX_WITH_MULTIVERSION_PYTHON ?= 1
# Enable the kchmviewer.
VBOX_WITH_KCHMVIEWER = 1
# Build the Validation Kit.
VBOX_WITH_VALIDATIONKIT = 1
# Build the testcases.
VBOX_WITH_TESTCASES = 1
# Enable this to build vditool even if VBOX_WITH_TESTCASES is disabled
VBOX_WITH_VDITOOL =
# Enable this to build vbox-img even if VBOX_WITH_TESTCASES is disabled
VBOX_WITH_VBOX_IMG =
# Enables the VPX module for VM video capturing
if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.x86 darwin.amd64 linux.x86 linux.amd64 solaris.amd64 win.x86 win.amd64)
VBOX_WITH_VPX = 1
endif
# Enable shared folders
VBOX_WITH_SHARED_FOLDERS = 1
# Enable shared clipboard
VBOX_WITH_SHARED_CLIPBOARD = 1
# Enable the host/guest information service (aka guest properties).
VBOX_WITH_GUEST_PROPS = 1
# Enable this to prevent the guest from writing guest properties.
VBOX_WITH_GUEST_PROPS_RDONLY_GUEST =
# Compile the host channel
VBOX_WITH_HOST_CHANNEL = 1
# Enable the guest control service.
if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
VBOX_WITH_GUEST_CONTROL = 1
endif
# Enable ballooning
VBOX_WITH_MEMBALLOON = 1
# Enable crOpenGL service
if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
VBOX_WITH_CROGL = 1
endif
# enable new wined3d code
VBOX_WITH_NEW_WINE = 1
# Enable S3 support (requires libcurl)
VBOX_WITH_S3 = 1
# Enable Host=>Guest Drag'n'Drop
if1of ($(KBUILD_TARGET), darwin linux solaris win)
VBOX_WITH_DRAG_AND_DROP = 1
if1of ($(KBUILD_TARGET), linux solaris win)
VBOX_WITH_DRAG_AND_DROP_GH = 1
endif
endif
# Enables use of merge modules in the windows installer. This will increase
# the overall installer size significantly because merge modules are not able
# to use a common .cab file to reduce their size.
#VBOX_WITH_MSM_INSTALL = 1
## @}
## @name Networking
## @{
# Use VBoxNetFlt for host interface networking.
if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
VBOX_WITH_NETFLT = 1
ifeq ($(KBUILD_TARGET),solaris)
# requires snv_159+.
VBOX_WITH_NETFLT_CROSSBOW = 1
endif
# Use VBoxNetAdp for host only networking.
if1of ($(KBUILD_TARGET), darwin freebsd linux solaris) ## @todo this should be set and used on windows too.
VBOX_WITH_NETADP = 1
endif
endif
# Enables the UDP tunnel transport.
VBOX_WITH_UDPTUNNEL = 1
# Enable the netshaper support
VBOX_WITH_NETSHAPER = 1
# Enable Virtual Distributed Ethernet or not.
if1of ($(KBUILD_TARGET), freebsd linux)
VBOX_WITH_VDE = 1
endif
## @}
## @name Extension pack
## @{
# Enables the extension pack feature.
VBOX_WITH_EXTPACK = 1
# Enables separating code into the Oracle VM VirtualBox Extension Pack, dubbed PUEL.
VBOX_WITH_EXTPACK_PUEL = 1
# Enables building+packing the Oracle VM VirtualBox Extension Pack, includes VBOX_WITH_EXTPACK_PUEL
VBOX_WITH_EXTPACK_PUEL_BUILD = 1
# Enable the BusMouse sample extension pack.
#VBOX_WITH_EXTPACK_BUSMOUSESAMPLE = 1
# Enable the VNC server extension pack (GPL only).
#VBOX_WITH_EXTPACK_VNC = 1
# Enables the VBoxDTrace extension pack.
VBOX_WITH_EXTPACK_VBOXDTRACE = 1
## @}
## @name Misc
## @{
# Enable Seamless mode
VBOX_X11_SEAMLESS_GUEST = 1
# Enables all the doxgen bits.
VBOX_WITH_ALL_DOXYGEN_TARGETS = 1
# Set this to skip installing the redistributable compiler runtime.
#VBOX_WITHOUT_COMPILER_REDIST = 1
# Enables VMMR0.r0 (++) loading using the native loader on solaris.
# Good for debugging and analysis. Experimental.
#VBOX_WITH_NATIVE_SOLARIS_LOADING = 1
# Set this to enable user mode dtrace probes.
if1of ($(KBUILD_TARGET), darwin linux solaris)
VBOX_WITH_DTRACE_R3 = 1
VBOX_WITH_DTRACE_R3_MAIN = 1
endif
# Set this to enable kernel driver dtrace probes.
if1of ($(KBUILD_TARGET), darwin solaris)
VBOX_WITH_DTRACE_R0DRV = 1
endif
# Set this to enable dtrace probes in platform agnostic kernel code.
ifn1of ($(KBUILD_TARGET), os2)
VBOX_WITH_DTRACE_R0 = 1
endif
# Set this to enable dtrace probes raw-mode context code.
if1of ($(KBUILD_TARGET), linux solaris)
VBOX_WITH_DTRACE_RC = 1
endif
# Set this to enable support for dtrace probes in guest code.
#VBOX_WITH_DTRACE_GST = 1
# Set this to indicate that the host ships with DTrace.
if1of ($(KBUILD_TARGET), darwin solaris)
VBOX_WITH_NATIVE_DTRACE = 1
endif
## @}
## @name Compiler and linker config
## @{
# For treating compiler and linker warnings as errors where possible.
if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.x86 darwin.amd64 linux.x86 linux.amd64 win.x86 win.amd64)
VBOX_WITH_WARNINGS_AS_ERRORS = 1
endif
# Whether we can use Open Watcom to build stuff.
if1of ($(KBUILD_TARGET), darwin linux os2 win)
VBOX_WITH_OPEN_WATCOM = 1
endif
## @}
## @name Hardening
## @{
# Enables hardening.
# Most developers will want to disable this in their LocalConfig.kmk.
VBOX_WITH_HARDENING = 1
# Where the application files are (going to be) installed.
#VBOX_PATH_APP_PRIVATE = /usr/lib/virtualbox
ifdef VBOX_WITH_HARDENING
if1of ($(KBUILD_TARGET), linux solaris)
VBOX_PATH_APP_PRIVATE = /opt/VirtualBox
else ifeq ($(KBUILD_TARGET),darwin)
VBOX_PATH_APP_PRIVATE = /Applications/VirtualBox.app/Contents/MacOS
else ifeq ($(KBUILD_TARGET),freebsd)
VBOX_PATH_APP_PRIVATE = /usr/local/lib/virtualbox
else ifeq ($(KBUILD_TARGET),haiku)
VBOX_PATH_APP_PRIVATE = /boot/system/apps/VirtualBox
endif
endif
# Where the architecture specific application files are (going to be) installed.
#VBOX_PATH_APP_PRIVATE_ARCH = /usr/lib/virtualbox
ifdef VBOX_WITH_HARDENING
if1of ($(KBUILD_TARGET), solaris)
VBOX_PATH_APP_PRIVATE_ARCH_TOP = $(VBOX_PATH_APP_PRIVATE)
VBOX_PATH_APP_PRIVATE_ARCH = $(VBOX_PATH_APP_PRIVATE_ARCH_TOP)/$(if-expr $(KBUILD_TARGET_ARCH) == "amd64",amd64,i386)
else ifdef VBOX_PATH_APP_PRIVATE
VBOX_PATH_APP_PRIVATE_ARCH = $(VBOX_PATH_APP_PRIVATE)
endif
endif
# Where the shared libraries are (going to be) installed.
#VBOX_PATH_SHARED_LIBS = /usr/lib
ifdef VBOX_WITH_HARDENING
if1of ($(KBUILD_TARGET), solaris)
VBOX_PATH_SHARED_LIBS = $(VBOX_PATH_APP_PRIVATE)/$(if-expr $(KBUILD_TARGET_ARCH) == "amd64",amd64,i386)
else ifdef VBOX_PATH_APP_PRIVATE
VBOX_PATH_SHARED_LIBS = $(VBOX_PATH_APP_PRIVATE)
endif
endif
# Where the documentation is (going to be) installed.
#VBOX_PATH_APP_DOCS = /usr/share/doc/virtualbox
ifdef VBOX_WITH_HARDENING
ifdef VBOX_PATH_APP_PRIVATE
VBOX_PATH_APP_DOCS = $(VBOX_PATH_APP_PRIVATE)
endif
endif
# The DT_RPATH/DT_RUNPATH to embed into the binaries (ELF).
# (This one is used for all binaries, there is no need to adjust this
# depending on the location of the object.)
#VBOX_WITH_RUNPATH = /usr/lib/virtualbox
ifdef VBOX_WITH_HARDENING
if1of ($(KBUILD_TARGET), solaris)
VBOX_WITH_RUNPATH = $(VBOX_PATH_APP_PRIVATE)/$(if-expr $(KBUILD_TARGET_ARCH) == "amd64",amd64,i386)
else if1of ($(KBUILD_TARGET), freebsd linux)
VBOX_WITH_RUNPATH = $(VBOX_PATH_APP_PRIVATE)
endif
endif
# Enable use of the $ORIGIN DT_RPATH/DT_RUNPATH feature (ELF).
# Because of the setuid usage on all ELF platforms when hardening the build
# things gets a bit complicated since the $ORIGIN+setuid policy differs.
#VBOX_WITH_ORIGIN = 1
ifndef VBOX_WITH_HARDENING
if1of ($(KBUILD_TARGET), linux solaris)
VBOX_WITH_ORIGIN = 1
endif
endif
# Enable the system wide support service/daemon.
# Very sketchy work in progress.
#VBOX_WITH_SUPSVC = 1
# Continue to support Vista w/o any service pack, at least for now.
VBOX_WITH_VISTA_NO_SP = 1
## @}
# Strip binaries of release and profile builds before packing them into the installer
# archive. When building .deb/.rpms, don't strip the symbols as they are required for
# the debug packages containing symbols for gdb located in /usr/lib/debug.
VBOX_DO_STRIP := $(if $(filter release profile,$(KBUILD_TYPE)),1,)
#
# Config items for enabling work in progress.
#
# It's good pratice to add stuff here even if it is currently disabled by
# default.
#
# Note! Please, do *not* add stuff to the global DEFS unless it is *really*
# necessary! The other guys will hate for it you when they have to
# recompile everything when the feature is enabled or disabled. Put
# the ifdefs in target or template definitions.
#
# Mask all Local APIC interrupt vectors which are set up to NMI mode when switching
# to/from the guest in raw mode. Modern Linux kernels use the performance counter
# to raise an NMI from time to time.
if1of ($(KBUILD_TARGET), linux)
VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI = 1
endif
## For testing deadlock detection and lock order validation.
# If issues are found, create high priority defects and temporarily comment
# the next line.
VBOX_WITH_STRICT_LOCKS = 1
#
# Branding
#
VBOX_BRAND_BIOS_LOGO := $(PATH_ROOT)/src/VBox/Devices/Graphics/BIOS/puel_logo.bmp
VBOX_BRAND_LICENSE_HTML := $(PATH_ROOT)/doc/License-gpl-2.0.html
VBOX_BRAND_LICENSE_RTF := $(PATH_ROOT)/doc/License-gpl-2.0.rtf
VBOX_BRAND_LICENSE_TXT := $(PATH_ROOT)/doc/License-gpl-2.0.txt
VBOX_BRAND_LICENSE_VER :=
VBOX_BRAND_GUI_ABOUT_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about.png
VBOX_BRAND_GUI_ABOUT_HIDPI_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/hidpi/NonOSE/about_hidpi.png
VBOX_BRAND_GUI_ABOUT_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about_16px.png
VBOX_BRAND_GUI_VBOX_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_16px.png
VBOX_BRAND_GUI_VBOX_20PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_20px.png
VBOX_BRAND_GUI_VBOX_32PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_32px.png
VBOX_BRAND_GUI_VBOX_40PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_40px.png
VBOX_BRAND_GUI_VBOX_48PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_48px.png
VBOX_BRAND_GUI_VBOX_64PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_64px.png
VBOX_BRAND_GUI_VBOX_SVG := $(PATH_ROOT)/src/VBox/Resources/NonOSE/virtualbox.svg
VBOX_BRAND_WIN_INST_DLGJPG := $(PATH_ROOT)/src/VBox/Installer/win/Binary/Dialog.jpg
VBOX_BRAND_WIN_INST_EXT :=
VBOX_BRAND_WIN_ADD_INST_DLGBMP := $(PATH_ROOT)/src/VBox/Additions/WINNT/Installer/welcome.bmp
VBOX_BRAND_DARWIN_DISKIMAGE_DS_STORE := $(PATH_ROOT)/src/VBox/Installer/darwin/DiskImage/DS_Store
VBOX_BRAND_DARWIN_DISKIMAGE_BG := $(PATH_ROOT)/src/VBox/Installer/darwin/DiskImage/vbox_folder.tiff
VBOX_BRAND_DARWIN_INSTALLER_BG := $(PATH_ROOT)/src/VBox/Installer/darwin/VirtualBox_mpkg/background.tif
#
# Skip stuff.
#
ifdef VBOX_ONLY_EXTPACKS
# Clear some VBOX_WITH_XXX variables instead of adding ifdefs all over the place.
VBOX_WITH_DEBUGGER =
VBOX_WITH_ADDITIONS =
VBOX_WITH_VBOXDRV =
VBOX_WITH_TESTCASES =
endif
# VBOX_QUICK can be used by core developers to speed to the build
ifdef VBOX_QUICK
# undefine variables by assigning blank.
VBOX_WITH_VALIDATIONKIT=
VBOX_WITH_TESTCASES=
VBOX_WITH_MAIN =
VBOX_WITH_VBOXSDL =
VBOX_WITH_QTGUI =
VBOX_WITH_DEBUGGER_GUI =
VBOX_WITH_DOCS =
endif # VBOX_QUICK
ifeq ($(KBUILD_TARGET),darwin)
# Don't bother with SDL ttf for now.
VBOX_WITH_SECURELABEL=
# We'll use the native html/help viewer.
VBOX_WITH_KCHMVIEWER=
VBOX_WITH_VRDP_RDESKTOP=
# Permanent (no working SDL).
VBOX_WITH_VBOXSDL=
endif
ifeq ($(KBUILD_TARGET),freebsd)
VBOX_WITH_DOCS=
endif
ifeq ($(KBUILD_TARGET),haiku)
# Don't bother with SDL ttf for now.
VBOX_WITH_SECURELABEL=
# We'll use the native html/help viewer.
VBOX_WITH_KCHMVIEWER=
VBOX_WITH_VRDP_RDESKTOP=
# Permanent (no working SDL).
VBOX_WITH_VBOXSDL=
VBOX_WITH_DOCS=
VBOX_WITH_VBOXDRV=
VBOX_WITH_VRDP=
VBOX_WITH_HEADLESS=
VBOX_WITH_VBOXSDL=
VBOX_WITH_QTGUI=
# VBOX_WITH_MAIN=
VBOX_WITH_DOCS=
VBOX_WITH_ISCSI=
VBOX_WITH_INIP=
VBOX_WITH_INTERNAL_NETWORKING=
VBOX_WITH_PDM_ASYNC_COMPLETION=
VBOX_WITH_KCHMVIEWER=
VBOX_WITH_HARDENING=
endif
ifeq ($(KBUILD_TARGET),os2)
VBOX_WITH_WEBSERVICES=
VBOX_WITH_INSTALLER=
VBOX_WITH_SECURELABEL=
VBOX_WITH_VRDP_AUTHMOD=
VBOX_WITH_VRDP_RDESKTOP=
VBOX_WITH_VALIDATIONKIT=
VBOX_WITH_QTGUI=
VBOX_WITH_USB=
VBOX_WITH_EHCI=
VBOX_WITH_DOCS=
VBOX_WITH_PDM_ASYNC_COMPLETION=
VBOX_WITH_KCHMVIEWER=
VBOX_WITH_HARDENING=
endif
ifeq ($(KBUILD_TARGET),solaris)
VBOX_WITH_SECURELABEL=
VBOX_WITH_OGL=
endif
ifeq ($(KBUILD_TARGET),win)
VBOX_WITH_VRDP_RDESKTOP=
VBOX_WITH_KCHMVIEWER=
endif
ifn1of ($(KBUILD_TARGET_ARCH), x86 amd64)
VBOX_WITH_ADDITION_DRIVERS=
VBOX_WITH_CROGL=
VBOX_WITH_DEBUGGER=
VBOX_WITH_DOCS=
VBOX_WITH_EHCI=
VBOX_WITH_HARDENING=
VBOX_WITH_HEADLESS=
VBOX_WITH_HGCM=
VBOX_WITH_HGSMI=
VBOX_WITH_INIP=
VBOX_WITH_INSTALLER=
VBOX_WITH_INTERNAL_NETWORKING=
VBOX_WITH_ISCSI=
VBOX_WITH_KCHMVIEWER=
VBOX_WITH_MAIN=
VBOX_WITH_PDM_ASYNC_COMPLETION=
VBOX_WITH_QTGUI=
VBOX_WITH_RAW_MODE=
VBOX_WITH_SECURELABEL=
VBOX_WITH_VALIDATIONKIT=
VBOX_WITH_USB=
VBOX_WITH_VBOXDRV=
VBOX_WITH_VBOXSDL=
VBOX_WITH_WEBSERVICES=
VBOX_WITH_XPCOM=
VBOX_WITHOUT_HARDENING=1
# remove later:
VBOX_WITH_VRDP=
VBOX_WITH_VRDP_AUTHMOD=
VBOX_WITH_VRDP_RDESKTOP=
endif
#
# Include automatic and local config file to override the above settings
# and to provide defaults for the settings below this point.
#
ifndef AUTOCFG
AUTOCFG := $(wildcard $(PATH_ROOT)/AutoConfig.kmk)
endif
ifneq ($(AUTOCFG),)
include $(AUTOCFG)
endif
ifndef LOCALCFG
LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
ifneq ($(LOCALCFG),)
include $(LOCALCFG)
endif
else
# Ignore it if it doesn't exist.
if exists "$(LOCALCFG)"
include $(LOCALCFG)
else
$(warning LOCALCFG='$(LOCALCFG)' does not exist)
override LOCALCFG :=
endif
endif
#
# Allow to overwrite the branding information from an external file
#
ifdef VBOX_BRANDING_CFG
include $(VBOX_BRANDING_CFG)
endif
#
# Bitch about old settings.
#
ifdef VBOX_WITHOUT_LINUX_COMPILER_H
$(warning VBOX_WITHOUT_LINUX_COMPILER_H was renamed to VBOX_WITH_LINUX_COMPILER_H, the meaning is inverted.)
endif
#
# Indicate VBOX_ONLY build if any of the VBOX_ONLY_* variables are set.
#
VBOX_ONLY_BUILD := $(strip $(foreach x, ADDITIONS DOCS EXTPACKS SDK VALIDATIONKIT\
, $(if-expr defined(VBOX_ONLY_$(x)),VBOX_ONLY_$(x))))
if $(words $(VBOX_ONLY_BUILD)) > 1
$(error VBox: More than one VBOX_ONLY build enabled! $(VBOX_ONLY_BUILD))
endif
#
# For the docs build box.
#
ifdef VBOX_ONLY_DOCS
VBOX_WITH_DOCS_CHM = 1
endif
#
# Disable components that are not open sourced.
#
ifdef VBOX_OSE
VBOX_WITH_VRDP=
VBOX_WITH_EHCI_IMPL=
VBOX_WITH_XHCI_IMPL=
VBOX_WITH_USB_VIDEO_IMPL=
VBOX_WITH_EXTPACK_PUEL=
VBOX_WITH_EXTPACK_PUEL_BUILD=
VBOX_WITH_PCI_PASSTHROUGH_IMPL=
VBOX_WITH_OS2_ADDITIONS_BIN=
VBOX_WITH_SECURELABEL=
VBOX_WITH_KCHMVIEWER=
VBOX_WITH_PLUGIN_CRYPT=
ifn1of ($(KBUILD_TARGET), linux)
VBOX_WITH_DOCS=
VBOX_WITH_DOCS_PACKING=
endif
if1of ($(KBUILD_TARGET), solaris)
VBOX_WITH_32_ON_64_MAIN_API=
endif
# Enable any translations in OSE, even partial ones.
ifndef ($(VBOX_NO_DOCS_TRANSLATIONS))
VBOX_WITH_DOCS_TRANSLATIONS = 1
endif
VBOX_WITH_INTEL_PXE=
# Disable for OSE, requires snv_159+.
VBOX_WITH_NETFLT_CROSSBOW=
ifn1of ($(KBUILD_TARGET), darwin linux solaris win)
VBOX_WITH_INSTALLER=
endif
if1of ($(KBUILD_TARGET), win)
VBOX_WITH_VPX=
endif
VBOX_GUI_WITH_HIDPI=
# branding
VBOX_BRAND_LICENSE_HTML := $(PATH_ROOT)/doc/License-gpl-2.0.html
VBOX_BRAND_LICENSE_RTF := $(PATH_ROOT)/doc/License-gpl-2.0.rtf
VBOX_BRAND_LICENSE_TXT := $(PATH_ROOT)/doc/License-gpl-2.0.txt
VBOX_BRAND_BIOS_LOGO := $(PATH_ROOT)/src/VBox/Devices/Graphics/BIOS/ose_logo.bmp
VBOX_BRAND_GUI_ABOUT_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about.png
VBOX_BRAND_GUI_ABOUT_HIDPI_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about.png
VBOX_BRAND_GUI_ABOUT_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about_16px.png
VBOX_BRAND_GUI_VBOX_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_16px.png
VBOX_BRAND_GUI_VBOX_20PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_20px.png
VBOX_BRAND_GUI_VBOX_32PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_32px.png
VBOX_BRAND_GUI_VBOX_40PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_40px.png
VBOX_BRAND_GUI_VBOX_48PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_48px.png
VBOX_BRAND_GUI_VBOX_64PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_64px.png
VBOX_BRAND_GUI_CUBE_42PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_cube_42px.png
VBOX_BRAND_GUI_VBOX_SVG := $(PATH_ROOT)/src/VBox/Resources/OSE/virtualbox.svg
endif
#
# VBOX_WITHOUT_HARDENING is for developers (put in LocalConfig.kmk).
# Note that this is a bit rough since hardening governs more than one
# variable... Also note that we allow VBOX_WITH_HARDENING=1 on the
# command line to overrule VBOX_WITHOUT_HARDENING (the check below).
#
ifdef VBOX_WITHOUT_HARDENING
VBOX_WITH_HARDENING=
ifeq ($(VBOX_WITH_HARDENING),)
VBOX_PATH_APP_PRIVATE=
VBOX_PATH_APP_PRIVATE_ARCH=
VBOX_PATH_APP_PRIVATE_ARCH_TOP=
VBOX_PATH_SHARED_LIBS=
VBOX_PATH_APP_DOCS=
VBOX_WITH_RUNPATH=
if1of ($(KBUILD_TARGET), linux solaris)
VBOX_WITH_ORIGIN=1
endif
endif
endif
#
# Sanitize the additions build config variables.
#
ifdef VBOX_WITH_ADDITIONS_FROM_BUILD_SERVER
VBOX_WITHOUT_ADDITIONS := 1
ifdef VBOX_ONLY_ADDITIONS
$(error VBOX_ONLY_ADDITIONS + VBOX_WITH_ADDITIONS_FROM_BUILD_SERVER does not add up!)
endif
endif
ifdef VBOX_ONLY_ADDITIONS
ifdef VBOX_WITHOUT_ADDITIONS
$(error VBOX_ONLY_ADDITIONS + VBOX_WITHOUT_ADDITIONS does not add up!)
endif
endif
ifdef VBOX_WITHOUT_ADDITIONS
# Zap anything that could be contradicting this.
VBOX_WITH_ADDITIONS :=
endif
#
# Sanitize the documentation build config variables.
#
ifdef VBOX_WITH_DOCS_FROM_BUILD_SERVER
VBOX_WITHOUT_DOCS := 1
ifdef VBOX_ONLY_DOCS
$(error VBOX_ONLY_DOCS + VBOX_WITH_DOCS_FROM_BUILD_SERVER does not add up!)
endif
endif
ifdef VBOX_ONLY_DOCS
ifdef VBOX_WITHOUT_DOCS
$(error VBOX_ONLY_DOCS + VBOX_WITHOUT_DOCS does not add up!)
endif
endif
ifdef VBOX_WITHOUT_DOCS
# Zap anything that could be contradicting this.
VBOX_WITH_DOCS :=
VBOX_WITH_DOCS_CHM :=
endif
#
# Disable components for headless
#
ifdef VBOX_HEADLESS
VBOX_WITH_QTGUI=
VBOX_WITH_VBOXSDL=
VBOX_WITH_OGL=
VBOX_WITH_KCHMVIEWER=
VBOX_WITH_VRDP_RDESKTOP=
endif
#
# Undefined VBOX_WITH_MAIN implies exclusion of a few more items.
#
ifndef VBOX_WITH_MAIN
VBOX_WITH_VBOXSDL=
VBOX_WITH_QTGUI=
VBOX_WITH_DEBUGGER_GUI=
VBOX_WITH_HEADLESS=
ifdef VBOX_ONLY_DOCS
$(error Oh, does VBOX_ONLY_DOCS actually end up here. sweet.)
endif
VBOX_WITH_DOCS=
endif
ifndef VBOX_WITH_QTGUI
VBOX_WITH_KCHMVIEWER=
endif
ifdef VBOX_WITH_EXTPACK_PUEL_BUILD
VBOX_WITH_EXTPACK_PUEL = 1
endif
ifdef VBOX_WITH_TESTSUITE
$(warning VBOX_WITH_TESTSUITE was renamed to VBOX_WITH_VALIDATIONKIT)
VBOX_WITH_VALIDATIONKIT = $(VBOX_WITH_TESTSUITE)
endif
#
# Mark OSE builds clearly, helps figuring out limitations more easily.
#
ifdef VBOX_OSE
# This can be overridden (e.g. in LocalConfig.kmk) by whoever publishes a set
# of VirtualBox binaries. We request though that you always use something that
# clearly identifies your build and makes it clear that it is not one done by
# the VirtualBox team.
VBOX_BUILD_PUBLISHER = _OSE
endif
# Keep in sync with G_virtualBoxPackage in glue-jaxws.xsl and glue-java.xsl
# Changed with every new version, so beware!
if $(VBOX_VERSION_BUILD) < 51
VBOX_API_VERSION = $(VBOX_VERSION_MAJOR)_$(VBOX_VERSION_MINOR)
else
VBOX_API_VERSION = $(VBOX_VERSION_MAJOR)_$(expr $(VBOX_VERSION_MINOR) + 1)
endif
VBOX_API_SUFFIX = _$(VBOX_API_VERSION)
VBOX_JAVA_PACKAGE = org.virtualbox$(VBOX_API_SUFFIX)
#
# Derived / helper config indicators. Not configurable.
#
# Use the OpenGL module in qt when the video hardware acceleartion feature
# is enabled.
if defined(VBOX_WITH_VIDEOHWACCEL) && defined(VBOX_WITH_QTGUI)
VBOX_GUI_USE_QGL = 1
else
VBOX_GUI_USE_QGL=
endif
# Collection macro mainly for deciding whether VBoxDTrace needs shipping.
VBOX_WITH_DTRACE := $(if-expr defined(VBOX_WITH_DTRACE_R0) || defined(VBOX_WITH_DTRACE_R0DRV) \
|| defined(VBOX_WITH_DTRACE_R3) || defined(VBOX_WITH_DTRACE_RC),1,)
#
# Image and object format config.
#
if1of ($(KBUILD_TARGET), freebsd haiku linux netbsd openbsd solaris)
VBOX_LDR_FMT = elf
endif
ifeq ($(KBUILD_TARGET),darwin)
VBOX_LDR_FMT = macho
endif
ifeq ($(KBUILD_TARGET),os2)
VBOX_LDR_FMT = lx
VBOX_LDR_FMT32 = lx
VBOX_LDR_FMT64 = elf
DONT_USE_YASM = 1 # yasm doesn't implement omf yet.
endif
ifeq ($(KBUILD_TARGET),win)
VBOX_LDR_FMT = pe
endif
VBOX_LDR_FMT32 ?= $(VBOX_LDR_FMT)
VBOX_LDR_FMT64 ?= $(VBOX_LDR_FMT)
#
# Assembler setup.
#
# This is a bit complicated since we have to support two different assmblers
# (yasm/nasm) and possibly two different formats (32-bit/64-bit).
#
ifeq ($(VBOX_LDR_FMT),elf)
ifeq ($(KBUILD_TARGET_ARCH),x86)
VBOX_ASFLAGS_FMT = -f elf32 -DASM_FORMAT_ELF
else
VBOX_ASFLAGS_FMT = -f elf64 -DASM_FORMAT_ELF
endif
VBOX_ASFLAGS_DBFINFO = -g dwarf2
endif
ifeq ($(VBOX_LDR_FMT),lx)
VBOX_ASFLAGS_FMT = -f obj -DASM_FORMAT_OMF
VBOX_ASFLAGS_DBFINFO = -g stabs
endif
ifeq ($(VBOX_LDR_FMT),macho)
ifeq ($(KBUILD_TARGET_ARCH),x86)
VBOX_ASFLAGS_FMT = -f macho32 -DASM_FORMAT_MACHO
else
VBOX_ASFLAGS_FMT = -f macho64 -DASM_FORMAT_MACHO
endif
VBOX_ASFLAGS_DBFINFO = -g dwarf2
endif
ifeq ($(VBOX_LDR_FMT),pe)
ifeq ($(KBUILD_TARGET_ARCH),x86)
VBOX_ASFLAGS_FMT = -f win32 -DASM_FORMAT_PE
else
VBOX_ASFLAGS_FMT = -f win64 -DASM_FORMAT_PE
endif
VBOX_ASFLAGS_DBFINFO = -g cv8
endif
ifndef VBOX_ASFLAGS_FMT
$(error VBOX_ASFLAGS_FMT is not defined. VBOX_LDR_FMT=$(VBOX_LDR_FMT))
endif
ifeq ($(VBOX_LDR_FMT32),elf)
VBOX_ASFLAGS_FMT32 = -f elf32 -DASM_FORMAT_ELF
VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
endif
ifeq ($(VBOX_LDR_FMT32),lx)
VBOX_ASFLAGS_FMT32 = -f obj -DASM_FORMAT_OMF
VBOX_ASFLAGS_DBFINFO32 = -g stabs
endif
ifeq ($(VBOX_LDR_FMT32),macho)
VBOX_ASFLAGS_FMT32 = -f macho32 -DASM_FORMAT_MACHO
VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
endif
ifeq ($(VBOX_LDR_FMT32),pe)
VBOX_ASFLAGS_FMT32 = -f win32 -DASM_FORMAT_PE
VBOX_ASFLAGS_DBFINFO32 = -g cv8
endif
ifndef VBOX_ASFLAGS_FMT32
$(error VBOX_ASFLAGS_FMT32 is not defined. VBOX_LDR_FMT32=$(VBOX_LDR_FMT32))
endif
ifeq ($(VBOX_LDR_FMT64),elf)
VBOX_ASFLAGS_FMT64 = -f elf64 -DASM_FORMAT_ELF
VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
endif
ifeq ($(VBOX_LDR_FMT64),macho)
VBOX_ASFLAGS_FMT64 = -f macho64 -DASM_FORMAT_MACHO
VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
endif
ifeq ($(VBOX_LDR_FMT64),pe)
VBOX_ASFLAGS_FMT64 = -f win64 -DASM_FORMAT_PE
VBOX_ASFLAGS_DBFINFO64 = -g cv8
endif
ifndef VBOX_ASFLAGS_FMT64
$(error VBOX_ASFLAGS_FMT64 is not defined. VBOX_LDR_FMT64=$(VBOX_LDR_FMT64))
endif
ifndef DONT_USE_YASM
VBOX_ASTOOL = YASM
VBOX_LDR_FMT_2_YASM_DBGINFO.elf = -g dwarf2
VBOX_LDR_FMT_2_YASM_DBGINFO.lx = -g stabs
VBOX_LDR_FMT_2_YASM_DBGINFO.pe = -g cv8
VBOX_ASFLAGS = $(VBOX_ASFLAGS_FMT) -D__YASM__ -Worphan-labels $(VBOX_YASM_Wno-segreg-in-64bit) $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT))
VBOX_ASFLAGS32 = $(VBOX_ASFLAGS_FMT32) -D__YASM__ -Worphan-labels $(VBOX_YASM_Wno-segreg-in-64bit) $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT32))
VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__YASM__ -Worphan-labels $(VBOX_YASM_Wno-segreg-in-64bit) $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT64))
else
VBOX_ASTOOL = NASM
VBOX_ASFLAGS = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT)) -D__NASM__ -w+orphan-labels -g
VBOX_ASFLAGS32 = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT32)) -D__NASM__ -w+orphan-labels -g
VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__NASM__ -w+orphan-labels -g
endif
#
# Windows only has mingw handy. On *nix we have to deal with cross compiling
# 32-bit targets on 64-bit platforms, meaning we'll be using gcc32/g++32.
# In the latter case we'll also have to disable all the all the R0 driver related stuff.
#
ifndef VBOX_GCC_TOOL
ifeq ($(KBUILD_TARGET),win)
ifeq ($(KBUILD_TARGET_ARCH),x86)
VBOX_GCC_TOOL := MINGW32
TOOL_MINGW32_CFLAGS := $(UNDEFINED) # override -g
else
VBOX_GCC_TOOL := MINGWW64
endif
else ifeq ($(KBUILD_TARGET),os2)
VBOX_GCC_TOOL := GXX3OMF
else ifeq ($(KBUILD_TARGET),darwin)
VBOX_GCC_TOOL := GXX4MACHO
else ifeq ($(KBUILD_TARGET),haiku)
# Haiku shouldn't pass '-r' to the linker by default
VBOX_GCC_TOOL := GXX3PLAIN
else ifeq ($(KBUILD_TARGET),solaris)
VBOX_GCC_TOOL := GXX3PLAIN
VBOX_GCC32_TOOL := GXX3PLAIN
ifeq ($(KBUILD_HOST),solaris)
TOOL_GXX3PLAIN_LD_SYSMOD ?= /usr/ccs/bin/ld
endif
else
VBOX_GCC_TOOL := GXX3
ifeq ($(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH),x86.amd64) ## @todo mixing target/host here!
VBOX_GCC_TOOL := GXX32
VBOX_WITH_VBOXDRV=
else ifeq ($(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH),amd64.x86)
VBOX_GCC_TOOL := GXX64
VBOX_WITH_VBOXDRV=
endif
endif
endif
ifndef VBOX_GCC32_TOOL
ifeq ($(KBUILD_TARGET_ARCH),x86)
VBOX_GCC32_TOOL := $(VBOX_GCC_TOOL)
else ifeq ($(KBUILD_TARGET),win)
VBOX_GCC32_TOOL := MINGW32
else
VBOX_GCC32_TOOL := GXX32
endif
endif
#
# Decide which Visual C++ compiler version we're using by default.
#
ifndef VBOX_VCC_TOOL_STEM
VBOX_VCC_TOOL_STEM := VCC100
else ifn1of ($(VBOX_VCC_TOOL_STEM), VCC100 VCC110)
$(error VBox: VBOX_VCC_TOOL_STEM='$(VBOX_VCC_TOOL_STEM)' is not supported, only VCC100 and VCC110 is)
endif
ifndef VBOX_VCC_TOOL
VBOX_VCC_TOOL := $(VBOX_VCC_TOOL_STEM)$(toupper $(KBUILD_TARGET_ARCH))
endif
## @todo Remove the default tool crap here!
TOOL = $(VBOX_GCC_TOOL)
TOOL.win.x86 = $(VBOX_VCC_TOOL_STEM)X86
TOOL.win.amd64 = $(VBOX_VCC_TOOL_STEM)AMD64
ASTOOL = $(VBOX_ASTOOL)
#
# Setup the global defines and includes.
#
# Note! The __SOMETHING__ #defines are deprecated as they violate the C/C++ specs.
#
INCS += $(PATH_ROOT)/include $(PATH_OUT)
DEFS += VBOX
DEFS.debug := DEBUG DEBUG_$(subst $(subst _, ,_),_,$(USERNAME)) DEBUG_USERNAME=$(subst $(subst _, ,_),_,$(USERNAME))
DEFS.dbgopt = $(DEFS.debug)
DEFS.profile = VBOX_WITH_STATISTICS
DEFS.strict = RT_STRICT VBOX_STRICT
DEFS.x86 = RT_ARCH_X86 __X86__
DEFS.amd64 = RT_ARCH_AMD64 __AMD64__
DEFS.darwin = RT_OS_DARWIN __DARWIN__
DEFS.freebsd = RT_OS_FREEBSD __FREEBSD__
DEFS.haiku = RT_OS_HAIKU
DEFS.linux = RT_OS_LINUX _FILE_OFFSET_BITS=64
DEFS.netbsd = RT_OS_NETBSD
DEFS.openbsd = RT_OS_OPENBSD
DEFS.os2 = RT_OS_OS2 __OS2__
DEFS.solaris = RT_OS_SOLARIS _FILE_OFFSET_BITS=64
DEFS.win = RT_OS_WINDOWS __WIN__
DEFS.win.x86 = __WIN32__
DEFS.win.amd64 = __WIN64__
# optional defines (use environment or make commandline)
ifdef VBOX_WITH_STATISTICS
DEFS += VBOX_WITH_STATISTICS
endif
ifdef VBOX_STRICT
DEFS += VBOX_STRICT
endif
ifdef LOG_ENABLED
DEFS += LOG_ENABLED
endif
ifdef VBOX_OSE
DEFS += VBOX_OSE
endif
ifdef VBOX_WITH_64_BITS_GUESTS
DEFS += VBOX_WITH_64_BITS_GUESTS
endif
# Don't flood CDEFS, old MASMs doesn't like too many defines.
ifdef VBOX_WITH_DEBUGGER
DEFS += VBOX_WITH_DEBUGGER
endif
ifdef VBOX_WITH_HARDENING
CDEFS += VBOX_WITH_HARDENING
endif
if defined(VBOX_WITH_STRICT_LOCKS) && ($(KBUILD_TYPE) == "debug" || $(KBUILD_TYPE) == "strict")
CDEFS += RT_LOCK_STRICT RT_LOCK_STRICT_ORDER
endif
ifdef VBOX_WITH_EF_WRAPS
CDEFS += RTMEM_WRAP_TO_EF_APIS RTMEM_WRAP_SOME_NEW_AND_DELETE_TO_EF
endif
# Quoted strings should not be passed to the assemblers since they might not
# subscribe to C preprocessing semantics.
ifdef VBOX_PATH_APP_PRIVATE
CDEFS += RTPATH_APP_PRIVATE=\"$(VBOX_PATH_APP_PRIVATE)\"
endif
ifdef VBOX_PATH_APP_PRIVATE_ARCH
CDEFS += RTPATH_APP_PRIVATE_ARCH=\"$(VBOX_PATH_APP_PRIVATE_ARCH)\"
endif
ifdef VBOX_PATH_APP_PRIVATE_ARCH_TOP
CDEFS += RTPATH_APP_PRIVATE_ARCH_TOP=\"$(VBOX_PATH_APP_PRIVATE_ARCH_TOP)\"
endif
ifdef VBOX_PATH_SHARED_LIBS
CDEFS += RTPATH_SHARED_LIBS=\"$(VBOX_PATH_SHARED_LIBS)\"
endif
ifdef VBOX_PATH_APP_DOCS
CDEFS += RTPATH_APP_DOCS=\"$(VBOX_PATH_APP_DOCS)\"
endif
CXXDEFS += $(CDEFS)
OBJCDEFS += $(CDEFS)
USES += dtrace
#
# Compiler optimization flags.
#
VBOX_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) $(VBOX_GCC_Wlogical-op)
VBOX_GCC_WARN_PEDANTIC = -Wshadow $(VBOX_GCC_WARN) -Wno-long-long
ifdef VBOX_WITH_MASOCHISTIC_WARNINGS
VBOX_GCC_WARN_PEDANTIC += -Wunused-variable -Wunused-function -Wunused-label -Wunused-parameter
endif
VBOX_GCC_PEDANTIC_CXX ?= -pedantic -Wshadow $(VBOX_GCC_WARN_PEDANTIC) -Wno-long-long $(VBOX_GCC_Wno-delete-non-virtual-dtor)
VBOX_GCC_PEDANTIC_C ?= -pedantic -Wshadow $(VBOX_GCC_WARN_PEDANTIC) -Wno-long-long -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Werror-implicit-function-declaration
ifeq ($(KBUILD_TARGET),win)
VBOX_C_CXX_FLAGS_NO_UNUSED_PARAMETERS = #-Wdxxxx
else
VBOX_C_CXX_FLAGS_NO_UNUSED_PARAMETERS = -Wno-unused-parameter
endif
ifeq ($(KBUILD_TYPE),debug)
VBOX_GCC_FP ?= -fno-omit-frame-pointer
VBOX_GCC_OPT ?= -O0
VBOX_VCC_FP ?= -Oy-
VBOX_VCC_OPT ?=
VBOX_GCC_R0_FP ?= -fno-omit-frame-pointer -fno-optimize-sibling-calls
VBOX_GCC_R0_OPT ?= -O2
VBOX_VCC_R0_FP ?= -Oy-
VBOX_VCC_R0_OPT ?=
VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer -fno-optimize-sibling-calls
VBOX_GCC_GC_OPT ?= -O2
VBOX_VCC_GC_FP ?= -Oy-
VBOX_VCC_GC_OPT ?=
else
# We should use -fomit-frame-pointer for GCC / -Oy for VCC.
# -funwind-tables provides support for backtraces in gdb then.
VBOX_GCC_FP ?= -fno-omit-frame-pointer
VBOX_GCC_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
VBOX_VCC_FP ?= -Oy-
VBOX_VCC_OPT ?= -O2
VBOX_GCC_R0_FP ?= -fno-omit-frame-pointer
VBOX_GCC_R0_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
VBOX_VCC_R0_FP ?= -Oy-
VBOX_VCC_R0_OPT ?= -O2
VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer
VBOX_GCC_GC_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
VBOX_VCC_GC_FP ?= -Oy-
VBOX_VCC_GC_OPT ?= -O2
endif
ifeq ($(KBUILD_TARGET_ARCH),x86)
ifneq ($(KBUILD_TARGET),darwin)
# (The '<=' operator is for prepending (kmk specific).)
VBOX_GCC_OPT <= -march=i586
endif
endif
#
# Select the CRT type we're using with Microsoft Visual C++.
#
ifdef VBOX_WITH_DEBUG_VCC_CRT
VBOX_VCC_CRT_TYPE = d
VBOX_VCC_CRT_TYPE_N =
else
VBOX_VCC_CRT_TYPE =
VBOX_VCC_CRT_TYPE_N = d
endif
#
# Decide which Windows DDK to use by default.
#
ifeq ($(VBOX_VCC_TOOL_STEM),VCC110)
VBOX_WINDDK ?= WINDDK80
else
VBOX_WINDDK ?= WINDDK71
endif
VBOX_WINDDK_WLH ?= $(VBOX_WINDDK)WLH
VBOX_WINDDK_GST ?= $(VBOX_WINDDK)
VBOX_WINDDK_GST_W8 ?= WINDDK80W8
VBOX_WINDDK_GST_W7 ?= $(VBOX_WINDDK_GST)W7
VBOX_WINDDK_GST_WLH ?= $(VBOX_WINDDK_GST)WLH
VBOX_WINDDK_GST_W2K3 ?= WINDDK71WNET
ifeq ($(KBUILD_TARGET_ARCH),x86)
VBOX_WINDDK_GST_WXP ?= WINDDK71WXP
VBOX_WINDDK_GST_W2K ?= $(VBOX_WINDDK_GST_WXP)
VBOX_WINDDK_GST_NT4 ?= $(VBOX_WINDDK_GST_WXP)
else
VBOX_WINDDK_GST_WXP ?= $(VBOX_WINDDK_GST_W2K3)
VBOX_WINDDK_GST_W2K ?= $(VBOX_WINDDK_GST_W2K3)
VBOX_WINDDK_GST_NT4 ?= $(VBOX_WINDDK_GST_W2K3)
endif
#
# Decide which Windows SDK to use by default.
#
ifeq ($(VBOX_VCC_TOOL_STEM),VCC110)
VBOX_WINPSDK ?= WINPSDK80
else
VBOX_WINPSDK ?= WINPSDK71
endif
VBOX_WINPSDK_GST ?= $(VBOX_WINPSDK)
VBOX_WINPSDK_GST_W8 ?= WINPSDK80
VBOX_WINPSDK_GST_W7 ?= $(VBOX_WINPSDK_GST)
VBOX_WINPSDK_GST_WLH ?= $(VBOX_WINPSDK_GST)
VBOX_WINPSDK_GST_WXP ?= $(VBOX_WINPSDK_GST)
ifeq ($(KBUILD_TARGET_ARCH),x86)
VBOX_WINPSDK_GST_W2K ?= $(VBOX_WINPSDK_GST)
VBOX_WINPSDK_GST_NT4 ?= $(VBOX_WINPSDK_GST)
else
VBOX_WINPSDK_GST_W2K ?= $(VBOX_WINPSDK_GST_WXP)
VBOX_WINPSDK_GST_NT4 ?= $(VBOX_WINPSDK_GST_WXP)
endif
#
# ARCH_BITS_DEFS.
#
if1of ($(KBUILD_TARGET_ARCH),amd64 sparc64)
VBOX_HC_ARCH_BITS := 64
ARCH_BITS_DEFS := HC_ARCH_BITS=64
else if1of ($(KBUILD_TARGET_ARCH),x86 sparc32)
VBOX_HC_ARCH_BITS := 32
ARCH_BITS_DEFS := HC_ARCH_BITS=32
else
$(error VBox: KBUILD_TARGET_ARCH=$(KBUILD_TARGET_ARCH))
endif
ifdef VBOX_WITH_64_BITS_GUESTS
VBOX_GC_ARCH_BITS_DEFS := GC_ARCH_BITS=64
else
VBOX_GC_ARCH_BITS_DEFS := GC_ARCH_BITS=32
endif
ARCH_BITS_DEFS += $(VBOX_GC_ARCH_BITS_DEFS)
#
# Add the output dir(s) to the dynamic loader search path.
#
if1of ($(KBUILD_HOST), freebsd linux netbsd openbsd solaris)
export LD_LIBRARY_PATH:=$(PATH_STAGE_BIN):$(PATH_STAGE_LIB):$(LD_LIBRARY_PATH)
endif
ifeq ($(KBUILD_HOST),haiku)
export LIBRARY_PATH:=$(PATH_STAGE_BIN):$(PATH_STAGE_LIB):$(LIBRARY_PATH)
endif
ifeq ($(KBUILD_HOST),os2)
#fixme! export BEGINLIBPATH:=$(PATH_STAGE_BIN);$(PATH_STAGE_LIB);$(BEGINLIBPATH)
endif
ifeq ($(KBUILD_HOST),win)
# This check is a bit hacky, but avoids problems with PATH being changed
# again when the makefiles are reread because some automatically generated
# makefile has been modified.
ifeq ($(findstring $(PATH_STAGE_BIN);$(PATH_STAGE_LIB);,$(PATH)),)
export PATH:=$(PATH_STAGE_BIN);$(PATH_STAGE_LIB);$(PATH)
endif
endif
#
# Common libraries and tools.
#
ifeq ($(KBUILD_TARGET),darwin)
LIB_RUNTIME = $(PATH_STAGE_BIN)/VBoxRT.dylib
LIB_RUNTIME_EF = #$(PATH_STAGE_LIB)/RuntimeEFCPP.a
VBOX_LIB_RUNTIME_X86 = $(PATH_STAGE_BIN)/VBoxRT-x86.dylib
LIB_KPROFILE = $(PATH_STAGE_BIN)/kPrf2.dylib
LIB_VMM = $(PATH_STAGE_BIN)/VBoxVMM.dylib
LIB_VMMGC = $(PATH_STAGE_BIN)/VMMGC.gc
LIB_REM = $(PATH_STAGE_LIB)/VBoxREM.dylib
LIB_XPCOM = $(PATH_STAGE_BIN)/VBoxXPCOM.dylib
VBOX_LIB_XPCOM_X86 = $(PATH_STAGE_BIN)/VBoxXPCOM-x86.dylib
LIB_DDU = $(PATH_STAGE_BIN)/VBoxDDU.dylib
endif
if1of ($(KBUILD_TARGET), freebsd haiku linux netbsd openbsd solaris)
LIB_RUNTIME = $(PATH_STAGE_BIN)/VBoxRT.so
LIB_RUNTIME_EF = $(PATH_STAGE_LIB)/RuntimeEFCPP.a
VBOX_LIB_RUNTIME_X86 = $(PATH_STAGE_BIN)/VBoxRT-x86.so
LIB_KPROFILE = $(PATH_STAGE_BIN)/kPrf2.so
LIB_VMM = $(PATH_STAGE_BIN)/VBoxVMM.so
LIB_VMMGC = $(PATH_STAGE_BIN)/VMMGC.gc
LIB_REM = $(PATH_STAGE_LIB)/VBoxREM.so
LIB_XPCOM = $(PATH_STAGE_BIN)/VBoxXPCOM.so
VBOX_LIB_XPCOM_X86 = $(PATH_STAGE_BIN)/VBoxXPCOM-x86.so
LIB_DDU = $(PATH_STAGE_BIN)/VBoxDDU.so
endif
ifeq ($(KBUILD_TARGET),os2)
LIB_RUNTIME = $(PATH_STAGE_BIN)/VBoxRT.dll
LIB_RUNTIME_EF = #$(PATH_STAGE_LIB)/RuntimeEFCPP.a
VBOX_LIB_RUNTIME_X86 = $(PATH_STAGE_BIN)/VBoxRT-x86.dll
LIB_KPROFILE = $(PATH_STAGE_BIN)/kPrf2.dll
LIB_VMM = $(PATH_STAGE_BIN)/VBoxVMM.dll
LIB_VMMGC = $(PATH_STAGE_LIB)/VMMRCImp.lib
LIB_REM = $(PATH_STAGE_LIB)/VBoxREMImp.lib
LIB_XPCOM = $(PATH_STAGE_BIN)/VBoxXCOM.dll
VBOX_LIB_XPCOM_X86 = $(PATH_STAGE_BIN)/VBoxXPCOM-x86.dll
LIB_DDU = $(PATH_STAGE_BIN)/VBoxDDU.dll
VBOX_OBJ_SYS0 = $(PATH_OBJ)/RuntimeR0/os2/sys0.obj
endif
ifeq ($(KBUILD_TARGET),win)
LIB_RUNTIME = $(PATH_STAGE_LIB)/VBoxRT.lib
LIB_RUNTIME_EF = #$(PATH_STAGE_LIB)/RuntimeEFCPP.lib
VBOX_LIB_RUNTIME_X86 = $(PATH_STAGE_LIB)/VBoxRT-x86.lib
LIB_KPROFILE = $(PATH_STAGE_LIB)/kPrf2.lib
LIB_VMM = $(PATH_STAGE_LIB)/VBoxVMM.lib
LIB_VMMGC = $(PATH_OBJ)/VMMRC/VMMGC.lib
LIB_REM = $(PATH_STAGE_LIB)/VBoxREMImp.lib
LIB_XPCOM = $(PATH_STAGE_BIN)/VBoxXPCOM.lib
VBOX_LIB_XPCOM_X86 = $(PATH_STAGE_BIN)/VBoxXPCOM-x86.lib
LIB_DDU = $(PATH_STAGE_LIB)/VBoxDDU.lib
endif
if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), win.amd64 linux.amd64)
VBOX_LIB_VMM_LAZY = $(PATH_STAGE_LIB)/VMMR3LazyImp$(VBOX_SUFF_LIB)
else
VBOX_LIB_VMM_LAZY = $(LIB_VMM)
endif
VBOX_LIB_SUPHARDENED = $(PATH_STAGE_LIB)/SUPR3HardenedStatic$(VBOX_SUFF_LIB)
VBOX_LIB_RUNTIME_STATIC = $(PATH_STAGE_LIB)/RuntimeR3$(VBOX_SUFF_LIB)
ifndef VBOX_WITH_REM
LIB_REM :=
endif
# Python
ifndef VBOX_BLD_PYTHON
if1of ($(KBUILD_HOST), win)
VBOX_BLD_PYTHON := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS)/win.x86/python/v*/python$(HOSTSUFF_EXE))) \
else
VBOX_BLD_PYTHON := $(firstword $(which python$(HOSTSUFF_EXE)) $(which python2.7$(HOSTSUFF_EXE)) \
$(which python2.6$(HOSTSUFF_EXE)) python$(HOSTSUFF_EXE))
endif
endif
#
# pylint setup, see http://www.logilab.org/857.
# Supported are 0.21.0 - 0.25.2, but no 0.26.0.
#
# Disabled:
# W0301 - Unnecessary semicolon.
# W0511 - TODO/XXX/FIXME/+++.
# W0603 - Using the global statement.
# W0702 - No exception type(s) specified.
# W0703 - Catch "Exception".
# I0011 - Locally disabling XXXXX.
# C0321 - More than one statement on a single line.
# R0201 - Method could be a function.
#
# Note! Yes, --max-branchs is a typo, but not by me.
#
# Note! Users of older pylint release (< 1.0) needs to define
# VBOX_WITH_PYLINT_PRE_V1_0 in LocalConfig because they changed the
# output arguments in an backwards incompatible way and added more
# attribute regex options.
#
ifndef VBOX_PYLINT
VBOX_PYLINT := $(firstword $(which pylint-2.7) $(which pylint-2.6) $(which pylint2) $(which pylint))
ifdef VBOX_PYLINT
VBOX_PYLINT := $(VBOX_BLD_PYTHON) $(VBOX_PYLINT)
endif
endif
if !defined(VBOX_WITH_PYLINT) && defined(VBOX_PYLINT)
VBOX_WITH_PYLINT := 1
endif
VBOX_PYLINT_FLAGS := --report=n \
$(if-expr !defined(VBOX_WITH_PYLINT_PRE_V1_0)\
,--msg-template='{path}:{line}: <{msg_id}>({obj}:{symbol}): {msg}' \
,--output-format=msvs --include-ids=y) \
--persistent=n \
--rcfile=$(PATH_ROOT)/tools/pylintrc \
--max-line-length=130 \
--max-attributes=20 \
--max-branch$(if-expr !defined(VBOX_WITH_PYLINT_PRE_V1_0),e,)s=50 \
--max-statements=100 \
--max-returns=100 \
--max-public-methods=139 \
--max-args=9 \
--max-module-lines=4096 \
--max-locals=32 \
--min-public-methods=0 \
--function-rgx='[a-z_][a-zA-Z0-9_]{2,40}$(DOLLAR)' \
--method-rgx='[a-z_][a-zA-Z0-9_]{2,40}$(DOLLAR)' \
--argument-rgx='([a-z_][a-zA-Z0-9_]{2,30}|rc|hr|s|c|ch|cx|cy|cb|fn)$(DOLLAR)' \
--variable-rgx='([a-z_][a-zA-Z0-9_]{2,30}|rc|hr|s|c|ch|cx|cy|cb|fn)$(DOLLAR)' \
--attr-rgx='([a-z_][a-zA-Z0-9_]{2,30}|rc|hr|o)$(DOLLAR)' \
--module-rgx='(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+)|(td[A-Z][a-zA-Z0-9]+)|(t(e|)st(-|)[a-zA-Z0-9]+))$(DOLLAR)' \
--class-rgx='(td|)[A-Z_][a-zA-Z0-9_]+$(DOLLAR)' \
--const-rgx='(g_(k|)[abcdefhmnpilorstu]+[A-Z][a-zA-Z0-9]+|[A-Z_][A-Z0-9_]+|__copyright__|__version__|__file__|__all__)$(DOLLAR)' \
--good-names='i,j,k,t,o,c,e,ch,s,_' \
$(if-expr !defined(VBOX_WITH_PYLINT_PRE_V1_0),--class-attribute-rgx='(k[abcdefhmnpilorstu]+[A-Z0-9][a-zA-Z0-9_]{0,32}|[A-Z_][A-Z0-9_]{2,32})',) \
$(if-expr defined(VBOX_WITH_PYLINT_V1_1_PLUS) || defined(VBOX_WITH_PYLINT_V1_2_1_PLUS),--disable=C0326,) \
$(if-expr defined(VBOX_WITH_PYLINT_V1_2_1_PLUS),--disable=C0330 --disable=W0123,) \
--disable=W0301,W0511,W0603,W0702,W0703,C0321,R0201,I0011 \
--ignored-classes=testdriver.vboxcon \
# Define the macro for win path conversion.
ifndef VBOX_ONLY_SDK
VBOX_FN_MAKE_WIN_PATH = $(subst /,\\,$(1))
else
# on Wine Z: is always FS root
VBOX_FN_MAKE_WIN_PATH = $(subst /,\\,$(patsubst /%,Z:/%,$(1)))
endif #!VBOX_ONLY_SDK
# The kprofile build automagically links with kProfile.
ifeq ($(KBUILD_TYPE),kprofile)
LIB_RUNTIME += $(LIB_KPROFILE)
endif
# Enable C++ electric fence heap. (Warning: will easily run out of virtual memory / kernel stuff on Linux/Windows.)
ifdef VBOX_WITH_CPP_EF
LIB_RUNTIME <= $(LIB_RUNTIME_EF)
endif
# Overridable libraries (unix).
LIB_PTHREAD ?= pthread
# Xcursor (consider an SDK for this).
ifeq ($(VBOX_XCURSOR_LIBS),)
ifeq ($(KBUILD_TARGET),solaris)
VBOX_XCURSOR_LIBS := $(lastword $(wildcard $(KBUILD_DEVTOOLS_TRG)/libXcursor/*/lib/libXcursor.a))
ifneq ($(VBOX_XCURSOR_LIBS),)
VBOX_XCURSOR_INCS := $(patsubst %/lib/libXcursor.a,%/include, $(VBOX_XCURSOR_LIBS))
VBOX_XCURSOR_LIBS += X11 Xrender Xfixes
endif
endif
ifeq ($(VBOX_XCURSOR_LIBS),)
VBOX_XCURSOR_LIBS := Xcursor
endif
endif
# Intel ASL compiler for ACPI
VBOX_IASLCMD ?= $(firstword $(wildcard $(KBUILD_DEVTOOLS_HST)/bin/iasl$(HOSTSUFF_EXE)) iasl$(HOSTSUFF_EXE))
# libxslt XSLT processor. (see PATH_TOOL_YASM for explanation why it's temporarily located in bin.)
ifeq ($(VBOX_XSLTPROC),)
ifeq ($(KBUILD_HOST),win)
VBOX_XSLTPROC := $(wildcard $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)/libxslt/10128/bin/xsltproc.exe)
ifeq ($(VBOX_XSLTPROC),)
VBOX_XSLTPROC := $(KBUILD_DEVTOOLS)/win.x86/bin/xsltproc.exe
endif
else ifeq ($(KBUILD_HOST),os2)
VBOX_XSLTPROC := BEGINLIBPATH="$(KBUILD_DEVTOOLS_HST)/bin;$$BEGINLIBPATH" $(KBUILD_DEVTOOLS_HST)/bin/xsltproc.exe
else ifeq ($(KBUILD_HOST),haiku)
VBOX_XSLTPROC := $(KBUILD_DEVTOOLS)/haiku.x86/bin/xsltproc
else
VBOX_XSLTPROC := xsltproc$(HOSTSUFF_EXE)
endif
endif
# bin2c (convert binary files into C arrays)
VBOX_BIN2C ?= $(PATH_OBJ)/bin2c/bin2c$(HOSTSUFF_EXE)
# RTManifest (extension pack manifest utility)
VBOX_RTMANIFEST ?= $(PATH_OBJ)/bldRTManifest/bldRTManifest$(HOSTSUFF_EXE)
# RTSignTool (certificate extraction tool)
VBOX_RTSIGNTOOL ?= $(PATH_OBJ)/bldRTSignTool/bldRTSignTool$(HOSTSUFF_EXE)
# VBoxCmp (simple /bin/cmp with more sensible output)
VBOX_VBOXCMP ?= $(PATH_OBJ)/VBoxCmp/VBoxCmp$(HOSTSUFF_EXE)
# VBoxCPP (special purpose C preprocessor)
VBOX_VBOXCPP ?= $(PATH_OBJ)/VBoxCPP/VBoxCPP$(HOSTSUFF_EXE)
# VBoxTpG (tracepoint generator)
VBOX_VBOXTPG ?= $(PATH_OBJ)/VBoxTpG/VBoxTpG$(HOSTSUFF_EXE)
# VBoxPeSetVersion (changes the minimum OS version of an image)
VBOX_PE_SET_VERSION ?= $(PATH_OBJ)/VBoxPeSetVersion/VBoxPeSetVersion$(HOSTSUFF_EXE)
# Visual C++ EditBin.exe.
VBOX_VCC_EDITBIN = $(if $(PATH_TOOL_$(VBOX_VCC_TOOL)_BIN),$(PATH_TOOL_$(VBOX_VCC_TOOL)_BIN)/,)editbin.exe /NoLogo
# filesplitter (splits java files)
VBOX_FILESPLIT ?= $(PATH_OBJ)/filesplitter/filesplitter$(HOSTSUFF_EXE)
# biossums (set BIOS checksums)
VBOX_BIOSSUMS ?= $(PATH_OBJ)/biossums/biossums$(HOSTSUFF_EXE)
# MakeAlternativeSource (for BIOSes)
VBOX_MAKE_ALTERNATIVE_SOURCE ?= $(PATH_OBJ)/MakeAlternativeSource/MakeAlternativeSource$(HOSTSUFF_EXE)
# VBoxDef2LazyLoad (lazy dynamic library loader assembly generator)
VBOX_DEF_2_LAZY_LOAD ?= $(PATH_OBJ)/VBoxDef2LazyLoad/VBoxDef2LazyLoad$(HOSTSUFF_EXE)
# GNU tar if present.
if1of ($(KBUILD_TARGET), linux os2 win)
VBOX_GTAR ?= tar
else if1of ($(KBUILD_TARGET), freebsd solaris)
VBOX_GTAR ?= gtar
endif
# mkisofs
ifeq ($(KBUILD_HOST),win)
VBOX_MKISOFS ?= $(KBUILD_DEVTOOLS_HST)/bin/mkisofs.exe
else
VBOX_MKISOFS ?= mkisofs
endif
ifeq ($(KBUILD_HOST),win)
VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
else
VBOX_NM ?= nm -p
endif
# Makeself for the linux installers.
VBOX_MAKESELF ?= $(KBUILD_DEVTOOLS)/common/makeself/v2.1.5/makeself.sh
# Microsoft HTML Help Workshop.
VBOX_PATH_HTML_HELP_WORKSHOP ?= $(KBUILD_DEVTOOLS)/win.x86/HTML_Help_Workshop/v1.3/
# Path to the null soft installer.
VBOX_PATH_NSIS ?= $(KBUILD_DEVTOOLS)/win.x86/nsis/v2.46-log-nsscm-r1
# Path to AutoIt3.
VBOX_PATH_AUTOIT3 ?= $(KBUILD_DEVTOOLS)/win.x86/autoit/v3.2.10.0
# Windows install tools...
# Note! The scripts has been moved to Bin in v8.0.
VBOX_PATH_WIX ?= $(KBUILD_DEVTOOLS)/win.x86/wix/v3.8.1128.0
VBOX_PATH_MSITRAN ?= $(KBUILD_DEVTOOLS)/win.x86/sdk/v7.1/Bin/MsiTran.Exe
VBOX_PATH_MSIDB ?= $(KBUILD_DEVTOOLS)/win.x86/sdk/v7.1/Bin/MsiDb.Exe
VBOX_PATH_WISUBSTG ?= $(KBUILD_DEVTOOLS)/win.x86/sdk/v7.1/Samples/sysmgmt/msi/scripts/WiSubStg.vbs
VBOX_PATH_WISUMINFO ?= $(KBUILD_DEVTOOLS)/win.x86/sdk/v7.1/Samples/sysmgmt/msi/scripts/WiSumInf.vbs
VBOX_PATH_DIFX ?= $(KBUILD_DEVTOOLS)/win.$(KBUILD_TARGET_ARCH)/DIFx/v2.1-r3
VBOX_PATH_CABSDK ?= $(KBUILD_DEVTOOLS)/win.x86/cabsdk/r1
VBOX_PATH_MAKECAB ?= $(VBOX_PATH_CABSDK)/BIN/MAKECAB.EXE
# We need to export YASM for OSE, but since it was converted to .zip we need to
# allow for the location used by the zip to be properly cleaned up first.
PATH_TOOL_YASM ?= $(KBUILD_DEVTOOLS_HST)/bin
endif
# The Microsoft IDL compiler (the SDK build needs this on non-Windows).
VBOX_WIN_MIDL ?= $(EXEC_X86_WIN32) $(call VBOX_FN_MAKE_WIN_PATH,$(firstword $(wildcard $(addsuffix /[Mm][Ii][Dd][Ll].[Ee][Xx][Ee], \
$(KBUILD_DEVTOOLS)/win.x86/sdk/v7.1/Bin$(if-expr "$(KBUILD_HOST).$(KBUILD_HOST_ARCH)" == "win.amd64",/x64,) \
$(KBUILD_DEVTOOLS)/win.x86/ddk/7600.16385.1/bin/x86 \
$(KBUILD_DEVTOOLS)/win.x86/bin \
$(PATH_SDK_$(VBOX_WINPSDK)_BIN) \
$(PATH_SDK_$(VBOX_WINPSDK)) \
$(PATH_SDK_WINPSDK_BIN) \
$(PATH_SDK_WINPSDK) \
)) Sorry_Cannot_Find_The_Midl_Compiler_In_The_PSDK))
# XPCOM setup for all but win32.
ifneq ($(KBUILD_TARGET),win)
VBOX_WITH_XPCOM = 1
# if updating, also update xpidl_INST var in src/libs/xpcom18a4/Makefile.kmk
VBOX_XPIDL ?= $(PATH_STAGE_BIN)/xpidl$(HOSTSUFF_EXE)
ifeq ($(KBUILD_TARGET),os2)
VBOX_XPIDL_ENV = BEGINLIBPATH="$(dir $(VBOX_XPIDL));$$BEGINLIBPATH"$(SP)
endif
VBOX_PATH_XPCOM_IDL ?= $(VBOX_PATH_SDK)/bindings/xpcom/idl
VBOX_XPCOM_INCS ?= \
$(VBOX_PATH_SDK)/bindings/xpcom/include \
$(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom \
$(VBOX_PATH_SDK)/bindings/xpcom/include/string \
$(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom \
$(VBOX_PATH_SDK)/bindings/xpcom/include/nsprpub \
$(VBOX_PATH_SDK)/bindings/xpcom/include/ipcd
ifneq ($(KBUILD_TARGET),os2)
# libIDL-config (for xpcom18a4)
ifeq ($(origin VBOX_LIBIDL_CONFIG),undefined)
export VBOX_LIBIDL_CONFIG := $(firstword $(shell which libIDL-config-2 libIDL-config 2> /dev/null))
endif
endif
endif
# The X11 LIBPATH. (The amd64 hack is for RHEL4.)
ifeq ($(KBUILD_TARGET_ARCH),amd64)
VBOX_LIBPATH_X11 ?= /usr/X11R6/lib64 /usr/X11R6/lib
else
VBOX_LIBPATH_X11 ?= /usr/X11R6/lib
endif
# 32bit X11 LIBPATH for building 32bit guest additions
VBOX_LIBPATH32_X11 ?= /usr/X11R6/lib32 /usr/X11R6/lib
# Good windows shell.
VBOX_GOOD_COMSPEC = $(subst \,/,$(SystemRoot))/System32/cmd.exe
VBOX_GOOD_COMSPEC_BS ?= $(subst /,\,$(VBOX_GOOD_COMSPEC))
#
# Macros dealing with the darwin version we're targeting.
# The DEF in VBOX_DEF_MACOSX_VERSION_MIN mean default. The default min
# version is assumed to be the
#
ifeq ($(KBUILD_TARGET),darwin)
VBOX_DEF_MACOSX_VERSION_MIN ?= 10.6
# Check for the Xcode 4.1 bits in tools/darwin.x86.
if !defined(VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL) \
&& !defined(VBOX_XCODE_VERSION) \
&& exists "$(KBUILD_DEVTOOLS)/darwin.x86/xcode/v4.1"
VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL := 1
VBOX_PATH_MACOSX_DEVEL_ROOT := $(KBUILD_DEVTOOLS)/darwin.x86/xcode/v4.1
VBOX_XCODE_VERSION := 4.1
endif
# Fallback - system / LocalConfig.kmk.
VBOX_PATH_MACOSX_DEVEL_ROOT ?= /Developer
VBOX_PATH_MACOSX_SDK_ROOT ?= $(VBOX_PATH_MACOSX_DEVEL_ROOT)/SDKs
# Figure the default SDK location and obsolete linker tricks.
ifeq ($(VBOX_DEF_MACOSX_VERSION_MIN),10.4)
ifeq ($(origin VBOX_DARWIN_CLASSIC_LINKER),undefined)
VBOX_DARWIN_CLASSIC_LINKER := $(shell ld -v 2>&1 )
ifneq ($(filter ld64%, $(subst :, , $(VBOX_DARWIN_CLASSIC_LINKER))),)
export VBOX_DARWIN_CLASSIC_LINKER := -Wl,-classic_linker
else
export VBOX_DARWIN_CLASSIC_LINKER :=
endif
endif
VBOX_PATH_MACOSX_SDK ?= $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN)u.sdk
else
VBOX_PATH_MACOSX_SDK ?= $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN).sdk
endif
## The Xcode version.
ifeq ($(KBUILD_HOST),darwin)
ifndef VBOX_XCODE_VERSION
ifdef VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL
VBOX_XCODE_VERSION := $(word 2, $(shell $(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/xcodebuild -version))
else
VBOX_XCODE_VERSION := $(word 2, $(shell xcodebuild -version))
endif
VBOX_XCODE_VERSION ?= 4.1
endif
ifeq ($(VBOX_XCODE_VERSION),4.2)
$(warning Xcode 4.2 is not able to correctly build the recompiler!)
$(warning Please downgrade to Xcode 4.1 if you want a working VMM!)
endif
else
VBOX_XCODE_VERSION ?= 4.1
endif
VBOX_XCODE_VERSION_MAJOR := $(word 1, $(subst ., ,$(VBOX_XCODE_VERSION)))
VBOX_XCODE_VERSION_MINOR := $(word 2, $(subst ., ,$(VBOX_XCODE_VERSION)))
VBOX_XCODE_VERSION := $(VBOX_XCODE_VERSION_MAJOR).$(VBOX_XCODE_VERSION_MINOR)
ifeq ($(KBUILD_TARGET_ARCH),x86)
if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4 10.5)
VBOX_DARWIN_NO_COMPACT_LINKEDIT ?= $(VBOX_LD_no_compact_linkedit)
TOOL_GXX4MACHO_SUFFIX ?= -4.0
endif
else
if $(VBOX_XCODE_VERSION_MAJOR) < 4 && "$(VBOX_XCODE_VERSION)" != "3.2"
ifeq ($(PATH_CURRENT),$(PATH_ROOT)/tools)
$(warning VBox: 64-bit darwin builds require Xcode 3.2 or later, you have $(VBOX_XCODE_VERSION))
else
$(error VBox: 64-bit darwin builds require Xcode 3.2 or later, you have $(VBOX_XCODE_VERSION))
endif
endif
endif
if $(VBOX_XCODE_VERSION_MAJOR) == 4 && $(VBOX_XCODE_VERSION_MINOR) >= 2
TOOL_GXX4MACHO_PREFIX ?= llvm-
endif
TOOL_GXX4MACHO_SUFFIX ?= -4.2
VBOX_DARWIN_NO_COMPACT_LINKEDIT ?=
TOOL_GCC4MACHO_SUFFIX ?= $(TOOL_GXX4MACHO_SUFFIX)$(HOSTSUFF_EXE)
TOOL_GCC4MACHO_PREFIX ?= $(TOOL_GXX4MACHO_PREFIX)
ifdef VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL
TOOL_GCC4MACHO_PREFIX := $(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/$(TOOL_GCC4MACHO_PREFIX)
TOOL_GXX4MACHO_PREFIX := $(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/$(TOOL_GXX4MACHO_PREFIX)
TOOL_GCC4MACHO_SUFFIX := $(TOOL_GCC4MACHO_SUFFIX) -isysroot $(VBOX_PATH_MACOSX_SDK)
TOOL_GXX4MACHO_SUFFIX := $(TOOL_GXX4MACHO_SUFFIX) -isysroot $(VBOX_PATH_MACOSX_SDK)
ifndef SVN # must expand first so we won't be using old svn.
SVN := $(firstword $(which svn) svn)
endif
export PATH:=$(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/:$(PATH)
TOOL_GXX32_CC = $(TOOL_GCC4MACHO_PREFIX)gcc$(TOOL_GCC4MACHO_SUFFIX) -m32
TOOL_GXX32_CXX = $(TOOL_GCC4MACHO_PREFIX)g++$(TOOL_GCC4MACHO_SUFFIX) -m32
TOOL_GXX32_LD = $(TOOL_GXX32_CXX)
override TOOL_StandardDTrace_DTRACE := dtrace "-xcpppath=$(TOOL_GCC4MACHO_PREFIX)cpp-4.2"
endif
## @todo WTF do we do the -m32/64 stuff here for these compilers? Also the visibility should be elsewhere...
TOOL_GXX4MACHO_OBJC = $(TOOL_GCC4MACHO_PREFIX)gcc$(TOOL_GCC4MACHO_SUFFIX) $(if-expr $(KBUILD_TARGET_ARCH) == "x86",-m32,-m64) -fvisibility=hidden
TOOL_GXX4MACHO_OBJCXX = $(TOOL_GCC4MACHO_PREFIX)gcc$(TOOL_GCC4MACHO_SUFFIX) $(if-expr $(KBUILD_TARGET_ARCH) == "x86",-m32,-m64) -fvisibility=hidden -fvisibility-inlines-hidden
VBOX_DARWIN_DEF_SDK_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=$(subst .,,$(VBOX_DEF_MACOSX_VERSION_MIN))0 \
MAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(VBOX_DEF_MACOSX_VERSION_MIN))0
VBOX_DARWIN_DEF_SDK_CFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
VBOX_DARWIN_DEF_SDK_CXXFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
VBOX_DARWIN_DEF_SDK_OBJCFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
VBOX_DARWIN_DEF_SDK_LDFLAGS = -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK) \
-Wl,-headerpad_max_install_names $(VBOX_DARWIN_CLASSIC_LINKER) $(VBOX_DARWIN_NO_COMPACT_LINKEDIT)
# specific versions.
## @todo s/VBOX_DARWIN_DEF_SDK_10/VBOX_DARWIN_SDK_10/g
if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4) # classic linker detection is bust otherwise
VBOX_PATH_MACOSX_SDK_10_4 ?= $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.4u.sdk
VBOX_DARWIN_DEF_SDK_10_4_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=1040 MAC_OS_X_VERSION_MAX_ALLOWED=1040
VBOX_DARWIN_DEF_SDK_10_4_CFLAGS := -mmacosx-version-min=10.4 -isysroot $(VBOX_PATH_MACOSX_SDK_10_4)
VBOX_DARWIN_DEF_SDK_10_4_CXXFLAGS := -mmacosx-version-min=10.4 -isysroot $(VBOX_PATH_MACOSX_SDK_10_4)
VBOX_DARWIN_DEF_SDK_10_4_OBJCFLAGS := -mmacosx-version-min=10.4 -isysroot $(VBOX_PATH_MACOSX_SDK_10_4)
VBOX_DARWIN_DEF_SDK_10_4_OBJCXXFLAGS := -mmacosx-version-min=10.4 -isysroot $(VBOX_PATH_MACOSX_SDK_10_4)
VBOX_DARWIN_DEF_SDK_10_4_LDFLAGS := -mmacosx-version-min=10.4 -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK_10_4) \
-Wl,-headerpad_max_install_names $(VBOX_DARWIN_CLASSIC_LINKER)
else
VBOX_DARWIN_DEF_SDK_10_4_CXXFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.4 SDK)
VBOX_DARWIN_DEF_SDK_10_4_LDFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.4 SDK)
endif
if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4 10.5)
VBOX_PATH_MACOSX_SDK_10_5 ?= $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.5.sdk
VBOX_DARWIN_DEF_SDK_10_5_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=1050 MAC_OS_X_VERSION_MAX_ALLOWED=1050
VBOX_DARWIN_DEF_SDK_10_5_CFLAGS := -mmacosx-version-min=10.5 -isysroot $(VBOX_PATH_MACOSX_SDK_10_5)
VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS := -mmacosx-version-min=10.5 -isysroot $(VBOX_PATH_MACOSX_SDK_10_5)
VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS := -mmacosx-version-min=10.5 -isysroot $(VBOX_PATH_MACOSX_SDK_10_5)
VBOX_DARWIN_DEF_SDK_10_5_OBJCXXFLAGS := -mmacosx-version-min=10.5 -isysroot $(VBOX_PATH_MACOSX_SDK_10_5)
VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS := -mmacosx-version-min=10.5 -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK_10_5) \
-Wl,-headerpad_max_install_names $(VBOX_DARWIN_NO_COMPACT_LINKEDIT)
else
VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.5 SDK)
VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.5 SDK)
endif
if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4 10.5 10.6)
VBOX_PATH_MACOSX_SDK_10_6 ?= $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.6.sdk
VBOX_DARWIN_DEF_SDK_10_6_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=1060 MAC_OS_X_VERSION_MAX_ALLOWED=1060
VBOX_DARWIN_DEF_SDK_10_6_CFLAGS := -mmacosx-version-min=10.6 -isysroot $(VBOX_PATH_MACOSX_SDK_10_6)
VBOX_DARWIN_DEF_SDK_10_6_CXXFLAGS := -mmacosx-version-min=10.6 -isysroot $(VBOX_PATH_MACOSX_SDK_10_6)
VBOX_DARWIN_DEF_SDK_10_6_OBJCFLAGS := -mmacosx-version-min=10.6 -isysroot $(VBOX_PATH_MACOSX_SDK_10_6)
VBOX_DARWIN_DEF_SDK_10_6_OBJCXXFLAGS := -mmacosx-version-min=10.6 -isysroot $(VBOX_PATH_MACOSX_SDK_10_6)
VBOX_DARWIN_DEF_SDK_10_6_LDFLAGS := -mmacosx-version-min=10.6 -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK_10_6) \
-Wl,-headerpad_max_install_names
else
VBOX_DARWIN_DEF_SDK_10_6_CXXFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.6 SDK)
VBOX_DARWIN_DEF_SDK_10_6_LDFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.6 SDK)
endif
if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4 10.5 10.6 10.7)
ifndef VBOX_PATH_MACOSX_SDK_10_7
ifneq ($(wildcard $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.7.sdk),)
VBOX_PATH_MACOSX_SDK_10_7 = $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.7.sdk
else
VBOX_PATH_MACOSX_SDK_10_7 = $(KBUILD_DEVTOOLS)/darwin.x86/SDKs/MacOSX10.7.sdk
endif
endif
VBOX_DARWIN_DEF_SDK_10_7_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=1070 MAC_OS_X_VERSION_MAX_ALLOWED=1070
VBOX_DARWIN_DEF_SDK_10_7_CFLAGS := -mmacosx-version-min=10.7 -isysroot $(VBOX_PATH_MACOSX_SDK_10_7)
VBOX_DARWIN_DEF_SDK_10_7_CXXFLAGS := -mmacosx-version-min=10.7 -isysroot $(VBOX_PATH_MACOSX_SDK_10_7)
VBOX_DARWIN_DEF_SDK_10_7_OBJCFLAGS := -mmacosx-version-min=10.7 -isysroot $(VBOX_PATH_MACOSX_SDK_10_7)
VBOX_DARWIN_DEF_SDK_10_7_OBJCXXFLAGS := -mmacosx-version-min=10.7 -isysroot $(VBOX_PATH_MACOSX_SDK_10_7)
VBOX_DARWIN_DEF_SDK_10_7_LDFLAGS := -mmacosx-version-min=10.7 -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK_10_7) \
-Wl,-headerpad_max_install_names
else
VBOX_DARWIN_DEF_SDK_10_7_CXXFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.7 SDK)
VBOX_DARWIN_DEF_SDK_10_7_LDFLAGS = $(error VBox: $(if $(target),$(target): ,)Using 10.7 SDK)
endif
endif # target=darwin
#
# Macro switching between @executable_path, @rpath and /Applications/VirtualBox.app
# depending on whether the build is hardened or not (dylib install_name).
#
ifeq ($(KBUILD_TARGET),darwin)
ifndef VBOX_DYLD_EXECUTABLE_PATH
ifdef VBOX_WITH_HARDENING
VBOX_DYLD_EXECUTABLE_PATH = $(VBOX_PATH_APP_PRIVATE_ARCH)
else if 0
VBOX_DYLD_EXECUTABLE_PATH = @executable_path
else
VBOX_DYLD_EXECUTABLE_PATH = @rpath
VBOX_WITH_RELATIVE_RUNPATH = @loader_path/
endif
endif
endif
#
# Check for incompatible rpath combinations.
#
if defined(VBOX_WITH_RUNPATH) && defined(VBOX_WITH_ORIGIN)
$(error VBox: VBOX_WITH_RUNPATH and VBOX_WITH_ORIGIN are mutually exclusive)
endif
if defined(VBOX_WITH_RELATIVE_RUNPATH) && defined(VBOX_WITH_ORIGIN)
$(error VBox: VBOX_WITH_RELATIVE_RUNPATH and VBOX_WITH_ORIGIN are mutually exclusive)
endif
if defined(VBOX_WITH_RUNPATH) && defined(VBOX_WITH_RELATIVE_RUNPATH)
$(error VBox: VBOX_WITH_RUNPATH and VBOX_WITH_RELATIVE_RUNPATH are mutually exclusive)
endif
if defined(VBOX_WITH_RELATIVE_RUNPATH) && defined(VBOX_WITH_HARDENING)
$(error VBox: VBOX_WITH_RELATIVE_RUNPATH and VBOX_WITH_HARDENING are mutually exclusive)
endif
#
# VBOX_WITH_ORIGIN translates into VBOX_WITH_RELATIVE_RUNPATH.
#
# We use two helper variables for the VBOX_WITH_ORIGIN stuff:
# VBOX_ORIGIN - Indirect expansion trick.
# VBOX_GCC_RPATH_OPT - Different GCC/LD combinations needs different options.
#
VBOX_ORIGIN = $$ORIGIN
ifeq ($(KBUILD_TARGET),solaris)
VBOX_GCC_RPATH_OPT = -R
else
VBOX_GCC_RPATH_OPT = -Wl,-rpath,
VBOX_GCC_ORIGIN_OPT = -Wl,-z,origin
endif
ifdef VBOX_WITH_ORIGIN
VBOX_WITH_RELATIVE_RUNPATH = $$(VBOX_ORIGIN)
endif
#
# The X11 headers.
#
VBOX_PATH_X11_ROOT = $(PATH_ROOT)/src/VBox/Additions/x11/x11include
VBOX_PATH_X11_XFREE_4_3 = $(VBOX_PATH_X11_ROOT)/4.3
VBOX_PATH_X11_XORG_7_0 = $(VBOX_PATH_X11_ROOT)/7.0
VBOX_PATH_X11_XORG_7_1 = $(VBOX_PATH_X11_ROOT)/7.1
#
# crOpenGL related paths and variables.
#
ifdef VBOX_WITH_CROGL
ifdef VBOX_WITH_WDDM
VBOX_WITH_CRHGSMI = 1
endif
VBOX_PATH_CROGL_GLAPI = $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/glapi_parser
VBOX_PATH_CROGL_GENFILES = $(PATH_OBJ)/VBoxOGLgen
VBOX_PATH_CROGL_INCLUDE = $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/include
VBOX_CROGL_API_FILES = $(VBOX_PATH_CROGL_GLAPI)/apiutil.py $(VBOX_PATH_CROGL_GLAPI)/APIspec.txt
VBOX_CROGL_PYTHON_ENV = $(REDIRECT) $(if $1,-E 'PYTHONPATH=$1',) $(if $2,-o $2,) $(if $3,-i $3) --
if1of ($(KBUILD_HOST), os2 win)
VBOX_PATH_CROGL_PYTHON_INCLUDE = $(VBOX_PATH_CROGL_GLAPI);$(PATH_ROOT)/src/VBox/GuestHost/OpenGL/packer;$(PATH_ROOT)/src/VBox/HostServices/SharedOpenGL/crserverlib
else
VBOX_PATH_CROGL_PYTHON_INCLUDE = $(VBOX_PATH_CROGL_GLAPI):$(PATH_ROOT)/src/VBox/GuestHost/OpenGL/packer:$(PATH_ROOT)/src/VBox/HostServices/SharedOpenGL/crserverlib
endif
ifeq ($(KBUILD_TARGET),win)
VBOX_LIB_OGL_CRUTIL = $(PATH_OBJ)/VBoxOGLcrutil/VBoxOGLcrutil$(VBOX_SUFF_LIB)
VBOX_LIB_OGL_HOSTCRUTIL = $(PATH_OBJ)/VBoxOGLhostcrutil/VBoxOGLhostcrutil$(VBOX_SUFF_LIB)
ifeq ($(KBUILD_TARGET),x86)
VBOX_LIB_OGL_CRUTIL_X86 = $(VBOX_LIB_OGL_CRUTIL)
else
VBOX_LIB_OGL_CRUTIL_X86 = $(PATH_OBJ)/VBoxOGLcrutil-x86/VBoxOGLcrutil-x86$(VBOX_SUFF_LIB)
endif
else
VBOX_LIB_OGL_CRUTIL = $(VBOX_PATH_ADDITIONS)/VBoxOGLcrutil$(VBOX_SUFF_DLL)
VBOX_LIB_OGL_HOSTCRUTIL = $(PATH_STAGE_BIN)/VBoxOGLhostcrutil$(VBOX_SUFF_DLL)
endif
if1of ($(KBUILD_TARGET), freebsd linux solaris)
# VBOX_PATH_MESA_SOURCE = $(PATH_ROOT)/src/libs/mesa-7.2
VBOX_PATH_MESA_SOURCE = $(VBOX_PATH_X11_ROOT)/mesa-7.2
VBOX_MESA_INCS = \
$(VBOX_PATH_MESA_SOURCE) \
$(VBOX_PATH_MESA_SOURCE)/include \
$(VBOX_PATH_MESA_SOURCE)/src/mesa/ \
$(VBOX_PATH_MESA_SOURCE)/src/mesa/glapi \
$(VBOX_PATH_MESA_SOURCE)/src/mesa/main \
$(VBOX_PATH_MESA_SOURCE)/src/mesa/drivers/dri/common
endif
VBOX_DARWIN_OPENGL_INST = obj/VBoxOGL/GL/
SDK_DARWIN-OPENGL = Workaround SDK for the darwin OpenGL include directorly layout layout.
SDK_DARWIN-OPENGL_INCS = $(PATH_OUT)/obj/VBoxOGL
SDK_DARWIN-OPENGL_ORDERDEPS = $(addprefix $(PATH_OUT)/obj/VBoxOGL/GL/,$(VBOX_DARWIN_OPENGL_HEADERS))
## @todo kBuild: Using INTERMEDIATES doesn't work!
endif
# The icons to use.
ifdef VBOX_OSE
VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_win.ico
VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_win.ico
VBOX_NSIS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_win.ico
VBOX_MACOSX_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox.icns
else
ifeq ($(KBUILD_HOST),win)
VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox-vista.ico
VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBoxGA-vista.ico
VBOX_NSIS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBoxGA-nsis.ico
TOOL_VCC80X86_RC := $(KBUILD_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
TOOL_VCC80AMD64_RC := $(KBUILD_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
TOOL_VCC70_RC := $(KBUILD_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
else
VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox-winxp.ico
VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBoxGA-winxp.ico
VBOX_NSIS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox-nsis.ico
endif
VBOX_MACOSX_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox.icns
endif
ifndef VBOX_NOINC_DYNAMIC_CONFIG_KMK
#
# GCC and YASM dynamic properties.
# Most of this is resolved on first kmk invocation and cached in PATH_OUT.
#
# Note! That a harmless warning is printed if the file doesn't exist.
# Note! Changes in GCC are not detected automatically (yet).
#
include $(KBUILD_PATH)/tools/$(VBOX_GCC_TOOL).kmk
ifneq ($(VBOX_GCC_TOOL),$(VBOX_GCC32_TOOL))
include $(KBUILD_PATH)/tools/$(VBOX_GCC32_TOOL).kmk
endif
# These tests never worked on Windows because of /dev/null, so, there
# can be no harm in just dropping them until cygwin is mp safe.
ifeq ($(KBUILD_HOST),win)
VBOX_GCC_CHECK_EX_CC = $(3)
VBOX_GCC_CHECK_EX_CXX = $(3)
VBOX_GCC_CHECK_EX_LD = $(3)
VBOX_GCC_CHECK_CC = $(2)
VBOX_GCC_CHECK_CXX = $(2)
VBOX_GCC_CHECK_LD = $(2)
VBOX_GCC32_CHECK_CXX = $(2)
else
VBOX_GCC_CHECK_EX_CC = $(shell \
if $(1) $(subst -Wno-,-W,$(2)) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi; )
VBOX_GCC_CHECK_EX_CXX = $(shell \
if $(1) $(subst -Wno-,-W,$(2)) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi; )
VBOX_GCC_CHECK_EX_LD = $(shell \
if $(1) -Wl,$(2) $(if $(eq $(KBUILD_HOST),darwin),-Wl$(COMMA)-u$(COMMA)start -Wl$(COMMA)-undefined$(COMMA)dynamic_lookup,) \
then echo "-Wl,$(2)"; else echo "$(3)"; fi; )
VBOX_GCC_CHECK_CC = $(call VBOX_GCC_CHECK_EX_CC, $(TOOL_$(VBOX_GCC_TOOL)_CC),$1,$2)
VBOX_GCC_CHECK_CXX = $(call VBOX_GCC_CHECK_EX_CXX, $(TOOL_$(VBOX_GCC_TOOL)_CXX),$1,$2)
VBOX_GCC_CHECK_LD = $(call VBOX_GCC_CHECK_EX_LD, $(TOOL_$(VBOX_GCC_TOOL)_LD),$1,$2)
VBOX_GCC32_CHECK_CXX = $(call VBOX_GCC_CHECK_EX_CXX, $(TOOL_$(VBOX_GCC32_TOOL)_CXX),$1,$2)
endif
ifeq ($(KBUILD_HOST),win) ## @todo can drop this now, we're not using cygwin.
# This isn't important (yet) on windows, so cook the result until
# cygwin is feeling better.
VBOX_GCC_VERSION := $(int-add $(int-mul 10000, 3), $(int-mul 100, 3), 3)
else
# This is kind of bad, the returned string needs to be re-evaluated before use.
# The reason for this hack is that the windows kmk_ash cannot deal with $((1+1)).
# Some versions of gcc (e.g. openSUSE11) return only major.minor on `gcc -dumpversion`.
VBOX_GCC_VERSION = $(shell \
$(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))|' )
endif
# Find MinGW cross compilers for EFI on non-windows systems. We need to probe
# them for supported options in the Dynamic Config.kmk section below.
ifdef VBOX_WITH_EFI
ifneq ($(KBUILD_HOST),win)
ifndef VBOX_PATH_PREFIX_MINGW32
VBOX_PATH_PREFIX_MINGW32 := $(firstword \
$(which i686-w64-mingw32-gcc) \
$(which i686-w32-mingw32-gcc) \
$(which i686-pc-mingw32-gcc) \
$(which i586-mingw32msvc-gcc) \
)# Add more variants.
ifdef VBOX_PATH_PREFIX_MINGW32
VBOX_PATH_PREFIX_MINGW32 := $(substr $(VBOX_PATH_PREFIX_MINGW32), 1, $(expr $(length-var VBOX_PATH_PREFIX_MINGW32) - 3))
endif
endif
ifndef VBOX_PATH_PREFIX_MINGW64
VBOX_PATH_PREFIX_MINGW64 := $(firstword \
$(which x86_64-w64-mingw64-gcc) \
$(which x86_64-w64-mingw32-gcc) \
$(which x86_64-pc-mingw64-gcc) \
$(which x86_64-pc-mingw32-gcc) \
$(which x86_64-w32-mingw32-gcc) \
)# Add more variants.
ifdef VBOX_PATH_PREFIX_MINGW64
VBOX_PATH_PREFIX_MINGW64 := $(substr $(VBOX_PATH_PREFIX_MINGW64), 1, $(expr $(length-var VBOX_PATH_PREFIX_MINGW64) - 3))
endif
endif
if defined(VBOX_PATH_PREFIX_MINGW32) || defined(VBOX_PATH_PREFIX_MINGW64)
if !defined(VBOX_PATH_PREFIX_MINGW32)
VBOX_PATH_PREFIX_MINGW32 = $(VBOX_PATH_PREFIX_MINGW64)
else if !defined(VBOX_PATH_PREFIX_MINGW64)
VBOX_PATH_PREFIX_MINGW64 = $(VBOX_PATH_PREFIX_MINGW32)
endif
endif
endif # !win
endif # VBOX_WITH_EFI
# YASM macros
ifndef DONT_USE_YASM
include $(KBUILD_PATH)/tools/YASM.kmk
if1of ($(KBUILD_HOST), win os2)
VBOX_YASM_CHECK = $(if-expr "$(shell $(TOOL_YASM_AS) -e -o nul $1 - < /dev/null 2>&1)" == "",$(1),)
else
VBOX_YASM_CHECK = $(if-expr "$(shell $(TOOL_YASM_AS) -e -o /dev/null $1 - < /dev/null 2>&1)" == "",$(1),)
endif
else
VBOX_YASM_CHECK =
endif
# No $(QUIET) here as it's interesting to see what goes into the file.
$(PATH_OUT)/DynamicConfig.kmk: \
$(PATH_ROOT)/Config.kmk \
$(LOCALCFG) \
$(AUTOCFG) \
$(VBOX_GCC_PATH_CC) \
$(VBOX_GCC_PATH_CXX) \
$(VBOX_GCC32_PATH_CC) \
$(VBOX_GCC32_PATH_CXX)
$(call MSG_GENERATE,,$@,)
$(QUIET)$(RM) -f '$@'
$(QUIET)$(MKDIR) -p $(@D)
# HC compiler switch detection.
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_PATH_CC ?= $(which $(TOOL_$(VBOX_GCC_TOOL)_CC))'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_PATH_CXX ?= $(which $(TOOL_$(VBOX_GCC_TOOL)_CXX))'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CC))'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CXX))'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-pointer-sign ?= $(call VBOX_GCC_CHECK_CC,-Wno-pointer-sign,)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-array_bounds ?= $(call VBOX_GCC_CHECK_CC,-Wno-array-bounds,)'
# -Wextra produces additional useful warnings but includes -Wno-missing-field-initializers (too noisy)
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wextra ?= $(call VBOX_GCC_CHECK_CC,-Wextra,)'
$(QUIET)$(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CC),)'
$(QUIET)$(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CC),40500),)'
$(QUIET)$(APPEND) '$@' ' VBOX_GCC_Wlogical-op ?= $(call VBOX_GCC_CHECK_CC,-Wlogical-op,)'
$(QUIET)$(APPEND) '$@' ' endif'
$(QUIET)$(APPEND) '$@' 'endif'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-address ?= $(call VBOX_GCC_CHECK_CXX,-Wno-address,)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-delete-non-virtual-dtor ?= $(call VBOX_GCC_CHECK_CXX,-Wno-delete-non-virtual-dtor,)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-int-to-pointer-cast ?= $(call VBOX_GCC_CHECK_CC,-Wno-int-to-pointer-cast,)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-invalid-offsetof ?= $(call VBOX_GCC_CHECK_CXX,-Wno-invalid-offsetof,)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-missing-field-initializers ?= $(call VBOX_GCC_CHECK_CC,-Wno-missing-field-initializers,)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-pointer-to-int-cast ?= $(call VBOX_GCC_CHECK_CC,-Wno-pointer-to-int-cast,)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-variadic-macros ?= $(call VBOX_GCC_CHECK_CXX,-Wno-variadic-macros,)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-vla ?= $(call VBOX_GCC_CHECK_CXX,-Wno-vla,)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-overlength-strings?= $(call VBOX_GCC_CHECK_CC,-Wno-overlength-strings,)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_fno-stack-protector ?= $(call VBOX_GCC_CHECK_CC,-fno-stack-protector,)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_fno-dwarf2-cfi-asm ?= $(call VBOX_GCC_CHECK_CC,-fno-dwarf2-cfi-asm,)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_fdiagnostics-show-option ?= $(call VBOX_GCC_CHECK_CC,-fdiagnostics-show-option,)'
# Produce code optimized for the most common IA32/AMD64/EM64T processors. Introduced with gcc version 4.2.
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_mtune-generic ?= $(call VBOX_GCC_CHECK_CC,-mtune=generic,)'
$(QUIET)$(APPEND) '$@' 'VBOX_LD_as_needed ?= $(call VBOX_GCC_CHECK_LD,--as-needed,)'
# gcc version < 3.4 has a bug in handling __attribute__((regparm(3))).
# See http://osdir.com/ml/gcc.prs/2002-08/msg00223.html and probably http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20004
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_BUGGY_REGPARM ?= $$(int-lt $$(VBOX_GCC_VERSION_CC),30400)'
# Set default attribute for ELF and MACH-O symbols to ``hidden'' to reduce the number
# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
$(QUIET)$(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CC),)'
$(QUIET)$(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CC),40000),)'
$(QUIET)$(APPEND) '$@' ' VBOX_GCC_fvisibility-hidden ?= $(call VBOX_GCC_CHECK_CC,-fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN -DRT_USE_VISIBILITY_DEFAULT,)'
$(QUIET)$(APPEND) '$@' ' endif'
$(QUIET)$(APPEND) '$@' 'endif'
ifn1of ($(KBUILD_TARGET),haiku)
# Set default attribute for inline functions to ``hidden'' to reduce the number
# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
$(QUIET)$(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CXX),)'
$(QUIET)$(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CXX),40000),)'
$(QUIET)$(APPEND) '$@' ' VBOX_GCC_fvisibility-inlines-hidden ?= $(call VBOX_GCC_CHECK_CXX,-fvisibility-inlines-hidden,)'
$(QUIET)$(APPEND) '$@' ' endif'
$(QUIET)$(APPEND) '$@' 'endif'
endif
# Prevent warnings about unused parameters as of gcc-4.8 as this warning is now very verbose
$(QUIET)$(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CXX),)'
$(QUIET)$(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CXX),40800),)'
$(QUIET)$(APPEND) '$@' ' VBOX_GCC_Wno-unused-parameter ?= -Wno-unused-parameter'
$(QUIET)$(APPEND) '$@' ' endif'
$(QUIET)$(APPEND) '$@' 'endif'
# C++ Std settings
$(QUIET)$(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CXX),)'
$(QUIET)$(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CXX),40800),)'
$(QUIET)$(APPEND) '$@' ' VBOX_GCC_std ?= -std=c++11'
$(QUIET)$(APPEND) '$@' ' else ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CXX),40600),)'
$(QUIET)$(APPEND) '$@' ' VBOX_GCC_std ?= -std=c++0x'
$(QUIET)$(APPEND) '$@' ' endif'
$(QUIET)$(APPEND) '$@' 'endif'
ifeq ($(KBUILD_TARGET),solaris)
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_msave-args ?= $(call VBOX_GCC_CHECK_CXX,-msave-args,)'
# Detect the solaris assembler. It is used by the the 4.x gcc compilers,
# apparently. It will not be able to handle IEMAll via a -pipe, only when
# passed a file. The solaris assmbler rulez ... not!
$(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: *//' )'
$(QUIET)$(APPEND) '$@' 'if $$(pos Sun Compiler Common,$$(VBOX_AS_VERSION)) > 0'
$(QUIET)$(APPEND) '$@' ' VBOX_GCC_USING_SOLARIS_AS=1'
$(QUIET)$(APPEND) '$@' 'endif'
$(QUIET)$(APPEND) '$@' 'ifndef VBOX_GCC_USING_SOLARIS_AS'
$(QUIET)$(APPEND) '$@' ' VBOX_GCC_pipe ?= -pipe'
$(QUIET)$(APPEND) '$@' 'endif'
else
$(QUIET)$(APPEND) '$@' 'VBOX_GCC_pipe ?= -pipe'
endif
# Find the compiler includes for IPRT no-crt.
# Note that `$(dir $(gcc -print-libgcc-file-name))/include does not work for a 64-bit cross build on a 32-bit build host.
ifeq ($(KBUILD_HOST),win)
# With the cygwin issues and gcc on windows returning a useless path, just skip this on windows.
$(QUIET)$(APPEND) '$@' 'VBOX_PATH_GCC_INCS ?= '
else
$(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'
endif
# 32-bit (GC) compiler switch detection.
$(QUIET)$(APPEND) '$@' 'VBOX_GCC32_PATH_CC ?= $(which $(TOOL_$(VBOX_GCC32_TOOL)_CC))'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC32_PATH_CXX ?= $(which $(TOOL_$(VBOX_GCC32_TOOL)_CXX))'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC32_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CC))'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC32_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CXX))'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC32_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC32_TOOL)_CC) -print-libgcc-file-name)'
$(QUIET)$(APPEND) '$@' 'VBOX_GCC32_Wno-variadic-macros ?= $(call VBOX_GCC32_CHECK_CXX,-Wno-variadic-macros,)'
# darwin no_compact_linkedit starting at Xcode 3.2
ifeq ($(KBUILD_HOST),darwin)
$(QUIET)$(APPEND) '$@' 'VBOX_LD_no_compact_linkedit ?= $(call VBOX_GCC_CHECK_LD,-no_compact_linkedit,)'
endif
# YASM
$(QUIET)$(APPEND) '$@' 'VBOX_YASM_Wno-segreg-in-64bit ?= $(call VBOX_YASM_CHECK,-Wno-segreg-in-64bit,)'
ifdef VBOX_PATH_PREFIX_MINGW32
$(QUIET)$(APPEND) '$@' 'VBOX_MINGW32_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(VBOX_PATH_PREFIX_MINGW32)gcc -m32)'
$(QUIET)$(APPEND) '$@' 'VBOX_MINGW32_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(VBOX_PATH_PREFIX_MINGW32)g++ -m32)'
$(QUIET)$(APPEND) '$@' 'VBOX_MINGW32_Wno-array-bounds ?= $(call VBOX_GCC_CHECK_EX_CXX,$(VBOX_PATH_PREFIX_MINGW32)g++ -m32,-Wno-array-bounds,)'
$(QUIET)$(APPEND) '$@' 'VBOX_MINGW32_Wno-unused-but-set-variable ?= $(call VBOX_GCC_CHECK_EX_CXX,$(VBOX_PATH_PREFIX_MINGW32)g++ -m32,-Wno-unused-but-set-variable,)'
$(QUIET)$(APPEND) '$@' 'VBOX_MINGW32_Wno-maybe-uninitialized ?= $(call VBOX_GCC_CHECK_EX_CXX,$(VBOX_PATH_PREFIX_MINGW32)g++ -m32,-Wno-maybe-uninitialized,)'
$(QUIET)$(APPEND) '$@' 'VBOX_MINGW32_USER_LABEL_PREFIX ?= $(shell echo "__USER_LABEL_PREFIX__" | $(VBOX_PATH_PREFIX_MINGW32)g++ -m32 -E -xc++ - | $(SED) -e "/^$(HASH)/d")'
endif
ifdef VBOX_PATH_PREFIX_MINGW64
$(QUIET)$(APPEND) '$@' 'VBOX_MINGW64_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(VBOX_PATH_PREFIX_MINGW64)gcc -m64)'
$(QUIET)$(APPEND) '$@' 'VBOX_MINGW64_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(VBOX_PATH_PREFIX_MINGW64)g++ -m64)'
$(QUIET)$(APPEND) '$@' 'VBOX_MINGW64_Wno-array-bounds ?= $(call VBOX_GCC_CHECK_EX_CXX,$(VBOX_PATH_PREFIX_MINGW64)g++ -m64,-Wno-array-bounds,)'
$(QUIET)$(APPEND) '$@' 'VBOX_MINGW64_Wno-unused-but-set-variable ?= $(call VBOX_GCC_CHECK_EX_CXX,$(VBOX_PATH_PREFIX_MINGW64)g++ -m64,-Wno-unused-but-set-variable,)'
$(QUIET)$(APPEND) '$@' 'VBOX_MINGW64_Wno-maybe-uninitialized ?= $(call VBOX_GCC_CHECK_EX_CXX,$(VBOX_PATH_PREFIX_MINGW64)g++ -m64,-Wno-maybe-uninitialized,)'
$(QUIET)$(APPEND) '$@' 'VBOX_MINGW64_USER_LABEL_PREFIX ?= $(shell echo "__USER_LABEL_PREFIX__" | $(VBOX_PATH_PREFIX_MINGW64)g++ -m64 -E -xc++ - | $(SED) -e "/^$(HASH)/d")'
endif
$(QUIET)$(APPEND) '$@' 'VBOX_HAVE_FLEX ?= $(if $(which flex),1,)'
$(QUIET)$(APPEND) '$@' 'VBOX_HAVE_BISON ?= $(if $(which bison),1,)'
$(QUIET)$(ECHO) '========= START OF $@ ========='
$(QUIET)$(CAT) $@
$(QUIET)$(ECHO) '=========== END OF $@ ========='
include $(PATH_OUT)/DynamicConfig.kmk
endif # !VBOX_NOINC_DYNAMIC_CONFIG_KMK
#
# Warnings as errors.
#
# GCC: We disable warnings on non-X86 systems because of the variadic
# macro usage in the logger.
#
ifdef VBOX_WITH_WARNINGS_AS_ERRORS
if $(VBOX_GCC_VERSION_CXX) >= 40000
VBOX_GCC_WERR ?= -Werror
endif
VBOX_VCC_WERR ?= -WX
VBOX_VCC_LD_WERR ?= ## @todo later also: -WX
endif
#
# Misc macros.
#
##
# Edits VirtualBox version, vendor and package strings in a text file.
#
# The rule using this must list $(VBOX_SVN_REV_KMK) as a prerequisite.
#
# @param 1 The input filename.
# @param 2 The output filename.
#
VBOX_EDIT_VERSION_CMD_FN = $(SED) \
-e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
-e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
-e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
-e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
-e 's/@VBOX_SVN_REV@/$(VBOX_SVN_REV)/g' \
-e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
-e 's/@VBOX_VENDOR_SHORT@/$(VBOX_VENDOR_SHORT)/g' \
-e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
-e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
-e 's/@VBOX_PACKAGE_STRING@/$(VBOX_PACKAGE_STRING)/g' \
--output $(2) $(1)
##
# Generates a rule for editing a file using VBOX_EDIT_VERSION_CMD_FN.
#
# @param 1 The target name.
# @param 2 The input filename relative to the current sub-makefile.
# @param 3 The output filename relative to the target output dir.
# Optional, defaults to 2.
#
VBOX_EDIT_VERSION_RULE_FN = $(eval $(value VBOX_EDIT_VERSION_RULE_DEF))
define VBOX_EDIT_VERSION_RULE_DEF
$$($(1)_0_OUTDIR)/$(if $(3),$(3),$(2)): $(PATH_SUB_CURRENT)/$(2) $(VBOX_SVN_REV_KMK) | $$(dir $$@)
$(call MSG_GENERATE,$(1),$@,$<)
$(QUIET)$(call VBOX_EDIT_VERSION_CMD_FN,$<,$@)
endef
##
# Fill in am import library target based on a somewhat special windows .def file.
#
# @param 1 The target name of the import library.
# @param 2 The name of the real library.
# @param 3 The .def-file paths relative to the current makefile.
#
VBOX_GENERATE_IMPORT_TARGET_FN = $(eval $(VBOX_GENERATE_IMPORT_TARGET_DEF))
define VBOX_GENERATE_IMPORT_TARGET_DEF
$(1)_TEMPLATE = VBoxR3Dll
$(1)_INST = $(INST_LIB)
if $(KBUILD_TARGET) == "darwin"
$(1)_LDFLAGS = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/$(2)$(SUFF_DLL)
else ifn1of ($(KBUILD_TARGET), os2 win)
$(1)_SONAME = $(2)$(SUFF_DLL)
endif
if1of ($(KBUILD_TARGET), os2 win)
$(1)_SOURCES = $$($(1)_0_OUTDIR)/$(1)Imp.def
$(1)_CLEAN = $$($(1)_0_OUTDIR)/$(1)Imp.def
else
$(1)_SOURCES = $$($(1)_0_OUTDIR)/$(1)Imp.c
$(1)_CLEAN = $$($(1)_0_OUTDIR)/$(1)Imp.c
endif
$$$$($(1)_SOURCES): $(addprefix $(PATH_SUB_CURRENT)/,$(3)) $(PATH_ROOT)/src/bldprogs/deftoimp.sed | $$$$(dir $$$$@)
$$(call MSG_GENERATE,,$$@)
ifeq ($(KBUILD_TARGET),os2)
$$(SED) \
-e '/not-$(KBUILD_TARGET)/d' \
-e '/not-$(KBUILD_TARGET_ARCH)/d' \
-e 's/^LIBRARY[[:space:]][[:space:]]*\(.*\)\.dll/LIBRARY \1 INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
-e 's/^[ \t][ \t]*\([_a-zA-Z]\)/ _\1/' \
-e 's/[ \t]DATA[ \t]*/ /' \
--output $$@ $(addprefix $(PATH_SUB_CURRENT)/,$(3))
else ifeq ($(KBUILD_TARGET),win)
$$(SED) \
-e '/not-$(KBUILD_TARGET)/d' \
-e '/not-$(KBUILD_TARGET_ARCH)/d' \
--output $$@ $(addprefix $(PATH_SUB_CURRENT)/,$(3))
else
$$(QUIET)$$(APPEND) -tn $$@ \
'#ifdef VBOX_HAVE_VISIBILITY_HIDDEN' \
'# define EXPORT __attribute__((visibility("default")))' \
'# define EXPORT_DATA __attribute__((visibility("default")))' \
'#else' \
'# define EXPORT' \
'# define EXPORT_DATA' \
'#endif' \
''
$$(SED) \
-e '/not-$(KBUILD_TARGET)/d' \
-e '/not-$(KBUILD_TARGET_ARCH)/d' \
-f $(PATH_ROOT)/src/bldprogs/deftoimp.sed \
--append $$@ $(addprefix $(PATH_SUB_CURRENT)/,$(3))
endif
endef # VBOX_GENERATE_IMPORT_TARGET_DEF
#
# Code Signing.
#
# There are two signing modes; 'test' and 'release'.
# - The 'test' mode is tailored local development, where typically test
# certificates are involved. Only the bar minimum of files are signed and
# nothing is timestamped (if we can control timestamping) in order to reduce
# build time and to allow working offline.
# - The 'release' mode is tailored for creating builds that are give to other
# people, like the ones the build servers create. As much as possible is
# signed and timestamped.
#
ifdef VBOX_SIGNING_MODE
VBOX_SIGNING_MODE := $(strip $(VBOX_SIGNING_MODE))
ifn1of ($(VBOX_SIGNING_MODE), test release)
$(error VBOX_SIGNING_MODE must be either 'test' or 'release'. The value '$(VBOX_SIGNING_MODE)' is not recognized.)
endif
ifeq ($(KBUILD_HOST),win)
#
# Windows
#
# VBOX_PATH_SELFSIGN points to the Vista WDK bin/SelfSign directory.
ifndef VBOX_PATH_SELFSIGN
VBOX_PATH_SELFSIGN := $(lastword $(sort $(wildcard $(KBUILD_DEVTOOLS)/win.x86/selfsign/*)))
ifeq ($(VBOX_PATH_SELFSIGN),)
VBOX_PATH_SELFSIGN := $(KBUILD_DEVTOOLS)/win.x86/selfsign/r1
endif
endif
VBOX_SIGNTOOL ?= $(KBUILD_DEVTOOLS)/bin/retry.cmd $(VBOX_PATH_SELFSIGN)/SignTool.exe
VBOX_INF2CAT ?= $(VBOX_PATH_SELFSIGN)/Inf2Cat.exe
ifeq ($(VBOX_SIGNING_MODE),test)
VBOX_CERTIFICATE_SUBJECT_NAME ?= MyTestCertificate
VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
else # release
VBOX_CERTIFICATE_SUBJECT_NAME ?= Oracle Corporation
VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)" /a
# TEMPORARY HACK!
if defined(VBOX_ONLY_VALIDATIONKIT)
VBOX_CROSS_CERTIFICATE_FILE ?= $(VBOX_PATH_SELFSIGN)/MSCV-VSClass3.cer
else
VBOX_CROSS_CERTIFICATE_FILE ?= $(VBOX_PATH_SELFSIGN)/VeriSign Class 3 Public Primary Certification Authority - G5.cer
endif
VBOX_CROSS_CERTIFICATE_FILE_ARGS ?= /ac "$(VBOX_CROSS_CERTIFICATE_FILE)"
VBOX_TSA_URL ?= http://timestamp.verisign.com/scripts/timestamp.dll
VBOX_TSA_URL_ARGS ?= /t "$(VBOX_TSA_URL)"
endif
VBOX_CERTIFICATE_STORE ?= my
VBOX_CERTIFICATE_STORE_ARGS ?= /s "$(VBOX_CERTIFICATE_STORE)"
## Commands for signing a driver image after link.
VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_IMAGE_FN,$(out)))
## Sign a file (generic).
# @param 1 The file to sign.
# @param 2 File description. Optional.
# @param 3 Additional parameters. Optional.
VBOX_SIGN_FILE_FN ?= $(VBOX_SIGNTOOL) sign \
$(VBOX_CROSS_CERTIFICATE_FILE_ARGS) \
$(VBOX_CERTIFICATE_STORE_ARGS) \
$(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
$(VBOX_TSA_URL_ARGS) \
$(if $(strip $(2)),/d "$(strip $(2))",) \
$(3) \
$(1)
## Sign an executable image.
# @param 1 The file to sign.
# @param 2 File description. Optional.
VBOX_SIGN_IMAGE_FN ?= $(call VBOX_SIGN_FILE_FN,$(1),$(2),/ph)
## Create a security catalog file.
# @param 1 The directory containing the stuff to sign.
# @param 2 The expected .cat name. (Inf2Cat lowercases it)
# @param 3 The list of OSes, separated by ';'.
VBOX_MAKE_CAT_HLP_FN ?= \
$(RM) -f $(2)\
$(NL)$(TAB)$(VBOX_INF2CAT) /driver:$(strip $(1)) /os:$(strip $(subst ;,$(COMMA),$(3))) /verbose \
$(NL)$(TAB)$(MV) $(2) $(2) \
$(NL)$(TAB)$(call VBOX_SIGN_FILE_FN,$(2))
VBOX_MAKE_CAT64_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),XP_X64;Server2003_X64;Vista_X64)
VBOX_MAKE_CAT32_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),2000;XP_X86;Server2003_X86;Vista_X86)
ifeq ($(KBUILD_TARGET_ARCH),x86)
VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT32_FN,$(1),$(2))
else
VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT64_FN,$(1),$(2))
endif
# Go nuts, sign everything.
if "$(VBOX_SIGNING_MODE)" == "release" || defined(VBOX_WITH_HARDENING)
## Commands for signing an executable or a dll image after link.
VBOX_SIGN_IMAGE_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_IMAGE_FN,$(out)))
endif
## Enable signing of the additions.
VBOX_SIGN_ADDITIONS ?= 1
else ifeq ($(KBUILD_HOST),darwin)
#
# Darwin code signing.
#
# Currently release signing is done when packing. This may change later.
# (Installer package signing is done elsewhere (VBOX_MACOSX_INSTALLER_SIGN).)
#
ifeq ($(VBOX_SIGNING_MODE),test)
VBOX_CERTIFICATE_SUBJECT_NAME ?= $(error You need to set VBOX_CERTIFICATE_SUBJECT_NAME in LocalConfig.kmk.)
VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= --sign "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
else
VBOX_CERTIFICATE_SUBJECT_NAME ?= Developer ID Application: Oracle America, Inc.
VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= --sign "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
endif
VBOX_CODESIGN ?= codesign
if 0
VBOX_DARWIN_KEXT_SIGN_FILES = CodeDirectory CodeRequirement CodeResources CodeSignature
else
VBOX_DARWIN_KEXT_SIGN_FILES = CodeResources
endif
# The above version with complicated requirements is what Xcode 5.0.1GM suggest for kexts.
VBOX_SIGN_BUNDLE_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(VBOX_CODESIGN) \
--verbose=9 \
--force \
--file-list - \
$(3) \
$(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
$(1) $(if $(2),--identifier "$(2)",)
## Sign a Mach-O image.
# @param 1 The bundle to sign.
# @param 2 Identifier, optional.
VBOX_SIGN_MACHO_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(VBOX_CODESIGN) \
--verbose=9 \
--force \
--file-list - \
$(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
$(1) \
$(if $(2),--identifier "$(2)",)
## Sign a VMM Mach-O image.
# @param 1 The bundle to sign.
# @param 2 Identifier, optional.
ifdef VBOX_NOT_OSX_105
VBOX_SIGN_VMM_MOD_FN = $(VBOX_SIGN_MACHO_FN)
else
VBOX_SIGN_VMM_MOD_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(VBOX_CODESIGN) \
--verbose=9 \
--force \
--file-list - \
$(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
$(1) -D $(1).codesign \
$(if $(2),--identifier "$(2)",)
endif
## Sign a non-executable file.
# @param 1 The bundle to sign.
# @param 2 Identifier, optional.
ifdef VBOX_NOT_OSX_105
VBOX_SIGN_FILE_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(VBOX_CODESIGN) \
--verbose=9 \
--force \
--file-list - \
$(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
$(1) \
$(if $(2),--identifier "$(2)",)
else
VBOX_SIGN_FILE_FN =
endif
## @def VBOX_TEST_SIGN_KEXT
# Adds test signing to a $1.kext target (the plist installer target).
#
# After both targets has been defined:
# $(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxDrv)
#
# @param 1 The kext name. Assumes there is a SYSMODS target of name $1
# as well as an .plist installer by the name of '$1.kext'.
# @remarks Currently assumes only binary + Info.plist in the bundle, no
# other files. Should that be requirement, add them as a list
# in the 2nd parameter.
# @note This is only for the 'test' signing mode, we skip this in
# 'release' signing mode as to not waste time on the build boxes.
ifeq ($(VBOX_SIGNING_MODE),test) ## @todo when kBuild is updated to r2742+, this should be enabled for both modes.
define VBOX_TEST_SIGN_KEXT
$1_INSTTYPE.darwin = none
$(foreach extfile, $(VBOX_DARWIN_KEXT_SIGN_FILES) \
, $$($1.kext_0_OUTDIR)/Contents/_CodeSignature/$(extfile)=>_CodeSignature/$(extfile))
$1.kext_SYMLINKS += $(foreach symfile, $(VBOX_DARWIN_KEXT_SIGN_SYMLINKS), $(symfile)=>_CodeSignature/$(symfile))
$1.kext_CLEAN += \
$(foreach extfile, $(VBOX_DARWIN_KEXT_SIGN_FILES) , $$($1.kext_0_OUTDIR)/Contents/_CodeSignature/$(extfile)) \
$(foreach symfile, $(VBOX_DARWIN_KEXT_SIGN_SYMLINKS), $$($1.kext_0_OUTDIR)/Contents/$(symfile)) \
$$($1.kext_0_OUTDIR)/Contents/MacOS/$1 \
$$($1.kext_0_OUTDIR)/$1.kext/Contents/_CodeSignature/
$$$$($1.kext_0_OUTDIR)/Contents/MacOS/$1 \
+ $(foreach file,$(VBOX_DARWIN_KEXT_SIGN_FILES), $$$$($1.kext_0_OUTDIR)/Contents/_CodeSignature/$(file)): \
$(MKDIR) -p -- "$$($1.kext_0_OUTDIR)/Contents/MacOS/"
$(INSTALL) -m 644 $$($1_1_TARGET) $$($1.kext_0_OUTDIR)/Contents/MacOS/$1
$(call VBOX_SIGN_BUNDLE_FN,$$($1.kext_0_OUTDIR),org.virtualbox.app.kext.$1,)
endef
else
VBOX_TEST_SIGN_KEXT =
endif
else ifeq ($(KBUILD_HOST),solaris)
#
# Solaris code signing.
#
ifeq ($(VBOX_SIGNING_MODE),test)
VBOX_CERTIFICATE_FILE ?= $(error You need to set VBOX_CERTIFICATE_FILE in LocalConfig.kmk.)
VBOX_TOKEN_NAME ?= $(error You need to set VBOX_TOKEN_NAME in LocalConfig.kmk.)
VBOX_PIN_FILE ?= $(error You need to set VBOX_PIN_FILE in LocalConfig.kmk.)
else
VBOX_CERTIFICATE_FILE ?= $(PATH_ROOT)/oracle.pem
VBOX_TOKEN_NAME ?= "Sun Software PKCS\#11 softtoken"
VBOX_PIN_FILE ?= $(PATH_ROOT)/oracle.pin
endif
VBOX_CERTIFICATE_FILE_ARGS ?= -c $(VBOX_CERTIFICATE_FILE)
VBOX_TOKEN_NAME_ARGS ?= -T $(VBOX_TOKEN_NAME)
VBOX_PIN_ARGS ?= -P $(VBOX_PIN_FILE)
VBOX_ELFSIGN ?= elfsign
## Commands for signing a driver image after link.
VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_ELF_FN,$(out)))
# Sign an ELF image.
# @param 1 The elf object file to sign.
VBOX_SIGN_ELF_FN ?= $(VBOX_ELFSIGN) \
sign \
$(VBOX_CERTIFICATE_FILE_ARGS) \
$(VBOX_TOKEN_NAME_ARGS) \
$(VBOX_PIN_ARGS) \
-e $(1)
else
# Not Windows, Mac OS X or Solaris build host, ignore.
VBOX_SIGNING_MODE :=
endif
#
# Complain if windows hardening is enabled but not code signing.
#
else if "$(KBUILD_TARGET)" == "win" && defined(VBOX_WITH_HARDENING) && !defined(VBOX_ONLY_BUILD)
$(error You need to enable code signing for a hardened windows build to work.)
endif
#
# Windows .inf editing.
#
ifeq ($(KBUILD_TARGET_ARCH),x86)
VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF32_FN,$(1),$(2))
else
VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF64_FN,$(1),$(2))
endif
## Edit an inf file an x86 target.
# @param 1 The inf file to edit.
# @param 2 The output file.
VBOX_EDIT_INF32_FN = $(SED) $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d') \
-e 's/^;x86 *//' \
-e '/^;amd64 /d' \
-e 's/^;edit-DriverVer.*/DriverVer = $(date-utc %m\/%d\/%Y),$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)/' \
--output $(2) \
$(1)
## Edit an inf file an x86 target.
# @param 1 The inf file to edit.
# @param 2 The output file.
VBOX_EDIT_INF64_FN = $(SED) \
$(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d')\
-e 's/^;amd64 *//' \
-e '/^;x86 /d' \
-e 's/^;edit-DriverVer.*/DriverVer = $(date-utc %m\/%d\/%Y),$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)/' \
--output $(2) \
$(1)
##
# Helper macro for re-signing DLL images from tools that we ship so they won't
# cause trouble for the hardened build requirements.
#
# Invoke via $(call VBOX_RE_SIGN_DLL_FN) inside the SOURCES list. Necessary
# _CLEAN entry will be added to the target. If hardening is not enabled or
# we're not on windows, the source will be returned.
#
# @returns Name of the output file name. May have leading space, but no trailing.
# @param 1 Target name.
# @param 2 The source name.
#
if defined(VBOX_SIGNING_MODE) && "$(KBUILD_TARGET)" == "win"
VBOX_RE_SIGN_DLL_FN = $(if-expr !defined($(1)_VBOX_RE_SIGNED_$(notdir $(2))),\
$(evalcall VBOX_RE_SIGN_DLL_INTERNAL_FN,$1,$2)\
,)$($(1)_0_OUTDIR)/$(notdir $2)
define VBOX_RE_SIGN_DLL_INTERNAL_FN
local n = $(notdir $2)
ifndef $(1)_VBOX_RE_SIGNED_$(n)
$(1)_VBOX_RE_SIGNED_$(n) := 1
$(eval $(1)_CLEAN += $$($(1)_0_OUTDIR)/$(n))
$$($(1)_0_OUTDIR)/$(n): $(2) $(VBOX_VERSION_STAMP) | $$(dir $$@)
$(call MSG_TOOL,SIGNTOOL,,$<,$@)
$(RM) -f -- "$@"
$(CP) -- "$<" "$@"
$(VBOX_VCC_EDITBIN) /LargeAddressAware /DynamicBase /NxCompat /Release /IntegrityCheck \
/Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
"$@"
$(call VBOX_SIGN_IMAGE_FN,$@)
endif
endef # VBOX_RESIGN_DLL_FN
else
VBOX_RE_SIGN_DLL_FN = $(2)
endif
##
# @param
VBOX_RESIGN_DLL_FN =
#
# Adjust kBuild defaults.
#
if1of ($(KBUILD_TARGET), darwin win)
kBuildGlobalDefaults_LD_DEBUG = split
endif
#
# Haiku resource and version generation.
#
ifeq ($(KBUILD_HOST),haiku)
VBOX_HAIKU_RCTOOL := rc
VBOX_HAIKU_XRESTOOL := xres
VBOX_HAIKU_SETVERSIONTOOL := setversion
# XXX: install won't preserve attributes...
VBOX_HAIKU_MIMESETTOOL := mimeset
## Add optional resources to the program, set its version info, and sniff its mime properties.
# @param 1 The file to add resources to.
# @param 2 The resource files.
# @param 3 The target name.
define VBOX_HAIKU_XRES_SETVER_FN
$(if $(2),$(call MSG_TOOL,HaikuAddResources,$(3),$(2))
$(QUIET)$(VBOX_HAIKU_XRESTOOL) -o $(1) $(2),)
$(call MSG_TOOL,HaikuSetVersion,$(3))
$(QUIET)$(VBOX_HAIKU_SETVERSIONTOOL) $(1) \
-app $(VBOX_VERSION_MAJOR) $(VBOX_VERSION_MINOR) $(VBOX_VERSION_BUILD) d $(VBOX_SVN_REV) \
-short "$(VBOX_PRODUCT)" \
-long "$(VBOX_PRODUCT) $(VBOX_VERSION_STRING) $(shell /bin/echo -e '\xC2\xA9')2009-$(VBOX_C_YEAR) $(VBOX_VENDOR)"
$(call MSG_TOOL,HaikuMimeSet,$(3))
$(QUIET)$(VBOX_HAIKU_MIMESETTOOL) -f $(1)
endef
VBOX_HAIKU_XRES_SETVER_CMDS ?= $(if $(eq $(tool_do),LINK_PROGRAM),$(call VBOX_HAIKU_XRES_SETVER_FN,$(out),$($(target)_RSRCS),$(target)),)
endif
#
# Default prefixes and suffixes.
#
VBOX_PREF_LIB =
if1of ($(KBUILD_TARGET), os2 win)
VBOX_SUFF_LIB = .lib
else
VBOX_SUFF_LIB = .a
endif
if1of ($(KBUILD_HOST), os2 win)
VBOX_HOSTSUFF_LIB = .lib
else
VBOX_HOSTSUFF_LIB = .a
endif
VBOX_SUFF_DLL = $(SUFF_DLL)
ifeq ($(KBUILD_TARGET),os2) # GXX3OMF produces out .o at the moment.
VBOX_SUFF_OBJ = .o
else
VBOX_SUFF_OBJ = $(SUFF_OBJ)
endif
VBOXW32GUEST_SUFF_LIB = .lib
VBOXLNX32GUEST_SUFF_LIB = .a
#
# SDKs for external libraries.
#
SDK_VBOX_LIBXML2 = .
SDK_VBOX_LIBXML2_INCS ?= $(PATH_ROOT)/src/libs/libxml2-2.6.31/include
SDK_VBOX_LIBXML2_DEFS ?= _REENTRANT
SDK_VBOX_LIBXML2_DEFS.win += WIN32 _WINDOWS _MBCS
# note: no linking to LIB here, we do that explicitly in src/VBox/Runtime/Makefile.kmk to link
# libxml against VBoxRT
SDK_VBOX_LIBPNG = .
SDK_VBOX_LIBPNG_INCS ?= $(PATH_ROOT)/src/libs/libpng-1.2.8
SDK_VBOX_LIBPNG_LIBS ?= $(PATH_STAGE_LIB)/VBox-libpng$(VBOX_SUFF_LIB)
SDK_VBOX_ZLIB = .
if1of ($(KBUILD_TARGET), os2 solaris win)
SDK_VBOX_ZLIB_INCS ?= $(PATH_ROOT)/src/libs/zlib-1.2.6
SDK_VBOX_ZLIB_LIBS ?= $(PATH_STAGE_LIB)/VBox-zlib$(VBOX_SUFF_LIB)
else
SDK_VBOX_ZLIB_INCS ?=
SDK_VBOX_ZLIB_LIBS ?= z
SDK_VBOX_ZLIB_DEFS.linux ?= _LARGEFILE64_SOURCE
endif
SDK_VBOX_ZLIB-x86 = .
SDK_VBOX_ZLIB-x86_EXTENDS = VBOX_ZLIB
if1of ($(KBUILD_TARGET), os2 solaris win)
SDK_VBOX_ZLIB_LIBS-x86 ?= $(PATH_STAGE_LIB)/VBox-zlib-x86$(VBOX_SUFF_LIB)
endif
SDK_VBOX_ZLIB_STATIC = .
SDK_VBOX_ZLIB_STATIC_EXTENDS ?= VBOX_ZLIB
if1of ($(KBUILD_TARGET), os2 win) # Not required on solaris.
SDK_VBOX_ZLIB_STATIC_LIBS ?= $(PATH_STAGE_LIB)/VBox-zlib-static$(VBOX_SUFF_LIB)
endif
SDK_VBOX_OPENSSL = Only for VBoxRT and/or statically linked programs.
SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS := $(PATH_OUT)/obj/crypto-headers/include
SDK_VBOX_OPENSSL_INCS ?= $(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)
SDK_VBOX_OPENSSL_ORDERDEPS ?= $(crypto-headers_1_TARGET)
SDK_VBOX_OPENSSL_LIBS ?= \
$(PATH_STAGE_LIB)/VBox-libssl$(VBOX_SUFF_LIB) \
$(PATH_STAGE_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB)
SDK_VBOX_OPENSSL-x86 = Only for VBoxRT and/or statically linked programs.
SDK_VBOX_OPENSSL-x86_VBOX_DEFAULT_INCS := $(PATH_OUT)/obj/crypto-headers/include
SDK_VBOX_OPENSSL-x86_INCS ?= $(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)
SDK_VBOX_OPENSSL-x86_ORDERDEPS ?= $(crypto-headers_1_TARGET)
SDK_VBOX_OPENSSL-x86_LIBS ?= \
$(PATH_STAGE_LIB)/VBox-libssl-x86$(VBOX_SUFF_LIB) \
$(PATH_STAGE_LIB)/VBox-libcrypto-x86$(VBOX_SUFF_LIB)
SDK_VBOX_OPENSSL2 = What you should be using.
SDK_VBOX_OPENSSL2_EXTENDS = VBOX_OPENSSL
if "$(SDK_VBOX_OPENSSL_INCS)" == "$(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)"
SDK_VBOX_OPENSSL2_LIBS = $(NO_SUCH_VARIABLE)
endif
SDK_VBoxOpenSslExtPack = Internal use only.
SDK_VBoxOpenSslExtPack_INCS = $(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)
SDK_VBoxOpenSslExtPack_ORDERDEPS = $(crypto-headers_1_TARGET)
SDK_VBoxOpenSslExtPack_LIBS = \
$(PATH_STAGE_LIB)/VBoxExtPack-libssl$(VBOX_SUFF_LIB) \
$(PATH_STAGE_LIB)/VBoxExtPack-libcrypto$(VBOX_SUFF_LIB)
ifdef VBOX_WITH_S3
VBOX_WITH_LIBCURL = 1
SDK_VBOX_LIBCURL = .
SDK_VBOX_LIBCURL_INCS ?= $(PATH_ROOT)/src/libs/curl-7.27.0/include
SDK_VBOX_LIBCURL_LIBS ?= $(PATH_STAGE_LIB)/VBox-libcurl$(VBOX_SUFF_LIB)
SDK_VBOX_LIBCURL_DEFS ?= BUILDING_LIBCURL
SDK_VBOX_LIBCURL-x86 = .
SDK_VBOX_LIBCURL-x86_INCS ?= $(PATH_ROOT)/src/libs/curl-7.27.0/include
SDK_VBOX_LIBCURL-x86_LIBS.x86 ?= $(PATH_STAGE_LIB)/VBox-libcurl-x86$(VBOX_SUFF_LIB)
SDK_VBOX_LIBCURL-x86_DEFS ?= BUILDING_LIBCURL
endif
SDK_VBOX_VPX = .
SDK_VBOX_VPX_DEFAULT_INCS := $(PATH_ROOT)/src/libs/libvpx
SDK_VBOX_VPX_INCS ?= $(SDK_VBOX_VPX_DEFAULT_INCS)
SDK_VBOX_VPX_LIBS ?= $(PATH_STAGE_LIB)/VBox-libvpx$(VBOX_SUFF_LIB)
#
# Special SDK for the problematic NTDLL.LIB.
#
SDK_VBOX_NTDLL = Mini NTDLL import library, required IPRT.
SDK_VBOX_NTDLL_LIBS.x86 ?= $(PATH_STAGE_LIB)/RuntimeR3NtDll-x86.lib
SDK_VBOX_NTDLL_LIBS.amd64 ?= $(PATH_STAGE_LIB)/RuntimeR3NtDll-amd64.lib
#
# The linux kernel headers(/sources).
#
if1of ($(KBUILD_TARGET), linux)
ifeq ($(origin VBOX_LINUX_SRC),undefined)
ifneq ($(wildcard /lib/modules/$(shell uname -r)/build/include/linux/autoconf.h /lib/modules/$(shell uname -r)/build/include/generated/autoconf.h),)
export VBOX_LINUX_SRC := /lib/modules/$(shell uname -r)/build
else
export VBOX_LINUX_SRC := /usr/src/linux
endif
endif
ifneq ($(VBOX_LINUX_SRC),)
ifeq ($(origin VBOX_LINUX_INCS),undefined)
export VBOX_LINUX_INCS := $(VBOX_LINUX_SRC)/include
# XXX hack alert! Support split Linux kernels (make O=<build directory>). kernelpath points to
# the obj directory while VBOX_LINUX_SRC points to the virgin source directory.
# XXX put this crap elsewhere
kernelpath := $(shell $(SED_EXT) -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(VBOX_LINUX_SRC)/Makefile)
ifeq ($(kernelpath),)
# Linux >= 2.6.25
kernelpath := $(shell $(SED_EXT) -ne 's+^MAKEARGS *:= *-C *\(\S*\).*+\1+p' $(VBOX_LINUX_SRC)/Makefile)
endif
ifneq ($(kernelpath),)
# absolute path?
ifneq ($(patsubst /%,,$(kernelpath)),)
# no, relative path
kernelpath := $(realpath $(VBOX_LINUX_SRC)/$(kernelpath))
endif
endif
ifneq ($(kernelpath),)
VBOX_LINUX_INCS += $(VBOX_LINUX_SRC)/include2 $(kernelpath)/include
else
kernelpath := $(VBOX_LINUX_SRC)
endif
#
VBOX_LINUX_INCS += $(kernelpath)/include/asm-i386/mach-default \
$(kernelpath)/include/asm-x86/mach-default \
$(kernelpath)/include/drm \
$(kernelpath)/arch/x86/include \
$(kernelpath)/arch/x86/include/asm/mach-default \
$(kernelpath)/arch/x86/include/uapi \
$(VBOX_LINUX_SRC)/arch/x86/include/generated \
$(VBOX_LINUX_SRC)/arch/x86/include/generated/uapi \
$(kernelpath)/include/uapi \
$(VBOX_LINUX_SRC)/include/generated/uapi \
$(kernelpath)/include
endif
endif
# Since Linux 2.6.15, <linux/autoconf.h> is included like this. It cannot hurt to do the
# same for older Linux kernels
ifneq ($(wildcard $(kernelpath)/include/linux/kconfig.h),)
# Linux >= 3.1
export VBOX_LINUX_INCLUDE := -include $(kernelpath)/include/linux/kconfig.h
else ifneq ($(wildcard $(VBOX_LINUX_SRC)/include/generated/autoconf.h),)
# Linux >= 2.6.33
export VBOX_LINUX_INCLUDE := -include $(VBOX_LINUX_SRC)/include/generated/autoconf.h
else ifneq ($(wildcard $(VBOX_LINUX_SRC)/include/linux/autoconf.h),)
# Linux < 2.6.33
export VBOX_LINUX_INCLUDE := -include $(VBOX_LINUX_SRC)/include/linux/autoconf.h
endif
endif
#
# Determine Solaris version.
#
ifeq ($(KBUILD_TARGET),solaris)
ifeq ($(origin VBOX_SOLARIS_VERSION),undefined)
$(eval export VBOX_SOLARIS_VERSION := $(shell uname -r | $(SED_EXT) 's|\([0-9]*\)\.\([0-9]*\)|$$(int-add $$(int-mul 100, \1), \2)|' ))
endif
ifeq ($(VBOX_SOLARIS_VERSION),510)
DEFS.solaris += RT_OS_SOLARIS_10
# Solaris 10 does not include crossbow.
VBOX_SOLARIS_10 = 1
# We cannot compile additions on Solaris 10, due kernel interface deps
VBOX_WITHOUT_ADDITIONS := 1
VBOX_WITH_ADDITIONS =
else ifeq ($(VBOX_SOLARIS_VERSION),511)
# uname -v can report "snv_XYZ" or "11.X"
VBOX_SOLARIS_11_VERSION = $(shell uname -v | sed 's/snv_//' | cut -f1 -d'.')
ifeq ($(VBOX_SOLARIS_11_VERSION),11)
VBOX_SOLARIS_11_FULLVERSION = $(shell pkg contents -H -t set -o pkg.fmri system/kernel | $(SED_EXT) -e '1!d' -e 's/^.*\@//;s/\:.*//;s/.*,//')
# FULLVERSION format e.g. "5.11-0.175.1.0.0.16.0", we're interested in 175 (VERSION), 1 (UPDATE), 16 (BUILD).
VBOX_SOLARIS_11_VERSION = $(word 2, $(subst ., ,$(word 2,$(subst -, ,$(VBOX_SOLARIS_11_FULLVERSION)))))
VBOX_SOLARIS_11_UPDATE_VERSION = $(word 3, $(subst ., ,$(word 2,$(subst -, ,$(VBOX_SOLARIS_11_FULLVERSION)))))
VBOX_SOLARIS_11_BUILD_VERSION = $(word 6, $(subst ., ,$(word 2,$(subst -, ,$(VBOX_SOLARIS_11_FULLVERSION)))))
endif
# OSS audio support for Solaris
VBOX_WITH_SOLARIS_OSS := $(if-expr $(VBOX_SOLARIS_11_VERSION) >= 115,1,)
endif
# XPCOM namespace cleanup issue with Solaris GCC 4.5.2 and newer, see @bugref{5838}.
if $(VBOX_GCC_VERSION_CXX) >= 40502
VBOX_WITH_XPCOM_NAMESPACE_CLEANUP =
endif
endif
#
# VBoxTpG tool.
#
TOOL_VBoxTpG = The VirtualBox Tracepoint Generator
TOOL_VBoxTpG_DTRACE_DEPORD = $(VBOX_VBOXTPG)
TOOL_VBoxTpG_DTRACE_HDR_FLAGS := \
$(if-expr $(intersects $(KBUILD_TARGET_ARCH),$(KBUILD_ARCHES_64)),-64,-32) \
-h --host-$(VBOX_HC_ARCH_BITS)-bit #-vvv
define TOOL_VBoxTpG_DTRACE_HDR_CMDS
$(QUIET)$(VBOX_VBOXTPG) $(flags) -o "$(out)" -s "$(source)"
endef
TOOL_VBoxTpG_DTRACE_OBJ_NOT_NEEDED :=
TOOL_VBoxTpG_DTRACE_OBJ_FLAGS := -G --host-$(VBOX_HC_ARCH_BITS)-bit #-vvv
define TOOL_VBoxTpG_DTRACE_OBJ_CMDS
$(QUIET)$(VBOX_VBOXTPG) \
$(if-expr $(intersects $(bld_trg_arch),$(KBUILD_ARCHES_64)),-64,-32) \
$(flags) \
-o "$(out)" -s "$(source)"
endef
#
# VBoxTpG tool - Disabled, only generate the header.
#
TOOL_VBoxTpG-Disabled = The VirtualBox Tracepoint Generator, disabled.
TOOL_VBoxTpG-Disabled_DTRACE_DEPORD = $(VBOX_VBOXTPG)
TOOL_VBoxTpG-Disabled_DTRACE_HDR_FLAGS := -h
define TOOL_VBoxTpG-Disabled_DTRACE_HDR_CMDS
$(QUIET)$(VBOX_VBOXTPG) $(flags) -o "$(out)" -s "$(source)"
endef
TOOL_VBoxTpG-Disabled_DTRACE_OBJ_NOT_NEEDED := $(KBUILD_OSES)
#
# dtrace+VBoxTpG tool for ring-3 to ring-0 pointer conversion.
#
TOOL_DTraceAndVBoxTpG = DTrace and the VirtualBox Tracepoint Generator working together on static ring-3 probes.
TOOL_DTraceAndVBoxTpG_EXTENDS = StandardDTrace
TOOL_DTraceAndVBoxTpG_DTRACE_DEPORD = $(VBOX_VBOXTPG)
TOOL_DTraceAndVBoxTpG_DTRACE_HDR_CMDS =
define TOOL_DTraceAndVBoxTpG_DTRACE_HDR_CMDS
$(TOOL_StandardDTrace_DTRACE_HDR_CMDS)
$(QUIET)$(VBOX_VBOXTPG) --generate-wrapper-header --host-$(VBOX_HC_ARCH_BITS)-bit --ring-3-context \
$(filter-out -C, $(filter-out -h,$(flags))) \
-o "$(out).tmp" -s "$(source)"
$(APPEND) "$(out).tmp"
$(SED) -e 's/\(#define.*\)(arg0/\1_ORIGINAL(arg0/' --append "$(out).tmp" "$(out)"
$(MV) -f -- "$(out).tmp" "$(out)"
endef
TOOL_DTraceAndVBoxTpG_DTRACE_OBJ_NOT_NEEDED = $(TOOL_StandardDTrace_DTRACE_OBJ_NOT_NEEDED)
TOOL_DTraceAndVBoxTpG_DTRACE_OBJ_CMDS = $(TOOL_StandardDTrace_DTRACE_OBJ_CMDS)
ifdef VBOX_WITH_RAW_MODE
#
# Template for building RC things.
#
TEMPLATE_VBoxRc = VBox Raw-Mode Context
TEMPLATE_VBoxRc_ASTOOL = $(VBOX_ASTOOL)
TEMPLATE_VBoxRc_ASFLAGS = $(VBOX_ASFLAGS32)
TEMPLATE_VBoxRc_DEFS = IN_RC IPRT_NO_CRT RT_WITH_NOCRT_ALIASES $(ARCH_BITS_DEFS)
TEMPLATE_VBoxRc_INCS = $(PATH_ROOT)/include/iprt/nocrt
TEMPLATE_VBoxRc_SYSSUFF = .gc
TEMPLATE_VBoxRc_BLD_TRG_ARCH = x86
TEMPLATE_VBoxRc_MODE = a+r,u+w
TEMPLATE_VBoxRc_USES += dtrace
TEMPLATE_VBoxRc_DTRACE_HDR_FLAGS = --raw-mode-context
TEMPLATE_VBoxRc_DTRACE_OBJ_FLAGS = --raw-mode-context --probe-fn-name "VMMRCProbeFire"
ifdef VBOX_WITH_DTRACE_RC
TEMPLATE_VBoxRc_DTRACETOOL = VBoxTpG
TEMPLATE_VBoxRc_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_RC
else
TEMPLATE_VBoxRc_DTRACETOOL = VBoxTpG-Disabled
endif
ifeq ($(VBOX_LDR_FMT32),pe)
TEMPLATE_VBoxRc_TOOL = $(VBOX_VCC_TOOL_STEM)X86
ifdef TODO_MORE_WARNINGS
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)
else
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)
endif
TEMPLATE_VBoxRc_CFLAGS = $(TEMPLATE_VBoxRc_CXXFLAGS)
TEMPLATE_VBoxRc_LDFLAGS = -Ignore:4197 \
-Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Exports -NoD $(VBOX_VCC_LD_WERR) -Release -Debug \
-Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
-Stub:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com
ifdef VBOX_SIGNING_MODE
TEMPLATE_VBoxRc_LDFLAGS += -IntegrityCheck
endif
TEMPLATE_VBoxRc_LIBS = \
TEMPLATE_VBoxRc_LIBS += \
$(PATH_STAGE_LIB)/RuntimeRCStub$(VBOX_SUFF_LIB)
TEMPLATE_VBoxRc_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
endif # pe
ifeq ($(VBOX_LDR_FMT32),elf)
TEMPLATE_VBoxRc_TOOL = $(VBOX_GCC32_TOOL)
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
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)
ifeq ($(KBUILD_TARGET),solaris)
TEMPLATE_VBoxRc_LDFLAGS = -r
else
TEMPLATE_VBoxRc_LDFLAGS = -nostdlib -Bsymbolic -g
## @todo WTF doesn't the globals work? Debug info is supposed to be split everywhere. GRR
TEMPLATE_VBoxRc_LD_DEBUG = split
endif
ifn1of ($(KBUILD_TARGET), solaris freebsd)
TEMPLATE_VBoxRc_LIBS = \
$(VBOX_GCC32_LIBGCC) # instricts
endif
if1of ($(KBUILD_TARGET),linux)
TEMPLATE_VBoxRc_POST_CMDS = $(if $(eq $(tool_do),LINK_SYSMOD),if readelf -S $(out)|grep -q "[cd]tors"; then echo "Found ctors/dtors in $(out)!"; exit 1; fi)
endif
endif
ifeq ($(VBOX_LDR_FMT32),macho)
TEMPLATE_VBoxRc_TOOL = GXX4MACHO
TEMPLATE_VBoxRc_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
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
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
TEMPLATE_VBoxRc_LDFLAGS = $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -m32 -nostdlib
#TEMPLATE_VBoxRc_LDFLAGS.release = -Wl,-S ???
endif
ifeq ($(VBOX_LDR_FMT32),lx)
TEMPLATE_VBoxRc_TOOL = GXX3OMF
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
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
TEMPLATE_VBoxRc_LDFLAGS = -Zdll -nostdlib
TEMPLATE_VBoxRc_LIBS = \
$(VBOX_GCC32_LIBGCC) \
$(VBOX_OBJ_SYS0) \
end
endif
#
# Template for building a RC ring-3 testcase (tstVMStructGC, tstDevStructGC).
#
TEMPLATE_VBoxRcExe = VBox Raw-Mode as ring-3 testcase
TEMPLATE_VBoxRcExe_EXTENDS = VBoxRc
TEMPLATE_VBoxRcExe_DEFS = $(filter-out IPRT_NO_CRT RT_WITH_NOCRT_ALIASES,$(TEMPLATE_VBoxRc_DEFS))
TEMPLATE_VBoxRcExe_INCS = $(NO_SUCH_VARIABLE)
TEMPLATE_VBoxRcExe_MODE = $(NO_SUCH_VARIABLE)
ifeq ($(VBOX_LDR_FMT32),pe)
TEMPLATE_VBoxRcExe_LDFLAGS = -Ignore:4197 \
-Incremental:NO -MapInfo:Exports -NoD -Debug \
-Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
-Stub:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com
TEMPLATE_VBoxRcExe_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK)
TEMPLATE_VBoxRcExe_LIBS = \
$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_LIB)/libcmt.lib \
$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_LIB)/oldnames.lib
endif
ifeq ($(VBOX_LDR_FMT32),elf)
TEMPLATE_VBoxRcExe_CFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CFLAGS)) -O0
TEMPLATE_VBoxRcExe_CXXFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CXXFLAGS)) -O0
TEMPLATE_VBoxRcExe_LDFLAGS = -g
if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), freebsd.amd64)
# The FreeBSD port of gcc isn't picking up -m32 where it should.
TEMPLATE_VBoxRcExe_DEFS.$(KBUILD_TARGET) = $(TEMPLATE_VBoxRc_DEFS.$(KBUILD_TARGET)) IPRT_DONT_USE_SYSTEM_STDINT_H
TEMPLATE_VBoxRcExe_LDFLAGS.$(KBUILD_TARGET) = /usr/lib32/crt1.o /usr/lib32/crti.o /usr/lib32/crtbegin.o $(TEMPLATE_VBoxRc_LDFLAGS.$(KBUILD_TARGET)) -nostdlib -v
TEMPLATE_VBoxRcExe_LIBPATH.$(KBUILD_TARGET) = /usr/lib32
endif
endif
ifeq ($(VBOX_LDR_FMT32),macho)
TEMPLATE_VBoxRcExe_CFLAGS = $(filter-out -static -nostdinc,$(TEMPLATE_VBoxRc_CFLAGS))
TEMPLATE_VBoxRcExe_CXXFLAGS = $(filter-out -static -nostdinc,$(TEMPLATE_VBoxRc_CXXFLAGS))
TEMPLATE_VBoxRcExe_LDFLAGS = -g -m32
endif
ifeq ($(VBOX_LDR_FMT32),lx)
TEMPLATE_VBoxRcExe_CFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CFLAGS))
TEMPLATE_VBoxRcExe_CXXFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CXXFLAGS))
TEMPLATE_VBoxRcExe_LDFLAGS = -g
TEMPLATE_VBoxRcExe_LIBS = $(NO_SUCH_VARIABLE)
endif
endif # VBOX_WITH_RAW_MODE
#
# Template for building R0 things.
#
TEMPLATE_VBoxR0 = VBox Ring 0
TEMPLATE_VBoxR0_ASTOOL = $(VBOX_ASTOOL)
TEMPLATE_VBoxR0_ASFLAGS = $(VBOX_ASFLAGS)
TEMPLATE_VBoxR0_DEFS = IN_RING0 IN_RING0_AGNOSTIC IPRT_NO_CRT RT_WITH_NOCRT_ALIASES $(ARCH_BITS_DEFS)
TEMPLATE_VBoxR0_INCS = $(PATH_ROOT)/include/iprt/nocrt
TEMPLATE_VBoxR0_SYSSUFF = .r0
TEMPLATE_VBoxR0_MODE = a+r,u+w
TEMPLATE_VBoxR0_USES += dtrace
TEMPLATE_VBoxR0_DTRACE_HDR_FLAGS = --ring-0-context-agnostic
TEMPLATE_VBoxR0_DTRACE_OBJ_FLAGS = --ring-0-context-agnostic
ifdef VBOX_WITH_DTRACE_R0
TEMPLATE_VBoxR0_DTRACETOOL = VBoxTpG
TEMPLATE_VBoxR0_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R0
else
TEMPLATE_VBoxR0_DTRACETOOL = VBoxTpG-Disabled
endif
ifeq ($(VBOX_LDR_FMT),pe)
TEMPLATE_VBoxR0_TOOL = $(VBOX_VCC_TOOL)
ifdef TODO_MORE_WARNINGS
TEMPLATE_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)
else
TEMPLATE_VBoxR0_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -GS- -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP) -W3 -wd4244 -wd4996 $(VBOX_VCC_WERR)
endif
TEMPLATE_VBoxR0_CFLAGS = $(TEMPLATE_VBoxR0_CXXFLAGS)
TEMPLATE_VBoxR0_LDFLAGS = -Ignore:4197 \
-Driver -Subsystem:NATIVE -Incremental:NO -Align:4096 -MapInfo:Exports -NoD $(VBOX_VCC_LD_WERR) -Release -Debug \
-Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
-Stub:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com
ifdef VBOX_WITH_DTRACE_R0
TEMPLATE_VBoxR0_LDFLAGS += -Merge:VTGPrLc.Data=VTGPrLc.Begin -Merge:VTGPrLc.End=VTGPrLc.Begin -Merge:VTGPrLc.Begin=VTGObj
endif
ifdef VBOX_SIGNING_MODE
TEMPLATE_VBoxR0_LDFLAGS += -IntegrityCheck
endif
TEMPLATE_VBoxR0_LIBS = \
$(PATH_STAGE_LIB)/RuntimeR0Stub$(VBOX_SUFF_LIB)
include $(KBUILD_PATH)/sdks/$(VBOX_WINDDK).kmk ## TODO: Add a kBuild feature for loading SDKs.
TEMPLATE_VBoxR0_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
endif # pe
ifeq ($(VBOX_LDR_FMT),elf)
TEMPLATE_VBoxR0_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_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
TEMPLATE_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
TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding
TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables
ifeq ($(KBUILD_TARGET),solaris)
TEMPLATE_VBoxR0_LDFLAGS = -r
TEMPLATE_VBoxR0_LDFLAGS.solaris = -u _init -u _info
$(PATH_STAGE_LIB)/RuntimeR0Stub$(VBOX_SUFF_LIB)
ifdef VBOX_GCC_USING_SOLARIS_AS
TEMPLATE_VBoxR0_CFLAGS.amd64 += -Wa,-xmodel=kernel
TEMPLATE_VBoxR0_CXXFLAGS.amd64 += -Wa,-xmodel=kernel
endif
# Solaris driver signing.
TEMPLATE_VBoxR0_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
else
TEMPLATE_VBoxR0_LDFLAGS = -nostdlib -Bsymbolic -g
## @todo WTF doesn't the globals work? Debug info is supposed to be split everywhere. GRR
TEMPLATE_VBoxR0_LD_DEBUG = split
endif
ifn1of ($(KBUILD_TARGET),solaris freebsd)
TEMPLATE_VBoxR0_LIBS = \
$(VBOX_GCC_LIBGCC) # instricts
endif
if1of ($(KBUILD_TARGET),linux)
TEMPLATE_VBoxR0_POST_CMDS = $(if $(eq $(tool_do),LINK_SYSMOD),if readelf -S $(out)|grep -q "[cd]tors"; then echo "Found ctors/dtors in $(out)!"; exit 1; fi)
endif
endif
ifeq ($(VBOX_LDR_FMT),macho)
TEMPLATE_VBoxR0_TOOL = GXX4MACHO
TEMPLATE_VBoxR0_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
TEMPLATE_VBoxR0_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) \
-fno-common -msoft-float -static -fno-rtti -fno-exceptions $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing \
-mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_fno-stack-protector)
TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mno-sse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -fno-unwind-tables
TEMPLATE_VBoxR0_CXXFLAGS.x86 = -m32
TEMPLATE_VBoxR0_CFLAGS = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) \
-fno-common -msoft-float -static -fno-exceptions $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing \
-mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_fno-stack-protector)
TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -mno-red-zone -mno-sse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -fno-unwind-tables
TEMPLATE_VBoxR0_CFLAGS.x86 = -m32
TEMPLATE_VBoxR0_LDFLAGS = $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -nostdlib
#TEMPLATE_VBoxR0_LDFLAGS.release = -Wl,-S ???
TEMPLATE_VBoxR0_LDFLAGS.amd64 = -m64 -static
TEMPLATE_VBoxR0_LDFLAGS.x86 = -m32
endif
ifeq ($(VBOX_LDR_FMT),lx)
TEMPLATE_VBoxR0_TOOL = GXX3OMF
TEMPLATE_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
TEMPLATE_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
TEMPLATE_VBoxR0_LDFLAGS = -nostdlib -Zdll
TEMPLATE_VBoxR0_LIBS = \
$(VBOX_GCC_LIBGCC) \
$(VBOX_OBJ_SYS0) \
end
endif
#
# Template for building SUPDRV R0 things.
#
TEMPLATE_VBOXR0DRV = VBox SUPDRV Ring 0
TEMPLATE_VBOXR0DRV_ASTOOL = $(VBOX_ASTOOL)
TEMPLATE_VBOXR0DRV_ASFLAGS = $(VBOX_ASFLAGS)
TEMPLATE_VBOXR0DRV_DEFS = IN_RING0 IN_RT_R0 $(ARCH_BITS_DEFS)
TEMPLATE_VBOXR0DRV_USES += dtrace
ifdef VBOX_WITH_DTRACE_R0DRV
TEMPLATE_VBOXR0DRV_DTRACETOOL = VBoxTpG
TEMPLATE_VBOXR0DRV_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R0DRV
ifdef VBOX_WITH_NATIVE_DTRACE
TEMPLATE_VBOXR0DRV_DEFS += VBOX_WITH_NATIVE_DTRACE
endif
else
TEMPLATE_VBOXR0DRV_DTRACETOOL = VBoxTpG-Disabled
endif
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_VCC_TOOL)
TEMPLATE_VBOXR0DRV_RCDEFS = \
VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
VBOX_SVN_REV=\"$(VBOX_SVN_REV)\" \
VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD) \
VBOX_SVN_REV_NR=$(VBOX_SVN_REV)
TEMPLATE_VBOXR0DRV_DEFS.x86 = _X86_
TEMPLATE_VBOXR0DRV_DEFS.x86 += NO_INTERLOCKED_INTRINSICS # Avoids intrisic VC/WDK trouble
TEMPLATE_VBOXR0DRV_DEFS.x86 += WIN9X_COMPAT_SPINLOCK # Avoid multiply defined _KeInitializeSpinLock@4
TEMPLATE_VBOXR0DRV_DEFS.amd64 = _AMD64_
TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -Gz -W3 -GS- -wd4996 -Zc:wchar_t- -Gs4096 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
TEMPLATE_VBOXR0DRV_CFLAGS = $(TEMPLATE_VBOXR0DRV_CXXFLAGS)
TEMPLATE_VBOXR0DRV_LDFLAGS = -Ignore:4197 \
-Driver -Subsystem:NATIVE -Incremental:NO -Align:4096 -MapInfo:Exports -NoD -Release -Debug \
-Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
-Stub:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com
ifdef VBOX_WITH_DTRACE_R0DRV
TEMPLATE_VBOXR0DRV_LDFLAGS += -Merge:VTGPrLc.Data=VTGPrLc.Begin -Merge:VTGPrLc.End=VTGPrLc.Begin -Merge:VTGPrLc.Begin=VTGObj
endif
ifdef VBOX_SIGNING_MODE
TEMPLATE_VBOXR0DRV_LDFLAGS += -IntegrityCheck
endif
TEMPLATE_VBOXR0DRV_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
endif
ifeq ($(KBUILD_TARGET),linux)
TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBOXR0DRV_DEFS += __KERNEL__ MODULE
TEMPLATE_VBOXR0DRV_INCS = $(VBOX_LINUX_INCS)
TEMPLATE_VBOXR0DRV_CFLAGS = -nostdinc -iwithprefix include $(VBOX_LINUX_INCLUDE) \
$(VBOX_GCC_WARN) -Wstrict-prototypes $(VBOX_GCC_Wno-pointer-sign) -Wno-sign-compare $(VBOX_GCC_fdiagnostics-show-option) \
$(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
-fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mpreferred-stack-boundary=2 -msoft-float
TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
-fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
-Wno-sign-compare -Wdeclaration-after-statement
TEMPLATE_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
ifndef VBOX_LINUX_VERSION_2_4
# 2.6
TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
else
# 2.4
TEMPLATE_VBOXR0DRV_SYSSUFF = .o
TEMPLATE_VBOXR0DRV_LDFLAGS = -r -s
endif
endif
ifeq ($(KBUILD_TARGET),os2)
TEMPLATE_VBOXR0DRV_TOOL = GXX3OMF
TEMPLATE_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
TEMPLATE_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
TEMPLATE_VBOXR0DRV_LIBS = $(VBOX_GCC_LIBGCC)
# wlink thinks physdevice doesn't need fixups and should have a stack - stupid!
TEMPLATE_VBOXR0DRV_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
endif
ifeq ($(KBUILD_TARGET),darwin)
TEMPLATE_VBOXR0DRV_TOOL = GXX4MACHO
TEMPLATE_VBOXR0DRV_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS) KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT
TEMPLATE_VBOXR0DRV_INCS += $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/Kernel.framework/Headers
## @todo try use VBOX_GCC_PEDANTIC_CXX
TEMPLATE_VBOXR0DRV_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) \
-g $(VBOX_GCC_pipe) $(VBOX_GCC_WARN) -Wno-long-long $(VBOX_GCC_fdiagnostics-show-option) \
-fno-common -nostdinc -fno-builtin -finline $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden) \
-fno-keep-inline-functions -fno-exceptions -msoft-float \
-fapple-kext -fno-rtti -fcheck-new -force_cpusubtype_ALL \
$(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fasm-blocks
TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = -m64 -mkernel -mno-red-zone -gdwarf-2
TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = -m32 -static
TEMPLATE_VBOXR0DRV_CFLAGS = $(VBOX_DARWIN_DEF_SDK_CFLAGS) \
-g $(VBOX_GCC_pipe) $(VBOX_GCC_WARN) -Wno-long-long -fno-common -nostdinc -fno-builtin -finline \
-fno-keep-inline-functions -fno-exceptions $(VBOX_GCC_fvisibility-hidden) -msoft-float \
-Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations \
-Werror-implicit-function-declaration -force_cpusubtype_ALL \
$(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fasm-blocks
TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mkernel -mno-red-zone -gdwarf-2
TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -static
TEMPLATE_VBOXR0DRV_LDFLAGS = $(filter-out $(VBOX_DARWIN_NO_COMPACT_LINKEDIT),$(VBOX_DARWIN_DEF_SDK_LDFLAGS)) \
-nostdlib -Wl,-kext,-new_linker -Wl,-Y,1455 -keep_private_extern
TEMPLATE_VBOXR0DRV_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC)
endif
ifeq ($(KBUILD_TARGET),solaris)
## The Solaris /usr/platform/i86pc/include and /usr/include directories.
VBOX_SOLARIS_SYS_INCS ?= /usr/platform/i86pc/include /usr/include
TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBOXR0DRV_DEFS += _MACHDEP _KERNEL _STRICT_STDC
TEMPLATE_VBOXR0DRV_INCS = $(VBOX_SOLARIS_SYS_INCS)
TEMPLATE_VBOXR0DRV_LDFLAGS = -r -dy
TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = $(if $(eq $(KBUILD_HOST),solaris),-64,-m elf_x86_64)
# Exclude -Wall because of solaris headers' pragma ident warnings that gcc refuses to supress.
TEMPLATE_VBOXR0DRV_CFLAGS = -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
-Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_fdiagnostics-show-option) \
-Wshadow -Wuninitialized -Wunused-function -Wunused-label -Wunused-value -Wunused-variable \
-Wformat -Wimplicit-int -Wimplicit-function-declaration -Werror-implicit-function-declaration -Wparentheses \
-O2 -fno-omit-frame-pointer -ffreestanding -nodefaultlibs -fno-strict-aliasing -fno-common -std=c99
TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_msave-args) \
-mno-red-zone -mcmodel=kernel $(if-expr defined(VBOX_GCC_USING_SOLARIS_AS),-Wa$(COMMA)-xmodel=kernel,) \
-fno-reorder-blocks -fno-asynchronous-unwind-tables -funit-at-a-time
TEMPLATE_VBOXR0DRV_CXXFLAGS = -Wpointer-arith -Winline \
-Wshadow -Wuninitialized -Wunused-function -Wunused-label -Wunused-value -Wunused-variable \
-Wformat \
-O2 -nodefaultlibs -fno-omit-frame-pointer -fno-strict-aliasing -fno-common -fno-exceptions -fno-rtti
TEMPLATE_VBOXR0DRV_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
endif # Solaris
ifeq ($(KBUILD_TARGET),freebsd)
# x86 FreeBSD (6.2 or something):
# cc -O2 -fno-strict-aliasing -pipe -Werror -D_KERNEL -DKLD_MODULE \
# -nostdinc -I- -I. -I@ -I@/contrib/altq -I@/../include -I/usr/include \
# -finline-limit=8000 -fno-common -mno-align-long-strings -mpreferred-stack-boundary=2 \
# -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -ffreestanding -Wall -Wredundant-decls -Wnested-externs \
# -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions \
# -std=c99 -c ../my.c
# :> export_syms
# awk -f /usr/src/sys/modules/my/../../conf/kmod_syms.awk my.kld export_syms | xargs -J% objcopy % my.kld
#
# AMD64 FreeBSD (7.1):
# cc -O2 -fno-strict-aliasing -pipe -D_KERNEL -DKLD_MODULE -std=c99 -nostdinc -I. -I@ -I@/contrib/altq \
# -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common \
# -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx \
# -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -ffreestanding \
# -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign \
# -fformat-extensions -c /usr/src/sys/modules/my/../../dev/my/if_my.c
# :> export_syms
# awk -f /usr/src/sys/modules/my/../../conf/kmod_syms.awk if_my.ko export_syms | xargs -J% objcopy % if_my.ko
# Note: @ -> /usr/src/sys and machine -> /usr/src/sys/i386/include
## The location of the FreeBSD kernel source.
VBOX_FREEBSD_SRC ?= /usr/src/sys
## The FreeBSD /usr/include.
VBOX_FREEBSD_SYS_INCS ?= /usr/include
TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBOXR0DRV_LDTOOL = FREEBSDKMODLD
TEMPLATE_VBOXR0DRV_DEFS += _KERNEL KLD_MODULE
TEMPLATE_VBOXR0DRV_INCS = \
$(VBOX_FREEBSD_SRC) \
$(VBOX_FREEBSD_SRC)/contrib/altq \
$(VBOX_FREEBSD_SRC)/../include \
$(VBOX_FREEBSD_SYS_INCS)
# omitting: -Wcast-qual, -Wredundant-decls
TEMPLATE_VBOXR0DRV_CFLAGS = \
$(VBOX_GCC_WARN) -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) $(VBOX_GCC_fdiagnostics-show-option) \
-Wstrict-prototypes -Wmissing-prototypes -Wstrict-prototypes \
-Wimplicit-function-declaration -Werror-implicit-function-declaration \
-O2 -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
$(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
-nostdinc -std=c99
TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2
TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 --param inline-unit-growth=100 --param large-function-growth=1000 \
-fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx \
-mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -Wundef
TEMPLATE_VBOXR0DRV_CXXFLAGS = -fno-exceptions -fno-rtti \
$(VBOX_GCC_WARN) -Wpointer-arith -Winline \
-O2 -fno-strict-aliasing -fno-common -finline-limit=8000 \
$(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
-nostdinc
TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
TEMPLATE_VBOXR0DRV_LDFLAGS = -d --warn-common
TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386_fbsd
TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64_fbsd
TOOL_FREEBSDKMODLD = FreeBSD kernel module linker.
# See kBuild/tools/GCC3.kmk for docs.
TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPORD =
ifeq ($(KBUILD_TARGET_ARCH),amd64)
TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT =
define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
# Link intermediate .kld (a relocatable object).
ld $(flags) -r -o $(out) $(objs) \
$(foreach p,$(libpath), -L$(p))\
$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
# Strip non-exported symbols private and localize the exported ones.
awk -f $(VBOX_FREEBSD_SRC)/conf/kmod_syms.awk $(out) $(if $(othersrc), $(othersrc),/dev/null) \
| xargs -J% objcopy % $(out)
## Strip debug info (comment out if debugging or something).
objcopy --strip-debug $(out)
endef
else # x86
TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT = $(outbase).kld
define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
# Link intermediate .kld (a relocatable object).
ld $(flags) -r -o $(outbase).kld $(objs) \
$(foreach p,$(libpath), -L$(p))\
$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
# Strip non-exported symbols private and localize the exported ones.
awk -f $(VBOX_FREEBSD_SRC)/conf/kmod_syms.awk $(outbase).kld $(if $(othersrc), $(othersrc),/dev/null) \
| xargs -J% objcopy % $(outbase).kld
# Link the final .ko (a shared object).
ld $(flags) -Bshareable -o $(out) $(outbase).kld
endef
endif # x86
endif # FreeBSD
ifeq ($(KBUILD_TARGET),haiku)
## The Haiku include directories
VBOX_HAIKU_SYS_INCS ?= /boot/develop/headers/os/kernel /boot/develop/headers/os/drivers
TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBOXR0DRV_LDTOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBOXR0DRV_DEFS = _KERNEL_MODE=1 _STRICT_STDC IN_RING0 IN_RT_R0
TEMPLATE_VBOXR0DRV_INCS = $(VBOX_HAIKU_SYS_INCS)
#TODO: sort this out
TEMPLATE_VBOXR0DRV_LDFLAGS = -shared -no-undefined -dc -dy -lroot -rpath-link /boot/system/develop/lib/x86 --no-add-needed /boot/system/develop/lib/_KERNEL_ --no-add-needed /boot/system/develop/lib/haiku_version_glue.o
TEMPLATE_VBOXR0DRV_CFLAGS = -fno-PIC \
$(VBOX_GCC_WARN) -Wstrict-prototypes $(VBOX_GCC_Wno-pointer-sign) -Wno-sign-compare \
$(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
-fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
-Wno-sign-compare -Wdeclaration-after-statement
TEMPLATE_VBOXR0DRV_CXXFLAGS = -fno-PIC -Wpointer-arith \
-Wshadow -Wuninitialized -Wunused-function -Wunused-label -Wunused-value -Wunused-variable \
-Wformat \
-O2 -nodefaultlibs -fno-omit-frame-pointer -fno-strict-aliasing -fno-common -fno-exceptions -fno-rtti
TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86) -fno-exceptions -fno-rtti
TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = $(TEMPLATE_VBOXR0DRV_CFLAGS.amd64) -fno-exceptions -fno-rtti
endif # Haiku
ifdef VBOX_WITH_VBOXDRV
ifndef TEMPLATE_VBOXR0DRV_TOOL
$(warning Warning: VBox Build: Target $(KBUILD_HOST) is not officially supported!)
endif
endif
ifn1of ($(KBUILD_TARGET), darwin os2 win solaris)
# This doesn't work if supdrv is natively loading VMMR0.r0 et al, but
# fortunately it isn't really necessary.
TEMPLATE_VBOXR0DRV_CFLAGS += -include $(PATH_ROOT)/include/VBox/SUPDrvMangling.h
TEMPLATE_VBOXR0DRV_CXXFLAGS += -include $(PATH_ROOT)/include/VBox/SUPDrvMangling.h
endif
#
# Template for building libraries used by ring-0 drivers.
#
TEMPLATE_VBoxR0DrvLib = VBox Ring 0 Driver Library
TEMPLATE_VBoxR0DrvLib_EXTENDS = VBOXR0DRV
TEMPLATE_VBoxR0DrvLib_INSTTYPE = stage
#
# Template for building R3 executables and static libraries which are linked into executables.
# Note! This is the base template for a whole lot of other ones, so be careful when changing it.
#
TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
TEMPLATE_VBOXR3EXE_ASFLAGS.x86 = $(VBOX_ASFLAGS32)
TEMPLATE_VBOXR3EXE_ASFLAGS.amd64 = $(VBOX_ASFLAGS64)
TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
TEMPLATE_VBOXR3EXE_DEFS.win = _CRT_SECURE_NO_DEPRECATE
TEMPLATE_VBOXR3EXE_USES = dtrace
if defined(VBOX_WITH_DTRACE_R3) && defined(VBOX_WITH_NATIVE_DTRACE)
TEMPLATE_VBOXR3EXE_DTRACETOOL = DTraceAndVBoxTpG
TEMPLATE_VBOXR3EXE_DTRACE_OBJ_FLAGS = -C
TEMPLATE_VBOXR3EXE_DTRACE_HDR_FLAGS = -C
TEMPLATE_VBOXR3EXE_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R3 VBOX_WITH_NATIVE_DTRACE
else
TEMPLATE_VBOXR3EXE_DTRACE_HDR_FLAGS = --ring-3-context
TEMPLATE_VBOXR3EXE_DTRACE_OBJ_FLAGS = --ring-3-context --pic --probe-fn-imported --probe-fn-name "SUPTracerFireProbe"
if defined(VBOX_WITH_DTRACE_R3)
TEMPLATE_VBOXR3EXE_DTRACETOOL = VBoxTpG
TEMPLATE_VBOXR3EXE_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R3
else
TEMPLATE_VBOXR3EXE_DTRACETOOL = VBoxTpG-Disabled
endif
endif
TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
ifeq ($(KBUILD_TARGET),win)
# TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
TEMPLATE_VBOXR3EXE_TOOL.win.x86 = $(VBOX_VCC_TOOL_STEM)X86
TEMPLATE_VBOXR3EXE_TOOL.win.amd64 = $(VBOX_VCC_TOOL_STEM)AMD64
TEMPLATE_VBOXR3EXE_RCDEFS = \
VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
VBOX_SVN_REV=\"$(VBOX_SVN_REV)\" \
VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD) \
VBOX_SVN_REV_NR=$(VBOX_SVN_REV)
TEMPLATE_VBOXR3EXE_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK)
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)
TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
TEMPLATE_VBOXR3EXE_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE)
TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
TEMPLATE_VBOXR3EXE_LDFLAGS = -Ignore:4197 \
/NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug \
/Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
/STUB:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com \
/DISALLOWLIB:libc.lib \
/DISALLOWLIB:libcd.lib \
/DISALLOWLIB:libcmt.lib \
/DISALLOWLIB:libcmtd.lib \
/DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE_N).lib \
/DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE_N).lib
ifdef VBOX_WITH_DTRACE_R3
TEMPLATE_VBOXR3EXE_LDFLAGS += -Merge:VTGPrLc.Data=VTGPrLc.Begin -Merge:VTGPrLc.End=VTGPrLc.Begin -Merge:VTGPrLc.Begin=VTGObj
endif
if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_HARDENING)
TEMPLATE_VBOXR3EXE_LDFLAGS += -IntegrityCheck
endif
$(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.x86)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.x86)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.x86)_LIB)/oldnames.lib
$(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.amd64)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.amd64)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.amd64)_LIB)/oldnames.lib
TEMPLATE_VBOXR3EXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
else # the gcc guys
TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_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)
TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
TEMPLATE_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)
TEMPLATE_VBOXR3EXE_OBJCFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS)
TEMPLATE_VBOXR3EXE_OBJCXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
TEMPLATE_VBOXR3EXE_LDFLAGS.linux = -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed)
TEMPLATE_VBOXR3EXE_LDFLAGS.solaris = -Wl,-z,ignore # same as VBOX_LD_as_needed
ifeq ($(KBUILD_TARGET),linux)
TEMPLATE_VBOXR3EXE_LIBS = pthread m rt dl
else ifeq ($(KBUILD_TARGET),os2)
TEMPLATE_VBOXR3EXE_TOOL = GXX3OMF
TEMPLATE_VBOXR3EXE_LIBS = socket iconv
else ifeq ($(KBUILD_TARGET),darwin)
TEMPLATE_VBOXR3EXE_TOOL = GXX4MACHO
TEMPLATE_VBOXR3EXE_LIBS =
TEMPLATE_VBOXR3EXE_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_DEFS)
TEMPLATE_VBOXR3EXE_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -fno-common
TEMPLATE_VBOXR3EXE_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
TEMPLATE_VBOXR3EXE_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS)
TEMPLATE_VBOXR3EXE_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
TEMPLATE_VBOXR3EXE_LDFLAGS.darwin.x86 = -read_only_relocs suppress
ifdef VBOX_WITH_DTRACE_R3
TEMPLATE_VBOXR3EXE_CXXFLAGS := $(filter-out -pedantic,$(TEMPLATE_VBOXR3EXE_CXXFLAGS)) -fdollars-in-identifiers # annoying gcc option precedence.
endif
else ifeq ($(KBUILD_TARGET),haiku)
TEMPLATE_VBOXR3EXE_TOOL = GXX3
TEMPLATE_VBOXR3EXE_POST_CMDS = $(VBOX_HAIKU_XRES_SETVER_CMDS)
TEMPLATE_VBOXR3EXE_LIBS = network iconv stdc++ supc++
TEMPLATE_VBOXR3EXE_LIBPATH += \
# Haiku uses PIC by default...
TEMPLATE_VBOXR3EXE_CFLAGS += -fno-pic
TEMPLATE_VBOXR3EXE_CXXFLAGS += -fno-pic
TEMPLATE_VBOXR3EXE_LDFLAGS += -fno-pic
else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd)
TEMPLATE_VBOXR3EXE_TOOL = GXX3
TEMPLATE_VBOXR3EXE_LIBS = pthread
TEMPLATE_VBOXR3EXE_INCS += \
TEMPLATE_VBOXR3EXE_LIBPATH += \
/usr/lib \
else ifeq ($(KBUILD_TARGET),solaris)
TEMPLATE_VBOXR3EXE_TOOL = GXX3PLAIN
TEMPLATE_VBOXR3EXE_DEFS += LIBICONV_PLUG _REENTRANT # Avoid the GNU libiconv, for now at least.
TEMPLATE_VBOXR3EXE_LIBS = rt socket
else
$(warning Warning: VBOX Build: Target $(KBUILD_TARGET) is not officially supported!)
endif
ifdef VBOX_WITH_RUNPATH
TEMPLATE_VBOXR3EXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
else ifdef VBOX_WITH_RELATIVE_RUNPATH
TEMPLATE_VBOXR3EXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
endif
ifdef VBOX_WITH_ORIGIN
TEMPLATE_VBOXR3EXE_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT)
endif
endif
#
# Template for building R3 shared objects / DLLs.
# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
# -
TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
-current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
-compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
ifn1of ($(KBUILD_TARGET), darwin win os2)
TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
endif
ifeq ($(KBUILD_TARGET),haiku)
# Haiku uses PIC by default...
TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fno-pic
TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fno-pic
TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fno-pic
endif
#
# Temporary: Renaming the template and warnings will be errors (soon).
#
TEMPLATE_VBoxR3Dll += VBox ring-3 SO/DLLs, no warnings
TEMPLATE_VBoxR3Dll_EXTENDS += VBOXR3
TEMPLATE_VBoxR3Dll_EXTENDS_BY += appending
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBoxR3Dll_CFLAGS += $(VBOX_VCC_WERR)
TEMPLATE_VBoxR3Dll_CXXFLAGS += $(VBOX_VCC_WERR)
TEMPLATE_VBoxR3Dll_LDFLAGS += $(VBOX_VCC_LD_WERR)
else
TEMPLATE_VBoxR3Dll_CFLAGS += $(VBOX_GCC_WERR)
TEMPLATE_VBoxR3Dll_CXXFLAGS += $(VBOX_GCC_WERR)
endif
# x86 edition of the above template for use on AMD64 targets.
TEMPLATE_VBoxR3Dll-x86 = 32-bit VBox ring-3 SO/DLLs, no warnings
TEMPLATE_VBoxR3Dll-x86_EXTENDS = VBoxR3Dll
TEMPLATE_VBoxR3Dll-x86_BLD_TRG_ARCH = x86
TEMPLATE_VBoxR3Dll-x86_DEFS = $(filter-out HC_ARCH_BITS%,$(TEMPLATE_VBoxR3Dll_DEFS)) \
HC_ARCH_BITS=32 ARCH_BITS=32
#
# Template for building performance critical stuff with warnings-as-errors.
#
TEMPLATE_VBoxR3DllNoPic = VBox ring-3 SO/DLLs without PIC, without warnings.
TEMPLATE_VBoxR3DllNoPic_EXTENDS = VBOXR3
if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), linux.x86 freebsd.x86)
TEMPLATE_VBoxR3DllNoPic_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS)
TEMPLATE_VBoxR3DllNoPic_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) $(VBOX_GCC_WERR)
TEMPLATE_VBoxR3DllNoPic_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) $(VBOX_GCC_WERR)
TEMPLATE_VBoxR3DllNoPic_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS)
else ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBoxR3DllNoPic_CFLAGS = $(TEMPLATE_VBOXR3_CFLAGS) $(VBOX_VCC_WERR)
TEMPLATE_VBoxR3DllNoPic_CFLAGS.debug = $(filter-out -RTC%,$(TEMPLATE_VBOXR3_CFLAGS.debug))
TEMPLATE_VBoxR3DllNoPic_CXXFLAGS = $(TEMPLATE_VBOXR3_CXXFLAGS) $(VBOX_VCC_WERR)
TEMPLATE_VBoxR3DllNoPic_CXXFLAGS.debug = $(filter-out -RTC%,$(TEMPLATE_VBOXR3_CXXFLAGS.debug)) # RTCsu Prevents IEM opt.
TEMPLATE_VBoxR3DllNoPic_LDFLAGS = $(TEMPLATE_VBOXR3_LDFLAGS) $(VBOX_VCC_LD_WERR)
else
TEMPLATE_VBoxR3DllNoPic_CFLAGS = $(TEMPLATE_VBOXR3_CFLAGS) $(VBOX_GCC_WERR)
TEMPLATE_VBoxR3DllNoPic_CXXFLAGS = $(TEMPLATE_VBOXR3_CXXFLAGS) $(VBOX_GCC_WERR)
endif
# x86 edition of the above template for use on AMD64 targets.
TEMPLATE_VBoxR3DllNoPic-x86 = 32-bit VBox ring-3 SO/DLLs without PIC, without warnings.
TEMPLATE_VBoxR3DllNoPic-x86_EXTENDS = VBoxR3DllNoPic
TEMPLATE_VBoxR3DllNoPic-x86_BLD_TRG_ARCH = x86
TEMPLATE_VBoxR3DllNoPic-x86_DEFS = $(filter-out HC_ARCH_BITS%,$(TEMPLATE_VBoxR3DllNoPic_DEFS)) \
HC_ARCH_BITS=32 ARCH_BITS=32
#
# Template for building performance critical stuff without warnings-as-errors.
#
TEMPLATE_VBoxR3DllWarnNoPic = VBox ring-3 SO/DLLs without PIC, with warnings.
TEMPLATE_VBoxR3DllWarnNoPic_EXTENDS = VBOXR3
if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), linux.x86 freebsd.x86)
TEMPLATE_VBoxR3DllWarnNoPic_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS)
TEMPLATE_VBoxR3DllWarnNoPic_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS)
TEMPLATE_VBoxR3DllWarnNoPic_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
TEMPLATE_VBoxR3DllWarnNoPic_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS)
else ifeq ($(KBUILD_TARGET),win)
endif
#
# Template for building static R3 executables and any static
# libraries they link with.
#
TEMPLATE_VBOXR3STATIC = VBox Static Ring 3 EXE
TEMPLATE_VBOXR3STATIC_EXTENDS = VBOXR3EXE
TEMPLATE_VBOXR3STATIC_DEFS = IN_RT_STATIC IN_RT_R3 IN_SUP_STATIC $(TEMPLATE_VBOXR3EXE_DEFS)
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBOXR3STATIC_CFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
TEMPLATE_VBOXR3STATIC_CXXFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
TEMPLATE_VBOXR3STATIC_LDFLAGS = $(filter-out /DISALLOWLIB:libcmt$(VBOX_VCC_CRT_TYPE).lib /DISALLOWLIB:libcpmt$(VBOX_VCC_CRT_TYPE).lib, $(TEMPLATE_VBOXR3EXE_LDFLAGS)) \
/DISALLOWLIB:msvcrt.lib \
/DISALLOWLIB:msvcrtd.lib \
/DISALLOWLIB:msvcprt.lib \
/DISALLOWLIB:msvcprtd.lib
$(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.x86)_LIB)/oldnames.lib \
$(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
$(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/oldnames.lib
else ifn1of ($(KBUILD_TARGET), darwin linux solaris)
# The gcc guys sans darwin, linux and solaris (don't depend on statically compiled system libs there)
TEMPLATE_VBOXR3STATIC_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -static
TEMPLATE_VBOXR3STATIC_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -static
TEMPLATE_VBOXR3STATIC_OBJCFLAGS = $(TEMPLATE_VBOXR3EXE_OBJCFLAGS) -static
TEMPLATE_VBOXR3STATIC_OBJCXXFLAGS = $(TEMPLATE_VBOXR3EXE_OBJCXXFLAGS) -static
TEMPLATE_VBOXR3STATIC_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -static
else ifeq ($(KBUILD_TARGET),solaris)
TEMPLATE_VBOXR3STATIC_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS) nsl
TEMPLATE_VBOXR3STATIC_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)',$(TEMPLATE_VBOXR3EXE_LDFLAGS))
else
TEMPLATE_VBOXR3STATIC_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)',$(TEMPLATE_VBOXR3EXE_LDFLAGS))
endif
#
# Temporary: Renaming the template and warnings will be errors (soon).
# Unlike VBOXR3STATIC, this is strict wrt warnings and includes IPRT.
#
TEMPLATE_VBoxR3Static = New name for VBOXR3STATIC
TEMPLATE_VBoxR3Static_EXTENDS = VBOXR3STATIC
TEMPLATE_VBoxR3Static_EXTENDS_BY = appending
TEMPLATE_VBoxR3Static_SDKS += VBOX_OPENSSL
TEMPLATE_VBoxR3Static_SDKS.win += VBOX_NTDLL
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBoxR3Static_CFLAGS += $(VBOX_VCC_WERR)
TEMPLATE_VBoxR3Static_CXXFLAGS += $(VBOX_VCC_WERR)
TEMPLATE_VBoxR3Static_LDFLAGS += $(VBOX_VCC_LD_WERR)
else
TEMPLATE_VBoxR3Static_CFLAGS += $(VBOX_GCC_WERR)
TEMPLATE_VBoxR3Static_CXXFLAGS += $(VBOX_GCC_WERR)
endif
TEMPLATE_VBoxR3Static_LIBS += \
$(VBOX_LIB_RUNTIME_STATIC)
ifndef SDK_VBOX_OPENSSL_LIBS
TEMPLATE_VBoxR3Static_LIBS += \
$(PATH_STAGE_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB) \
$(PATH_STAGE_LIB)/VBox-libssl$(VBOX_SUFF_LIB)
endif
ifndef SDK_VBOX_LIBXML2_LIBS
TEMPLATE_VBoxR3Static_LIBS += \
$(PATH_STAGE_LIB)/VBox-libxml2-static$(VBOX_SUFF_LIB)
endif
if1of ($(KBUILD_TARGET),os2 win)
TEMPLATE_VBoxR3Static_LIBS += \
$(PATH_STAGE_LIB)/VBox-liblzf-static$(VBOX_SUFF_LIB) \
$(PATH_STAGE_LIB)/VBox-zlib-static$(VBOX_SUFF_LIB)
else
TEMPLATE_VBoxR3Static_LIBS += \
$(PATH_STAGE_LIB)/VBox-liblzf$(VBOX_SUFF_LIB) \
$(SDK_VBOX_ZLIB_LIBS)
ifeq ($(KBUILD_TARGET),linux)
TEMPLATE_VBoxR3Static_LIBS += crypt
else if1of ($(KBUILD_TARGET),darwin freebsd)
TEMPLATE_VBoxR3Static_LIBS += iconv
else ifeq ($(KBUILD_TARGET),solaris)
TEMPLATE_VBoxR3Static_LIBS += kstat
endif
endif
#
# Same as VBOXR3EXE but without C++ exceptions.
#
# VBOXR3EXE does C++ exceptions and may assumes that extern "C" functions
# doesn't throw them. Use this template (and VBOXR3DLLNOXCPT) with care
# and only where the C++ overhead is really unwanted.
#
TEMPLATE_VBOXR3EXENOXCPT = VBox Ring 3 Exe without C++ exception
TEMPLATE_VBOXR3EXENOXCPT_EXTENDS = VBOXR3EXE
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBOXR3EXENOXCPT_CFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3EXE_CFLAGS) ) -EHs-
TEMPLATE_VBOXR3EXENOXCPT_CXXFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3EXE_CXXFLAGS)) -EHs-
else
TEMPLATE_VBOXR3EXENOXCPT_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fno-exceptions
endif
#
# Same as VBOXR3 but without C++ exceptions.
#
TEMPLATE_VBOXR3DLLNOXCPT = VBox Ring 3 SO/DLLs without C++ exception
TEMPLATE_VBOXR3DLLNOXCPT_EXTENDS = VBOXR3
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBOXR3DLLNOXCPT_CFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3_CFLAGS) ) -EHs-
TEMPLATE_VBOXR3DLLNOXCPT_CXXFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3_CXXFLAGS)) -EHs-
else
TEMPLATE_VBOXR3DLLNOXCPT_CXXFLAGS = $(TEMPLATE_VBOXR3_CXXFLAGS) -fno-exceptions
endif
#
# Template for building hardened Ring-3 executables.
# These shall have no extra runpaths, esp. not origin ones.
#
TEMPLATE_VBOXR3HARDENEDEXE = Hardened VBox Ring-3 EXE
TEMPLATE_VBOXR3HARDENEDEXE_EXTENDS = VBOXR3EXE
TEMPLATE_VBOXR3HARDENEDEXE_DEBUG_INST.win = $(INST_DEBUG)hardened-exes/
ifdef VBOX_WITH_HARDENING
TEMPLATE_VBOXR3HARDENEDEXE_LIBS = $(VBOX_LIB_SUPHARDENED) $(TEMPLATE_VBOXR3EXE_LIBS)
else
TEMPLATE_VBOXR3HARDENEDEXE_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS)
endif
TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.darwin = $(TEMPLATE_VBOXR3EXE_LDFLAGS.darwin) -framework IOKit
ifeq ($(KBUILD_TARGET),linux)
# not necessary except USE_LIB_PCAP is defined in SUPR3HardenedMain.cpp
# TEMPLATE_VBOXR3HARDENEDEXE_LIBS += cap
endif
ifeq ($(KBUILD_TARGET),win) # No CRT!
TEMPLATE_VBOXR3HARDENEDEXE_SDKS = VBOX_NTDLL $(TEMPLATE_VBOXR3EXE_SDKS)
$(PATH_TOOL_$(TEMPLATE_VBOXR3HARDENEDEXE_TOOL.win.x86)_LIB)/chkstk.obj
TEMPLATE_VBOXR3HARDENEDEXE_CXXFLAGS = $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_CXXFLAGS)) -GS-
TEMPLATE_VBOXR3HARDENEDEXE_CXXFLAGS.debug= $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)) -GS- -O2 -Oy-
TEMPLATE_VBOXR3HARDENEDEXE_CFLAGS = $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_CFLAGS)) -GS-
TEMPLATE_VBOXR3HARDENEDEXE_CFLAGS.debug = $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_CFLAGS.debug)) -GS- -O2 -Oy-
TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) \
/DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE).lib \
/DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE).lib
TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.win.x86 = $(TEMPLATE_VBOXR3EXE_LDFLAGS.win.x86) /entry:suplibHardenedWindowsMain
TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.win.amd64 = $(TEMPLATE_VBOXR3EXE_LDFLAGS.win.amd64) /entry:suplibHardenedWindowsMain
TEMPLATE_VBOXR3HARDENEDEXE_LIBS.x86 = $(NOT_SUCH_VARIABLE)
TEMPLATE_VBOXR3HARDENEDEXE_LIBS.amd64 = $(NOT_SUCH_VARIABLE)
else ifn1of ($(KBUILD_TARGET), os2)
TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%,$(TEMPLATE_VBOXR3EXE_LDFLAGS))
TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBOXR3EXE_LDFLAGS.linux))
endif
#
# Template for building hardened Ring-3 libraries.
#
TEMPLATE_VBOXR3HARDENEDLIB = Hardened VBox Ring-3 LIB
TEMPLATE_VBOXR3HARDENEDLIB_EXTENDS = VBOXR3HARDENEDEXE
TEMPLATE_VBOXR3HARDENEDLIB_LIBS = $(NO_SUCH_VARIABLE)
#
# Template for building hardened Ring-3 executables.
# These shall have no extra runpaths, esp. not origin ones.
#
TEMPLATE_VBoxR3HardenedTstExe = VBox Ring-3 Hardened Testcase Exe (currently windows only!)
TEMPLATE_VBoxR3HardenedTstExe_EXTENDS = VBOXR3HARDENEDEXE
TEMPLATE_VBoxR3HardenedTstExe_INST = $(INST_TESTCASE)
#
# Template for building set-uid-to-root helper programs.
# In hardened builds, these may only contain absolute runpaths!
#
TEMPLATE_VBoxR3SetUidToRoot = Set-uid-to-root helper program.
if1of ($(KBUILD_TARGET),win)
TEMPLATE_VBoxR3SetUidToRoot_EXTENDS = VBOXR3EXE
else
TEMPLATE_VBoxR3SetUidToRoot_EXTENDS = VBOXR3HARDENEDEXE
endif
TEMPLATE_VBoxR3SetUidToRoot_LIBS = $(NO_SUCH_VARIABLE)
ifdef VBOX_WITH_RUNPATH
TEMPLATE_VBoxR3SetUidToRoot_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
endif
ifndef VBOX_WITH_HARDENING
ifdef VBOX_WITH_RELATIVE_RUNPATH
TEMPLATE_VBoxR3SetUidToRoot_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
endif
ifdef VBOX_WITH_ORIGIN
TEMPLATE_VBoxR3SetUidToRoot_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT)
endif
endif
#
# Template for building R3 tools.
#
TEMPLATE_VBoxR3Tool = VBox Ring 3 Tools
TEMPLATE_VBoxR3Tool_EXTENDS = VBOXR3EXE
TEMPLATE_VBoxR3Tool_INST = $(VBOX_INST_TOOLS)
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBoxR3Tool_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) $(VBOX_VCC_WERR)
TEMPLATE_VBoxR3Tool_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) $(VBOX_VCC_WERR)
TEMPLATE_VBoxR3Tool_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) $(VBOX_VCC_LD_WERR)
else
TEMPLATE_VBoxR3Tool_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) $(VBOX_GCC_WERR)
TEMPLATE_VBoxR3Tool_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) $(VBOX_GCC_WERR)
ifdef VBOX_WITH_RUNPATH
TEMPLATE_VBoxR3Tool_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' $(TEMPLATE_VBOXR3EXE_LDFLAGS)
else ifdef VBOX_WITH_RELATIVE_RUNPATH
TEMPLATE_VBoxR3Tool_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..' $(TEMPLATE_VBOXR3EXE_LDFLAGS)
endif
endif
TEMPLATE_VBoxR3Tool_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
#
# Template for building R3 shared objects / DLLs with the 10.5 Mac OS X SDK.
# Identical to VBOXR3EXE, except for the DYLIB, the classic_linker and SDK bits.
#
TEMPLATE_VBOXR3OSX105 = VBox Ring 3 SO/DLLs for OS X 10.5
TEMPLATE_VBOXR3OSX105_EXTENDS = VBOXR3EXE
TEMPLATE_VBOXR3OSX105_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_DEFS) PIC
TEMPLATE_VBOXR3OSX105_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CFLAGS) -fno-common
TEMPLATE_VBOXR3OSX105_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS)
TEMPLATE_VBOXR3OSX105_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS)
TEMPLATE_VBOXR3OSX105_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS)
TEMPLATE_VBOXR3OSX105_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS) \
-read_only_relocs suppress \
-current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
-compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
#
# Template for building R3 shared objects / DLLs with the 10.7 Mac OS X SDK.
# Identical to VBoxR3Dll, except for the DYLIB, the classic_linker and SDK bits.
#
TEMPLATE_VBoxR3DllOsX107 = VBox Ring 3 SO/DLLs for OS X 10.7
TEMPLATE_VBoxR3DllOsX107_EXTENDS = VBoxR3Dll
TEMPLATE_VBoxR3DllOsX107_TOOL = LLVMGXX42MACHO
TEMPLATE_VBoxR3DllOsX107_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_DEFS) PIC
TEMPLATE_VBoxR3DllOsX107_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_CFLAGS) -fno-common
TEMPLATE_VBoxR3DllOsX107_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_CXXFLAGS)
TEMPLATE_VBoxR3DllOsX107_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_OBJCFLAGS)
TEMPLATE_VBoxR3DllOsX107_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_OBJCFLAGS)
TEMPLATE_VBoxR3DllOsX107_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_LDFLAGS) \
-current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
-compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
#
# Ring-3 testcase, running automatically during the build.
# This is the VBOXR3EXE template only with a different install dir.
#
TEMPLATE_VBOXR3AUTOTST = VBox Ring 3 Testcase Exe
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBOXR3AUTOTST_EXTENDS = VBoxR3Static
TEMPLATE_VBOXR3AUTOTST_LIBS = $(NO_SUCH_VARIABLE)
else
TEMPLATE_VBOXR3AUTOTST_EXTENDS = VBOXR3EXE
endif
TEMPLATE_VBOXR3AUTOTST_INST = $(INST_TESTCASE)
if "$(KBUILD_TARGET)" == "win" && defined(VBOX_SIGNING_MODE)
TEMPLATE_VBOXR3AUTOTST_POST_CMDS = $(NO_SUCH_VARIABLE)
TEMPLATE_VBOXR3AUTOTST_LDFLAGS = $(filter-out -IntegrityCheck, $(TEMPLATE_VBoxR3Static_LDFLAGS))
endif
#
# Ring-3 testcase.
# This is the VBOXR3EXE template only with a different install dir.
#
TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
ifdef VBOX_WITH_RUNPATH
TEMPLATE_VBOXR3TSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' $(TEMPLATE_VBOXR3EXE_LDFLAGS)
else ifdef VBOX_WITH_RELATIVE_RUNPATH
TEMPLATE_VBOXR3TSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..' $(TEMPLATE_VBOXR3EXE_LDFLAGS)
endif
if "$(KBUILD_TARGET)" == "win" && defined(VBOX_SIGNING_MODE)
TEMPLATE_VBOXR3TSTEXE_POST_CMDS =
TEMPLATE_VBOXR3TSTEXE_LDFLAGS = $(filter-out -IntegrityCheck, $(TEMPLATE_VBOXR3EXE_LDFLAGS))
endif
#
# Ring-3 testcase (no -pedantic)
#
TEMPLATE_VBOXR3TSTNPEXE = VBox Ring 3 Testcase Exe Non-pedantic
TEMPLATE_VBOXR3TSTNPEXE_EXTENDS = VBOXR3TSTEXE
ifneq ($(KBUILD_TARGET),win) # (only gcc)
TEMPLATE_VBOXR3TSTNPEXE_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBOXR3TSTNPEXE_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3TSTEXE_CXXFLAGS)) -Wno-sign-compare
TEMPLATE_VBOXR3TSTNPEXE_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3TSTEXE_CFLAGS)) -Wno-sign-compare
endif
#
# Ring-3 testcase DLL.
#
TEMPLATE_VBoxR3TstDll = VBox Ring-3 Testcase Dll
TEMPLATE_VBoxR3TstDll_EXTENDS = VBOXR3TSTEXE
ifn1of ($(KBUILD_TARGET), darwin win os2)
TEMPLATE_VBoxR3TstDll_DEFS = $(TEMPLATE_VBOXR3TSTEXE_DEFS) PIC
TEMPLATE_VBoxR3TstDll_CFLAGS = $(TEMPLATE_VBOXR3TSTEXE_CFLAGS) -fPIC
TEMPLATE_VBoxR3TstDll_CXXFLAGS = $(TEMPLATE_VBOXR3TSTEXE_CXXFLAGS) -fPIC
TEMPLATE_VBoxR3TstDll_LDFLAGS = $(TEMPLATE_VBOXR3TSTEXE_LDFLAGS) -fPIC
endif
#
# Template for the CppUnit kind of testcases.
#
TEMPLATE_VBOXCPPUNITEXE = VBox CppUnit Testcase Exe
TEMPLATE_VBOXCPPUNITEXE_EXTENDS = VBOXR3TSTEXE
## @todo make a CPPUNIT SDK and add cppunit tools packages for windows, mac, solaris and OS/2.
#TEMPLATE_VBOXCPPUNITEXE_SDKS = CPPUNIT -
TEMPLATE_VBOXCPPUNITEXE_LIBS = \
$(TEMPLATE_VBOXR3TSTEXE_LIBS) \
cppunit
#
# Template for building bad C/C++ style R3 executables (no -pedantic).
#
TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
ifneq ($(KBUILD_TARGET),win) # (only gcc)
TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3EXE_CXXFLAGS)) -Wno-sign-compare
TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3EXE_CFLAGS)) \
-Wno-sign-compare -Werror-implicit-function-declaration
endif
#
# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
# (Same transformation as for VBOXR3NPEXE.)
#
# @deprecated Use VBoxR3DllNonPedantic!
#
TEMPLATE_VBOXR3NP = VBox Ring 3 Non-pedantic
TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3
ifneq ($(KBUILD_TARGET),win) # (only gcc)
TEMPLATE_VBOXR3NP_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBOXR3NP_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3_CXXFLAGS)) -Wno-sign-compare
TEMPLATE_VBOXR3NP_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3_CFLAGS)) \
-Wno-sign-compare -Werror-implicit-function-declaration
TEMPLATE_VBOXR3NP_OBJCFLAGS = $(filter-out -pedantic -Wstrict-prototypes,$(TEMPLATE_VBOXR3_OBJCFLAGS))
TEMPLATE_VBOXR3NP_OBJCXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBOXR3_OBJCXXFLAGS))
endif
#
# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
# (Same transformation as for VBoxR3ExeNonPedantic.)
#
TEMPLATE_VBoxR3DllNonPedantic = VBox ring-3 Non-pedantic, with warnings.
TEMPLATE_VBoxR3DllNonPedantic_EXTENDS = VBOXR3
ifneq ($(KBUILD_TARGET),win) # (only gcc)
TEMPLATE_VBoxR3DllNonPedantic_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBoxR3DllNonPedantic_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3_CXXFLAGS)) -Wno-sign-compare
TEMPLATE_VBoxR3DllNonPedantic_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3_CFLAGS)) \
-Wno-sign-compare -Werror-implicit-function-declaration
endif
# x86 edition of the above template for use on AMD64 targets.
TEMPLATE_VBoxR3DllNonPedantic-x86 = 32-bit VBox ring-3 SO/DLLs, no warnings
TEMPLATE_VBoxR3DllNonPedantic-x86_EXTENDS = VBoxR3DllNonPedantic
TEMPLATE_VBoxR3DllNonPedantic-x86_BLD_TRG_ARCH = x86
TEMPLATE_VBoxR3DllNonPedantic-x86_DEFS = $(filter-out HC_ARCH_BITS%,$(TEMPLATE_VBoxR3Dll_DEFS)) \
HC_ARCH_BITS=32 ARCH_BITS=32
#
# Template for building libraries, shared libraries / modules
# which only depends on IPRT for crt.
#
TEMPLATE_VBoxNoCrtGccLib = VBox no-crt GCC libraries and modules, yasm/nasm.
TEMPLATE_VBoxNoCrtGccLib_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
TEMPLATE_VBoxNoCrtGccLib_ASDEFS = ASM_CALL64_GCC
TEMPLATE_VBoxNoCrtGccLib_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno $(VBOX_GCC_WARN) -Werror-implicit-function-declaration
TEMPLATE_VBoxNoCrtGccLib_CFLAGS.amd64 = -m64 -mcmodel=medium -fno-common
TEMPLATE_VBoxNoCrtGccLib_CFLAGS.release = -O2 -fno-strict-aliasing
TEMPLATE_VBoxNoCrtGccLib_CFLAGS.darwin = -static
TEMPLATE_VBoxNoCrtGccLib_CXXFLAGS = $(TEMPLATE_VBoxNoCrtGccLib_CFLAGS)
TEMPLATE_VBoxNoCrtGccLib_CXXFLAGS.$(KBUILD_TARGET) = $(TEMPLATE_VBoxNoCrtGccLib_CFLAGS.$(KBUILD_TARGET))
TEMPLATE_VBoxNoCrtGccLib_CXXFLAGS.$(KBUILD_TARGET_ARCH) = $(TEMPLATE_VBoxNoCrtGccLib_CFLAGS.$(KBUILD_TARGET_ARCH))
TEMPLATE_VBoxNoCrtGccLib_INCS = $(PATH_ROOT)/include/iprt/nocrt
ifeq (disabled-by-mingw-w64 $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
# cross compile to 64-bit ELF (linux).
TEMPLATE_VBoxNoCrtGccLib_TOOL = XGCCAMD64LINUX
TEMPLATE_VBoxNoCrtGccLib_ASTOOL = YASM
TEMPLATE_VBoxNoCrtGccLib_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
TEMPLATE_VBoxNoCrtGccLib_LIBS = $(KBUILD_DEVTOOLS)/win.x86/x86_64-unknown-linux-gnu/20060701-r2/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/libgcc.a
TEMPLATE_VBoxNoCrtGccLib_LDFLAGS = -nostdlib
# Use the default GCC (MinGW) with the Microsoft linker.
# (Drop all '-g' options as we're unable to strip the debug info.)
TEMPLATE_VBoxNoCrtGccLib_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBoxNoCrtGccLib_ASTOOL = $(VBOX_ASTOOL)
TEMPLATE_VBoxNoCrtGccLib_ASFLAGS = $(VBOX_ASFLAGS)
TEMPLATE_VBoxNoCrtGccLib_LDTOOL = $(VBOX_VCC_TOOL)
TEMPLATE_VBoxNoCrtGccLib_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD -Ignore:4197
TEMPLATE_VBoxNoCrtGccLib_LIBS = $(VBOX_GCC_LIBGCC)
TEMPLATE_VBoxNoCrtGccLib_CFLAGS := $(filter-out -g,$(TEMPLATE_VBoxNoCrtGccLib_CFLAGS)) -s
TEMPLATE_VBoxNoCrtGccLib_CXXFLAGS := $(filter-out -g,$(TEMPLATE_VBoxNoCrtGccLib_CXXFLAGS)) -s
else
# Use the default GCC.
# The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
TEMPLATE_VBoxNoCrtGccLib_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBoxNoCrtGccLib_ASTOOL = $(VBOX_ASTOOL)
TEMPLATE_VBoxNoCrtGccLib_ASFLAGS = $(VBOX_ASFLAGS)
TEMPLATE_VBoxNoCrtGccLib_CFLAGS += $(VBOX_GCC_fno-stack-protector)
TEMPLATE_VBoxNoCrtGccLib_CXXFLAGS += $(VBOX_GCC_fno-stack-protector)
ifeq ($(KBUILD_TARGET_ARCH),amd64)
# in 64-bit mode we'll build a sys-module (VBoxREM2).
if1of ($(KBUILD_TARGET), darwin solaris)
else
TEMPLATE_VBoxNoCrtGccLib_LDFLAGS = -nostdlib
endif
else # x86:
TEMPLATE_VBoxNoCrtGccLib_LDFLAGS = -nostdlib
ifn1of ($(KBUILD_TARGET), os2 darwin solaris)
TEMPLATE_VBoxNoCrtGccLib_LDFLAGS += -Wl,--no-undefined
endif
endif # x86
TEMPLATE_VBoxNoCrtGccLib_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
TEMPLATE_VBoxNoCrtGccLib_LIBS = # FIXME - has unwind mess.
endif
#
# Same as VBoxNoCrtGccLib only it uses GAS as the assembler instead of yasm/nasm.
#
TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBoxNoCrtGccLib
TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBoxNoCrtGccLib_TOOL)
ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
else
TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
endif
#
# Template for building executables that are part of the VBox Main component
# (COM/XPCOM interface to VirtualBox).
#
TEMPLATE_VBOXMAINEXE = VBox Main Executable
TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE NDEBUG=1
TEMPLATE_VBOXMAINEXE_DEFS.win = _UNICODE
TEMPLATE_VBOXMAINEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
TEMPLATE_VBOXMAINEXE_USES = dtrace
if defined(VBOX_WITH_DTRACE_R3_MAIN) && defined(VBOX_WITH_NATIVE_DTRACE)
TEMPLATE_VBOXMAINEXE_DTRACETOOL = DTraceAndVBoxTpG
TEMPLATE_VBOXMAINEXE_DTRACE_OBJ_FLAGS = -C
TEMPLATE_VBOXMAINEXE_DTRACE_HDR_FLAGS = -C
TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R3 VBOX_WITH_DTRACE_R3_MAIN VBOX_WITH_NATIVE_DTRACE
else
TEMPLATE_VBOXMAINEXE_DTRACE_HDR_FLAGS = --ring-3-context
TEMPLATE_VBOXMAINEXE_DTRACE_OBJ_FLAGS = --ring-3-context --pic --probe-fn-imported --probe-fn-name "SUPTracerFireProbe"
if defined(VBOX_WITH_DTRACE_R3_MAIN)
TEMPLATE_VBOXMAINEXE_DTRACETOOL = VBoxTpG
TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R3 VBOX_WITH_DTRACE_R3_MAIN
else
TEMPLATE_VBOXMAINEXE_DTRACETOOL = VBoxTpG-Disabled
endif
endif
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBOXMAINEXE_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK)
# Note: C4250 is the dominance warning, see r32789.
# C4065 is about default only switches.
# C4996 is about deprected function (CRT only?).
#TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
TEMPLATE_VBOXMAINEXE_TOOL.win.x86 = $(VBOX_VCC_TOOL_STEM)X86
TEMPLATE_VBOXMAINEXE_TOOL.win.amd64 = $(VBOX_VCC_TOOL_STEM)AMD64
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)
TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
TEMPLATE_VBOXMAINEXE_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE)
TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
TEMPLATE_VBOXMAINEXE_LDFLAGS = -Ignore:4197 \
/NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug \
/Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
/STUB:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com \
/DISALLOWLIB:libc.lib \
/DISALLOWLIB:libcd.lib \
/DISALLOWLIB:libcmt.lib \
/DISALLOWLIB:libcmtd.lib \
/DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE_N).lib \
/DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE_N).lib
if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_HARDENING)
TEMPLATE_VBOXMAINEXE_LDFLAGS += -IntegrityCheck
endif
ifdef VBOX_WITH_DTRACE_R3_MAIN
TEMPLATE_VBOXMAINEXE_LDFLAGS += -Merge:VTGPrLc.Data=VTGPrLc.Begin -Merge:VTGPrLc.End=VTGPrLc.Begin -Merge:VTGPrLc.Begin=VTGObj
endif
TEMPLATE_VBOXMAINEXE_LIBS = \
$(LIB_RUNTIME)
$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.x86)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.x86)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.x86)_LIB)/oldnames.lib \
$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.x86)_ATLMFC_LIB)/atls$(VBOX_VCC_CRT_TYPE).lib
$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.amd64)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.amd64)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.amd64)_LIB)/oldnames.lib \
$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.amd64)_ATLMFC_LIB)/atls$(VBOX_VCC_CRT_TYPE).lib
TEMPLATE_VBOXMAINEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
else # the GCC guys:
TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBOXMAINEXE_CXXFLAGS = -g $(VBOX_GCC_pipe) \
$(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) -Wno-long-long -Wno-non-virtual-dtor -Wshadow \
-fshort-wchar -fpermissive -fexceptions -frtti $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing \
$(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_std)
ifdef VBOX_WITH_DTRACE_R3_MAIN
TEMPLATE_VBOXMAINEXE_CXXFLAGS := $(filter-out -pedantic,$(TEMPLATE_VBOXMAINEXE_CXXFLAGS)) -fdollars-in-identifiers # annoying gcc option precedence.
endif
TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
TEMPLATE_VBOXMAINEXE_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)
TEMPLATE_VBOXMAINEXE_OBJCFLAGS = $(TEMPLATE_VBOXMAINEXE_CFLAGS)
TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
ifeq ($(KBUILD_TARGET),linux)
TEMPLATE_VBOXMAINEXE_LIBS = pthread m rt $(LIB_RUNTIME) dl
TEMPLATE_VBOXMAINEXE_LDFLAGS.linux = -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed)
else ifeq ($(KBUILD_TARGET),os2)
TEMPLATE_VBOXMAINEXE_TOOL = GXX3OMF
TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
else ifeq ($(KBUILD_TARGET),darwin)
TEMPLATE_VBOXMAINEXE_TOOL = GXX4MACHO
TEMPLATE_VBOXMAINEXE_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
TEMPLATE_VBOXMAINEXE_CFLAGS += $(VBOX_DARWIN_DEF_SDK_CFLAGS)
TEMPLATE_VBOXMAINEXE_CXXFLAGS += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
TEMPLATE_VBOXMAINEXE_OBJCFLAGS += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS += $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS)
TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin += -bind_at_load
TEMPLATE_VBOXMAINEXE_LDFLAGS += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -framework Carbon
TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
else ifeq ($(KBUILD_TARGET),haiku)
TEMPLATE_VBOXMAINEXE_TOOL = GXX3
TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) network stdc++ supc++
else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd)
TEMPLATE_VBOXMAINEXE_TOOL = GXX3
TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
TEMPLATE_VBOXMAINEXE_INCS += \
TEMPLATE_VBOXMAINEXE_LIBPATH += \
/usr/lib \
else ifeq ($(KBUILD_TARGET),solaris)
TEMPLATE_VBOXMAINEXE_TOOL = GXX3PLAIN
TEMPLATE_VBOXMAINEXE_DEFS += _REENTRANT
TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt thread
else
$(warning Warning: VBOX Build: Target $(KBUILD_TARGET) is not officially supported!)
TEMPLATE_VBOXMAINEXE_LIBS =
endif
TEMPLATE_VBOXMAINEXE_LDFLAGS.solaris = -Wl,-z,ignore # Same as VBOX_LD_as_needed.
ifdef VBOX_WITH_RUNPATH
TEMPLATE_VBOXMAINEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
else ifdef VBOX_WITH_RELATIVE_RUNPATH
TEMPLATE_VBOXMAINEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
endif
ifdef VBOX_WITH_ORIGIN
TEMPLATE_VBOXMAINEXE_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT)
endif
endif # !win
# Add COM/XPCOM stuff
TEMPLATE_VBOXMAINEXE_LIBS += \
$(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
ifdef VBOX_WITH_XPCOM
## @todo may be worth creating the VBOX_XPCOM SDK def
TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
endif
TEMPLATE_VBOXMAINEXE_INCS += \
$(VBOX_XPCOM_INCS)
TEMPLATE_VBOXMAINEXE_LIBS += \
$(LIB_XPCOM)
TEMPLATE_VBOXMAINEXE_INTERMEDIATES += \
$(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h
else # COM
TEMPLATE_VBOXMAINEXE_INCS += \
$(VBOX_PATH_SDK)/bindings/mscom/include
TEMPLATE_VBOXMAINEXE_INTERMEDIATES += \
$(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h
endif # COM
#
# Template for building the Main DLL modules (such as in-process COM/XPCOM
# components for Main).
#
# This differs from VBOXMAINEXE only in PIC handling and similar DLL stuff.
#
TEMPLATE_VBOXMAINDLL = VBox Main Component (shared library)
TEMPLATE_VBOXMAINDLL_EXTENDS = VBOXMAINEXE
ifn1of ($(KBUILD_TARGET), darwin haiku os2 win)
TEMPLATE_VBOXMAINDLL_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
TEMPLATE_VBOXMAINDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
TEMPLATE_VBOXMAINDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
TEMPLATE_VBOXMAINDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
endif
TEMPLATE_VBOXMAINDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin)) \
-current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
-compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
#
# Template identical to VBOXMAINDLL except for where the stuff is
# installed when using XPCOM (components/).
#
# Note! In the hardened build this gets a bit ugly since $ORIGIN/..
# doesn't work. So, we keep the $ORIGIN from VBOXMAINEXE and let
# the installers do the necessary .so symlinking.
#
# (No difference when building against COM on Windows.)
#
TEMPLATE_VBOXMAINCOMP = VBox Main COM/XPCOM Component (shared library)
TEMPLATE_VBOXMAINCOMP_EXTENDS = VBOXMAINEXE
ifn1of ($(KBUILD_TARGET), win)
TEMPLATE_VBOXMAINCOMP_INST = $(INST_BIN)components/
endif
ifneq ($(KBUILD_TARGET),win)
ifeq ($(filter-out solaris.x86 %.amd64 %.sparc32 %.sparc64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) ## TODO: cleanup!
TEMPLATE_VBOXMAINCOMP_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
TEMPLATE_VBOXMAINCOMP_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
TEMPLATE_VBOXMAINCOMP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
if defined(VBOX_WITH_RELATIVE_RUNPATH) && !defined(VBOX_WITH_HARDENING)
TEMPLATE_VBOXMAINCOMP_LDFLAGS = -fPIC $(filter-out '$(VBOX_GCC_RPATH_OPT)%',$(TEMPLATE_VBOXMAINEXE_LDFLAGS)) '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..'
else
TEMPLATE_VBOXMAINCOMP_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
endif
else ifndef VBOX_WITH_HARDENING
ifdef VBOX_WITH_RELATIVE_RUNPATH
TEMPLATE_VBOXMAINCOMP_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%',$(TEMPLATE_VBOXMAINEXE_LDFLAGS)) '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..'
endif
endif
endif
TEMPLATE_VBOXMAINCOMP_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin)) \
-current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
-compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
TEMPLATE_VBoxMainComp-x86 = 32-bit VBox Main Component (shared library)
TEMPLATE_VBoxMainComp-x86_EXTENDS = VBOXMAINCOMP
TEMPLATE_VBoxMainComp-x86_BLD_TRG_ARCH = x86
TEMPLATE_VBoxMainComp-x86_DEFS = $(filter-out HC_ARCH_BITS%,$(TEMPLATE_VBOXMAINCOMP_DEFS)) HC_ARCH_BIT=32 ARCH_BITS=32 \
VBOX_IN_32_ON_64_MAIN_API
TEMPLATE_VBoxMainComp-x86_LIBS = \
$(subst $(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB),$(PATH_STAGE_LIB)/VBoxCOM-x86$(VBOX_SUFF_LIB),\
$(subst $(LIB_RUNTIME),$(VBOX_LIB_RUNTIME_X86),\
$(subst $(LIB_XPCOM),$(VBOX_LIB_XPCOM_X86),\
$(TEMPLATE_VBOXMAINCOMP_LIBS))))
#
# Template for building the Main static libraries.
#
# This differs from VBOXMAINDLL only that it zeroes out the _LIBS definition.
#
TEMPLATE_VBoxMainLib = VBox Main Component (static library)
TEMPLATE_VBoxMainLib_EXTENDS = VBOXMAINDLL
TEMPLATE_VBoxMainLib_LIBS =
TEMPLATE_VBoxMainLib-x86 = 32-bit VBox Main Component (static library)
TEMPLATE_VBoxMainLib-x86_EXTENDS = VBoxMainLib
TEMPLATE_VBoxMainLib-x86_BLD_TRG_ARCH = x86
TEMPLATE_VBoxMainLib-x86_DEFS = $(filter-out HC_ARCH_BITS%,$(TEMPLATE_VBoxMainLib_DEFS)) HC_ARCH_BIT=32 ARCH_BITS=32 \
VBOX_IN_32_ON_64_MAIN_API
#
# Main unit testing, for compiling API implementation files into a testcase.
# This is the VBOXMAINEXE template only with a different install dir.
#
TEMPLATE_VBOXMAINTSTEXE = VBox Main Testcase Exe
TEMPLATE_VBOXMAINTSTEXE_EXTENDS = VBOXMAINEXE
TEMPLATE_VBOXMAINTSTEXE_INST = $(INST_TESTCASE)
ifdef VBOX_WITH_RUNPATH
TEMPLATE_VBOXMAINTSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
else ifdef VBOX_WITH_RELATIVE_RUNPATH
TEMPLATE_VBOXMAINTSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..' $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
endif
if "$(KBUILD_TARGET)" == "win" && defined(VBOX_SIGNING_MODE)
TEMPLATE_VBOXMAINTSTEXE_POST_CMDS =
endif
#
# Template for building executables that use the VBox Main component.
#
TEMPLATE_VBOXMAINCLIENTEXE = VBox Main Client (executable)
TEMPLATE_VBOXMAINCLIENTEXE_EXTENDS = VBOXMAINEXE
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBOXMAINCLIENTEXE_DEPS = $(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h
$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/User32.Lib \
$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/Shell32.Lib \
$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/ShLwApi.Lib \
$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/Ole32.Lib \
$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/OleAut32.Lib \
$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/Uuid.Lib
else
TEMPLATE_VBOXMAINCLIENTEXE_DEPS = $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h
TEMPLATE_VBOXMAINCLIENTEXE_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
NDEBUG TRIMMED
-pthread
endif
#
# Template for building shared libraries / DLLs that use the VBox Main component.
#
# This differs from VBOXMAINCLIENTEXE only in PIC handling and similar DLL stuff.
#
TEMPLATE_VBOXMAINCLIENTDLL = VBox MAIN Client (shared library)
TEMPLATE_VBOXMAINCLIENTDLL_EXTENDS = VBOXMAINCLIENTEXE
ifn1of ($(KBUILD_TARGET), darwin os2 win)
TEMPLATE_VBOXMAINCLIENTDLL_DEFS = PIC $(TEMPLATE_VBOXMAINCLIENTEXE_DEFS)
TEMPLATE_VBOXMAINCLIENTDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CFLAGS)
TEMPLATE_VBOXMAINCLIENTDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS)
TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)
endif
TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin))
#
# Template for building testcases which are API clients.
#
TEMPLATE_VBOXMAINCLIENTTSTEXE = VBox Main Client Testcase (executable)
TEMPLATE_VBOXMAINCLIENTTSTEXE_EXTENDS = VBOXMAINCLIENTEXE
TEMPLATE_VBOXMAINCLIENTTSTEXE_INST = $(INST_TESTCASE)
ifdef VBOX_WITH_RUNPATH
TEMPLATE_VBOXMAINCLIENTTSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' $(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)
else ifdef VBOX_WITH_RELATIVE_RUNPATH
TEMPLATE_VBOXMAINCLIENTTSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..' $(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)
endif
if "$(KBUILD_TARGET)" == "win" && defined(VBOX_SIGNING_MODE)
TEMPLATE_VBOXMAINCLIENTTSTEXE_POST_CMDS =
endif
#
# Templates used for building the extension packs.
#
ifdef VBOX_WITH_EXTPACK
# Base templates (native or portable).
TEMPLATE_VBoxR3ExtPack = For the ring-3 context extension pack modules.
if 1 # Native for now.
TEMPLATE_VBoxR3ExtPack_EXTENDS = VBOXR3DLLNOXCPT
TEMPLATE_VBoxR3ExtPack_DEFS = $(TEMPLATE_VBOXR3DLLNOXCPT_DEFS) VBOX_IN_EXTPACK VBOX_IN_EXTPACK_R3
else
TEMPLATE_VBoxR3ExtPack_EXTENDS = VBoxNoCrtGccLib
TEMPLATE_VBoxR3ExtPack_DEFS = $(TEMPLATE_VBoxNoCrtGccLib_DEFS) VBOX_IN_EXTPACK VBOX_IN_EXTPACK_R3 IPRT_NO_CRT IN_RING3
TEMPLATE_VBoxR3ExtPack_INCS = $(PATH_ROOT)/include/iprt/nocrt $(TEMPLATE_VBOXR3DLLNOXCPT_INCS)
endif
ifneq ($(KBUILD_TARGET),win)
TEMPLATE_VBoxR3ExtPack_CXXFLAGS = $(TEMPLATE_VBOXR3DLLNOXCPT_CXXFLAGS) -fno-rtti
endif
TEMPLATE_VBoxR3ExtPack_INST = $(INST_EXTPACK)YouShallOverrideThis/
ifeq ($(KBUILD_TARGET),linux)
TEMPLATE_VBoxR3ExtPack_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)', $(TEMPLATE_VBOXR3DLLNOXCPT_LDFLAGS))
else
if !defined(VBOX_WITH_RUNPATH) && defined(VBOX_WITH_RELATIVE_RUNPATH)
TEMPLATE_VBoxR3ExtPack_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/../../..' $(filter-out '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)', $(TEMPLATE_VBOXR3DLLNOXCPT_LDFLAGS))
endif
endif
ifdef VBOX_ONLY_EXTPACKS_USE_IMPLIBS
if1of ($(KBUILD_TARGET), win os2)
TEMPLATE_VBoxR3ExtPack_LIBS = \
$(TEMPLATE_LIBS_VBOXR3) \
$(if-expr "$(VBOX_LIB_VMM_LAZY)" == "$(LIB_VMM)", $(PATH_STAGE_LIB)/VMMR3Imp$(VBOX_SUFF_LIB), $(VBOX_LIB_VMM_LAZY)) \
$(PATH_STAGE_LIB)/VBoxRTImp$(VBOX_SUFF_LIB)
else
TEMPLATE_VBoxR3ExtPack_LIBS = \
$(TEMPLATE_LIBS_VBOXR3) \
$(if-expr "$(VBOX_LIB_VMM_LAZY)" == "$(LIB_VMM)", $(PATH_STAGE_LIB)/VMMR3Imp$(VBOX_SUFF_DLL), $(VBOX_LIB_VMM_LAZY)) \
$(PATH_STAGE_LIB)/VBoxRTImp$(VBOX_SUFF_DLL)
endif
else
TEMPLATE_VBoxR3ExtPack_LIBS = \
$(TEMPLATE_LIBS_VBOXR3) \
$(LIB_RUNTIME) \
$(VBOX_LIB_VMM_LAZY)
endif
TEMPLATE_VBoxR0ExtPack = For the ring-0 context extension pack modules.
TEMPLATE_VBoxR0ExtPack_EXTENDS = VBoxR0
TEMPLATE_VBoxR0ExtPack_EXTENDS_BY = appending
TEMPLATE_VBoxR0ExtPack_INST = $(INST_EXTPACK)YouShallOverrideThis/
TEMPLATE_VBoxR0ExtPack_DEFS = VBOX_IN_EXTPACK VBOX_IN_EXTPACK_R0
if1of ($(VBOX_LDR_FMT), pe lx)
TEMPLATE_VBoxR0ExtPack_LIBS = \
$(PATH_STAGE_LIB)/VMMR0Imp$(VBOX_SUFF_LIB) \
$(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
endif
TEMPLATE_VBoxRcExtPack = For the raw-mode context extension pack modules.
TEMPLATE_VBoxRcExtPack_EXTENDS = VBoxRc
TEMPLATE_VBoxRcExtPack_EXTENDS_BY = appending
TEMPLATE_VBoxRcExtPack_SYSSUFF = .rc
TEMPLATE_VBoxRcExtPack_INST = $(INST_EXTPACK)YouShallOverrideThis/
TEMPLATE_VBoxRcExtPack_DEFS = VBOX_IN_EXTPACK VBOX_IN_EXTPACK_RC
if1of ($(VBOX_LDR_FMT32), pe lx)
TEMPLATE_VBoxRcExtPack_LIBS = \
$(PATH_STAGE_LIB)/VMMRCBuiltin$(VBOX_SUFF_LIB) \
$(PATH_STAGE_LIB)/VMMRCImp$(VBOX_SUFF_LIB)
endif
TEMPLATE_VBoxInsExtPack = For the install targets of an extension pack.
TEMPLATE_VBoxInsExtPack_MODE = 0644
TEMPLATE_VBoxInsExtPack_INST = $(INST_EXTPACK)YouShallOverrideThis/
# For each individual extension pack
ifdef VBOX_WITH_EXTPACK_PUEL
TEMPLATE_VBoxR3ExtPackPuel = For the ring-3 context modules in the PUEL extension pack.
TEMPLATE_VBoxR3ExtPackPuel_EXTENDS = VBoxR3ExtPack
TEMPLATE_VBoxR3ExtPackPuel_INST = $(INST_EXTPACK_PUEL)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
TEMPLATE_VBoxR0ExtPackPuel = For the ring-0 context modules in the PUEL extension pack.
TEMPLATE_VBoxR0ExtPackPuel_EXTENDS = VBoxR0ExtPack
TEMPLATE_VBoxR0ExtPackPuel_INST = $(INST_EXTPACK_PUEL)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
TEMPLATE_VBoxRcExtPackPuel = For the raw-mode context modules in the PUEL extension pack.
TEMPLATE_VBoxRcExtPackPuel_EXTENDS = VBoxRcExtPack
TEMPLATE_VBoxRcExtPackPuel_INST = $(INST_EXTPACK_PUEL)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
TEMPLATE_VBoxInsExtPackPuel = For the install targets of an extension pack.
TEMPLATE_VBoxInsExtPackPuel_EXTENDS = VBoxR0ExtPack
TEMPLATE_VBoxInsExtPackPuel_INST = $(INST_EXTPACK_PUEL)
endif
endif # VBOX_WITH_EXTPACK
#
# Qt 4
# Qt 4
# Qt 4
#
ifdef VBOX_WITH_QTGUI
# Guess VBOX_WITH_QT4_SUN
ifndef VBOX_WITH_QT4_SUN
ifndef VBOX_OSE
if1of ($(KBUILD_TARGET), darwin solaris win)
VBOX_WITH_QT4_SUN := 1
endif
endif
endif
#
# Handmade configuration of qt4 - very annoying, this needs to
# be cleaned up properly later some time (not important now).
#
ifeq ($(VBOX_PATH_QT4),)
ifeq ($(KBUILD_TARGET),darwin)
VBOX_PATH_QT4 := $(lastword $(sort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v4*)))
ifeq ($(VBOX_PATH_QT4),)
ifneq ($(wildcard /Library/Frameworks/QtCore.framework),)
# Using the global installation (for OSE).
VBOX_PATH_QT4 ?= /usr
VBOX_PATH_QT4_FRAMEWORKS ?= /Library/Frameworks
endif
endif
else if1of ($(KBUILD_TARGET), win)
VBOX_PATH_QT4 ?= $(lastword $(filter %-$(tolower $(VBOX_VCC_TOOL_STEM)),$(sort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v4*))))
else if1of ($(KBUILD_TARGET), linux solaris)
VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v4*)))
ifneq ($(VBOX_PATH_QT4),)
VBOX_WITH_QT4_SUN = 1
endif
endif
endif
ifeq ($(VBOX_PATH_QT4),)
if1of ($(USERNAME), bird)
# gentoo (64-bit)
VBOX_PATH_QT4 ?= /usr
VBOX_PATH_QT4_LIB ?= /usr/lib/qt4
endif
endif
VBOX_PATH_QT4 ?= /usr
VBOX_PATH_QT4_LIB ?= $(VBOX_PATH_QT4)/lib
ifdef VBOX_WITH_QT4_SUN
VBOX_QT4_INFIX=VBox
endif
VBOX_QT4_MOD = QtCore QtGui QtNetwork $(if $(VBOX_GUI_USE_QGL),QtOpenGL,)
VBOX_QT4_MOD_NAMES = $(foreach qtmod,$(VBOX_QT4_MOD),$(qtmod)$(VBOX_QT4_INFIX))
# Hack LD_LIBRARY_PATH for stuff in tools.
ifdef VBOX_WITH_QT4_SUN
if1of ($(KBUILD_TARGET), linux)
export LD_LIBRARY_PATH := $(VBOX_PATH_QT4_LIB):$(LD_LIBRARY_PATH)
endif
endif
#
# Template for building Qt GUI executables.
#
TEMPLATE_VBOXQT4GUIEXE = VBox Qt GUI Executable
TEMPLATE_VBOXQT4GUIEXE_USES = qt4
TEMPLATE_VBOXQT4GUIEXE_QTTOOL = QT4
TEMPLATE_VBOXQT4GUIEXE_MOCTOOL = QT4
TEMPLATE_VBOXQT4GUIEXE_UICTOOL = QT4
TEMPLATE_VBOXQT4GUIEXE_RCCTOOL = QT4
TEMPLATE_VBOXQT4GUIEXE_LRCTOOL = QT4
TEMPLATE_VBOXQT4GUIEXE_SDKS = QT4
TEMPLATE_VBOXQT4GUIEXE_QT_INFIX = $(VBOX_QT4_INFIX)
TEMPLATE_VBOXQT4GUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT QT_SHARED HAVE_CONFIG_H $(ARCH_BITS_DEFS)
TEMPLATE_VBOXQT4GUIEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
ifeq ($(KBUILD_TARGET),win)
# Note! No use of VBOX_VCC_CRT_TYPE here yet as it requires a /MDd build of Qt as well.
TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_VCC_TOOL)
TEMPLATE_VBOXQT4GUIEXE_DEFS += \
_WIN32_WINNT=0x0500 UNICODE _UNICODE \
QT_DLL _CRT_SECURE_NO_DEPRECATE \
$(QMAKE_PRL_DEFINES)
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = -nologo -Zm200 -W3 -MD -Zi -EHsc -Zc:wchar_t-
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE)
TEMPLATE_VBOXQT4GUIEXE_INCS += \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
TEMPLATE_VBOXQT4GUIEXE_LDFLAGS = -Ignore:4197 \
/NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug \
/Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
/STUB:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com
if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_HARDENING)
TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += -IntegrityCheck
endif
TEMPLATE_VBOXQT4GUIEXE_SDKS += $(VBOX_WINPSDK)
TEMPLATE_VBOXQT4GUIEXE_LIBS = \
$(VBOX_LIBS_QT4) \
$(LIB_RUNTIME) \
$(VBOX_LIB_VMM_LAZY) \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
ifdef VBOX_WITH_DEBUG_VCC_CRT # VBoxCOM (static) is causing trouble of course.
TEMPLATE_VBOXQT4GUIEXE_LIBS += \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib
endif
TEMPLATE_VBOXQT4GUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
else # the gcc guys:
TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBOXQT4GUIEXE_DEFS.linux = _REENTRANT
TEMPLATE_VBOXQT4GUIEXE_DEFS.solaris = _REENTRANT
## @todo Use VBOX_GCC_PEDANTIC_CXX?
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
-g $(VBOX_GCC_pipe) $(filter-out -Wno-unused,$(VBOX_GCC_WARN)) -frtti -fno-exceptions -Wno-non-virtual-dtor \
-Wno-long-long -fshort-wchar -fno-strict-aliasing \
$(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) \
$(VBOX_GCC_Wno-delete-non-virtual-dtor) $(VBOX_GCC_std)
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.linux = -pthread
TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_C) -Wno-long-long -fno-exceptions
TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS = \
-g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_CXX) -Wno-non-virtual-dtor -Wno-long-long \
-frtti -fno-exceptions $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
TEMPLATE_VBOXQT4GUIEXE_LIBS = \
$(VBOX_LIBS_QT4) \
$(LIB_SDL) \
$(LIB_RUNTIME) \
$(if-expr "$(LIB_VMM)" == "$(VBOX_LIB_VMM_LAZY)",$(LIB_REM),) \
$(VBOX_LIB_VMM_LAZY)
ifeq ($(KBUILD_TARGET),linux)
TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed)
TEMPLATE_VBOXQT4GUIEXE_LIBS += \
$(VBOX_XCURSOR_LIBS) \
Xext \
X11
TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
$(VBOX_LIBPATH_X11)
else ifeq ($(KBUILD_TARGET),darwin)
TEMPLATE_VBOXQT4GUIEXE_DEFS.darwin += $(VBOX_DARWIN_DEF_SDK_DEFS)
TEMPLATE_VBOXQT4GUIEXE_CFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CFLAGS)
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS)
TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -bind_at_load
TEMPLATE_VBOXQT4GUIEXE_LIBS +=
TEMPLATE_VBOXQT4GUIEXE_LIBPATH +=
else
TEMPLATE_VBOXQT4GUIEXE_INCS += \
$(VBOX_XCURSOR_INCS)
TEMPLATE_VBOXQT4GUIEXE_LIBS += \
$(VBOX_XCURSOR_LIBS) \
Xext \
X11 \
m \
$(LIB_PTHREAD)
TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
$(VBOX_LIBPATH_X11)
ifeq ($(KBUILD_TARGET),freebsd)
TEMPLATE_VBOXQT4GUIEXE_INCS += \
TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
/usr/lib \
endif
ifeq ($(KBUILD_TARGET),solaris)
TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.solaris = -Wl,-z,ignore # Same as VBOX_LD_as_needed.
TEMPLATE_VBOXQT4GUIEXE_LIBS += \
rt socket nsl
endif
endif
# Assume the Qt shared objects are in the same directory as the executable, on Solaris too.
ifdef VBOX_WITH_RUNPATH
TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
else ifdef VBOX_WITH_RELATIVE_RUNPATH
TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
endif
endif
# Add COM/XPCOM stuff
TEMPLATE_VBOXQT4GUIEXE_LIBS += \
$(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
ifdef VBOX_WITH_XPCOM
## @todo may be worth creating the VBOX_XPCOM SDK def, or just a SDK_VBOXXPCOM.
TEMPLATE_VBOXQT4GUIEXE_DEFS += VBOX_WITH_XPCOM
ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
TEMPLATE_VBOXQT4GUIEXE_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
endif
TEMPLATE_VBOXQT4GUIEXE_INCS += \
$(VBOX_XPCOM_INCS)
TEMPLATE_VBOXQT4GUIEXE_LIBS += \
$(LIB_XPCOM)
TEMPLATE_VBOXQT4GUIEXE_INTERMEDIATES += \
$(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h
else # COM
TEMPLATE_VBOXQT4GUIEXE_INCS += \
$(VBOX_PATH_SDK)/bindings/mscom/include
TEMPLATE_VBOXQT4GUIEXE_INTERMEDIATES += \
$(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h
endif # COM
#
# Template for building Qt GUI components.
#
TEMPLATE_VBOXQT4GUI = VBox Qt GUI Components
TEMPLATE_VBOXQT4GUI_EXTENDS = VBOXQT4GUIEXE
TEMPLATE_VBOXQT4GUI_LIBS = $(filter-out $(QTMAIN),$(TEMPLATE_VBOXQT4GUIEXE_LIBS))
ifeq ($(KBUILD_TARGET),darwin)
TEMPLATE_VBOXQT4GUI_LDFLAGS.darwin += $(filter-out -bind_at_load,$(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.darwin)) \
-current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
-compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
endif
ifn1of ($(KBUILD_TARGET), darwin os2 win)
TEMPLATE_VBOXQT4GUI_DEFS = PIC $(TEMPLATE_VBOXQT4GUIEXE_DEFS)
TEMPLATE_VBOXQT4GUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CFLAGS)
TEMPLATE_VBOXQT4GUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS)
TEMPLATE_VBOXQT4GUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS)
endif
endif # VBOX_WITH_QTGUI
#
# Template for installing symbol files that we wish to ship.
#
TEMPLATE_VBoxDbgSyms = Symbol files for VBoxDbg and gurus.
TEMPLATE_VBoxDbgSyms_INST = $(INST_VBOXDBG_SYMS)
#
# Template for building build bldprogs.
#
# HACK ALERT! The BLD_TRG_* is a hack to allow building libraries as well.
#
TEMPLATE_VBoxBldProg = VBox Build Program
TEMPLATE_VBoxBldProg_BLD_TRG := $(KBUILD_HOST)
TEMPLATE_VBoxBldProg_BLD_TRG_ARCH := $(KBUILD_HOST_ARCH)
TEMPLATE_VBoxBldProg_BLD_TRG_CPU := $(KBUILD_HOST_CPU)
TEMPLATE_VBoxBldProg_DEFS := IN_RING3 LOG_DISABLED
TEMPLATE_VBoxBldProg_DEFS.win := _CRT_SECURE_NO_DEPRECATE
ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
TEMPLATE_VBoxBldProg_ASTOOL := $(VBOX_ASTOOL)
TEMPLATE_VBoxBldProg_ASFLAGS.x86 := $(VBOX_ASFLAGS32)
TEMPLATE_VBoxBldProg_ASFLAGS.amd64 := $(VBOX_ASFLAGS64)
else
TEMPLATE_VBoxBldProg_ASTOOL := YASM
TEMPLATE_VBoxBldProg_ASFLAGS := -D__YASM__ -Worphan-labels
if1of ($(KBUILD_HOST),win)
TEMPLATE_VBoxBldProg_ASFLAGS += -g cv8 -DASM_FORMAT_ELF
TEMPLATE_VBoxBldProg_ASFLAGS.x86 := -f win32
TEMPLATE_VBoxBldProg_ASFLAGS.amd64 := -f win64
else if1of ($(KBUILD_HOST),darwin)
TEMPLATE_VBoxBldProg_ASFLAGS += -DASM_FORMAT_MACHO
TEMPLATE_VBoxBldProg_ASFLAGS.x86 := -f macho32
TEMPLATE_VBoxBldProg_ASFLAGS.amd64 := -f macho64
else
TEMPLATE_VBoxBldProg_ASFLAGS += -g dwarf2 -DASM_FORMAT_ELF
TEMPLATE_VBoxBldProg_ASFLAGS.x86 := -f elf32
TEMPLATE_VBoxBldProg_ASFLAGS.amd64 := -f elf64
endif
TEMPLATE_VBoxBldProg_ASFLAGS.amd64 += $(VBOX_YASM_Wno-segreg-in-64bit)
endif
ifeq ($(KBUILD_HOST),win)
TEMPLATE_VBoxBldProg_TOOL := $(VBOX_VCC_TOOL_STEM)$(toupper $(KBUILD_HOST_ARCH))
TEMPLATE_VBoxBldProg_SDKS := ReorderCompilerIncs $(VBOX_WINPSDK)
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)
TEMPLATE_VBoxBldProg_CXXFLAGS.debug := -RTCsu
TEMPLATE_VBoxBldProg_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE)
TEMPLATE_VBoxBldProg_CFLAGS = $(TEMPLATE_VBoxBldProg_CXXFLAGS)
TEMPLATE_VBoxBldProg_LDFLAGS = -Ignore:4197 \
/NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug \
/Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
/DISALLOWLIB:libc$(VBOX_VCC_CRT_TYPE_N).lib \
/DISALLOWLIB:libcmt$(VBOX_VCC_CRT_TYPE_N).lib \
/DISALLOWLIB:msvcrt.lib \
/DISALLOWLIB:msvcrtd.lib \
/DISALLOWLIB:msvcprt.lib \
/DISALLOWLIB:msvcprtd.lib
TEMPLATE_VBoxBldProg_LIBS = \
$(PATH_TOOL_$(TEMPLATE_VBoxBldProg_TOOL)_LIB)/oldnames.lib \
$(PATH_TOOL_$(TEMPLATE_VBoxBldProg_TOOL)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBoxBldProg_TOOL)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
else
# (gcc of some kind )
TEMPLATE_VBoxBldProg_TOOL = GXX3
TEMPLATE_VBoxBldProg_CFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros)
TEMPLATE_VBoxBldProg_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
TEMPLATE_VBoxBldProg_CXXFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros)
TEMPLATE_VBoxBldProg_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
TEMPLATE_VBoxBldProg_OBJCFLAGS = $(TEMPLATE_VBoxBldProg_CFLAGS)
TEMPLATE_VBoxBldProg_OBJCXXFLAGS = $(TEMPLATE_VBoxBldProg_CXXFLAGS)
ifeq ($(KBUILD_HOST),linux)
TEMPLATE_VBoxBldProg_LIBS = pthread m rt dl
else ifeq ($(KBUILD_HOST),os2)
TEMPLATE_VBoxBldProg_TOOL = GXX3OMF
TEMPLATE_VBoxBldProg_LIBS = socket iconv
else ifeq ($(KBUILD_HOST),darwin)
TEMPLATE_VBoxBldProg_TOOL = GXX4MACHO
if "$(VBOX_DEF_MACOSX_VERSION_MIN)" == "10.7" || "$(VBOX_DARWIN_HOST_VERSION_MAJOR)" == "7"
TEMPLATE_VBoxBldProg_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_DEFS)
TEMPLATE_VBoxBldProg_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_CFLAGS) -fno-common
TEMPLATE_VBoxBldProg_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_CXXFLAGS)
TEMPLATE_VBoxBldProg_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
TEMPLATE_VBoxBldProg_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
TEMPLATE_VBoxBldProg_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_LDFLAGS)
else if "$(VBOX_DEF_MACOSX_VERSION_MIN)" == "10.6" || "$(VBOX_DARWIN_HOST_VERSION_MAJOR)" == "6"
TEMPLATE_VBoxBldProg_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_DEFS)
TEMPLATE_VBoxBldProg_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_CFLAGS) -fno-common
TEMPLATE_VBoxBldProg_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_CXXFLAGS)
TEMPLATE_VBoxBldProg_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
TEMPLATE_VBoxBldProg_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
TEMPLATE_VBoxBldProg_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_LDFLAGS)
else if "$(VBOX_DEF_MACOSX_VERSION_MIN)" == "10.5" || "$(VBOX_DARWIN_HOST_VERSION_MAJOR)" == "5" || defined(VBOX_MACOS_10_5_WORKAROUND)
TEMPLATE_VBoxBldProg_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_DEFS)
TEMPLATE_VBoxBldProg_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CFLAGS) -fno-common
TEMPLATE_VBoxBldProg_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS)
TEMPLATE_VBoxBldProg_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
TEMPLATE_VBoxBldProg_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
TEMPLATE_VBoxBldProg_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS)
else
TEMPLATE_VBoxBldProg_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_DEFS)
TEMPLATE_VBoxBldProg_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -fno-common
TEMPLATE_VBoxBldProg_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
TEMPLATE_VBoxBldProg_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
TEMPLATE_VBoxBldProg_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
TEMPLATE_VBoxBldProg_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
endif
TEMPLATE_VBoxBldProg_LIBS =
else ifeq ($(KBUILD_HOST),haiku)
TEMPLATE_VBoxBldProg_TOOL = GXX3
TEMPLATE_VBoxBldProg_LIBS = network iconv
TEMPLATE_VBoxBldProg_LIBPATH += \
else if1of ($(KBUILD_HOST), freebsd netbsd openbsd)
TEMPLATE_VBoxBldProg_TOOL = GXX3
TEMPLATE_VBoxBldProg_LIBS = pthread
TEMPLATE_VBoxBldProg_INCS += \
TEMPLATE_VBoxBldProg_LIBPATH += \
/usr/lib \
else ifeq ($(KBUILD_HOST),solaris)
TEMPLATE_VBoxBldProg_TOOL = GXX3PLAIN
TEMPLATE_VBoxBldProg_LIBS = rt
else
$(warning Warning: VBOX Build: Target $(KBUILD_HOST) is not officially supported!)
endif
endif # !win
#
# Advanced build programs using IPRT and stuff.
#
TEMPLATE_VBoxAdvBldProg = Advanced VBox Build Program
TEMPLATE_VBoxAdvBldProg_EXTENDS = VBoxBldProg
TEMPLATE_VBoxAdvBldProg_SDKS = $(TEMPLATE_VBoxBldProg_SDKS)
TEMPLATE_VBoxAdvBldProg_SDKS.win= $(TEMPLATE_VBoxBldProg_SDKS.win) VBOX_NTDLL
TEMPLATE_VBoxAdvBldProg_DEFS = $(TEMPLATE_VBoxBldProg_DEFS) IN_RT_R3
ifeq ($(KBUILD_HOST),win)
TEMPLATE_VBoxAdvBldProg_CFLAGS = $(TEMPLATE_VBoxBldProg_CFLAGS) $(VBOX_VCC_WERR)
TEMPLATE_VBoxAdvBldProg_CXXFLAGS = $(TEMPLATE_VBoxBldProg_CXXFLAGS) $(VBOX_VCC_WERR)
endif
TEMPLATE_VBoxAdvBldProg_LIBS = \
$(PATH_STAGE_LIB)/RuntimeBldProg$(VBOX_HOSTSUFF_LIB) \
$(if-expr defined(IPRT_WITH_KSTUFF), \
$(PATH_STAGE_LIB)/VBox-kStuffStaticBldProg$(VBOX_HOSTSUFF_LIB) \
$(PATH_STAGE_LIB)/RuntimeBldProg$(VBOX_HOSTSUFF_LIB) \
,) \
$(TEMPLATE_VBoxBldProg_LIBS)
$(TEMPLATE_VBoxAdvBldProg_LIBS) \
iconv \
$(TEMPLATE_VBoxAdvBldProg_LIBS) \
iconv \
rt \
$(TEMPLATE_VBoxAdvBldProg_LIBS) \
crypt \
$(TEMPLATE_VBoxAdvBldProg_LIBS) \
contract \
kstat \
rt \
socket \
nsl \
#
# Windows rc workaround for crosscompiling.
# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
#
ifneq ($(KBUILD_HOST),win)
TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(KBUILD_DEVTOOLS)/win.x86/bin/rc.exe
TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(KBUILD_DEVTOOLS)/win.x86/bin/rc.exe
TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(KBUILD_DEVTOOLS)/win.x86/bin/rc.exe
WIN32_MC = $(EXEC_X86_WIN32) $(KBUILD_DEVTOOLS)/win.x86/bin/mc.exe
else
WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
$(PATH_SDK_$(VBOX_WINPSDK)_BIN)/MC.Exe\
$(PATH_SDK_WINPSDK_BIN)/MC.Exe\
$(PATH_SDK_WINPSDK)/Bin/MC.Exe\
$(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
$(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
$(KBUILD_DEVTOOLS)/win.x86/bin/mc.exe\
) Sorry_Cannot_find_mc_in_the_PSDK)
endif
#
# Template for building R3 programs for the guest additions.
#
TEMPLATE_VBOXGUESTR3EXE = VBox Guest Program
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBOXGUESTR3EXE_EXTENDS = VBOXR3EXE
TEMPLATE_VBOXGUESTR3EXE_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK_GST) VBOX_NTDLL
TEMPLATE_VBOXGUESTR3EXE_CFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
TEMPLATE_VBOXGUESTR3EXE_LDFLAGS = $(filter-out /DISALLOWLIB:libcmt$(VBOX_VCC_CRT_TYPE).lib /DISALLOWLIB:libcpmt$(VBOX_VCC_CRT_TYPE).lib, $(TEMPLATE_VBOXR3EXE_LDFLAGS)) \
/DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE).lib \
/DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE).lib
$(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.x86)_LIB)/oldnames.lib \
$(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
$(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.amd64)_LIB)/oldnames.lib \
$(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.amd64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
$(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
# Hack for running on NT4, W2K and XP w/o SP: Change OS and subsystem version in the image.
# HACK ALERT! Double expansion of $$(NLTAB).
TEMPLATE_VBOXGUESTR3EXE_POST_CMDS.win.x86 = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION) $(out)$$(NLTAB)$(TEMPLATE_VBOXR3EXE_POST_CMDS))
TEMPLATE_VBOXGUESTR3EXE_LNK_DEPS.win.x86 = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION))
else # the gcc guys
ifneq ($(VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE),)
ifneq ($(KBUILD_TARGET),linux)
override VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE :=
endif
endif
TEMPLATE_VBOXGUESTR3EXE_EXTENDS = VBOXR3EXE
TEMPLATE_VBOXGUESTR3EXE_TOOL := $(subst GXX,GCC,$(TEMPLATE_VBOXR3EXE_TOOL))
TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fno-exceptions
TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBOXR3EXE_LDFLAGS.linux))
ifneq ($(VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE),)
ifeq ($(KBUILD_TARGET_ARCH),x86)
TEMPLATE_VBOXGUESTR3EXE_TOOL := VBoxXGccX86RedHatLinux
else ifeq ($(KBUILD_TARGET_ARCH),amd64)
TEMPLATE_VBOXGUESTR3EXE_TOOL := VBoxXGccAmd64LinuxGnu
TEMPLATE_VBOXGUESTR3EXE_TOOL.x86 := VBoxXGccX86RedHatLinux
endif
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) $(VBOX_GCC_mtune-generic) $(VBOX_GCC_Wlogical-op),$(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS)) -pipe
TEMPLATE_VBOXGUESTR3EXE_CFLAGS := $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS)
TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux := $(filter-out $(VBOX_GCC_ORIGIN_OPT) $(VBOX_LD_as_needed),$(TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux))
endif
TEMPLATE_VBOXGUESTR3EXE_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%,$(TEMPLATE_VBOXR3EXE_LDFLAGS))
endif
TEMPLATE_VBOXGUESTR3EXE_INST = $(INST_ADDITIONS)
TEMPLATE_VBOXGUESTR3EXE_DEFS := $(filter-out $(ARCH_BITS_DEFS), $(TEMPLATE_VBOXR3EXE_DEFS)) IN_GUEST IN_GUEST_R3 IN_RT_R3 $(VBOX_GC_ARCH_BITS_DEFS)
TEMPLATE_VBOXGUESTR3EXE_DEFS.linux := $(TEMPLATE_VBOXR3EXE_DEFS.linux) LOG_USE_C99 RT_WITHOUT_EXEC_ALLOC
ifeq ($(KBUILD_TARGET),linux) # As few libs as possible on linux.
TEMPLATE_VBOXGUESTR3EXE_LIBS = pthread rt m dl
else if1of ($(KBUILD_TARGET), darwin freebsd netbsd openbsd)
TEMPLATE_VBOXGUESTR3EXE_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS) iconv
else ifeq ($(KBUILD_TARGET), solaris)
TEMPLATE_VBOXGUESTR3EXE_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS) nsl
endif
#
# Template for building normal R3 programs for the guest additions.
#
TEMPLATE_NewVBoxGuestR3Exe = VBox Guest Program w/ IPRT and VBGL.
TEMPLATE_NewVBoxGuestR3Exe_EXTENDS = VBOXGUESTR3EXE
TEMPLATE_NewVBoxGuestR3Exe_LIBS = \
$(VBOX_LIB_IPRT_GUEST_R3) \
$(VBOX_LIB_VBGL_R3) \
$(VBOX_LIB_IPRT_GUEST_R3) \
$(TEMPLATE_VBOXGUESTR3EXE_LIBS)
#
# Template for building R3 (dynamic) libraries for the guest additions.
#
TEMPLATE_VBOXGUESTR3DLL = VBox Guest User Dynamic Libraries
TEMPLATE_VBOXGUESTR3DLL_EXTENDS = VBOXGUESTR3EXE
## @todo add a INSTFUN that separates dlls and libs.
ifn1of ($(KBUILD_TARGET), darwin os2 win)
TEMPLATE_VBOXGUESTR3DLL_DEFS = $(TEMPLATE_VBOXGUESTR3EXE_DEFS) PIC
TEMPLATE_VBOXGUESTR3DLL_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fPIC
TEMPLATE_VBOXGUESTR3DLL_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fPIC -fno-exceptions
TEMPLATE_VBOXGUESTR3DLL_LDFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_LDFLAGS) -fPIC
endif
#
# Template for building normal R3 (dynamic) libraries for the guest additions, allows warnings.
#
## @todo rename to VBoxGuestR3DllWarn
TEMPLATE_NewVBoxGuestR3Dll = VBox Guest User Dynamic Libraries w/ IPRT and VBGL.
TEMPLATE_NewVBoxGuestR3Dll_EXTENDS = VBOXGUESTR3DLL
TEMPLATE_NewVBoxGuestR3Dll_LIBS = \
$(VBOX_LIB_IPRT_GUEST_R3_SHARED) \
$(VBOX_LIB_VBGL_R3_SHARED) \
$(VBOX_LIB_IPRT_GUEST_R3_SHARED) \
$(TEMPLATE_VBOXGUESTR3EXE_LIBS)
#
# Template for building normal R3 (dynamic) libraries for the guest additions, strict.
#
TEMPLATE_VBoxGuestR3Dll = VBox Guest User Dynamic Libraries w/ IPRT and VBGL.
TEMPLATE_VBoxGuestR3Dll_EXTENDS = NewVBoxGuestR3Dll
TEMPLATE_VBoxGuestR3Dll_EXTENDS_BY = appending
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBoxGuestR3Dll_CFLAGS += $(VBOX_VCC_WERR)
TEMPLATE_VBoxGuestR3Dll_CXXFLAGS += $(VBOX_VCC_WERR)
TEMPLATE_VBoxGuestR3Dll_LDFLAGS += $(VBOX_VCC_LD_WERR)
else ifeq ($(VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE),)
TEMPLATE_VBoxGuestR3Dll_CFLAGS += $(VBOX_GCC_WERR)
TEMPLATE_VBoxGuestR3Dll_CXXFLAGS += $(VBOX_GCC_WERR)
endif
#
# Template for building R3 (static) libraries for the guest additions, allows warnings.
#
## @todo rename to VBoxGuestR3LibWarn.
TEMPLATE_VBOXGUESTR3LIB = VBox Guest User Libraries
TEMPLATE_VBOXGUESTR3LIB_EXTENDS = VBOXGUESTR3EXE
TEMPLATE_VBOXGUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
#
# Template for building R3 (static) libraries for the guest additions, strict.
#
TEMPLATE_VBoxGuestR3Lib = VBox Guest User Dynamic Libraries w/ IPRT and VBGL.
TEMPLATE_VBoxGuestR3Lib_EXTENDS = VBOXGUESTR3LIB
TEMPLATE_VBoxGuestR3Lib_EXTENDS_BY = appending
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBoxGuestR3Lib_CFLAGS += $(VBOX_VCC_WERR)
TEMPLATE_VBoxGuestR3Lib_CXXFLAGS += $(VBOX_VCC_WERR)
TEMPLATE_VBoxGuestR3Lib_LDFLAGS += $(VBOX_VCC_LD_WERR)
else ifeq ($(VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE),)
TEMPLATE_VBoxGuestR3Lib_CFLAGS += $(VBOX_GCC_WERR)
TEMPLATE_VBoxGuestR3Lib_CXXFLAGS += $(VBOX_GCC_WERR)
endif
#
# Template for building R3 programs for the guest additions (no -pedantic)
#
TEMPLATE_VBOXGUESTR3NPEXE = VBox Guest Program Non-pedantic
TEMPLATE_VBOXGUESTR3NPEXE_EXTENDS = VBOXGUESTR3EXE
ifneq ($(KBUILD_TARGET),win) # gcc only
TEMPLATE_VBOXGUESTR3NPEXE_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS)) -Wno-sign-compare
TEMPLATE_VBOXGUESTR3NPEXE_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXGUESTR3EXE_CFLAGS)) -Wno-sign-compare
endif
#
# Template for building R3 (dynamic) libraries for the guest additions (no -pedantic)
#
TEMPLATE_VBOXGUESTR3NPDLL = VBox Guest User Dynamic Libraries Non-pedantic
TEMPLATE_VBOXGUESTR3NPDLL_EXTENDS = VBOXGUESTR3NPEXE
## @todo add a INSTFUN that separates dlls and libs.
ifn1of ($(KBUILD_TARGET), darwin os2 win)
TEMPLATE_VBOXGUESTR3NPDLL_DEFS = $(TEMPLATE_VBOXGUESTR3NPEXE_DEFS) PIC
TEMPLATE_VBOXGUESTR3NPDLL_CFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CFLAGS) -fPIC
TEMPLATE_VBOXGUESTR3NPDLL_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CXXFLAGS) -fPIC -fno-exceptions
TEMPLATE_VBOXGUESTR3NPDLL_LDFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_LDFLAGS) -fPIC
endif
#
# Template for building R3 (static) libraries for the guest additions (no -pedantic)
#
TEMPLATE_VBOXGUESTR3NPLIB = VBox Guest User Libraries Non-pedantic
TEMPLATE_VBOXGUESTR3NPLIB_EXTENDS = VBOXGUESTR3NPEXE
TEMPLATE_VBOXGUESTR3NPLIB_INST = $(INST_ADDITIONS_LIB)
#
# Template for XFree86 guest modules (relocatable module, i.e. sysmod).
# This mostly about zapping the VBOXR3EXE linker flags and libraries.
#
TEMPLATE_VBOXGUESTR3XF86MOD = VBox XFree86 Guest Module
TEMPLATE_VBOXGUESTR3XF86MOD_EXTENDS = VBOXGUESTR3EXE
TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS = -r
if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd) # the gnu ld guys.
TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.x86 = -m elf_i386
TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.amd64 = -m elf_x86_64
endif
TEMPLATE_VBOXGUESTR3XF86MOD_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fno-merge-constants -std=c99 -ffreestanding
TEMPLATE_VBOXGUESTR3XF86MOD_CXXFLAGS= $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fno-merge-constants -ffreestanding
ifeq ($(VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE),)
TEMPLATE_VBOXGUESTR3XF86MOD_CFLAGS += $(VBOX_GCC_fno-stack-protector)
TEMPLATE_VBOXGUESTR3XF86MOD_CXXFLAGS += $(VBOX_GCC_fno-stack-protector)
endif
TEMPLATE_VBOXGUESTR3XF86MOD_SYSSUFF = .o
TEMPLATE_VBOXGUESTR3XF86MOD_LIBS = \
$(VBOX_LIB_VBGL_R3_XFREE86)
TEMPLATE_VBOXGUESTR3XF86MOD_DEFS = $(TEMPLATE_VBOXGUESTR3DLL_DEFS) VBOX_GUESTR3XF86MOD RTMEM_NO_WRAP_TO_EF_APIS
#
# Template for XFree86 guest libraries.
#
TEMPLATE_VBOXGUESTR3XF86LIB = VBox XFree86 Guest Library
TEMPLATE_VBOXGUESTR3XF86LIB_EXTENDS = VBOXGUESTR3XF86MOD
TEMPLATE_VBOXGUESTR3XF86LIB_INST = $(INST_ADDITIONS_LIB)
#
# Template for X.org guest modules (shared libs).
# This mostly about zapping unnecessary LIBS from VBOXGUESTR3DLL and adding some flags.
#
TEMPLATE_VBOXGUESTR3XORGMOD = VBox X.org Guest Module
TEMPLATE_VBOXGUESTR3XORGMOD_EXTENDS = VBOXGUESTR3DLL
TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
TEMPLATE_VBOXGUESTR3XORGMOD_CFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_CFLAGS) -std=c99
if1of ($(KBUILD_TARGET), linux)
TEMPLATE_VBOXGUESTR3XORGMOD_CFLAGS += -Wno-conversion -Wno-unused-parameter
ifeq ($(VBOX_WITH_COMPATIBLE_LINUX_GUEST_PACKAGE),)
TEMPLATE_VBOXGUESTR3XORGMOD_CFLAGS += $(VBOX_GCC_Wno-variadic-macros)
endif
endif
TEMPLATE_VBOXGUESTR3XORGMOD_DEFS = $(TEMPLATE_VBOXGUESTR3DLL_DEFS) VBOX_GUESTR3XORGMOD RTMEM_NO_WRAP_TO_EF_APIS
ifeq ($(KBUILD_TARGET_ARCH),amd64)
TEMPLATE_VBOXGUESTR3XORGMOD_DEFS += _XSERVER64
endif
TEMPLATE_VBOXGUESTR3XORGMOD_LIBS = \
$(VBOX_LIB_VBGL_R3_XORG)
iconv
#
# Template for X.Org guest libraries.
#
TEMPLATE_VBOXGUESTR3XORGLIB = VBox X.Org Guest Library
TEMPLATE_VBOXGUESTR3XORGLIB_EXTENDS = VBOXGUESTR3XORGMOD
TEMPLATE_VBOXGUESTR3XORGLIB_INST = $(INST_ADDITIONS_LIB)
#
# Template for building R0 drivers for the guest additions.
#
TEMPLATE_VBOXGUESTR0 = VBox Guest Driver
TEMPLATE_VBOXGUESTR0_EXTENDS = VBOXR0DRV
TEMPLATE_VBOXGUESTR0_INST = $(INST_ADDITIONS)
TEMPLATE_VBOXGUESTR0_SDKS.win.x86 = ReorderCompilerIncs $(VBOX_WINDDK_GST) $(VBOX_WINPSDK_GST)INCS
TEMPLATE_VBOXGUESTR0_SDKS.win.amd64 = ReorderCompilerIncs $(VBOX_WINDDK_GST) $(VBOX_WINPSDK_GST)INCS
$(PATH_SDK_$(VBOX_WINDDK)_LIB)/int64.lib
TEMPLATE_VBOXGUESTR0_DEFS = $(TEMPLATE_VBOXR0DRV_DEFS) IN_GUEST IN_GUEST_R0
TEMPLATE_VBOXGUESTR0_DEFS.linux = RT_NO_EXPORT_SYMBOL
ifeq ($(KBUILD_TARGET),solaris)
TEMPLATE_VBOXGUESTR0_LDFLAGS = -r -dy
endif
ifn1of (darwin os2 win, $(KBUILD_TARGET))
TEMPLATE_VBOXGUESTR0_CFLAGS = $(patsubst %/VBox/SUPDrvMangling.h,%/VBox/VBoxGuestMangling.h,$(TEMPLATE_VBOXR0DRV_CFLAGS))
TEMPLATE_VBOXGUESTR0_CXXFLAGS = $(patsubst %/VBox/SUPDrvMangling.h,%/VBox/VBoxGuestMangling.h,$(TEMPLATE_VBOXR0DRV_CXXFLAGS))
endif
#
# Template for building R0 libraries for the guest additions.
#
TEMPLATE_VBOXGUESTR0LIB = VBox Guest Driver Libraries
TEMPLATE_VBOXGUESTR0LIB_EXTENDS = VBOXGUESTR0
TEMPLATE_VBOXGUESTR0LIB_INSTTYPE = stage
TEMPLATE_VBOXGUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
ifeq ($(KBUILD_TARGET),haiku)
TEMPLATE_VBOXGUESTR0LIB_LDFLAGS = -r -dy
endif
#
# Template for building OpenGL host dlls.
#
TEMPLATE_VBOXCROGLR3HOSTDLL = VBox OpenGL Host DLLs
TEMPLATE_VBOXCROGLR3HOSTDLL_EXTENDS = VBOXR3NP
TEMPLATE_VBOXCROGLR3HOSTDLL_EXTENDS_BY = prepending
TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS = CHROMIUM_THREADSAFE VBOX_WITH_HGCM UNPACKS
TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.win = _WIN32_WINNT=0x0500 WINDOWS=1
TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.linux = Linux=1 _GNU_SOURCE
TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.solaris = SunOS=1 _GNU_SOURCE #GLEXT_64_TYPES_DEFINED
TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE VBOX_WITH_COCOA_QT
TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.darwin = -framework AppKit
TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.freebsd = FreeBSD=1 _GNU_SOURCE
TEMPLATE_VBOXCROGLR3HOSTDLL_INCS = $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES)
TEMPLATE_VBOXCROGLR3HOSTDLL_SDKS.darwin = DARWIN-OPENGL
-framework OpenGL \
-current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
-compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.linux = -Wl,--no-as-needed
TEMPLATE_VBOXCROGLR3HOSTDLL_BLDDIRS = $(VBOX_PATH_CROGL_GENFILES)/
#
# Template for building OpenGL host libraries.
#
TEMPLATE_VBOXCROGLR3HOSTLIB = VBox OpenGL Host Libraries
TEMPLATE_VBOXCROGLR3HOSTLIB_EXTENDS = VBOXCROGLR3HOSTDLL
TEMPLATE_VBOXCROGLR3HOSTLIB_INST = $(INST_LIB)
#
# Template for building OpenGL guest dlls.
#
TEMPLATE_VBOXCROGLR3GUESTDLL = VBox OpenGL Guest DLLs
TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS = VBOXGUESTR3NPDLL
TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS_BY = prepending
TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS = CHROMIUM_THREADSAFE VBOX_WITH_HGCM
TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.win = WINDOWS=1
TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.linux = Linux=1 _GNU_SOURCE
TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.solaris = SunOS=1 _GNU_SOURCE #GLEXT_64_TYPES_DEFINED
TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE VBOX_WITH_COCOA_QT
TEMPLATE_VBOXCROGLR3GUESTDLL_LDFLAGS.darwin = -framework AppKit
TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.freebsd = FreeBSD=1 _GNU_SOURCE
TEMPLATE_VBOXCROGLR3GUESTDLL_INCS = $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES)
TEMPLATE_VBOXCROGLR3GUESTDLL_SDKS.darwin = DARWIN-OPENGL
-framework OpenGL \
-current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
-compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
TEMPLATE_VBOXCROGLR3GUESTDLL_BLDDIRS = $(VBOX_PATH_CROGL_GENFILES)/
#
# Template for building OpenGL guest libraries.
#
TEMPLATE_VBOXCROGLR3GUESTLIB = VBox OpenGL Guest Libraries
TEMPLATE_VBOXCROGLR3GUESTLIB_EXTENDS = VBOXCROGLR3GUESTDLL
TEMPLATE_VBOXCROGLR3GUESTLIB_INST = $(INST_ADDITIONS_LIB)
#
# Template for building Mesa guest library, Linux-only so far.
#
TEMPLATE_VBOXMESAR3GUESTLIB = VBox Mesa Guest Library
TEMPLATE_VBOXMESAR3GUESTLIB_EXTENDS = VBOXCROGLR3GUESTDLL
TEMPLATE_VBOXMESAR3GUESTLIB_INST = $(INST_ADDITIONS_LIB)
TEMPLATE_VBOXMESAR3GUESTLIB_DEFS.linux = Linux=1
TEMPLATE_VBOXMESAR3GUESTLIB_DEFS.solaris = SunOS=1
TEMPLATE_VBOXMESAR3GUESTLIB_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY
ifeq ($(KBUILD_TARGET),linux)
TEMPLATE_VBOXMESAR3GUESTLIB_ASTOOL = $(TEMPLATE_VBOXCROGLR3GUESTDLL_TOOL)
TEMPLATE_VBOXMESAR3GUESTLIB_ASFLAGS = $(NO_SUCH_VARIABLE)
TEMPLATE_VBOXMESAR3GUESTLIB_ASDEFS = $(NO_SUCH_VARIABLE)
endif
#
# Guest additions libraries (all static).
# The _MINI and _SHARED are both compiled as PIC and intended for linking into a .so/.dll/.dylib.
#
VBOX_LIB_IPRT_GUEST_R3 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3$(VBOX_SUFF_LIB)
VBOX_LIB_IPRT_GUEST_R3_SHARED = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3Shared$(VBOX_SUFF_LIB)
VBOX_LIB_IPRT_GUEST_R0 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR0$(VBOX_SUFF_LIB)
ifeq ($(KBUILD_TARGET_ARCH),x86)
VBOX_LIB_IPRT_GUEST_R0_NT4 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR0NT4$(VBOX_SUFF_LIB)
else
VBOX_LIB_IPRT_GUEST_R0_NT4 = $(VBOX_LIB_IPRT_GUEST_R0)
endif
VBOX_LIB_VBGL_R3 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3Lib$(VBOX_SUFF_LIB) \
$(if $(VBOX_WITH_DRAG_AND_DROP),$(VBOX_PATH_ADDITIONS_LIB)/VBoxDnDGuestR3Lib$(VBOX_SUFF_LIB))
VBOX_LIB_VBGL_R3_XFREE86 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibXFree86$(VBOX_SUFF_LIB)
VBOX_LIB_VBGL_R3_XORG = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibXOrg$(VBOX_SUFF_LIB)
VBOX_LIB_VBGL_R3_SHARED = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibShared$(VBOX_SUFF_LIB)
VBOX_LIB_VBGL_R0BASE = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0LibBase$(VBOX_SUFF_LIB)
VBOX_LIB_VBGL_R0 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0Lib$(VBOX_SUFF_LIB)
ifeq ($(KBUILD_TARGET),x86)
VBOX_LIB_IPRT_GUEST_R3_X86 = $(VBOX_LIB_IPRT_GUEST_R3)
VBOX_LIB_IPRT_GUEST_R3_SHARED_X86 = $(VBOX_LIB_IPRT_GUEST_R3_SHARED)
VBOX_LIB_VBGL_R3_X86 = $(VBOX_LIB_VBGL_R3)
VBOX_LIB_VBGL_R3_SHARED_X86 = $(VBOX_LIB_VBGL_R3_SHARED)
else
VBOX_LIB_IPRT_GUEST_R3_X86 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3-x86$(VBOX_SUFF_LIB)
VBOX_LIB_IPRT_GUEST_R3_SHARED_X86 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3Shared-x86$(VBOX_SUFF_LIB)
VBOX_LIB_VBGL_R3_X86 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3Lib-x86$(VBOX_SUFF_LIB)
VBOX_LIB_VBGL_R3_SHARED_X86 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibShared-x86$(VBOX_SUFF_LIB)
endif
#
# Check the publisher and version string.
#
# We are being very strict because the version string is visible in various
# APIs and logs and must be machine readable.
#
VBOX_VERSION_COMP_VALID_CHAR_SET = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz()[]{}+-.,
ifneq ($(VBOX_BUILD_PUBLISHER),)
if $(length $(VBOX_BUILD_PUBLISHER)) > 10
$(error VBox: VBOX_BUILD_PUBLISHER must not be longer than 10 characters!)
endif
if "$(substr $(VBOX_BUILD_PUBLISHER), 1, 1)" != "_"
$(error VBox: VBOX_BUILD_PUBLISHER must start with an underscore!)
endif
if "$(translate $(substr $(VBOX_BUILD_PUBLISHER),2),$(VBOX_VERSION_COMP_VALID_CHAR_SET),)" != ""
$(error VBox: VBOX_BUILD_PUBLISHER='$(VBOX_BUILD_PUBLISHER)' contains bad characters! Valid set is:$(NLTAB)$(VBOX_VERSION_COMP_VALID_CHAR_SET))
endif
endif
if $(words $(VBOX_VERSION_STRING)) != 1
$(error VBox: VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' contains spaces or is empty.)
endif
if "$(subst __,-,$(VBOX_VERSION_STRING))" != "$(VBOX_VERSION_STRING)"
$(error VBox: VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' contains double underscores.)
endif
VBOX_VER_TMP1 := $(subst _,$(SP),$(VBOX_VERSION_STRING))
if $(words $(VBOX_VER_TMP1)) > 3
$(error VBox: VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' contains too many parts (underscores), max 3!)
endif
if "$(translate $(word 1,$(VBOX_VER_TMP1)),0123456789,)" != ".."
$(error VBox: The x.y.z part of VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' is malformed: '$(word 1,$(VBOX_VER_TMP1))')
endif
if "$(word 1,$(VBOX_VER_TMP1))" != "$(VBOX_VERSION_STRING_RAW)"
$(error VBox: VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' does not start with VBOX_VERSION_STRING_RAW='$(VBOX_VERSION_STRING_RAW)')
endif
if $(words $(VBOX_VER_TMP1)) == 3 || ($(words $(VBOX_VER_TMP1)) == 2 && "$(VBOX_BUILD_PUBLISHER)" == "")
if "$(substr $(word 2,$(VBOX_VER_TMP1)),1,4)" == "BETA"
VBOX_VER_TMP2 = 5
else if "$(substr $(word 2,$(VBOX_VER_TMP1)),1,5)" == "ALPHA"
VBOX_VER_TMP2 = 6
else if "$(substr $(word 2,$(VBOX_VER_TMP1)),1,2)" == "RC"
VBOX_VER_TMP2 = 3
else
$(error VBox: VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' uses an unknown build type: '$(word 2,$(VBOX_VER_TMP1))')
endif
if "$(translate $(substr $(word 2,$(VBOX_VER_TMP1)),$(VBOX_VER_TMP2)),0123456789)" != ""
$(error VBox: VBOX_VERSION_STRING='$(VBOX_VERSION_STRING)' uses an unknown build type: '$(word 2,$(VBOX_VER_TMP1))')
endif
endif
VBOX_VER_TMP1 :=
VBOX_VER_TMP2 :=
#
# Two targets to coordinate version number changes properly. Note that the
# only way to get a really consistent build is to run 'kmk' in the top-level
# directory. If you don't run it there, you get a consistent sub-tree only.
#
VBOX_BAD_CHAR_SET = ,;:/\$(SP)$(TAB)$(HASH)=![]@%&''()*""<>?^{}|~
VBOX_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),,_)
VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
$(call MSG_GENERATE,,$@)
$(QUIET)$(MKDIR) -p $(@D)
$(QUIET)$(RM) -f $(wildcard $(PATH_OUT)/version-stamp-*)
$(QUIET)$(APPEND) $@ $(VBOX_VERSION_STRING)
$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
$(call MSG_GENERATE,,$@)
$(QUIET)$(MKDIR) -p $(@D)
$(QUIET)$(RM) -f $@ $@.tmp
$(QUIET)$(APPEND) $@.tmp '#ifndef ___version_generated_h___'
$(QUIET)$(APPEND) $@.tmp '#define ___version_generated_h___'
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)'
$(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)'
$(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)'
$(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_STRING_RAW "$(VBOX_VERSION_STRING_RAW)"'
$(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_STRING "$(VBOX_VERSION_STRING)"'
$(QUIET)$(APPEND) $@.tmp '#define VBOX_API_VERSION_STRING "$(VBOX_API_VERSION)"'
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(APPEND) $@.tmp '#endif'
$(QUIET)$(MV) -f $@.tmp $@
VBOX_PACKAGE_HEADER = $(PATH_OUT)/package-generated.h
$(VBOX_PACKAGE_HEADER):
$(call MSG_GENERATE,,$@)
$(QUIET)$(MKDIR) -p $(@D)
$(QUIET)$(RM) -f $@ $@.tmp
$(QUIET)$(APPEND) $@.tmp '#ifndef ___package_generated_h___'
$(QUIET)$(APPEND) $@.tmp '#define ___package_generated_h___'
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(APPEND) $@.tmp '#define VBOX_PACKAGE_STRING "$(VBOX_PACKAGE_STRING)"'
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(APPEND) $@.tmp '#endif'
$(QUIET)$(MV) -f $@.tmp $@
VBOX_PRODUCT_HEADER = $(PATH_OUT)/product-generated.h
$(VBOX_PRODUCT_HEADER): $(VBOX_VERSION_STAMP)
$(call MSG_GENERATE,,$@)
$(QUIET)$(MKDIR) -p $(@D)
$(QUIET)$(RM) -f $@ $@.tmp
$(QUIET)$(APPEND) $@.tmp '#ifndef ___product_generated_h___'
$(QUIET)$(APPEND) $@.tmp '#define ___product_generated_h___'
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(APPEND) $@.tmp '#define VBOX_VENDOR "$(VBOX_VENDOR)"'
$(QUIET)$(APPEND) $@.tmp '#define VBOX_VENDOR_SHORT "$(VBOX_VENDOR_SHORT)"'
$(QUIET)$(APPEND) $@.tmp '#define VBOX_PRODUCT "$(VBOX_PRODUCT)"'
$(QUIET)$(APPEND) $@.tmp '#define VBOX_BUILD_PUBLISHER "$(VBOX_BUILD_PUBLISHER)"'
$(QUIET)$(APPEND) $@.tmp '#define VBOX_C_YEAR "$(VBOX_C_YEAR)"'
$(QUIET)$(APPEND) $@.tmp ''
$(QUIET)$(APPEND) $@.tmp '#endif'
$(QUIET)$(MV) -f $@.tmp $@
#
# Used for external makefiles which cannot include Config.kmk
#
$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
$(call MSG_GENERATE,,$@)
$(QUIET)$(RM) -f $@ $@.tmp
$(QUIET)$(MKDIR) -p $(@D)
$(QUIET)$(APPEND) $@.tmp 'VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)'
$(QUIET)$(APPEND) $@.tmp 'VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)'
$(QUIET)$(APPEND) $@.tmp 'VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)'
$(QUIET)$(APPEND) $@.tmp 'VBOX_VERSION_STRING = $(VBOX_VERSION_STRING)'
$(QUIET)$(APPEND) $@.tmp 'VBOX_VENDOR = $(VBOX_VENDOR)'
$(QUIET)$(APPEND) $@.tmp 'VBOX_VENDOR_SHORT = $(VBOX_VENDOR_SHORT)'
$(QUIET)$(APPEND) $@.tmp 'VBOX_PRODUCT = $(VBOX_PRODUCT)'
$(QUIET)$(APPEND) $@.tmp 'VBOX_C_YEAR = $(VBOX_C_YEAR)'
$(QUIET)$(MV) -f $@.tmp $@
if !defined(VBOX_OSE) && !defined(VBOX_NOINC_LICENSE_VER_KMK)
if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris)
# VBOX_LICENSE_VER is used in several Makefiles
VBOX_LICENSE_VER_KMK = $(PATH_OUT)/license-version.kmk
$(VBOX_LICENSE_VER_KMK): $(VBOX_BRAND_LICENSE_HTML)
$(call MSG_GENERATE,,$(VBOX_LICENSE_VER_KMK))
$(QUIET)$(MKDIR) -p $(@D)
ifdef VBOX_BRAND_LICENSE_VER
$(QUIET)$(RM) -f '$@'
$(APPEND) '$@' 'VBOX_LICENSE_VER=$(VBOX_BRAND_LICENSE_VER)'
else
$(QUIET)$(SED) -e "s/.*License version \([0-9.]*\) *[,&].*/VBOX_LICENSE_VER=\1/;t;d" --output $@ $(VBOX_BRAND_LICENSE_HTML)
endif
-include $(VBOX_LICENSE_VER_KMK)
ifdef VBOX_LICENSE_VER
VBOX_LICENSE_FILES = \
License-$(VBOX_LICENSE_VER).html \
$(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES),License-$(VBOX_LICENSE_VER)-$(f).html)
VBOX_LICENSE_BINS = $(addprefix $(PATH_STAGE_BIN)/,$(VBOX_LICENSE_FILES))
endif
endif
endif
ifndef VBOX_NOINC_MISC
# Force building of the version header file as the first thing anywhere in
# the tree. This eliminates the need for manual dependencies on it.
## @todo there gotta be a better way of doing this.
Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK) $(VBOX_PRODUCT_HEADER) $(VBOX_PACKAGE_HEADER)
endif
#
# Subversion tree revision.
#
# The VBOX_SVN_REV contains our best guess. Use svn info on the root of the
# tree to determine this it if .svn/wc.db or .svn/entries is found (the former
# also up to two directory levels higher to allow for checkouts of the entire
# repository), otherwise fall back on the Config.kmk revision.
#
# Makefile rules using this information shall list $(VBOX_SVN_REV_KMK) as a
# prerequisite.
#
SVN ?= svn$(HOSTSUFF_EXE)
VBOX_SVN_REV_KMK = $(PATH_OUT)/revision.kmk
ifndef VBOX_SVN_REV
VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev$ )
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))
ifeq ($(which $(SVN)),)
VBOX_SVN_DEP :=
endif
# Rule for generating a timestamp and updating the real thing on change.
$(VBOX_SVN_REV_KMK).ts +| $(VBOX_SVN_REV_KMK): $(if $(VBOX_SVN_DEP), $(VBOX_SVN_DEP), $(PATH_ROOT)/Config.kmk)
$(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
$(QUIET)$(RM) -f $@ $@.tmp
$(QUIET)$(MKDIR) -p $(@D)
ifneq ($(VBOX_SVN_DEP),)
$(REDIRECT) -E 'LC_ALL=C' -wo $@.tmp -- $(SVN) info $(PATH_ROOT)
$(SED) -e '/^Last Changed Rev/!d' -e 's/Last Changed Rev\: */export VBOX_SVN_REV=/' --output $@ $@.tmp
$(QUIET)$(RM) -f $@.tmp
else
$(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV_FALLBACK)'
endif
$(QUIET)$(CP) --changed -fv $@ $(VBOX_SVN_REV_KMK)
ifndef VBOX_NOINC_SVN_REV_KMK
include $(VBOX_SVN_REV_KMK)
endif
else
# allow to overwrite VBOX_SVN_REV externally (mainly for building .debs/.rpms)
$(VBOX_SVN_REV_KMK):
$(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
$(QUIET)$(RM) -f $@
$(QUIET)$(MKDIR) -p $(@D)
$(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV)'
$(QUIET)echo '* $(VBOX_SVN_REV_KMK) was externally overwritten:'
$(QUIET)$(CAT) $(VBOX_SVN_REV_KMK)
endif
# only needed for VBoxGuest for Linux/FreeBSD guests
VBOX_SVN_REV_HEADER = $(PATH_OUT)/revision-generated.h
$(VBOX_SVN_REV_HEADER): $(VBOX_SVN_REV_KMK)
$(call MSG_GENERATE,,$@)
$(QUIET)$(RM) -f $@ $@.tmp
$(QUIET)$(MKDIR) -p $(@D)
$(QUIET)$(APPEND) $@.tmp '#define VBOX_SVN_REV $(VBOX_SVN_REV)'
$(QUIET)$(MV) -f $@.tmp $@
#
# Shared definitions of the XIDL file to use as a source for
# generating various other files (VBoxSVC, webservice, docs, front-ends, ...)
#
# Real XIDL source file; from this we strip the <desc> elements to generate
# a second XIDL file, from which the COM/XPCOM IDL files are then generated:
VBOX_XIDL_FILE_SRC = $(PATH_ROOT)/src/VBox/Main/idl/VirtualBox.xidl
# second XIDL file to use as source for COM/XPCOM IDL (with stripped docs):
VBOX_XIDL_FILE = $(PATH_OUT)/obj/VirtualBox_stripped.xidl
# Java stuff.
ifeq ($(KBUILD_TARGET), darwin)
VBOX_JAVA_COMMANDS = $(firstword $(wildcard \
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands \
$(if-expr $(VBOX_XCODE_VERSION_MAJOR) >= 4,/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands,) \
) /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands)
VBOX_JAVAC = $(VBOX_JAVA_COMMANDS)/javac
VBOX_JAVAH = $(VBOX_JAVA_COMMANDS)/javah
VBOX_JAR = $(VBOX_JAVA_COMMANDS)/jar
VBOX_JAVADOC = $(VBOX_JAVA_COMMANDS)/javadoc
VBOX_WSIMPORT = $(VBOX_JAVA_COMMANDS)/wsimport
if $(VBOX_XCODE_VERSION_MAJOR) >= 4 # Lion (4.1-preview 5) has a broken CurrentJDK link. Blindly applying it to 4.0.
VBOX_JAVA_INC = $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers
else
VBOX_JAVA_INC = $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Headers
endif
else
ifeq ($(KBUILD_TARGET),linux)
ifeq ($(origin VBOX_JAVA_HOME),undefined)
# Add correct detection for you distro after the /usr/../java-6-sun line.
VBOX_JAVA_HOME := $(firstword $(wildcard \
$(KBUILD_DEVTOOLS)/linux.x86/jdk1.6.0_27 \
\
endif
endif
ifeq ($(KBUILD_TARGET),solaris)
# VBOX_JAVA_HOME ?= /usr/jdk/jdk1.6.0
VBOX_JAVA_HOME ?= /usr/java
endif
ifeq ($(KBUILD_TARGET),win)
VBOX_JAVA_HOME ?= c:/jdk
endif
VBOX_JAVAC = $(VBOX_JAVA_HOME)/bin/javac
VBOX_JAVAH = $(VBOX_JAVA_HOME)/bin/javah
VBOX_JAR = $(VBOX_JAVA_HOME)/bin/jar
VBOX_JAVADOC = $(VBOX_JAVA_HOME)/bin/javadoc
VBOX_WSIMPORT = $(VBOX_JAVA_HOME)/bin/wsimport
# correct for targets we care about
VBOX_MD_OS = $(KBUILD_TARGET)
VBOX_JAVA_INC = \
$(VBOX_JAVA_HOME)/include \
$(VBOX_JAVA_HOME)/include/$(VBOX_MD_OS)
endif
#
# VBOX_SEP needs to be quoted when used on the shell command line.
#
if1of ($(KBUILD_TARGET), os2 win)
VBOX_SEP = $(SEMICOLON)
else
VBOX_SEP = $(COLON)
endif
VBOX_JAVAC_OPTS = -encoding UTF-8 -source 1.5 -target 1.5 -Xlint:unchecked
VBOX_JAVADOC_OPTS = -encoding UTF-8
#
# Legacy.
#
## @todo try remove this.
ifneq ($(LOCALCFG),)
include $(LOCALCFG)
endif
#
# Some extra goals.
#
.PHONY: up update st stat status
up update::
$(SVN) up
up2 update2::
$(SVN) up --ignore-externals
st stat status:
$(SVN) status
quick:
$(MAKE) VBOX_QUICK=1