# $Id: Config.kmk 99480 2023-04-20 08:30:37Z vboxsync $ ## @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-2023 Oracle and/or its affiliates. # # This file is part of VirtualBox base platform packages, as # available from https://www.virtualbox.org. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation, in version 3 of the # License. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # SPDX-License-Identifier: GPL-3.0-only # # 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/ KBUILD_UNIT_PATHS = $(KBUILD_DEVTOOLS)/kBuildUnits/ # 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 ## 'asan' builds # Same as release builds, except that some form of address sanitizer (e.g. # VBOX_WITH_GCC_SANITIZER=1 or VBOX_WITH_EF_WRAPS) is enabled. In addition # RT_STRICT and VBOX_STRICT are defined so assertions and sanity checks will # also be enabled (mainly for not needing to build+test strict builds separately). KBUILD_BLD_TYPES += asan BLD_TYPE_asan_EXTENDS = release BLD_TYPE_asan_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_UNATTENDED_TEMPLATES = $(INST_BIN)UnattendedTemplates/ 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_UNATTENDED_TEMPLATES = $(INST_BIN)UnattendedTemplates/ 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)) VBOX_PATH_TOOLS = $(patsubst %/,%,$(PATH_STAGE)/$(VBOX_INST_TOOLS)) # # Some source paths of global interest. # VBOX_PATH_SRC_CERTIFICATES = $(PATH_ROOT)/src/VBox/HostDrivers/Support/Certificates # # 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)) VBOX_MIN_KMK_REVISION := 3093 VBOX_MIN_KBUILD_KMK_REVISION := $(if-expr "$(KBUILD_HOST)" == "win",3097,$(if-expr "$(KBUILD_HOST).$(KBUILD_HOST_ARCH)" == "solaris.sparc64",2511,3074)) if $(KMK_REVISION) >= $(VBOX_MIN_KMK_REVISION) if $(KBUILD_KMK_REVISION) >= $(VBOX_MIN_KBUILD_KMK_REVISION) # OK. else $(error You must update kBuild! Requires kBuild binaries $(VBOX_MIN_KBUILD_KMK_REVISION) or later, kmk says $(KBUILD_KMK_REVISION) ($(KBUILD_VERSION))) endif else $(error You must update kBuild! Requires kBuild revision $(VBOX_MIN_KMK_REVISION) 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)) # Keep counting _MAJOR past 19.x (macOS 10.15.x) to simplify dealing with macOS 11.x. 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)) if $(VBOX_DARWIN_HOST_VERSION_MAJOR) <= 15 VBOX_DARWIN_HOST_VERSION := 10.$(VBOX_DARWIN_HOST_VERSION_MAJOR).$(VBOX_DARWIN_HOST_VERSION_MINOR) else VBOX_DARWIN_HOST_VERSION := 11.$(expr $(VBOX_DARWIN_HOST_VERSION_MAJOR) - 16).$(VBOX_DARWIN_HOST_VERSION_MINOR) endif endif include $(PATH_ROOT)/Version.kmk # 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) # VBOX_VERSION_STRING without the publisher. VBOX_VERSION_STRING_NO_PUB = $(VBOX_VERSION_STRING_RAW)$(addprefix _,$(VBOX_VERSION_PRERELEASE)) # 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_NO_PUB)$(VBOX_BUILD_PUBLISHER) ## Make a numeric value from the major, minor and build numbers (params) VBOX_FULL_VERSION_MAKE = $(expr ($1 << 24) | ($2 << 16) | $3) ## Checks if the current VBox version is higher or equal to the major, minor and # build numbers given as parameters. # @returns 1 if true, 0 if false. For use with 'if'. VBOX_VERSION_PREREQ = $(expr $(call VBOX_FULL_VERSION_MAKE,$(VBOX_VERSION_MAJOR),$(VBOX_VERSION_MINOR),$(VBOX_VERSION_BUILD)) \ >= $(call VBOX_FULL_VERSION_MAKE,$1,$2,$3)) # Force the additions.sh script to get an exact additions build when we're doing the release. if $(VBOX_VERSION_BUILD) % 2 == 0 ifeq ($(VBOX_VERSION_PRERELEASE),) VBOX_RELEASE_EXACT_MATCH = 1 endif 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 and/or its affiliates 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/Devices/PC/PXE/client/uinit.asm # src/VBox/RDP/webclient/flash/com/sun/network/rdp/Version.as # src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp # src/VBox/Frontends/VirtualBox/src/settings/global/VBoxGLSettingsLanguage.cpp # src/VBox/Frontends/VirtualBox/nls/*.ts # debian/control # src/VBox/Installer/linux/{debian,rpm} # src/VBox/Installer/linux/virtualbox.desktop # src/VBox/Additions/WINNT/Installer/ISO/ReadmeDrivers.txt # src/VBox/Main/nls/*.ts # src/VBox/ExtPacks/Puel/nls/*.ts # src/VBox/Frontends/VBoxManage/nls/*.ts # */*.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) # Supported VirtualBox host architectures. VBOX_SUPPORTED_HOST_ARCHS := amd64 if1of ($(KBUILD_TARGET), darwin) # Work in progress. VBOX_SUPPORTED_HOST_ARCHS += arm64 endif # # The VirtualBox Configuration Defaults. # # We try to document all the build configuration options here, things which # aren't enabled by default are left commented out just to show that they # exist and which value they should have (usually 1, but anyway). # # 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 # Select new Xcode based on host OS X version. ifeq ($(KBUILD_HOST),darwin) if "$(KBUILD_TARGET_ARCH)" == "arm64" VBOX_WITH_EVEN_NEWER_XCODE := 1 else if !defined(VBOX_WITH_EVEN_NEWER_XCODE) && !defined(VBOX_WITHOUT_EVEN_NEWER_XCODE) && !defined(VBOX_WITH_NEW_XCODE) && $(KBUILD_HOST_VERSION_MAJOR) >= 16 # (OS X 10.12 Sierra) VBOX_WITH_EVEN_NEWER_XCODE := 1 else if !defined(VBOX_WITH_NEW_XCODE) && !defined(VBOX_WITHOUT_NEW_XCODE) && $(KBUILD_HOST_VERSION_MAJOR) >= 13 # (OS X 10.9 Mavericks) VBOX_WITH_NEW_XCODE := 1 endif endif # Select new VC++ on Windows. VBOX_WITH_NEW_VCC = 1 # Use this to disable control flow. #VBOX_WITHOUT_CONTROL_FLOW_GUARD = 1 # Select Windows 11 SDK. VBOX_WITH_NEW_WINDOWS_SDK = 1 # Select Windows 11 DDK. VBOX_WITH_NEW_WINDOWS_DDK = 1 # Don't use the compiler CRT for statically linked modules, use IPRT with some # additional CRT functionality. # Note! This has only been tested with Visual C++ 2019. if "$(KBUILD_TARGET)" == "win" && "$(KBUILD_TYPE)" != "asan" VBOX_WITH_NOCRT_STATIC := 1 endif ## @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. # On linux we build this as a test case instead. # Skip for darwin.arm64 for now. if "$(KBUILD_TARGET)" != "linux" && "$(intersects $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.arm64)" == "" 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 # Don't include any CRTs. # For Windows hosts this would be the MS Visual Studio Redistributable (2019). VBOX_WITH_CRT_PACKING = # 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 ## @} # Set build options right for building the Additions as an RPM package. # VBOX_ONLY_RPM_ADDITIONS = 1 ifdef VBOX_ONLY_RPM_ADDITIONS VBOX_ONLY_ADDITIONS = 1 VBOX_ONLY_ADDITIONS_WITHOUT_RTISOMAKER = 1 # We build the RPMs using public sources. VBOX_OSE = 1 # We want to re-use parts of the packing pass, but not all. VBOX_WITHOUT_LINUX_GUEST_PACKAGE = 1 VBOX_WITHOUT_ADDITIONS_ISO = 1 endif ## @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 # Build QHelp documentation, needs qhelpgenerator VBOX_WITH_DOCS_QHELP = 1 # Include QHelp documentation in the package VBOX_WITH_DOCS_QHELP_PACKING = 1 # 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 # The French translation is too outdated to be useful, needs a fresh start. #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 VT-x & AMD-V execution manager (HM). if "$(KBUILD_TARGET)" == "amd64" && !defined(VBOX_WITHOUT_HWVIRT) VBOX_WITH_HWVIRT := 1 endif # Enable .r0 modules. if "$(KBUILD_TARGET_ARCH)" == "amd64" VBOX_WITH_R0_MODULES := 1 endif # 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 # Nested hardware virtualization (64-bit hosts only). ifeq ($(KBUILD_TARGET_ARCH),amd64) # Enables SVM nested hardware virtualization support. VBOX_WITH_NESTED_HWVIRT_SVM = 1 # Enables VMX nested hardware virtualization support. VBOX_WITH_NESTED_HWVIRT_VMX = 1 # Enables nested hardware virtualization support but only in IEM. #VBOX_WITH_NESTED_HWVIRT_ONLY_IN_IEM = 1 ifdef VBOX_WITH_NESTED_HWVIRT_ONLY_IN_IEM if !defined(VBOX_WITH_NESTED_HWVIRT_SVM) && !defined(VBOX_WITH_NESTED_HWVIRT_VMX) $(error VBOX_WITH_NESTED_HWVIRT_ONLY_IN_IEM defined without enabling nested VMX or nested SVM support) endif endif # Enables guest EPT support for VMX nested hardware virtualization. ifn1of ($(KBUILD_TARGET), darwin) VBOX_WITH_NESTED_HWVIRT_VMX_EPT = 1 endif if defined(VBOX_WITH_NESTED_HWVIRT_VMX_EPT) && !defined(VBOX_WITH_NESTED_HWVIRT_VMX) $(error VBOX_WITH_NESTED_HWVIRT_VMX_EPT requires VBOX_WITH_NESTED_HWVIRT_VMX) endif endif # Enable the TLBs in IEM (experimental). if1of ($(KBUILD_TARGET_ARCH), arm64) VBOX_WITH_IEM_TLB := 1 endif # Enable native NEM on windows and macOS. if1of ($(KBUILD_TARGET), win darwin) VBOX_WITH_NATIVE_NEM = 1 endif # Enable NEM fallback if the driver is not available. if1of ($(KBUILD_TARGET), darwin) VBOX_WITH_DRIVERLESS_NEM_FALLBACK = 1 endif # Enable forced driverless mode by default. if1of ($(KBUILD_TARGET), darwin) VBOX_WITH_DRIVERLESS_FORCED = 1 VBOX_WITH_INTNET_SERVICE_IN_R3 = 1 endif # Enables the new breakpoint handling code, see @bugref{8650} VBOX_WITH_DBGF_FLOW_TRACING = 1 # Enables ARMv8 virtualization, see @bugref{10383} if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.arm64) VBOX_WITH_VIRT_ARMV8 = endif ## @} ## @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 # 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 the Virtio SCSI device. VBOX_WITH_VIRTIO_SCSI = 1 # HDA emulation is Intel HDA by default. VBOX_WITH_INTEL_HDA = 1 ifn1of ($(KBUILD_TARGET), win darwin) # Enable OSS audio support. VBOX_WITH_AUDIO_OSS = 1 endif if1of ($(KBUILD_TARGET), linux) # Enable ALSA audio support. VBOX_WITH_AUDIO_ALSA = 1 endif if1of ($(KBUILD_TARGET), linux) # Enable PulseAudio audio support. VBOX_WITH_AUDIO_PULSE = 1 endif # Enable building debugging backend. # Only will be used at runtime when "VBoxInternal2/Audio/Debug/Enabled" (VM / global) is set. VBOX_WITH_AUDIO_DEBUG = 1 # Enables the audio endpoint detection on Windows hosts. VBOX_WITH_AUDIO_MMNOTIFICATION_CLIENT = 1 # Enable PCI passthrough support. # (disabled with 6.1, since it's not complete/useful enough) VBOX_WITH_PCI_PASSTHROUGH = # 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 # 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 linux win) VBOX_WITH_VMSVGA3D = 1 endif # Enable vmsvga (svga2) graphics device variant, 3D part, VGPU10 DX commands ifdef VBOX_WITH_VMSVGA3D VBOX_WITH_VMSVGA3D_DX = 1 # Enable DXVK library for supporting VGPU10 DX on non Windows hosts if1of ($(KBUILD_TARGET), linux darwin) VBOX_WITH_DXVK = 1 endif endif # Enable the generic 3D settings support if at least one 3D capable solution is enabled ifdef VBOX_WITH_VMSVGA3D VBOX_WITH_3D_ACCELERATION = 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 # Lazy developer!! VBOXWDDM_WITH_VBVA = 1 # Lazy developer!! ifdef VBOX_WITH_WDDM VBOX_WITH_VDMA = 1 else ifdef VBOX_WITH_VDMA undefine VBOX_WITH_VDMA endif # Gallium based WDDM driver if1of ($(KBUILD_TARGET), win) VBOX_WITH_MESA3D = 1 endif # VGPU10 UMD driver for Vista+ guests in the guest additions installer ifdef VBOX_WITH_VMSVGA3D_DX if1of ($(KBUILD_TARGET), win) VBOX_WITH_WDDM_DX = 1 endif endif # Disable the Intel PXE ROM (uses Etherboot). VBOX_WITH_INTEL_PXE = # Enable EFI support VBOX_WITH_EFI = 1 # Enable Secure Boot in the EFI firmware. VBOX_WITH_EFI_SECURE_BOOT = 1 # Enable TPM support in the EFI firmware. VBOX_WITH_EFI_TPM = 1 # Embed the EFI firmwares in VBoxDD2.dll/dylib/so. VBOX_WITH_EFI_IN_DD2 = 1 # Fetch EFI firmware image from the build server #VBOX_WITH_EFIFW_FROM_BUILD_SERVER = 1 # Include the EFI firmware into the package ifndef VBOX_WITH_EFI_IN_DD2 VBOX_WITH_EFIFW_PACKING = 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 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 ## @bugref{9218}: Disabled awaiting conversion of the device to new PDM device style. #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 unattended installation API VBOX_WITH_UNATTENDED = 1 # 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 # NVMe device emulation VBOX_WITH_NVME_IMPL = 1 # Storage related debug drivers VBOX_WITH_DRV_DISK_INTEGRITY = 1 # Enables the AMD IOMMU VBOX_WITH_IOMMU_AMD = 1 # Enables the Intel IOMMU VBOX_WITH_IOMMU_INTEL = 1 # Enables the new DBGF tracing framework VBOX_WITH_DBGF_TRACING = 1 # Enable TPM device emulation support. VBOX_WITH_TPM = 1 # Enable libtpms, required for the in process TPM emulation. if1of ($(KBUILD_TARGET), linux darwin win solaris) VBOX_WITH_LIBTPMS = 1 endif ## @} # 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 VBOX_WITH_GUEST_INSTALLER_UNICODE = 1 # The kernel driver/module and related runtime libraries. # On Linux we build this as a test case instead. # On darwin we don't use a support driver. if "$(KBUILD_TARGET)" != "linux" && "$(KBUILD_TARGET)" != "darwin" VBOX_WITH_VBOXDRV = 1 endif # The main api. VBOX_WITH_MAIN = 1 # Enables proxy stub for MS COM (speeds up setting IPC for objects). # (The VBOX_MIDL_PROXY_CLSID and VBOX_MIDL_PROXY_CLSID_IS are just two # representations of the class ID for the proxy stub.) VBOX_WITH_MIDL_PROXY_STUB = 1 VBOX_MIDL_PROXY_CLSID := {0bb3b78c-1807-4249-5ba5-ea42d66af0bf} VBOX_MIDL_PROXY_CLSID_IS := {0x0bb3b78c,0x1807,0x4249,{0x5b,0xa5,0xea,0x42,0xd6,0x6a,0xf0,0xbf}} # 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) && !defined(VBOX_ONLY_EXTPACKS) VBOX_WITH_32_ON_64_MAIN_API = 1 endif endif # Whether to generate a database of USB vendor IDs and device IDs into VBoxSVC. VBOX_WITH_MAIN_USB_ID_DATABASE = 1 # Whether to enable error message translation in Main. ifndef VBOX_ONLY_BUILD VBOX_WITH_MAIN_NLS = 1 endif # Whether to enable error message translation in Extension VM Pack. if !defined(VBOX_ONLY_BUILD) || defined(VBOX_ONLY_EXTPACKS) VBOX_WITH_PUEL_NLS = 1 endif # Whether to enable message translation in VBoxManage. #ifndef VBOX_ONLY_BUILD VBOX_WITH_VBOXMANAGE_NLS = 1 #endif # 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 # The webservices api. VBOX_WITH_WEBSERVICES = 1 VBOX_WITH_WEBSERVICES_SSL = 1 # The Qt GUI. VBOX_WITH_QTGUI = 1 # Indicates the Qt is Cocoa based on the Mac. ifeq ($(KBUILD_TARGET),darwin) VBOX_WITH_COCOA_QT = 1 endif # Use Qt6 instead of Qt5. if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.arm64) VBOX_WITH_QT6 := 1 endif # Enable the QHelp based help function in UI. if1of ($(KBUILD_TARGET), darwin linux solaris win) VBOX_WITH_QHELP_VIEWER = 1 endif # VBox Ballooning Control frontend. VBOX_WITH_FE_BALLOONCTRL = 1 # VBox Autostart Service. VBOX_WITH_FE_AUTOSTART = 1 # VBox Bug Report tool. VBOX_WITH_FE_BUGREPORT = 1 # Enable this to get the SDL based GUI built. Mostly useful for development # purposes. For production use it's recommended to use the Qt GUI which can # be also stripped down. See VBOX_WITH_QTGUI. VBOX_WITH_VBOXSDL = # Start VBoxSVC in windows session 0 (services session). VBOX_WITH_VBOXSVC_SESSION_0 = 1 # 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 # The basic frontend not using Main/COM/XPCOM. #VBOX_WITH_VBOXBFE = 1 # Enables the Python<->XPCOM, Python<->COM and (WS enabled) Python<->WS bindings. VBOX_WITH_PYTHON ?= 1 # Enables the PERL<->WS binding (if WS enabled). #VBOX_WITH_PERL ?= 1 # Enables the PHP<->WS binding (if WS enabled). VBOX_WITH_PHP ?= 1 if1of ($(KBUILD_TARGET), darwin linux solaris) # Enable Java<->XPCOM bridge + glue code VBOX_WITH_JXPCOM ?= 1 endif if1of ($(KBUILD_TARGET), ) # scm:ignore-empty-if1of-set # 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 (only up to 3.2, # unless VBOX_WITH_ONLY_PYTHON_LIMITED_API is overridden). VBOX_WITH_MULTIVERSION_PYTHON ?= 1 # Only build the limited Python extension API version for 3.3 and later. VBOX_WITH_ONLY_PYTHON_LIMITED_API = 1 # Build the Validation Kit. VBOX_WITH_VALIDATIONKIT = 1 # Include unit tests (testcases) on the Validation Kit .ISO # so that we can perform testing on older platforms which we don't support # on the host anymore. if1of ($(KBUILD_TARGET), darwin.amd64 linux win) VBOX_WITH_VALIDATIONKIT_UNITTESTS_PACKING = 1 endif # Set if we should ship the audio test from the Validation Kit with the host installer. VBOX_WITH_HOST_SHIPPING_AUDIO_TEST = 1 # Set if we should ship the audio test from the Validation Kit with the guest additions. VBOX_WITH_ADDITIONS_SHIPPING_AUDIO_TEST = 1 # Build the testcases. VBOX_WITH_TESTCASES = 1 # Enable this to build vbox-img even if VBOX_WITH_TESTCASES is disabled VBOX_WITH_VBOX_IMG = # Enables recording support. VBOX_WITH_RECORDING = 1 # Enable VPX (VP8 / VP9 codec), required for video capturing. VBOX_WITH_LIBVPX = 1 # Enables audio support for recording (depends on VBOX_WITH_RECORDING). VBOX_WITH_AUDIO_RECORDING = 1 if defined(VBOX_WITH_AUDIO_RECORDING) && !defined(VBOX_WITH_RECORDING) $(error Audio recording (VBOX_WITH_AUDIO_RECORDING) needs the general recording feature (VBOX_WITH_RECORDING) enabled) endif # Enables libvorbis (Ogg Vorbis), required for encoding audio into the recorded data. VBOX_WITH_LIBVORBIS = 1 # Enables libogg (Ogg file format). Required for building libvorbis above. VBOX_WITH_LIBOGG = 1 if defined(VBOX_WITH_LIBVORBIS) && !defined(VBOX_WITH_LIBOGG) $(error Need libogg (VBOX_WITH_LIBOGG) in order to build libvorbis (VBOX_WITH_LIBVORBIS)) endif # Enable shared folders VBOX_WITH_SHARED_FOLDERS = 1 # Enable shared clipboard VBOX_WITH_SHARED_CLIPBOARD = 1 # Enable shared clipboard (file) transfers #if1of ($(KBUILD_TARGET), win linux) # VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS = 1 # if1of ($(KBUILD_TARGET), linux) # VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS_HTTP = 1 # endif #endif # 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 # Enables support for handling certain commands via the built-in (busybox-like) toolbox in VBoxService. See @bugref{9783} # This is for supporting Guest Additions < 7.1. VBOX_WITH_GSTCTL_TOOLBOX_SUPPORT = 1 # Enables treating the toolbox as built-in commands. Requires 7.1 Guest Additions. See @bugref{9783} VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS = 1 endif # Enable ballooning VBOX_WITH_MEMBALLOON = 1 # Enable cURL (required for the network part of the GUI) VBOX_WITH_LIBCURL = 1 # Enable libssh (required for cloud network attachment) if1of ($(KBUILD_TARGET), darwin linux win) VBOX_WITH_LIBSSH = 1 endif # Enable Host=>Guest Drag'n'Drop if1of ($(KBUILD_TARGET), darwin linux solaris win) VBOX_WITH_DRAG_AND_DROP = 1 if1of ($(KBUILD_TARGET), darwin linux solaris win) VBOX_WITH_DRAG_AND_DROP_GH = $(VBOX_WITH_DRAG_AND_DROP) endif ifdef VBOX_WITH_DRAG_AND_DROP_GH ifeq ($(KBUILD_TARGET),darwin) # On OS X (Darwin) this needs to be set in order to get proper # guest->host support. # Note: Setting this requires Qt also having this feature enabled! VBOX_WITH_DRAG_AND_DROP_PROMISES = $(VBOX_WITH_DRAG_AND_DROP) endif endif endif # Enable audio support for VRDE. VBOX_WITH_AUDIO_VRDE = 1 ifdef VBOX_WITH_VALIDATIONKIT # Ship the Validation Kit audio driver for running tests (driver disabled by default). VBOX_WITH_AUDIO_VALIDATIONKIT = 1 endif # Use the VRDE external authentication library from VBoxSVC. if1of ($(KBUILD_TARGET), win) VBOX_WITH_VRDEAUTH_IN_VBOXSVC = 1 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 # Enables full VM encryption support @bugref{9955}. VBOX_WITH_FULL_VM_ENCRYPTION = 1 # Enables the 'sign' command in bldRTSignTool. We may need this on windows. if1of ($(KBUILD_TARGET), win) VBOX_WITH_BLD_RTSIGNTOOL_SIGNING = 1 endif # Enables support for liblzma inside of IPRT. VBOX_WITH_LIBLZMA = 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 win) 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 # Use new VBoxNetDhcpd instead of old VBoxNetDHCP VBOX_WITH_DHCPD = 1 # Experimental suport for cloud network integration (depends on libssh) ifdef VBOX_WITH_LIBSSH VBOX_WITH_CLOUD_NET = 1 endif # Use Mac OS X VMNET API instead of network kernel extensions VBOX_WITH_VMNET = 1 ## @} ## @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 ## @{ # 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) if1of ($(KBUILD_TARGET_ARCH), x86 amd64) ## @todo bugref:9898 VBOX_WITH_DTRACE_R3 := 1 VBOX_WITH_DTRACE_R3_MAIN := 1 endif endif # Set this to enable kernel driver dtrace probes. if1of ($(KBUILD_TARGET), darwin solaris) if1of ($(KBUILD_TARGET_ARCH), x86 amd64) ## @todo bugref:9898 VBOX_WITH_DTRACE_R0DRV := 1 endif endif # Set this to enable dtrace probes in platform agnostic kernel code. ifn1of ($(KBUILD_TARGET), os2) if1of ($(KBUILD_TARGET_ARCH), x86 amd64) ## @todo bugref:9898 VBOX_WITH_DTRACE_R0 := 1 endif endif # Set this to enable dtrace probes raw-mode context code. if1of ($(KBUILD_TARGET), linux solaris) if1of ($(KBUILD_TARGET_ARCH), x86 amd64) ## @todo bugref:9898 VBOX_WITH_DTRACE_RC := 1 endif 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) if1of ($(KBUILD_TARGET_ARCH), x86 amd64) ## @todo bugref:9898 VBOX_WITH_NATIVE_DTRACE := 1 endif endif # Makes it possible to run some of the testcases and tools on older # windows versions (only define when buildling win.x86). #VBOX_WITH_MORE_NT4_COMPAT_BINARIES = 1 # Set this to enable building of the vboximg-mount FUSE mounting utility. if1of ($(KBUILD_TARGET), darwin linux) VBOX_WITH_VBOXIMGMOUNT = 1 endif # Set this to enable packaging the fuse related bits into our installer. # Newer versions prohibit from distributing with commercial software @bugref{8515} #if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.amd64) # VBOX_WITH_FUSE_PACKING = 1 #endif # Enables updating checking through Main. # Only available if cURL is being used. ifdef VBOX_WITH_LIBCURL VBOX_WITH_UPDATE_AGENT = 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) if1of ($(KBUILD_TARGET_ARCH), amd64 x86) VBOX_WITH_OPEN_WATCOM := 1 endif 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), freebsd linux netbsd openbsd solaris) # duplicated further down 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 ifdef VBOX_WITH_VBOXDRV # Enable image verification on darwin @bugref{9232}. VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION = 1 endif ## @} # 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. # In rpm Additions we also need to do part of packing without strip. ifndef VBOX_ONLY_RPM_ADDITIONS VBOX_DO_STRIP := $(if $(filter release profile,$(KBUILD_TYPE)),1,) endif # # 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 ## VBoxSDS is the bridge windows service that sits between # VirtualBox object client and VBoxSVC that fixes problem # when multiple VBoxSVC starts for the same user # it is enabled for windows build only ifeq ($(KBUILD_TARGET),win) VBOX_WITH_SDS = 1 endif # # Branding # VBOX_BRAND_BIOS_LOGO := $(PATH_ROOT)/src/VBox/Devices/Graphics/BIOS/puel_logo.bmp VBOX_BRAND_LICENSE_HTML := $(PATH_ROOT)/doc/License-gpl-3.0.html VBOX_BRAND_LICENSE_RTF := $(PATH_ROOT)/doc/License-gpl-3.0.rtf VBOX_BRAND_LICENSE_TXT := $(PATH_ROOT)/doc/License-gpl-3.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_X2_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about_x2.png VBOX_BRAND_GUI_ABOUT_X3_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about_x3.png VBOX_BRAND_GUI_ABOUT_X4_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about_x4.png VBOX_BRAND_GUI_ABOUT_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about_16px.png VBOX_BRAND_GUI_ABOUT_16PX_X2_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about_16px_x2.png VBOX_BRAND_GUI_ABOUT_16PX_X3_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about_16px_x3.png VBOX_BRAND_GUI_ABOUT_16PX_X4_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about_16px_x4.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/Artwork/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_ADDITIONS = VBOX_WITH_VALIDATIONKIT = VBOX_WITH_TESTCASES = VBOX_WITH_VBOXSDL = VBOX_WITH_HEADLESS = VBOX_WITH_VRDP = VBOX_WITH_VRDP_RDESKTOP = VBOX_WITH_DOCS = VBOX_WITH_WEBSERVICES = VBOX_WITH_32_ON_64_MAIN_API = endif # VBOX_QUICK # Only AMD64 is supported for the main product, so disable most of the other bits. ifn1of ($(KBUILD_TARGET_ARCH), $(VBOX_SUPPORTED_HOST_ARCHS)) VBOX_WITH_MAIN = VBOX_WITH_QTGUI = VBOX_WITH_VBOXSDL = VBOX_WITH_VBOXHEADLESS = VBOX_WITH_WEBSERVICES = VBOX_WITH_DEBUGGER_GUI = endif ifeq ($(KBUILD_TARGET),darwin) VBOX_WITH_VRDP_RDESKTOP = # Permanent (no working SDL). VBOX_WITH_VBOXSDL = ifeq ($(KBUILD_TARGET_ARCH),arm64) # No Qt yet, so no GUI, NLS or qhelp. VBOX_WITH_NLS := VBOX_WITH_MAIN_NLS := VBOX_WITH_PUEL_NLS := VBOX_WITH_VBOXMANAGE_NLS := VBOX_WITH_DOCS_QHELP := VBOX_WITH_DOCS_QHELP_PACKING := # Skip webservices as those are tedious to build. VBOX_WITH_WEBSERVICES := # Ditto for the java<->XPCOM bridge. VBOX_WITH_JXPCOM := endif ifdef VBOX_WITH_DRIVERLESS_FORCED # No need for hardening when not using the driver. VBOX_WITH_HARDENING := endif endif ifeq ($(KBUILD_TARGET),freebsd) VBOX_WITH_DOCS = endif ifeq ($(KBUILD_TARGET),haiku) 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_HARDENING = endif ifeq ($(KBUILD_TARGET),os2) VBOX_WITH_WEBSERVICES = VBOX_WITH_INSTALLER = 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_HARDENING = endif ifeq ($(KBUILD_TARGET),win) VBOX_WITH_VRDP_RDESKTOP = endif ifn1of ($(KBUILD_TARGET_ARCH), x86 amd64 arm64) VBOX_WITH_ADDITION_DRIVERS = 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_MAIN = VBOX_WITH_PDM_ASYNC_COMPLETION = VBOX_WITH_QTGUI = VBOX_WITH_RAW_MODE = 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_NEW := $(strip $(foreach x, ADDITIONS DOCS EXTPACKS SDK VALIDATIONKIT \ , $(if-expr defined(VBOX_ONLY_$(x)),VBOX_ONLY_$(x)))) ifneq ($(VBOX_ONLY_BUILD),$(VBOX_ONLY_BUILD_NEW)) $(error VBox: LocalConfig.kmk changed the VBOX_ONLY_ build status, VBOX_ONLY_* must be on the kmk command line or in the environment: $(VBOX_ONLY_BUILD) -> $(VBOX_ONLY_BUILD_NEW)) endif # # Enforce VBOX_WITH_NLS. It controls all NLS (except the GUI at the moment). # if defined(VBOX_WITH_MAIN_NLS) || defined(VBOX_WITH_PUEL_NLS) || defined(VBOX_WITH_VBOXMANAGE_NLS) VBOX_WITH_NLS := 1 ifndef VBOX_WITH_NLS # (We test again to account for 'override VBOX_WITH_NLS :=') VBOX_WITH_MAIN_NLS := VBOX_WITH_PUEL_NLS := VBOX_WITH_VBOXMANAGE_NLS := endif endif # # For the docs build box. # ifdef VBOX_ONLY_DOCS # Always produce HTML docs (for publishing on website as part of release) VBOX_WITH_DOCS_HTML = 1 # Always produce QHelp docs (for help in the UI, replacing CHM) VBOX_WITH_DOCS_QHELP = 1 VBOX_WITH_TOOLS_QT_LINUX = 1 endif # # Disable components that are not open sourced. # ifdef VBOX_OSE VBOX_WITH_VRDP = VBOX_WITH_USB_VIDEO_IMPL = VBOX_WITH_NVME_IMPL = VBOX_WITH_EXTPACK_PUEL = VBOX_WITH_EXTPACK_PUEL_BUILD = VBOX_WITH_PCI_PASSTHROUGH_IMPL = VBOX_WITH_OS2_ADDITIONS_BIN = VBOX_WITH_LIBSSH = # not yet VBOX_WITH_PLUGIN_CRYPT = VBOX_WITH_DRAG_AND_DROP_PROMISES = ifn1of ($(KBUILD_TARGET), linux) VBOX_WITH_DOCS = VBOX_WITH_DOCS_PACKING = endif if1of ($(KBUILD_TARGET), solaris) VBOX_WITH_32_ON_64_MAIN_API = endif if1of ($(KBUILD_TARGET), win) # tar/gzip uncommon on Windows VBOX_WITH_EXTPACK_VBOXDTRACE = 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) # Undefine codec libraries which are not needed. VBOX_WITH_LIBVPX = VBOX_WITH_LIBVORBIS = VBOX_WITH_LIBOGG = # Disable recording (with audio support). VBOX_WITH_RECORDING = VBOX_WITH_AUDIO_RECORDING = endif # branding VBOX_BRAND_LICENSE_HTML := $(PATH_ROOT)/doc/License-gpl-3.0.html VBOX_BRAND_LICENSE_RTF := $(PATH_ROOT)/doc/License-gpl-3.0.rtf VBOX_BRAND_LICENSE_TXT := $(PATH_ROOT)/doc/License-gpl-3.0.txt VBOX_BRAND_LICENSE_VER := 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_X2_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about_x2.png VBOX_BRAND_GUI_ABOUT_X3_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about_x3.png VBOX_BRAND_GUI_ABOUT_X4_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about_x4.png VBOX_BRAND_GUI_ABOUT_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about_16px.png VBOX_BRAND_GUI_ABOUT_16PX_X2_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about_16px_x2.png VBOX_BRAND_GUI_ABOUT_16PX_X3_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about_16px_x3.png VBOX_BRAND_GUI_ABOUT_16PX_X4_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about_16px_x4.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/Artwork/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), freebsd linux netbsd openbsd solaris) # duplicated up above 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 ifndef VBOX_WITH_ADDITIONS $(error VBOX_ONLY_ADDITIONS + unset VBOX_WITH_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_QHELP := VBOX_WITH_DOCS_HTML := endif # # Disable components for headless # ifdef VBOX_HEADLESS VBOX_WITH_QTGUI = VBOX_WITH_VBOXSDL = 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 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 # # Derived indicators. # # # 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 acceleration 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,) # kSubmit / kWorker is only available on windows. ifdef VBOX_USE_KSUBMIT ifeq ($(KBUILD_HOST),win) TOOL_VCC142AMD64_USE_KSUBMIT := 1 TOOL_VCC142X86_USE_KSUBMIT := 1 # TOOL_VCC120AMD64_USE_KSUBMIT := 1 # TOOL_VCC120X86_USE_KSUBMIT := 1 TOOL_VCC100AMD64_USE_KSUBMIT := 1 TOOL_VCC100X86_USE_KSUBMIT := 1 TOOL_QT5_USE_KSUBMIT := 1 TOOL_OPENWATCOM_USE_KSUBMIT := 1 TOOL_YASM_USE_KSUBMIT := 1 TOOL_NASM_USE_KSUBMIT := 1 TOOL_VBoxNasm_USE_KSUBMIT := 1 else VBOX_USE_KSUBMIT := endif endif # # Requested permissions to the host OS (only the entitlements # crap on darwin for now). # ifeq ($(KBUILD_TARGET),darwin) # # The first two entitlements are required to get everything working # on Catalina which we want to keep supported for now. # VBOX_DARWIN_ENTITLEMENTS_LIST := \ com.apple.security.cs.allow-unsigned-executable-memory \ com.apple.security.cs.disable-executable-page-protection \ com.apple.security.device.audio-input \ com.apple.security.device.camera \ com.apple.security.device.usb # # The hypervisor entitlement is required in adhoc signing mode # to get access to the Hypervisor framework. For release signing # the entitlement is included in our developer certificate. # # The device-access and networking entitlemnents are reserved for # only specific vendors and are only available in release mode signing # (binaries signed with these entitlements in adhoc mode will just crash # with a code signing error). # ifeq ($(VBOX_SIGNING_MODE),adhoc) VBOX_DARWIN_ENTITLEMENTS_LIST += \ com.apple.security.hypervisor else VBOX_DARWIN_ENTITLEMENTS_LIST += \ com.apple.vm.device-access \ com.apple.vm.networking endif # Where the dynamic generated entitlements can be found. VBOX_DARWIN_ENTITLEMENTS_FILE := $(PATH_OUT)/Entitlements.plist endif # # 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). # if1of ($(KBUILD_TARGET_ARCH), amd64 x86) 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.macho = 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 else # ifn1of ($(KBUILD_TARGET_ARCH), amd64 x86) VBOX_ASTOOL =# No tool, just use the compiler one. VBOX_LDR_FMT_2_FLAGS.elf := -DASM_FORMAT_ELF VBOX_LDR_FMT_2_FLAGS.macho := -DASM_FORMAT_MACHO VBOX_LDR_FMT_2_FLAGS.pe := -DASM_FORMAT_PE VBOX_ASFLAGS := -g $(VBOX_LDR_FMT_2_FLAGS.$(VBOX_LDR_FMT)) VBOX_ASFLAGS32 := -g $(VBOX_LDR_FMT_2_FLAGS.$(VBOX_LDR_FMT32)) VBOX_ASFLAGS64 := -g $(VBOX_LDR_FMT_2_FLAGS.$(VBOX_LDR_FMT64)) if1of ($(KBUILD_TARGET_ARCH), sparc32 sparc64) VBOX_ASFLAGS += -m$(VBOX_HC_ARCH_BITS) VBOX_ASFLAGS32 += -m32 VBOX_ASFLAGS64 += -m64 endif endif # ifn1of ($(KBUILD_TARGET_ARCH), amd64 x86) # # 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) ifdef VBOX_WITH_EVEN_NEWER_XCODE VBOX_GCC_TOOL := CLANGXXMACHO DARWINCMN_TOOLCHAIN_DIRS_IGNORE_DEVTOOLS = 1# Use the system toolchains, not anything from tools/darwin.*. else ifdef VBOX_WITH_NEW_XCODE VBOX_GCC_TOOL := VBoxXcode62 else VBOX_GCC_TOOL := GXX4MACHO endif 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 := GCC3PLAIN 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 := GCC32 endif endif # # Decide which Visual C++ compiler version we're using by default. # ifndef VBOX_VCC_TOOL_STEM ifdef VBOX_WITH_NEW_VCC VBOX_VCC_TOOL_STEM := VCC142 else VBOX_VCC_TOOL_STEM := VCC100 endif else ifn1of ($(VBOX_VCC_TOOL_STEM), VCC100 VCC110 VCC120 VCC140 VCC141 VCC142) $(error VBox: VBOX_VCC_TOOL_STEM='$(VBOX_VCC_TOOL_STEM)' is not supported, only VCC100, VCC110, VCC120, VCC140, VCC141, VCC142 are) endif ifndef VBOX_VCC_TOOL VBOX_VCC_TOOL := $(VBOX_VCC_TOOL_STEM)$(toupper $(KBUILD_TARGET_ARCH)) endif # # Decide which Visual C++ compiler version we're using for newer stuff. # ifndef VBOX_NEWER_VCC_TOOL_STEM if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120" VBOX_NEWER_VCC_TOOL_STEM := $(VBOX_VCC_TOOL_STEM) else VBOX_NEWER_VCC_TOOL_STEM := VCC120 endif else ifn1of ($(VBOX_NEWER_VCC_TOOL_STEM), VCC120 VCC140 VCC141 VCC142) $(error VBox: VBOX_NEWER_VCC_TOOL_STEM='$(VBOX_NEWER_VCC_TOOL_STEM)' is not supported) endif ifndef VBOX_NEWER_VCC_TOOL VBOX_NEWER_VCC_TOOL := $(VBOX_NEWER_VCC_TOOL_STEM)$(toupper $(KBUILD_TARGET_ARCH)) endif # Temporary measure while kBuild / tools updates their define quoting. ifdef KMK_WITH_QUOTING if ("$(VBOX_VCC_TOOL_STEM)" >= "VCC140" && "$(KBUILD_TARGET)" == "win") \ || ("$(KBUILD_TARGET)" != "darwin" && "$(KBUILD_TARGET)" != "win" && "$(KMK_REVISION)" >= 3566) \ || ("$(KBUILD_TARGET)" == "darwin" && "$(KMK_REVISION)" >= 3579) VBOX_WITH_AUTOMATIC_DEFS_QUOTING := 1 endif endif # # Default tool nonsense. # ## @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.asan = RT_STRICT VBOX_STRICT DEFS.x86 = RT_ARCH_X86 __X86__ DEFS.amd64 = RT_ARCH_AMD64 __AMD64__ DEFS.arm64 = RT_ARCH_ARM64 DEFS.sparc32 = RT_ARCH_SPARC DEFS.sparc64 = RT_ARCH_SPARC64 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 DEFS.os-agnostic = RT_OS_AGNOSTIC 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 ifdef VBOX_WITH_REM DEFS += VBOX_WITH_REM endif ifdef VBOX_WITH_RAW_MODE DEFS += VBOX_WITH_RAW_MODE endif ifdef VBOX_WITH_DRIVERLESS_FORCED DEFS += VBOX_WITH_DRIVERLESS_FORCED endif # Don't flood CDEFS, old MASMs doesn't like too many defines. ifdef VBOX_WITH_DEBUGGER CDEFS += 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" || $(KBUILD_TYPE) == "asan") 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 ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING CDEFS += RTPATH_APP_PRIVATE="$(VBOX_PATH_APP_PRIVATE)" else CDEFS += RTPATH_APP_PRIVATE=\"$(VBOX_PATH_APP_PRIVATE)\" endif endif ifdef VBOX_PATH_APP_PRIVATE_ARCH ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING CDEFS += RTPATH_APP_PRIVATE_ARCH="$(VBOX_PATH_APP_PRIVATE_ARCH)" else CDEFS += RTPATH_APP_PRIVATE_ARCH=\"$(VBOX_PATH_APP_PRIVATE_ARCH)\" endif endif ifdef VBOX_PATH_APP_PRIVATE_ARCH_TOP ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING CDEFS += RTPATH_APP_PRIVATE_ARCH_TOP="$(VBOX_PATH_APP_PRIVATE_ARCH_TOP)" else CDEFS += RTPATH_APP_PRIVATE_ARCH_TOP=\"$(VBOX_PATH_APP_PRIVATE_ARCH_TOP)\" endif endif ifdef VBOX_PATH_SHARED_LIBS ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING CDEFS += RTPATH_SHARED_LIBS="$(VBOX_PATH_SHARED_LIBS)" else CDEFS += RTPATH_SHARED_LIBS=\"$(VBOX_PATH_SHARED_LIBS)\" endif endif ifdef VBOX_PATH_APP_DOCS ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING CDEFS += RTPATH_APP_DOCS="$(VBOX_PATH_APP_DOCS)" else CDEFS += RTPATH_APP_DOCS=\"$(VBOX_PATH_APP_DOCS)\" endif endif if1of ($(KBUILD_TARGET), os2) # The gcc here is too old to grok #pragma once, instead it complains. CDEFS += RT_WITHOUT_PRAGMA_ONCE endif CXXDEFS += $(CDEFS) PCHDEFS += $(CDEFS) OBJCDEFS += $(CDEFS) USES += dtrace USES.win += vboximportchecker # # Decide which Windows DDK to use by default. # ifdef VBOX_WITH_NEW_WINDOWS_DDK VBOX_WINDDK ?= WINSDK10-KM VBOX_WINDDK_WLH ?= $(VBOX_WINDDK) VBOX_WINDDK_GST_W8 ?= WINSDK10-KM-W8 VBOX_WINDDK_GST_W7 ?= WINSDK10-KM-W7 VBOX_WINDDK_GST_WLH ?= WINDDK71WLH else if1of ($(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. # ifdef VBOX_WITH_NEW_WINDOWS_SDK VBOX_WINPSDK ?= WINSDK10-UM VBOX_WINPSDK_INCS ?= $(VBOX_WINPSDK)-INCS else if1of ($(VBOX_VCC_TOOL_STEM), VCC110) VBOX_WINPSDK ?= WINPSDK80 VBOX_WINPSDK_INCS ?= $(VBOX_WINPSDK)INCS else VBOX_WINPSDK ?= WINPSDK71 VBOX_WINPSDK_INCS ?= $(VBOX_WINPSDK)INCS endif VBOX_WINPSDK_GST ?= $(VBOX_WINPSDK) VBOX_WINPSDK_GST_INCS ?= $(VBOX_WINPSDK_INCS) ifneq ($(VBOX_WINPSDK_GST),WINPSDK71) VBOX_WINPSDK_GST_W8 ?= $(VBOX_WINPSDK_GST) else VBOX_WINPSDK_GST_W8 ?= WINPSDK80 endif 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 arm64) 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_VMMRC = $(PATH_STAGE_BIN)/VMMRC.rc LIB_REM = $(PATH_STAGE_LIB)/VBoxREM.dylib LIB_XPCOM = $(PATH_STAGE_BIN)/VBoxXPCOM.dylib LIB_XPCOM_IMP = $(PATH_STAGE_LIB)/VBoxXPCOMImp.dylib VBOX_LIB_XPCOM_X86 = $(PATH_STAGE_BIN)/VBoxXPCOM-x86.dylib LIB_DDU = $(PATH_STAGE_BIN)/VBoxDDU.dylib VBOX_LIB_SUPR0 := 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_VMMRC = $(PATH_STAGE_BIN)/VMMRC.rc LIB_REM = $(PATH_STAGE_LIB)/VBoxREM.so LIB_XPCOM = $(PATH_STAGE_BIN)/VBoxXPCOM.so LIB_XPCOM_IMP = $(PATH_STAGE_LIB)/VBoxXPCOMImp.so VBOX_LIB_XPCOM_X86 = $(PATH_STAGE_BIN)/VBoxXPCOM-x86.so LIB_DDU = $(PATH_STAGE_BIN)/VBoxDDU.so VBOX_LIB_SUPR0 := 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_VMMRC = $(PATH_STAGE_LIB)/VMMRCImp.lib LIB_REM = $(PATH_STAGE_LIB)/VBoxREMImp.lib LIB_XPCOM = $(PATH_STAGE_BIN)/VBoxXCOM.dll LIB_XPCOM_IMP = $(PATH_STAGE_LIB)/VBoxXPCOMImp.lib 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 VBOX_LIB_SUPR0 = $(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB) 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_VMMRC = $(PATH_OBJ)/VMMRC/VMMRC.lib LIB_REM = $(PATH_STAGE_LIB)/VBoxREMImp.lib LIB_XPCOM = LIB_XPCOM_IMP = VBOX_LIB_XPCOM_X86 = LIB_DDU = $(PATH_STAGE_LIB)/VBoxDDU.lib VBOX_LIB_SUPR0 = $(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB) endif ifn1of ($(KBUILD_TARGET_ARCH), $(VBOX_SUPPORTED_HOST_ARCHS)) # Hack to build a couple of extpack things that thing they need the VMM lib. LIB_VMM := LIB_VMMRC := endif VBOX_LIB_SUPHARDENED = $(PATH_STAGE_LIB)/SUPR3HardenedStatic$(VBOX_SUFF_LIB) VBOX_LIB_RUNTIME_STATIC = $(PATH_STAGE_LIB)/RuntimeR3$(VBOX_SUFF_LIB) VBOX_LIB_RUNTIME_STATIC_X86 = $(PATH_STAGE_LIB)/RuntimeR3-x86$(VBOX_SUFF_LIB) if "$(KBUILD_TARGET)" == "win" && "$(KBUILD_TYPE)" == "asan" VBOX_LIB_RUNTIME_STATIC_NO_ASAN = $(PATH_STAGE_LIB)/RuntimeR3NoAsan$(VBOX_SUFF_LIB) else VBOX_LIB_RUNTIME_STATIC_NO_ASAN = $(VBOX_LIB_RUNTIME_STATIC) endif 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))) \ python-not-found.exe) else ifndef VBOX_WITH_PYTHON2_PREFERENCE VBOX_BLD_PYTHON := $(firstword \ $(which python3$(HOSTSUFF_EXE)) \ $(which python3.10$(HOSTSUFF_EXE)) \ $(which python3.9$(HOSTSUFF_EXE)) \ $(which python3.8$(HOSTSUFF_EXE)) \ $(which python3.7$(HOSTSUFF_EXE)) \ $(which python3.6$(HOSTSUFF_EXE)) \ $(which python3.5$(HOSTSUFF_EXE)) \ $(which python3.4$(HOSTSUFF_EXE)) \ $(which python2.7$(HOSTSUFF_EXE)) \ $(which python$(HOSTSUFF_EXE)) \ $(which python2.6$(HOSTSUFF_EXE)) \ python-not-found$(HOSTSUFF_EXE) ) else VBOX_BLD_PYTHON := $(firstword \ $(which python2.7$(HOSTSUFF_EXE)) \ $(which python2.6$(HOSTSUFF_EXE)) \ $(which python$(HOSTSUFF_EXE)) \ $(which python3$(HOSTSUFF_EXE)) \ python-not-found$(HOSTSUFF_EXE) ) endif endif ## For running python unittests in the validation kit. VBOX_UNITTEST_PYTHON ?= $(VBOX_BLD_PYTHON) # # pylint setup, see https://www.pylint.org/. # # 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. # C0326 - ???? # W0123 - ???? # C0330:bad-continuation - Wrong continued indentation (add X spaces). # * Triggering on perfectly legal comments in array initializers and stuff. # C0413:wrong-import-position - Import "YYYYY XXXXX" should be placed at the top of the module. # * False positives due to __copyright__, __version__, probably. # E0012:bad-option-value - Bad option value XXXXX. # * Newer pylint doesn't grok older warning disables in sources (e.g. W0142 in db.py). Wonderful! # I0012:locally-enabled - Locally enabling XXXXX. # * We temporarily disable stuff and then renabled it. Very tedious. # :nested-min-max - Buggy in 2.16.2 when mixing iterable and regular form, thus disabled. # # 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 # -- why was this needed. It messes up when using pylint w/ 3.x and building with 2.7. # VBOX_PYLINT := $(VBOX_BLD_PYTHON) $(VBOX_PYLINT) #endif endif if !defined(VBOX_WITH_PYLINT) && defined(VBOX_PYLINT) VBOX_WITH_PYLINT := 1 ifndef VBOX_PYLINT_VERSION ifdef VBOX_WITH_PYLINT_PRE_V1_0 VBOX_PYLINT_VERSION = 9999 else ifdef VBOX_WITH_PYLINT_V1_2_1_PLUS VBOX_PYLINT_VERSION = 10201 else ifdef VBOX_WITH_PYLINT_V1_1_PLUS VBOX_PYLINT_VERSION = 10100 else VBOX_PYLINT_VERSION = 10000 endif endif endif VBOX_PYLINT_FLAGS = $(if-expr $(VBOX_PYLINT_VERSION) >= 10500,--reports=n,--report=n) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 10000 \ ,--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=32 \ --max-branch$(if-expr $(VBOX_PYLINT_VERSION) >= 10000,e,)s=50 \ --max-statements=100 \ --max-returns=100 \ --max-public-methods=139 \ --max-args=9 \ --max-module-lines=4096 \ --max-locals=32 \ $(if-expr $(VBOX_PYLINT_VERSION) >= 10500,--max-bool-expr=99,) \ --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 $(VBOX_PYLINT_VERSION) >= 10000,--class-attribute-rgx='(k[abcdefhmnpilorstu]+[A-Z0-9][a-zA-Z0-9_]{0,32}|[A-Z_][A-Z0-9_]{2,32})',) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 10500,--max-nested-blocks=9,) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 10100,--disable=bad-whitespace,) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 10201,--disable=bad-continuation --disable=eval-used,) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 10201 && $(VBOX_PYLIN_VERSION) < 10500,--disable=bad-option-value,) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 10500,--disable=wrong-import-position --disable=E0012 --disable=locally-enabled,) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 10600,--disable=missing-docstring --disable=trailing-newlines --disable=ungrouped-imports,) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 10800,--disable=redundant-keyword-arg,) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 20000,--disable=useless-object-inheritance --disable=useless-return,) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 20400,--disable=import-outside-toplevel,) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 20900,--disable=super-with-arguments --disable=raise-missing-from,) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 21200,--disable=consider-using-f-string --disable=unnecessary-semicolon --disable=redundant-u-string-prefix) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 21602,--disable=broad-exception-raised) \ $(if-expr $(VBOX_PYLINT_VERSION) >= 21602,--disable=nested-min-max) \ --disable=unnecessary-semicolon,invalid-encoded-data,global-statement,bare-except,broad-except,multiple-statements,no-self-use,fixme \ --disable=I0011 \ --ignored-classes=testdriver.vboxcon # Define the macro for win path conversion. ifndef VBOX_ONLY_SDK VBOX_FN_MAKE_WIN_PATH = "$(quote-sh-dq $(subst /,\,$(requote unq, $(1))))" else # Z: is always FS root for Wine. 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) # genalias (generate aliases for nocrt_ functions) VBOX_GENALIAS ?= $(PATH_OBJ)/genalias/genalias$(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) # RTIsoMaker (our own ISO maker). VBOX_RTISOMAKER ?= $(PATH_OBJ)/bldRTIsoMaker/bldRTIsoMaker$(HOSTSUFF_EXE) # RTLdrCheckImports (checks imports against oldest supported OS version (GAs typically)) VBOX_RTLDRCHECKIMPORTS ?= $(PATH_OBJ)/bldRTLdrCheckImports/bldRTLdrCheckImports$(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_QSH),$(PATH_TOOL_$(VBOX_VCC_TOOL)_BIN_QSH)/,$(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) # VBoxCheckImports (checks what we imports from on windows) VBOX_CHECK_IMPORTS ?= $(PATH_OBJ)/VBoxCheckImports/VBoxCheckImports$(HOSTSUFF_EXE) # VBoxEditCoffLib (symbol name tweaking for VBoxSF on windows) VBOX_EDIT_COFF_LIB ?= $(PATH_OBJ)/VBoxEditCoffLib/VBoxEditCoffLib$(HOSTSUFF_EXE) # GNU tar if present. if1of ($(KBUILD_TARGET), linux os2 win) VBOX_GTAR ?= tar else if1of ($(KBUILD_TARGET), freebsd netbsd solaris) VBOX_GTAR ?= gtar endif # zip VBOX_ZIP ?= zip$(HOSTSUFF_EXE) ifeq ($(KBUILD_TARGET),win) ifeq ($(KBUILD_TARGET_ARCH),x86) # Normally we should test for KBUILD_HOST_ARCH but we only require MINGWW64 for 64-bit _targets_ VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p else VBOX_NM ?= $(PATH_TOOL_MINGWW64)/bin/nm.exe -p endif else ifeq ($(KBUILD_HOST),darwin) # Xcode 7.3.1 nm doesn't like -t, and -x behaves very differently. Throwing in -B (bsd) to make sure. VBOX_NM ?= $(subst $(REDIRECT_INT),$(REDIRECT_EXT),$(TOOL_$(VBOX_GCC_TOOL)_ENV_SETUP) $(PATH_TOOL_$(VBOX_GCC_TOOL)_TOOLCHAIN_BIN_SLASH)nm) -p \ $(if-expr $(VBOX_XCODE_VERSION_MAJOR) > 7 || ($(VBOX_XCODE_VERSION_MAJOR) == 7 && $(VBOX_XCODE_VERSION_MINOR) >= 3),-B,) else VBOX_NM ?= nm -p -t x endif # Makeself for the linux installers. VBOX_MAKESELF ?= $(KBUILD_DEVTOOLS)/common/makeself/v2.4.5-r2/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/v3.08-log # Windows install tools... # Note! The scripts has been moved to Bin in v8.0. VBOX_PATH_WIX ?= $(KBUILD_DEVTOOLS)/win.x86/wix/v3.11.2 ifdef VBOX_WITH_NEW_WINDOWS_SDK VBOX_PATH_MSITRAN ?= $(PATH_SDK_$(VBOX_WINPSDK)_BIN)/../x86/MsiTran.Exe VBOX_PATH_MSIDB ?= $(PATH_SDK_$(VBOX_WINPSDK)_BIN)/../x86/MsiDb.Exe VBOX_PATH_WISUBSTG ?= $(PATH_SDK_$(VBOX_WINPSDK)_BIN)/WiSubStg.vbs VBOX_PATH_WISUMINFO ?= $(PATH_SDK_$(VBOX_WINPSDK)_BIN)/WiSumInf.vbs else 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 endif VBOX_PATH_DIFX ?= $(KBUILD_DEVTOOLS)/win.$(KBUILD_TARGET_ARCH)/DIFx/v2.1-r3 ifdef VBOX_OSE ## @todo try get rid of this crap! People can use the latest and greatest Yasm release, no need to check in the binary for OSE. # 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. if1of ($(KBUILD_HOST).$(KBUILD_HOST_ARCH), linux.x86 solaris.x86 win.x86) PATH_TOOL_YASM ?= $(KBUILD_DEVTOOLS_HST)/bin endif endif # bison and flex for windows. Needed by mesa and also used by VBoxDTrace. ifeq ($(KBUILD_HOST),win) ifndef TOOL_BISON_YACC TOOL_BISON_YACC := $(firstfile $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.x86/win_flex_bison/v*/*bison*$(HOSTSUFF_EXE))) bison.exe) endif ifndef TOOL_FLEX_LEX TOOL_FLEX_LEX := $(firstfile $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.x86/win_flex_bison/v*/*flex*$(HOSTSUFF_EXE))) flex.exe) endif 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,$(qfirstfile ,$(qwildcard ,$(qaddsuffix ,/[Mm][Ii][Dd][Ll].[Ee][Xx][Ee], \ $(PATH_SDK_$(VBOX_WINPSDK)_BIN) \ $(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)) # Tricks to work around midl.exe problems with spaces in the /cpp_cmd value, it # forgets to quote it when creating the commandline and cl.exe gets very confused. if1of (quote, $(KMK_FEATURES)) VBOX_MIDL_REDIRECT = $(REDIRECT) --prepend "$(quote-sh-dq PATH=$(PATH_TOOL_$(VBOX_VCC_TOOL)_BIN);$(qaddsuffix ,;,$(PATH_TOOL_$(VBOX_VCC_TOOL)_DLL_BIN)))" -- VBOX_MIDL_REDIRECT_X86 = $(REDIRECT) --prepend "$(quote-sh-dq PATH=$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_BIN);$(qaddsuffix ,;,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_DLL_BIN)))" -- else VBOX_MIDL_REDIRECT = $(REDIRECT) --prepend 'PATH=$(PATH_TOOL_$(VBOX_VCC_TOOL)_BIN);$(PATH)' -- VBOX_MIDL_REDIRECT_X86 = $(REDIRECT) --prepend 'PATH=$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_BIN);$(PATH)' -- endif VBOX_MIDL_CPP_CMD = $(lastword $(notdir ,$(subst $(EXEC_X86_WIN32),,$(TOOL_$(VBOX_VCC_TOOL)_CC)))) VBOX_MIDL_CPP_CMD_X86 = $(lastword $(notdir ,$(subst $(EXEC_X86_WIN32),,$(TOOL_$(VBOX_VCC_TOOL_STEM)X86_CC)))) ## # Edits $1 and adding #pragma directives for disabling warnings windows.h causes. # @param 1 The name of the file to edit. define def_VBoxMidlOutputDisableMscWarnings $(QUIET)$(MV) -f "$1" "$1.tmp" $(QUIET)$(APPEND) -nt "$1" \ '#if _MSC_VER >= 1920 /* RT_MSC_VER_VS2019 */' \ '# pragma warning(disable:5031 5032) /* buggy winioctl.h in some w10 sdks */ ' \ '#endif' \ '#pragma warning(push) /* -Wall and windows.h */' \ '#pragma warning(disable:4668 4255)' \ '#if _MSC_VER >= 1800 /* RT_MSC_VER_VC120 */' \ '# pragma warning(disable:4005)' \ '#endif' \ '#if _MSC_VER >= 1900 /* RT_MSC_VER_VC140 */' \ '# pragma warning(disable:5039)' \ '#endif' \ '' $(QUIET)$(CAT_EXT) "$1.tmp" >> "$1" $(QUIET)$(APPEND) -n "$1" \ '' \ '#pragma warning(pop)' \ '' $(QUIET)$(RM) -f "$1.tmp" endef # 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) ifeq ($(KBUILD_HOST),solaris) VBOX_LIBIDL_CONFIG_FALLBACK = $(lastword $(wildcard $(KBUILD_DEVTOOLS)/solaris.amd64/libIDL/*/bin/libIDL-config-2)) endif export VBOX_LIBIDL_CONFIG := $(firstword $(which libIDL-config-2 libIDL-config) $(VBOX_LIBIDL_CONFIG_FALLBACK) libIDL-config-2-not-found) 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) # The minimum macOS version we're targetting. ifndef VBOX_DEF_MACOSX_VERSION_MIN if1of ($(VBOX_GCC_TOOL), GXX4MACHO GXX42MACHO) # For GAs. VBOX_DEF_MACOSX_VERSION_MIN := 10.6# Snow Leopard else if1of ($(VBOX_GCC_TOOL), VBoxXcode62) VBOX_DEF_MACOSX_VERSION_MIN := 10.9# Mavericks else ifeq ($(KBUILD_TARGET_ARCH),arm64) VBOX_DEF_MACOSX_VERSION_MIN := 11.0# The Jack Kerouac novel. else if defined(VBOX_WITH_VMNET) && !defined(VBOX_ONLY_BUILD) # Force SDK 10.15 for VMNET VBOX_DEF_MACOSX_VERSION_MIN := 10.15# Catalina else VBOX_DEF_MACOSX_VERSION_MIN := 10.13# High Sierra endif endif endif VBOX_DEF_MACOSX_VERSION_MIN_NO_DOT := $(subst .,,$(VBOX_DEF_MACOSX_VERSION_MIN)) if1of ($(VBOX_GCC_TOOL), GXX4MACHO GXX42MACHO) # For GAs. # 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 else # Fallback - system / LocalConfig.kmk. VBOX_PATH_MACOSX_DEVEL_ROOT ?= /Developer VBOX_PATH_MACOSX_SDK_ROOT ?= $(VBOX_PATH_MACOSX_DEVEL_ROOT)/SDKs VBOX_PATH_MACOSX_TOOLCHAIN_ROOT ?= $(VBOX_PATH_MACOSX_DEVEL_ROOT) endif else ifeq ($(VBOX_GCC_TOOL),VBoxXcode62) # Use the tool path of the compiler (it's clang, not gcc in this instance). include $(KBUILD_TOOL_PATHS)/$(VBOX_GCC_TOOL).kmk VBOX_PATH_MACOSX_DEVEL_ROOT := $(PATH_TOOL_$(VBOX_GCC_TOOL)) # Fallback - system / LocalConfig.kmk. ifndef VBOX_PATH_MACOSX_DEVEL_ROOT VBOX_PATH_MACOSX_DEVEL_ROOT := $(firstword $(wildcard /Applications/Xcode.app/Contents/Developer /Developer /Library/Developer)) endif ifndef VBOX_PATH_MACOSX_SDK_ROOT VBOX_PATH_MACOSX_SDK_ROOT := $(firstword $(wildcard \ $(PATH_TOOL_$(VBOX_GCC_TOOL)_SDKS) \ $(VBOX_PATH_MACOSX_DEVEL_ROOT)/SDKs/. \ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/. \ /Developer/SDKs/. \ /Library/Developer/CommandLineTools/SDKs/. )) endif ifndef VBOX_PATH_MACOSX_TOOLCHAIN_ROOT VBOX_PATH_MACOSX_TOOLCHAIN_ROOT := $(firstword $(wildcard \ $(PATH_TOOL_$(VBOX_GCC_TOOL)_TOOLCHAIN) \ $(VBOX_PATH_MACOSX_DEVEL_ROOT)/Library/Developer/CommandLineTools/. \ $(VBOX_PATH_MACOSX_DEVEL_ROOT)/Toolchains/XcodeDefault.xctoolchain/. \ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/. \ /Library/Developer/CommandLineTools/. \ ) /. ) endif else # VBOX_WITH_EVEN_NEWER_XCODE ends up here. include $(KBUILD_PATH)/tools/$(VBOX_GCC_TOOL).kmk include $(KBUILD_PATH)/sdks/MACOSX$(VBOX_DEF_MACOSX_VERSION_MIN_NO_DOT).kmk ifndef VBOX_PATH_MACOSX_SDK VBOX_PATH_MACOSX_SDK := $(PATH_SDK_MACOSX$(VBOX_DEF_MACOSX_VERSION_MIN_NO_DOT)) endif VBOX_PATH_MACOSX_SDK_ROOT = $(dir $(VBOX_PATH_MACOSX_SDK)) endif # 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 endif if !defined(VBOX_PATH_MACOSX_SDK) && !defined(VBOX_WITH_EVEN_NEWER_XCODE) # newer xcode handles this above VBOX_PATH_MACOSX_SDK_ROOT_DIRS ?= \ $(VBOX_PATH_MACOSX_SDK_ROOT) \ $(KBUILD_DEVTOOLS)/darwin.x86/SDKs/ \ $(KBUILD_DEVTOOLS)/darwin.amd64/SDKs/ \ $(KBUILD_DEVTOOLS)/darwin.x86/xcode/v4.1/SDKs \ $(KBUILD_DEVTOOLS)/darwin.x86/xcode/v3.2.6/SDKs ifeq ($(VBOX_DEF_MACOSX_VERSION_MIN),10.4) VBOX_PATH_MACOSX_SDK := $(firstword $(wildcard $(addsuffix /MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN)u.sdk, $(VBOX_PATH_MACOSX_SDK_ROOT_DIRS))) \ $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN)u.sdk ) else VBOX_PATH_MACOSX_SDK := $(firstword $(wildcard $(addsuffix /MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN).sdk, $(VBOX_PATH_MACOSX_SDK_ROOT_DIRS))) \ $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN).sdk ) endif endif ## The Xcode version (not relevant for command line tools, so we skip this in VBOX_WITH_EVEN_NEWER_XCODE mode). ifdef VBOX_WITH_EVEN_NEWER_XCODE VBOX_XCODE_VERSION ?= 10.98## Just a high non-existing version number. else ifeq ($(KBUILD_HOST),darwin) ifndef VBOX_XCODE_VERSION if1of ($(VBOX_GCC_TOOL), VBoxXcode62) VBOX_XCODE_VERSION := $(shell exec $(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/xcodebuild -version 2>&1) ifneq ($(pos Symbol not found,$(VBOX_XCODE_VERSION)),0) # Try detect unresolved symbol running Xcode 6.2 on Catalina. VBOX_XCODE_VERSION = 6.2 else VBOX_XCODE_VERSION := $(word 2, $(VBOX_XCODE_VERSION)) endif else if defined(VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL) || exists "$(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/xcodebuild" 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 ifeq ($(strip $(VBOX_XCODE_VERSION)),) if1of ($(VBOX_GCC_TOOL), GXX4MACHO GXX42MACHO) VBOX_XCODE_VERSION := 4.1 else if1of ($(VBOX_GCC_TOOL), VBoxXcode62) VBOX_XCODE_VERSION := 6.2 else VBOX_XCODE_VERSION := 9.4# whatever endif endif endif if1of ($(VBOX_GCC_TOOL), VBoxXcode62) ifdef KBUILD_USE_KOBJCACHE $(warning KBUILD_USE_KOBJCACHE does _not_ currently work with this version of Xcode) endif endif else VBOX_XCODE_VERSION ?= 4.1## @todo Anything special for GA, extpack and valkit tools fetching? 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 if1of ($(VBOX_GCC_TOOL), GXX4MACHO GXX42MACHO) if $(VBOX_XCODE_VERSION_MAJOR) > 4 || ($(VBOX_XCODE_VERSION_MAJOR) == 4 && $(VBOX_XCODE_VERSION_MINOR) >= 2) TOOL_GXX4MACHO_PREFIX ?= llvm- endif if $(VBOX_XCODE_VERSION_MAJOR) < 5 TOOL_GXX4MACHO_SUFFIX ?= -4.2 endif VBOX_DARWIN_NO_COMPACT_LINKEDIT ?= TOOL_GCC4MACHO_SUFFIX ?= $(TOOL_GXX4MACHO_SUFFIX)$(HOSTSUFF_EXE) TOOL_GCC4MACHO_PREFIX ?= $(TOOL_GXX4MACHO_PREFIX) if defined(VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL) TOOL_GCC4MACHO_PREFIX := $(VBOX_PATH_MACOSX_TOOLCHAIN_ROOT)/usr/bin/$(TOOL_GCC4MACHO_PREFIX) TOOL_GXX4MACHO_PREFIX := $(VBOX_PATH_MACOSX_TOOLCHAIN_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 if $(VBOX_XCODE_VERSION_MAJOR) > 4 || ($(VBOX_XCODE_VERSION_MAJOR) == 4 && $(VBOX_XCODE_VERSION_MINOR) >= 2) export PATH:=$(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/:$(VBOX_PATH_MACOSX_SDK)/usr/bin:$(VBOX_PATH_MACOSX_TOOLCHAIN_ROOT)/usr/bin:$(PATH) export DEVELOPER_DIR:=$(VBOX_PATH_MACOSX_DEVEL_ROOT) else export PATH:=$(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/:$(PATH) endif 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 if $(VBOX_XCODE_VERSION_MAJOR) < 5 ## @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 endif else if1of ($(VBOX_GCC_TOOL), VBoxXcode62) if $(KBUILD_HOST_VERSION_MAJOR) >= 18 # HACK ALERT! dtrace doesn't work on Mojave if we specify our Xcode 6.2 environment. override TOOL_StandardDTrace_DTRACE := dtrace "-xcpppath=$(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/gcc" else override TOOL_StandardDTrace_DTRACE := $(TOOL_$(VBOX_GCC_TOOL)_ENV_SETUP) dtrace "-xcpppath=$(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/gcc" endif export PATH:=$(VBOX_PATH_MACOSX_SDK)/usr/bin:$(PATH) else # effectively VBOX_WITH_EVEN_NEWER_XCODE override TOOL_StandardDTrace_DTRACE := $(TOOL_$(VBOX_GCC_TOOL)_ENV_SETUP) dtrace "-xcpppath=$(filter-out -f%,$(TOOL_$(VBOX_GCC_TOOL)_CC))" endif ifdef VBOX_WITH_EVEN_NEWER_XCODE VBOX_DARWIN_DEF_SDK_SDKS := MACOSX$(VBOX_DEF_MACOSX_VERSION_MIN_NO_DOT) VBOX_DARWIN_DEF_SDK_DEFS := MAC_OS_X_VERSION_MAX_ALLOWED=$(SDK_MACOSX$(VBOX_DEF_MACOSX_VERSION_MIN_NO_DOT)_VERSION_VALUE) VBOX_DARWIN_DEF_SDK_LDFLAGS = $(VBOX_DARWIN_CLASSIC_LINKER) $(VBOX_DARWIN_NO_COMPACT_LINKEDIT) else VBOX_DARWIN_DEF_SDK_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=$(VBOX_DEF_MACOSX_VERSION_MIN_NO_DOT)0 \ MAC_OS_X_VERSION_MAX_ALLOWED=$(VBOX_DEF_MACOSX_VERSION_MIN_NO_DOT)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)" \ $(VBOX_DARWIN_CLASSIC_LINKER) $(VBOX_DARWIN_NO_COMPACT_LINKEDIT) endif # specific versions - only used by xpcom18a4 (python) and 10.7 by UsbWebcam. ## @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)" $(VBOX_DARWIN_CLASSIC_LINKER) else VBOX_PATH_MACOSX_SDK_10_4 = $(error VBox: $(if $(target),$(target): ,)Using 10.4 SDK) 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)" $(VBOX_DARWIN_NO_COMPACT_LINKEDIT) else VBOX_PATH_MACOSX_SDK_10_5 = $(error VBox: $(if $(target),$(target): ,)Using 10.5 SDK) 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)" else VBOX_PATH_MACOSX_SDK_10_6 = $(error VBox: $(if $(target),$(target): ,)Using 10.6 SDK) 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)" else VBOX_PATH_MACOSX_SDK_10_7 = $(error VBox: $(if $(target),$(target): ,)Using 10.7 SDK) 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 # # Use bison and flex from Xcode to avoid linking issues (bison). # TOOL_BISON_YACC ?= $(TOOL_$(VBOX_GCC_TOOL)_ENV_SETUP) $(PATH_TOOL_$(VBOX_GCC_TOOL)_TOOLCHAIN_BIN_SLASH)bison TOOL_FLEX_LEX ?= $(TOOL_$(VBOX_GCC_TOOL)_ENV_SETUP) $(PATH_TOOL_$(VBOX_GCC_TOOL)_TOOLCHAIN_BIN_SLASH)flex # # Disable VMNet if the SDK is too old. # if defined(VBOX_WITH_VMNET) && "$(VBOX_DEF_MACOSX_VERSION_MIN)" vlt "10.15" VBOX_WITH_VMNET := 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 # # Configure 'asan' type builds. # # We ASSUME that anyone doing this kind of build on linux has a compiler # with sanitizer support (otherwise we'd end up with a circular dependency # with DynamicConfig.kmk here to check the compiler version). # ifeq ($(KBUILD_TYPE),asan) if "$(KBUILD_TARGET)" == "linux" VBOX_WITH_GCC_SANITIZER := 1 else if "$(KBUILD_TARGET)" == "darwin" VBOX_WITH_GCC_SANITIZER := 1 else if "$(KBUILD_TARGET)" == "win" VBOX_WITH_VCC_SANITIZER := 1 else VBOX_WITH_EF_WRAPS := 1 endif endif # # The address sanitiser library intercepts dlopen() and breaks RPATH $ORIGIN, # so we need to link it statically or set LD_LIBRARY_PATH. To link statically, # set VBOX_WITH_GCC_SANITIZER_STATIC in addition. # ifdef VBOX_WITH_GCC_SANITIZER VBOX_GCC_SANITIZER_FLAGS := \ -fsanitize=undefined \ -fsanitize=address \ -fsanitize=return \ -fsanitize=bounds \ -fsanitize=object-size \ -fno-sanitize=alignment \ -fno-sanitize=vptr \ -fno-common \ -DIPRT_WITH_GCC_SANITIZER \ -DVBOX_WITH_GCC_SANITIZER else ifdef VBOX_WITH_CLANG_SANITIZER ## @todo make work... VBOX_GCC_SANITIZER_FLAGS := \ -DIPRT_WITH_GCC_SANITIZER \ -DVBOX_WITH_GCC_SANITIZER \ -fsanitize=object-size \ -fsanitize-undefined-trap-on-error else VBOX_GCC_SANITIZER_FLAGS = endif # -libasan-static is currently not supported in combination with -no-undefined. VBOX_GCC_NO_UNDEFINED := VBOX_GCC_NO_UNDEFINED_R0 := ifdef VBOX_WITH_GCC_SANITIZER ifdef VBOX_WITH_GCC_SANITIZER_STATIC VBOX_GCC_NO_UNDEFINED := -Wl,--no-undefined VBOX_GCC_NO_UNDEFINED_R0 := -no-undefined VBOX_GCC_SANITIZER_LDFLAGS += -static-libasan else if "$(KBUILD_TARGET)" == "darwin" VBOX_GCC_SANITIZER_LDFLAGS += -fsanitize=address else VBOX_GCC_SANITIZER_LDFLAGS += -lasan endif endif endif # The config for Visual C++ 2019 update 9 and later. ifdef VBOX_WITH_VCC_SANITIZER VBOX_VCC_SANITIZER_FLAGS := -fsanitize=address -fno-sanitize-address-vcasan-lib # experimental: VBOX_VCC_SANITIZER_FLAGS += /fsanitize-address-use-after-return VBOX_VCC_SANITIZER_LDFLAGS := else VBOX_VCC_SANITIZER_FLAGS := VBOX_VCC_SANITIZER_LDFLAGS := endif # # The X11 headers. # VBOX_PATH_X11_ROOT = $(PATH_ROOT)/src/VBox/Additions/x11/x11include # # Miscellaneous includes # VBOX_GRAPHICS_INCS = $(PATH_ROOT)/include/VBox/Graphics VBOX_JPEG_INCS = $(PATH_ROOT)/src/libs/libjpeg-turbo-2.1.3 # The icons to use. ifdef VBOX_OSE VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/win/OSE/VirtualBox_win.ico VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/win/OSE/VirtualBox_win.ico VBOX_NSIS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/win/OSE/VirtualBox_win.ico VBOX_MACOSX_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/darwin/OSE/VirtualBox.icns else ifeq ($(KBUILD_HOST),win) VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/win/NonOSE/VirtualBox-vista.ico VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/win/NonOSE/VirtualBoxGA-vista.ico VBOX_NSIS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/win/NonOSE/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/win/NonOSE/VirtualBox-winxp.ico VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/win/NonOSE/VirtualBoxGA-winxp.ico VBOX_NSIS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/win/NonOSE/VirtualBox-nsis.ico endif VBOX_MACOSX_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/darwin/NonOSE/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). # if $(pos VBox,$(VBOX_GCC_TOOL)) > 0 include $(KBUILD_TOOL_PATHS)/$(VBOX_GCC_TOOL).kmk else include $(KBUILD_PATH)/tools/$(VBOX_GCC_TOOL).kmk endif ifneq ($(VBOX_GCC_TOOL),$(VBOX_GCC32_TOOL)) if $(pos VBox,$(VBOX_GCC32_TOOL)) > 0 include $(KBUILD_TOOL_PATHS)/$(VBOX_GCC32_TOOL).kmk else include $(KBUILD_PATH)/tools/$(VBOX_GCC32_TOOL).kmk endif 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 # Note! The chcking for 'error: unknown warning option' is for clang on darwin not giving us a # non-zero exit code when using an invalid option here, but it does later on. ifndef CLOSEPAR CLOSEPAR := ) endif VBOX_GCC_CHECK_EX_CC_CXX = $(shell \ if $(1) $(subst -Wno-,-W,$(2)) -Werror -c -o /dev/null $(4) > /dev/null 2>&1; then \ case "`LC_ALL=C $(1) $(subst -Wno-,-W,$(2)) -Werror -c -o /dev/null $(4) 2>&1`" in \ "error: unknown warning option"*$(CLOSEPAR) echo "$(3)";; \ *$(CLOSEPAR) echo "$(2)";; \ esac; \ else echo "$(3)"; fi; ) VBOX_GCC_CHECK_EX_CC = $(call VBOX_GCC_CHECK_EX_CC_CXX,$(1),$(2),$(3),-xc $(PATH_OUT)/DynamicConfig.c) VBOX_GCC_CHECK_EX_CXX = $(call VBOX_GCC_CHECK_EX_CC_CXX,$(1),$(2),$(3),-xc++ $(PATH_OUT)/DynamicConfig.cpp) 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,) \ -nostdlib -o /dev/null -xc /dev/null > /dev/null 2>&1; \ then echo "-Wl,$(2)"; else echo "$(3)"; fi; ) VBOX_GCC_CHECK_CC = $(call VBOX_GCC_CHECK_EX_CC, $(TOOL_$(VBOX_GCC_TOOL)_ENV_SETUP) $(TOOL_$(VBOX_GCC_TOOL)_CC),$1,$2) VBOX_GCC_CHECK_CXX = $(call VBOX_GCC_CHECK_EX_CXX, $(TOOL_$(VBOX_GCC_TOOL)_ENV_SETUP) $(TOOL_$(VBOX_GCC_TOOL)_CXX),$1,$2) VBOX_GCC_CHECK_LD = $(call VBOX_GCC_CHECK_EX_LD, $(TOOL_$(VBOX_GCC_TOOL)_ENV_SETUP) $(TOOL_$(VBOX_GCC_TOOL)_LD),$1,$2) VBOX_GCC32_CHECK_CXX = $(call VBOX_GCC_CHECK_EX_CXX, $(TOOL_$(VBOX_GCC32_TOOL)_ENV_SETUP) $(TOOL_$(VBOX_GCC32_TOOL)_CXX),$1,$2) endif ifeq ($(KBUILD_HOST),win) # We're not using gcc on windows anymore, just cook the result. VBOX_GCC_VERSION := $(expr 10000 * 3 + 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`. # gcc-5 of openSUSE42.1 only returns the major version on `gcc -dumpversion`! VBOX_GCC_VERSION = $(shell ($(1) -dumpfullversion 2>/dev/null || $(1) -dumpversion) | \ $(SED_EXT) 's|\([0-9][0-9]*\)\.\{0,1\}\([0-9]\{0,\}\)\.\{0,1\}\([0-9]\{0,\}\).*|$$(expr 10000 * \1 + 100 * $$(firstword \2 0) + $$(firstword \3 0))|' ) ifeq ($(KBUILD_TARGET),darwin) VBOX_CLANG_VERSION = $(shell $(1) --version | \ $(SED_EXT) -n 's|.*version \([0-9][0-9]*\)\.\{0,1\}\([0-9]\{0,\}\)\.\{0,1\}\([0-9]\{0,\}\).*|$$(expr 10000 * \1 + 100 * $$(firstword \2 0) + $$(firstword \3 0))|p' ) endif endif # 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 # NASM macros (input and output must differ with recent versions (strcmp)). ifndef DONT_USE_NASM include $(KBUILD_PATH)/tools/NASM.kmk if1of ($(KBUILD_HOST), win os2) VBOX_NASM_CHECK = $(if-expr "$(shell $(TOOL_NASM_AS) -e -o nul $1 NUL 2>&1)" == "",$(1),$(2)) else VBOX_NASM_CHECK = $(if-expr "$(shell $(TOOL_NASM_AS) -e -o /dev/./null $1 /dev/null 2>&1)" == "",$(1),$(2)) endif else VBOX_NASM_CHECK = endif # Figures the pylint version. VBOX_PYLINT_FIGURE_VERSION = $(shell $(1) --version 2> /dev/null \ | $(SED_EXT) -n -e 's/pylint-[^[:blank:]]*/pylint/' \ -e 's|^ *pylint *\([0-9][0-9]*\).\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$(DOLLAR)|$$(expr \1 * 10000 + \2 * 100 + \3)|p' ) # Java stuff. ifeq ($(KBUILD_TARGET),darwin) VBOX_JAVA_BIN_PATH = $(firstword $(wildcard \ /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands \ /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,) \ $(if-expr $(VBOX_XCODE_VERSION_MAJOR) >= 10,/Library/Java/JavaVirtualMachines/jdk1.8.*.jdk/Contents/Home/bin,) \ ) /usr/bin) VBOX_JAVA = $(VBOX_JAVA_BIN_PATH)/java VBOX_JAVAC = $(VBOX_JAVA_BIN_PATH)/javac VBOX_JAVAH = $(VBOX_JAVA_BIN_PATH)/javah VBOX_JAR = $(VBOX_JAVA_BIN_PATH)/jar VBOX_JAVADOC = $(VBOX_JAVA_BIN_PATH)/javadoc VBOX_WSIMPORT = $(VBOX_JAVA_BIN_PATH)/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 = $(firstword $(wildcard \ $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers \ /Library/Java/JavaVirtualMachines/jdk1.8.*.jdk/Contents/Home/include \ ) ) else VBOX_JAVA_INC = $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Headers endif else # !darwin 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 \ /usr/lib/jvm/java-6-sun \ /usr/lib/jvm/java-6-openjdk \ /usr/lib/jvm/java-6-openjdk-i386 \ /usr/lib/jvm/java-6-openjdk-amd64 \ /usr/lib/jvm/java-7-openjdk-i386 \ /usr/lib/jvm/java-7-openjdk-amd64 \ /usr/lib/jvm/default-java \ /usr/lib/jvm/java \ /usr/lib/jvm/jre \ \ /usr/lib/jvm/sun-jdk-1.6 \ ) /usr/lib/jvm/java-6-sun) endif endif ifeq ($(KBUILD_TARGET),solaris) # VBOX_JAVA_HOME ?= /usr/jdk/jdk1.6.0 VBOX_JAVA_HOME ?= $(firstword $(abspath $(wildcard \ /usr/jdk/latest/include/.. \ /usr/jdk/instances/jdk1.8*/include/.. \ /usr/jdk/instances/jdk1.7*/include/.. \ /usr/jdk/instances/jdk1.6*/include/.. \ )) /usr/java) endif ifeq ($(KBUILD_TARGET),win) VBOX_JAVA_HOME ?= c:/jdk endif VBOX_JAVA_BIN_PATH ?= $(VBOX_JAVA_HOME)/bin VBOX_JAVA ?= "$(VBOX_JAVA_BIN_PATH)/java$(HOSTSUFF_EXE)" VBOX_JAVAC = "$(VBOX_JAVA_BIN_PATH)/javac$(HOSTSUFF_EXE)" VBOX_JAVAH = "$(VBOX_JAVA_BIN_PATH)/javah$(HOSTSUFF_EXE)" VBOX_JAR = "$(VBOX_JAVA_BIN_PATH)/jar$(HOSTSUFF_EXE)" VBOX_JAVADOC = "$(VBOX_JAVA_BIN_PATH)/javadoc$(HOSTSUFF_EXE)" # With Java 11 wsimport was removed, usually part of a separate install now. VBOX_WSIMPORT = $(firstword $(wildcard $(VBOX_JAVA_BIN_PATH)/wsimport$(HOSTSUFF_EXE)) wsimport$(HOSTSUFF_EXE)) # 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 # !darwin # The first transform the almost usless openjdk versions like "javac 9-Ubuntu" into something the 2nd expression groks. VBOX_JAVA_FIGURE_VERSION = $(shell $(1) -version 2>&1 \ | $(SED_EXT) -n \ -e 's/ \([0-9][0-9]*\)\(-[[:alpha:]][[:alpha:]]\)/ \1.0.0\2/' \ -e 's|^[^ ]* *\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$(DOLLAR)|$$(expr \1 * 10000 + \2 * 100 + \3)|p' ) # Test C and C++ files. $(PATH_OUT)/DynamicConfig.c $(PATH_OUT)/DynamicConfig.cpp: $(QUIET)$(MKDIR) -p $(@D) $(QUIET)$(APPEND) -tn "$@" "int foobar(void)" "{" " return 42;" "}" "" # 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_GCC_LIBGCC) \ $(VBOX_GCC32_PATH_CC) \ $(VBOX_GCC32_PATH_CXX) \ $(VBOX_GCC32_LIBGCC) \ $(if-expr "$(KBUILD_HOST).$(KBUILD_HOST_ARCH)" == "solaris.amd64" && $(KBUILD_HOST_VERSION_MINOR) >= 11 \ , /platform/i86pc/kernel/$(KBUILD_HOST_ARCH)/unix,) \ | $(PATH_OUT)/DynamicConfig.c $(PATH_OUT)/DynamicConfig.cpp $(call MSG_GENERATE,,$@,) $(QUIET)$(RM) -f '$@' $(QUIET)$(MKDIR) -p $(@D) $(QUIET)$(APPEND) '$@' '# Host version: $(KBUILD_HOST_VERSION_MAJOR).$(KBUILD_HOST_VERSION_MINOR).$(KBUILD_HOST_VERSION_PATCH); full: $(KBUILD_HOST_VERSION)' ifneq ($(KBUILD_TARGET),win) $(QUIET)$(APPEND) '$@' '# $(KBUILD_HOST_UNAME_SYSNAME) - $(KBUILD_HOST_UNAME_RELEASE) - $(KBUILD_HOST_UNAME_VERSION)' endif ifeq ($(KBUILD_TARGET),darwin) $(QUIET)$(APPEND) '$@' '# VBOX_XCODE_VERSION: $(VBOX_XCODE_VERSION)' $(QUIET)$(APPEND) '$@' '# VBOX_PATH_MACOSX_TOOLCHAIN_ROOT: $(VBOX_PATH_MACOSX_TOOLCHAIN_ROOT)' $(QUIET)$(APPEND) '$@' '# VBOX_PATH_MACOSX_SDK_ROOT: $(VBOX_PATH_MACOSX_SDK_ROOT)' $(QUIET)$(APPEND) '$@' '# VBOX_PATH_MACOSX_DEVEL_ROOT: $(VBOX_PATH_MACOSX_DEVEL_ROOT)' $(QUIET)$(APPEND) '$@' 'VBOX_CLANG_VERSION_CC ?= $(call VBOX_CLANG_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CC))' $(QUIET)$(APPEND) '$@' 'VBOX_CLANG_VERSION_CXX ?= $(call VBOX_CLANG_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CXX))' endif # HC compiler switch detection. $(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_PATH_CC ?= $(which $(TOOL_$(VBOX_GCC_TOOL)_CC))' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_PATH_CXX ?= $(which $(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) '$@' ' if $$(VBOX_GCC_VERSION_CC) >= 40500' $(QUIET)$(APPEND) '$@' ' VBOX_GCC_Wlogical-op ?= $(call VBOX_GCC_CHECK_CC,-Wlogical-op,)' $(QUIET)$(APPEND) '$@' ' VBOX_GCC_Wno-logical-op ?= $$(subst -Wlogical-op,-Wno-logical-op,$$(VBOX_GCC_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-non-virtual-dtor ?= $(call VBOX_GCC_CHECK_CXX,-Wno-non-virtual-dtor,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-int-in-bool-context ?= $(call VBOX_GCC_CHECK_CC,-Wno-int-in-bool-context,)' $(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-literal-suffix ?= $(call VBOX_GCC_CHECK_CXX,-Wno-literal-suffix,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-misleading-indentation ?= $(call VBOX_GCC_CHECK_CC,-Wno-misleading-indentation,)' $(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_Wno-overloaded-virtual ?= $(call VBOX_GCC_CHECK_CXX,-Wno-overloaded-virtual,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-ignored-qualifiers ?= $(call VBOX_GCC_CHECK_CXX,-Wno-ignored-qualifiers,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-multistatement-macros ?= $(call VBOX_GCC_CHECK_CXX,-Wno-multistatement-macros,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-class-memaccess ?= $(call VBOX_GCC_CHECK_CXX,-Wno-class-memaccess,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-stringop-overflow ?= $(call VBOX_GCC_CHECK_CXX,-Wno-stringop-overflow,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-stringop-truncation ?= $(call VBOX_GCC_CHECK_CXX,-Wno-stringop-truncation,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-cast-function-type ?= $(call VBOX_GCC_CHECK_CC,-Wno-cast-function-type,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-deprecated-declarations ?= $(call VBOX_GCC_CHECK_CC,-Wno-deprecated-declarations,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-implicit-fallthrough ?= $(call VBOX_GCC_CHECK_CC,-Wno-implicit-fallthrough,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-inline ?= $(call VBOX_GCC_CHECK_CXX,-Wno-inline,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-unknown-pragmas ?= $(call VBOX_GCC_CHECK_CXX,-Wno-unknown-pragmas,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-deprecated-copy ?= $(call VBOX_GCC_CHECK_CXX,-Wno-deprecated-copy,)' $(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_m64 ?= $(call VBOX_GCC_CHECK_CC,-m64,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_msse4.1 ?= $(call VBOX_GCC_CHECK_CC,-msse4.1,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_mavx ?= $(call VBOX_GCC_CHECK_CC,-mavx,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_mavx2 ?= $(call VBOX_GCC_CHECK_CC,-mavx2,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_no-pie ?= $(call VBOX_GCC_CHECK_CC,-no-pie,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_fdiagnostics-show-option ?= $(call VBOX_GCC_CHECK_CC,-fdiagnostics-show-option,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_fno-printf-return-value ?= $(call VBOX_GCC_CHECK_CC,-fno-printf-return-value,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wa_cma_nocompress_debug_sections ?= $(call VBOX_GCC_CHECK_CC,-Wa$(COMMA)--nocompress-debug-sections,)' # 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,)' $(QUIET)$(APPEND) '$@' 'VBOX_LD_hash_style_sysv ?= $(call VBOX_GCC_CHECK_LD,--hash-style=sysv,)' $(QUIET)$(APPEND) '$@' 'VBOX_LD_gc_sections ?= $(call VBOX_GCC_CHECK_LD,--gc-sections,)' # 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) '$@' ' if $$(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) '$@' ' if $$(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 / clang 6 as this warning is now very verbose $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-unused-parameter ?= $(call VBOX_GCC_CHECK_CC,-Wno-unused-parameter,)' # Clang 6. $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-language-extension-token ?= $(call VBOX_GCC_CHECK_CC,-Wno-language-extension-token,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-extended-offsetof ?= $(call VBOX_GCC_CHECK_CC,-Wno-extended-offsetof,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-gnu-folding-constant ?= $(call VBOX_GCC_CHECK_CC,-Wno-gnu-folding-constant,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-return-type-c-linkage ?= $(call VBOX_GCC_CHECK_CXX,-Wno-return-type-c-linkage,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-string-plus-int ?= $(call VBOX_GCC_CHECK_CC,-Wno-string-plus-int,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-nested-anon-types ?= $(call VBOX_GCC_CHECK_CC,-Wno-nested-anon-types,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-gnu-anonymous-struct ?= $(call VBOX_GCC_CHECK_CXX,-Wno-gnu-anonymous-struct,)' # Clang 11. $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-c++17-compat-mangling ?= $(call VBOX_GCC_CHECK_CXX,-Wno-c++17-compat-mangling,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-nullability-extension ?= $(call VBOX_GCC_CHECK_CXX,-Wno-nullability-extension,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-gnu-statement-expression ?= $(call VBOX_GCC_CHECK_CXX,-Wno-gnu-statement-expression,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-import-preprocessor-directive-pedantic ?= $(call VBOX_GCC_CHECK_CXX,-Wno-import-preprocessor-directive-pedantic,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-undefined-var-template ?= $(call VBOX_GCC_CHECK_CXX,-Wno-undefined-var-template,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-c11-extensions ?= $(call VBOX_GCC_CHECK_CXX,-Wno-c11-extensions,)' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-tautological-pointer-compare ?= $(call VBOX_GCC_CHECK_CC,-Wno-tautological-pointer-compare,)' 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 ifn1of ($(KBUILD_TARGET_ARCH), sparc32 sparc64) # YASM $(QUIET)$(APPEND) '$@' '# debug: TOOL_YASM_AS="$(TOOL_YASM_AS)"' $(QUIET)$(APPEND) '$@' 'VBOX_YASM_Wno-segreg-in-64bit ?= $(call VBOX_YASM_CHECK,-Wno-segreg-in-64bit,)' # NASM (--allow-64-bit: 2.12rc2) $(QUIET)$(APPEND) '$@' 'VBOX_NASM_allow_64_bit ?= $(call VBOX_NASM_CHECK,--allow-64-bit,)' endif if1of ($(KBUILD_TARGET), linux) ifeq ($(KBUILD_TARGET),$(KBUILD_HOST)) $(QUIET)$(RM) -f -- "$@.sanitizer.so" "$@.sanitizer32.so" '$@.sanitizer.c' $(APPEND) -t '$@.sanitizer.c' 'int foo() { return 42; }' $(QUIET)$(APPEND) '$@' 'VBOX_GCC_SANITIZER_SO_FILES := \' $(TOOL_$(VBOX_GCC_TOOL)_ENV_SETUP) $(TOOL_$(VBOX_GCC_TOOL)_CC) -fPIC -shared \ $(VBOX_GCC_SANITIZER_FLAGS) $(VBOX_GCC_SANITIZER_LDFLAGS) -o "$@.sanitizer.so" "$@.sanitizer.c" ldd "$@.sanitizer.so" | $(SED_EXT) --append '$@' -re '/lib(a|ub)san\.so/!d' -e 's/.* => //' -e 's/ \(0x[0-9a-fA-F]*\) *$(DOLLAR)/ \\/' $(QUIET)$(APPEND) '$@' '' # $(QUIET)$(APPEND) '$@' 'VBOX_GCC32_SANITIZER_SO_FILES := \' # $(TOOL_$(VBOX_GCC32_TOOL)_ENV_SETUP) $(TOOL_$(VBOX_GCC32_TOOL)_CC) -fPIC -shared \ # $(VBOX_GCC_SANITIZER_FLAGS) $(VBOX_GCC_SANITIZER_LDFLAGS) -o "$@.sanitizer32.so" "$@.sanitizer.c" # ldd "$@.sanitizer32.so" | $(SED_EXT) --append '$@' -re '/lib(a|ub)san\.so/!d' -e 's/.* => //' -e 's/ \(0x[0-9a-fA-F]*\) *$(DOLLAR)/ \\/' # $(QUIET)$(APPEND) '$@' '' $(QUIET)$(RM) -f -- "$@.sanitizer.so" "$@.sanitizer32.so" '$@.sanitizer.c' endif endif 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 if defined(TOOL_FLEX) || defined(TOOL_BISON) echo "Do NOT include the flex or bison tools before Config.kmk gets loaded" exit 1 # endif $(QUIET)$(APPEND) '$@' 'VBOX_HAVE_FLEX ?= $(firstfile $(TOOL_FLEX_LEX) $(which flex))' $(QUIET)$(APPEND) '$@' 'VBOX_HAVE_BISON ?= $(firstfile $(TOOL_BISON_YACC) $(which bison))' $(QUIET)$(APPEND) '$@' 'VBOX_HAVE_XMLLINT ?= $(which xmllint)' if "$(KBUILD_HOST)" == "solaris" && $(KBUILD_HOST_VERSION_MAJOR) == 5 && $(KBUILD_HOST_VERSION_MINOR) == 11 # BRANCH_VERSION format on S11 - S11.3: # ..... # e.g.: 0.175.3.32.0.4.0:20180427T232405Z - N.B. trunk_id = 0.175 # BRANCH_VERSION format on S11.4: # ...... # e.g.: 11.4.0.0.1.10.0:20180702T173343Z # We're interested in and . $(QUIET)$(APPEND) '$@' "VBOX_SOLARIS_11_BRANCH_VERSION := $(shell pkg contents -H -t set -o pkg.fmri system/kernel | $(SED_EXT) -e '1!d' -e 's/^.*\-//;s/\:.*//;s/.*,//')" $(QUIET)$(APPEND) '$@' 'ifeq ($$(word 2, $$(subst ., ,$$(VBOX_SOLARIS_11_BRANCH_VERSION))),175)' $(QUIET)$(APPEND) '$@' ' VBOX_SOLARIS_11_UPDATE_VERSION := $$(word 3, $$(subst ., ,$$(VBOX_SOLARIS_11_BRANCH_VERSION)))' $(QUIET)$(APPEND) '$@' 'else' $(QUIET)$(APPEND) '$@' ' VBOX_SOLARIS_11_UPDATE_VERSION := $$(word 2, $$(subst ., ,$$(VBOX_SOLARIS_11_BRANCH_VERSION)))' $(QUIET)$(APPEND) '$@' 'endif' $(QUIET)$(APPEND) '$@' 'VBOX_SOLARIS_11_BUILD_VERSION := $$(word 6, $$(subst ., ,$$(VBOX_SOLARIS_11_BRANCH_VERSION)))' endif if1of ($(KBUILD_HOST), darwin freebsd solaris) $(QUIET)$(APPEND) '$@' 'VBOX_HOST_DTRACE_VERSION := $(shell dtrace -V)' endif if defined(VBOX_PYLINT) && !defined(VBOX_WITH_PYLINT_PRE_V1_0) && !defined(VBOX_WITH_PYLINT_V1_1_PLUS) && !defined(VBOX_WITH_PYLINT_V1_2_1_PLUS) $(QUIET)$(APPEND) '$@' "VBOX_PYLINT_VERSION := $(call VBOX_PYLINT_FIGURE_VERSION, $(VBOX_PYLINT))" endif if defined(VBOX_JAVAC) $(QUIET)$(APPEND) '$@' 'VBOX_JAVA_VERSION := $(call VBOX_JAVA_FIGURE_VERSION, $(VBOX_JAVAC))' endif $(QUIET)$(ECHO) '========= START OF $@ =========' $(QUIET)$(CAT) $@ $(QUIET)$(ECHO) '=========== END OF $@ =========' include $(PATH_OUT)/DynamicConfig.kmk endif # !VBOX_NOINC_DYNAMIC_CONFIG_KMK # # C++ language level # See https://en.cppreference.com/w/cpp/compiler_support and compiler docs. # ## @todo consider maxing this out. ifndef VBOX_GCC_std if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.arm64) # Go straight for c++17 here. VBOX_GCC_std := -std=c++17 # else if "$(VBOX_CLANG_VERSION_CXX)" vge 60000 # Most language features complete by v6. Lib stuff was less complete in v6, but hopefully acceptable for out purposes. #VBOX_GCC_std := -std=c++17 else if "$(VBOX_CLANG_VERSION_CXX)" vge 50000 # darwin Xcode 5 allegedly knows what C++11 is VBOX_GCC_std := -std=c++11 # else if "$(VBOX_GCC_VERSION_CXX)" vge 70000 # Language feature P0512R0 was v8, rest v7 or earlier. Most lib stuff present in 7, complete in v12. #VBOX_GCC_std := -std=gnu++17 else if "$(VBOX_GCC_VERSION_CXX)" vge 40800 VBOX_GCC_std := -std=c++11 else if "$(VBOX_GCC_VERSION_CXX)" vge 40600 VBOX_GCC_std := -std=c++0x endif endif ifndef VBOX_VCC_std if $(VBOX_VCC_TOOL_STEM) >= VCC141 # since 2017 15.3 VBOX_VCC_std := -std:c++17 -Zc:__cplusplus endif endif # # Compiler warning control. # 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_Wno-language-extension-token) \ $(VBOX_GCC_Wno-extended-offsetof) $(VBOX_GCC_Wno-gnu-folding-constant) $(VBOX_GCC_Wno-gnu-anonymous-struct) \ $(VBOX_GCC_Wlogical-op) $(VBOX_GCC_Wno-string-plus-int) $(VBOX_GCC_Wno-nested-anon-types) $(VBOX_GCC_Wno-variadic-macros) \ $(VBOX_GCC_Wno-c++17-compat-mangling) VBOX_GCC_WARN_PEDANTIC = -Wshadow $(VBOX_GCC_WARN) -Wno-long-long if $(VBOX_GCC_VERSION_CXX) >= 40200 || defined(VBOX_WITH_MASOCHISTIC_WARNINGS) # gcc 4.2.x+ (4.1.2 is causing trouble with the extpack & add builds) VBOX_GCC_WARN_MASOCHISTIC ?= -Wunused-variable -Wunused-function -Wunused-label -Wunused-parameter endif if $(KBUILD_TARGET) == "linux" \ || ($(KBUILD_TARGET) == "darwin" && "$(VBOX_GCC_TOOL)" != "GXX4MACHO" && "$(VBOX_GCC_TOOL)" != "GXX42MACHO") \ || defined(VBOX_WITH_MASOCHISTIC_WARNINGS) VBOX_GCC_WARN_PEDANTIC += $(VBOX_GCC_WARN_MASOCHISTIC) endif ifdef VBOX_GCC_Wno-variadic-macros # Don't use -pedantic unless -Wno-variadic-macros also works. Too noisy. VBOX_GCC_PEDANTIC_OPTION ?= -pedantic else VBOX_GCC_PEDANTIC_OPTION ?= endif VBOX_GCC_PEDANTIC_CXX ?= $(VBOX_GCC_PEDANTIC_OPTION) $(VBOX_GCC_WARN_PEDANTIC) $(VBOX_GCC_Wno-return-type-c-linkage) $(VBOX_GCC_Wno-overloaded-virtual) $(VBOX_GCC_Wno-undefined-var-template) VBOX_GCC_PEDANTIC_C ?= $(VBOX_GCC_PEDANTIC_OPTION) $(VBOX_GCC_WARN_PEDANTIC) -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Werror-implicit-function-declaration # Avoid freaking out when using flexible arrays in C++ code (ldrPE.cpp, ++). if ($(VBOX_GCC_VERSION_CXX) < 60100 || $(VBOX_GCC_VERSION_CXX) >= 70000) && "$(VBOX_GCC_Wno-array_bounds)" != "" VBOX_GCC_PEDANTIC_CXX += $(VBOX_GCC_Wno-array_bounds) endif # Stupid problem with (__typeof__((*ppv)) casts in asm.h where volatile is involved and ignored. if $(VBOX_GCC_VERSION_CXX) >= 80000 && "$(VBOX_GCC_Wno-ignored-qualifiers)" VBOX_GCC_PEDANTIC_CXX += $(VBOX_GCC_Wno-ignored-qualifiers) endif VBOX_GCC_NON_PEDANTIC_CXX ?= -Wno-sign-compare VBOX_GCC_NON_PEDANTIC_C ?= -Wno-sign-compare -Werror-implicit-function-declaration if "$(KBUILD_TARGET)" == "darwin" && "$(VBOX_GCC_TOOL)" != "GXX4MACHO" && "$(VBOX_GCC_TOOL)" != "GXX42MACHO" VBOX_GCC_PEDANTIC_CXX += -Wno-c99-extensions VBOX_GCC_NON_PEDANTIC_CXX += -Wno-c99-extensions endif # Disabled Visual C++ warnings, W4: # -wd4065: switch statement contains 'default' but no 'case' labels # -wd4996: deprecated / insecure. # -wd4127: conditional expression is constant [level 4] # -wd4706: assignment within conditional expression [level 4] # -wd4201: nonstandard extension used : nameless struct/union [level 4] # -wd4214: nonstandard extension used : bit field types other than int [level 4] # -wd4510: 'VM::' : default constructor could not be generated # -wd4512: 'VM' : assignment operator could not be generated # -wd4610: union 'VM::' can never be instantiated - user defined constructor required # Disabled Visual C++ warnings, Wall: # -wd4514: unreferenced inline function has been removed # -wd4820: 'RTSTRSPACECORE' : '7' bytes padding added after data member 'RTSTRSPACECORE::uchHeight' # -wd4365: '=' : conversion from 'unsigned char' to 'char', signed/unsigned mismatch # -wd4987: nonstandard extension used: 'throw (...)' (setjmp.h + our stuff) # -wd4710: 'std::string std::_Narrow_str(std::wstring)' : function not inlined # -wd4061: enumerator 'RTASN1TYPE_END' in switch of enum 'RTASN1TYPE' is not explicitly handled by a case label # Note! C4062 checks for the same but includes the 'default' case, just like gcc. So, no trouble disabling this. # -wd4986: 'operator new[]': exception specification does not match previous declaration (crtdbg.h vs new, exception specification only) # -wd4191: 'type cast' : unsafe conversion from 'int (__cdecl *)(gzFile)' to 'PFNRT' # -wd4574: 'INCL_WINSOCK_API_TYPEDEFS' is defined to be '0': did you mean to use '#if INCL_WINSOCK_API_TYPEDEFS'? # -wd4917: 'OLE_XPOS_HIMETRIC' : a GUID can only be associated with a class, interface or namespace # -wd4711: function 'void __cdecl rtMemCacheFreeOne(struct RTMEMCACHEINT * __ptr64,void * __ptr64)' selected for automatic inline expansion # -wd4571: Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught # -wd4611: interaction between '_setjmp' and C++ object destruction is non-portable # -wd4324: '_TDI_PNP_CONTEXT_XP' : structure was padded due to __declspec(align()) # -wd4505: VBoxNetFltNobj.h(45) : warning C4505: 'VBoxNetFltNobj::Release' : unreferenced local function has been removed # Probably related to http://stackoverflow.com/questions/3051992/compiler-warning-at-c-template-base-class # -wd4263: 'int VRDPChannelClipboard::SendPacket(const void *,uint32_t)' : member function does not override any base class virtual member function # Probably useful, but impractical, just like the next one. # -wd4264: 'int VRDPOutputCtx::SendPacket(void)' : no override available for virtual member function from base 'VRDPOutputCtx'; function is hidden # -wd4738: storing 32-bit float result in memory, possible loss of performance # -wd4371: UIActionPool.h(393) : warning C4371: 'UIActionPool::PointerToFunction' : layout of class may have changed from a previous version of the compiler due to better packing of member 'UIActionPool::PointerToFunction::ptfr' # -wd4748: uiactionpoolmanager.cpp(2723) : warning C4748: /GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function # Want to enable these: # -wd4242: '=' : conversion from 'uint32_t' to 'uint8_t', possible loss of data # -wd4244: 'conversion' conversion from 'type1' to 'type2', possible loss of data # -wd4200: nonstandard extension used : zero-sized array in struct/union # Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array VBOX_VCC_WARN_ALL := -W4 -Wall -wd4065 -wd4996 -wd4127 -wd4706 -wd4201 -wd4214 -wd4510 -wd4512 -wd4610 \ -wd4514 -wd4820 -wd4365 -wd4987 -wd4710 -wd4061 -wd4986 -wd4191 -wd4574 -wd4917 -wd4711 -wd4611 -wd4571 -wd4324 -wd4505 \ -wd4263 -wd4264 -wd4738 -wd4200 -wd4371 -wd4748 if1of ($(VBOX_VCC_TOOL_STEM), VCC120) # -wd4350: behavior change: 'std::_Wrap_alloc>::_Wrap_alloc(const std::_Wrap_alloc> &) throw()' called instead of 'std::_Wrap_alloc>::_Wrap_alloc>>(_Other &) throw()' # -wd4435: iprt/cpp/xml.h(185) : warning C4435: 'xml::Input' : Object layout under /vd2 will change due to virtual base 'xml::Stream' VBOX_VCC_WARN_ALL += -wd4350 -wd4435 endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" # -wd5045: Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified # -wd5039: 'RTStrSpaceDestroy': pointer or reference to potentially throwing function passed to extern C function under -EHc. Undefined behavior may occur if this function throws an exception. # -wd4464: relative include path contains '..' (iprt/nocrt/compiler.msc.h) # -wd4623: 'VM': default constructor was implicitly defined as deleted # -wd4625: 'SUPDRVTRACERDATA': copy constructor was implicitly defined as deleted # -wd4626: 'SUPDRVTRACERDATA': assignment operator was implicitly defined as deleted # -wd5026: 'SUPDRVTRACERDATA': move constructor was implicitly defined as deleted # -wd5027: 'SUPDRVTRACERDATA': move assignment operator was implicitly defined as deleted # -wd4435: 'xml::Input': Object layout under /vd2 will change due to virtual base 'xml::Stream' # -wd4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc VBOX_VCC_WARN_ALL += -wd5045 -wd4464 -wd4623 -wd4625 -wd4626 -wd5026 -wd5027 -wd4435 -wd4577 endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC142" # With v16.11.9, not with v16.6.0 4242 # -wd5220: 'RTDBGMODINT::cRefs': a non-static data member with a volatile qualified type no longer implies that compiler generated copy/move constructors and copy/move assignment operators are not trivial VBOX_VCC_WARN_ALL += -wd5220 # Temporarily: # -wd4242: asn1-ut-string.cpp(729): warning C4242: 'argument': conversion from 'uint32_t' to 'uint16_t', possibl loss of data # -wd4244: asn1-ut-objid.cpp(124): warning C4244: '=': conversion from 'uint32_t' to 'uint8_t', possible loss of data VBOX_VCC_WARN_ALL += -wd4242 -wd4244 endif # -wd4548: socket.cpp(1931): warning C4548: expression before comma has no effect; expected expression with side-effect VBOX_VCC_WARN_ALL += -wd4548 ifndef VBOX_WITH_NEW_WINDOWS_SDK # -wd5031: iprt/win/windows.h(55): warning C5031: #pragma warning(pop): likely mismatch, popping warning state pushed in different file # -wd5032: iprt/win/windows.h(37): warning C5032: detected #pragma warning(push) with no corresponding #pragma warning(pop) VBOX_VCC_WARN_ALL += -wd5031 -wd5032 endif ifndef VBOX_NEWER_VCC_WARN_ALL if "$(VBOX_VCC_TOOL_STEM)" < "VCC120" VBOX_NEWER_VCC_WARN_ALL := $(VBOX_VCC_WARN_ALL) -wd4350 -wd4435 else VBOX_NEWER_VCC_WARN_ALL := $(VBOX_VCC_WARN_ALL) endif endif # Disable pedantic warnings for NP/NonPedantic templates. # -wd4131: 'bi_flush' : uses old-style declarator # -wd4255: 'tr_static_init' : no function prototype given: converting '()' to '(void)' # -wd4668: '_WIN32_WCE' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'/ # -wd4100: 'cinfo' : unreferenced formal parameter # -wd4189: 'sz' : local variable is initialized but not referenced # -wd4132: 'xmlStringComment' : const object should be initialized # -wd4152: nonstandard extension, function/data pointer conversion in expression # -wd4702: unreachable code # -wd4057: '=' : 'xmlChar *' differs in indirection to slightly different base types from 'char *' # -wd4296: '>=' : expression is always true # -wd4389: '==' : signed/unsigned mismatch # -wd4018: '<=' : signed/unsigned mismatch # -wd4245: '=' : conversion from 'int' to 'unsigned int', signed/unsigned mismatch # -wd4267: '+=' : conversion from 'size_t' to 'long', possible loss of data # -wd4295: 'vendor_string' : array is too small to include a terminating null character VBOX_VCC_NON_PEDANTIC = -wd4131 -wd4255 -wd4668 -wd4100 -wd4189 -wd4132 -wd4152 -wd4702 -wd4057 -wd4296 -wd4389 -wd4018 -wd4245 \ -wd4267 -wd4295 VBOX_NEWER_VCC_NON_PEDANTIC = $(VBOX_VCC_NON_PEDANTIC) ifeq ($(KBUILD_TARGET),win) VBOX_C_CXX_FLAGS_NO_UNUSED_PARAMETERS = -wd4100 else VBOX_C_CXX_FLAGS_NO_UNUSED_PARAMETERS = -Wno-unused-parameter endif # # Version dependent Visual C++ stuff. # if1of (win, $(KBUILD_TARGET) $(KBUILD_HOST)) ifn1of ($(VBOX_VCC_TOOL_STEM), VCC100 VCC110 VCC120) ifndef VBOX_WITHOUT_CONTROL_FLOW_GUARD VBOX_VCC_CC_GUARD_CF = -guard:cf VBOX_VCC_LD_GUARD_CF = -Guard:CF else VBOX_VCC_CC_GUARD_CF = VBOX_VCC_LD_GUARD_CF = endif VBOX_VCC_LD_HIGH_ENTRYOPY_VA = /HighEntropyVA else VBOX_VCC_CC_GUARD_CF = VBOX_VCC_LD_GUARD_CF = VBOX_VCC_LD_HIGH_ENTRYOPY_VA = endif ifn1of ((VBOX_VCC_TOOL_STEM), VCC100 VCC110 VCC120 VCC140 VCC141) # 16.7 and later, so not in our linker yet. ## @todo BUGBUG! Update VCC before 7.0 is released. #VBOX_VCC_LD_CET_COMPAT = /CetCompat VBOX_VCC_LD_CET_COMPAT = else VBOX_VCC_LD_CET_COMPAT = endif endif # # Compiler optimization flags. # 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++. # if1of ($(KBUILD_TYPE), debug dbgopt strict) #not yet# VBOX_WITH_DEBUG_VCC_CRT = 1 endif ifdef VBOX_WITH_DEBUG_VCC_CRT VBOX_VCC_CRT_TYPE := d VBOX_VCC_CRT_TYPE_UPPER := D VBOX_VCC_CRT_TYPE_N := else VBOX_VCC_CRT_TYPE := VBOX_VCC_CRT_TYPE_UPPER := VBOX_VCC_CRT_TYPE_N := d endif # # 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 # # The general GCC/Clang no warning policy. # # Note! This doesn't control everything. Instead set VBOX_GCC_WERR=$(NO_SUCH_VARIABLE) to # completely disable -Werror. # if !defined(VBOX_WITHOUT_NO_GCC_WARNING_POLICY) && !defined(VBOX_WITH_NO_GCC_WARNING_POLICY) if defined(VBOX_WITH_MASOCHISTIC_WARNINGS) # gcc 4.6.x+ VBOX_WITH_NO_GCC_WARNING_POLICY = 1 else if "$(KBUILD_TARGET)" == "darwin" ifn1of ($(VBOX_GCC_TOOL), GXX4MACHO GXX42MACHO) VBOX_WITH_NO_GCC_WARNING_POLICY = 1 endif else if1of ($(KBUILD_TARGET), linux) if $(VBOX_GCC_VERSION_CXX) >= 40600 # gcc 4.6.x+ VBOX_WITH_NO_GCC_WARNING_POLICY = 1 endif endif endif ifdef VBOX_WITH_NO_GCC_WARNING_POLICY $(info build debug: VBOX_WITH_NO_GCC_WARNING_POLICY is enabled) endif # # Misc stuff that should be after including DynamicConfig.kmk. # # libxml XML linter. ifeq ($(VBOX_XMLLINT),) ifeq ($(KBUILD_HOST),win) VBOX_XMLLINT := $(wildcard $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)/libxslt/10128/bin/xmllint.exe) endif ifeq ($(VBOX_XMLLINT),) VBOX_XMLLINT := $(VBOX_HAVE_XMLLINT) endif ifneq ($(VBOX_XMLLINT),) VBOX_HAVE_XMLLINT := 1 else VBOX_XMLLINT := xmllint VBOX_HAVE_XMLLINT := endif else VBOX_HAVE_XMLLINT := 1 endif # Older versions of GCC cannot compile libssh, so disable it and the feature if that's the case. ifn1of ($(KBUILD_TARGET), darwin win) if $(VBOX_GCC_VERSION_CC) < 50000 VBOX_WITH_LIBSSH := VBOX_WITH_CLOUD_NET := endif 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,$<,$@) $(eval $(1)_CLEAN += $$($(1)_0_OUTDIR)/$(if $(3),$(3),$(2))) endef ## # Edits VirtualBox version, vendor, package, build target, build arch, and build type strings in a text file. # # Please use VBOX_EDIT_VERSION_AND_BUILD_RULE_FN to generate edit rule. # # @param 1 The input filename. # @param 2 The output filename. # VBOX_EDIT_VERSION_AND_BUILD_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' \ -e 's+@KBUILD_TYPE@+$(KBUILD_TYPE)+g' \ -e 's+@KBUILD_TARGET@+$(KBUILD_TARGET)+g' \ -e 's+@KBUILD_TARGET_ARCH@+$(KBUILD_TARGET_ARCH)+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_AND_BUILD_RULE_FN = $(eval $(VBOX_EDIT_VERSION_AND_BUILD_RULE_DEF)) define VBOX_EDIT_VERSION_AND_BUILD_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_AND_BUILD_CMD_FN,$$<,$$@) $(1)_CLEAN += $$($(1)_0_OUTDIR)/$(if $(3),$(3),$(2)) 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 ## VBOX_UTF8_MANIFEST_CMDS # Wrapper around VBOX_UTF8_MANIFEST_FN that makes sure it's an EXE link target, # as this UTF-8 manifest doesn't make sense for non-executables. ifn1of ($(VBOX_VCC_TOOL_STEM), VCC100 VCC110 VCC120) ## VBOX_UTF8_MANIFEST_FN # Adds a manifest resource with ID 1 that tells windows 10 1903 and later to # use UTF-8 for the ANSI and OEM code pages. We only do this when using UCRT # as the VCC100 CRT typically ends up with its internal code page not being # CP_UTF8 but the default codepage for the locale. # # @param 1 the output filename. # @param 2 the architecture (required for xp rtm) # VBOX_UTF8_MANIFEST_FN = \ $(QUIET)$(APPEND) -tn "$(1).manifest" \ '' \ '' \ ' ' \ ' ' \ ' ' \ ' UTF-8' \ ' ' \ ' ' \ '' \ $(NLTAB)$(QUIET)$(REDIRECT) -- $(requote sh,$(PATH_SDK_$(VBOX_WINPSDK)_BIN)/mt.exe) \ -nologo -manifest '$(subst /,\,$(1).manifest)' '-outputresource:$(subst /,\,$(1));$(HASH)1' \ $(NLTAB)$(QUIET)$(RM) -f -- "$(1).manifest" VBOX_UTF8_MANIFEST_CMDS ?= $(if-expr "$(tool_do)" == "LINK_PROGRAM",$(call VBOX_UTF8_MANIFEST_FN,$(out),$(bld_trg_arch)),) else VBOX_UTF8_MANIFEST_CMDS = endif # # 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. # - The 'adhoc' mode is specific to building on macOS and is similar to 'test' # mode but doesn't require any certificates but a host set up for development work. # Binaries are signed in adhoc mode and include required entitlements as appropriate # (something we would only do in the 'packing' target). This seem to be the only working # way with newer versions of macOS (tested with Ventura) with 'test' not working anymore. # ifdef VBOX_SIGNING_MODE VBOX_SIGNING_MODE := $(strip $(VBOX_SIGNING_MODE)) ifn1of ($(VBOX_SIGNING_MODE), test release adhoc) $(error VBOX_SIGNING_MODE must be either 'test', 'release' or 'adhoc'. The value '$(VBOX_SIGNING_MODE)' is not recognized.) endif if "$(VBOX_SIGNING_MODE)" == "adhoc" && "$(KBUILD_TARGET)" != "darwin" $(error 'adhoc' signing mode is only available on macOS) endif VBOX_RETRY ?= $(ASH) $(KBUILD_DEVTOOLS)/bin/retry.sh # temporary solution for a $(dir ...) equivalent which assumes that it gets a single path, possibly with spaces. VBOX_DIRX = $(subst ?,$(SP),$(dir $(subst $(SP),?,$1))) # Corp code signing client. VBOX_CCS_CLIENT_JAR := $(firstword $(rsort \ $(wildcard $(KBUILD_DEVTOOLS)/common/ccs/v*/Client.jar)) \ $(KBUILD_DEVTOOLS)/common/ccs/notfound/Client.jar ) VBOX_CCS_USER ?= virtualbox_grp VBOX_CCS_GLOBAL_UID ?= non-of-your-business VBOX_CCS_SERVER ?= UK ## # Corp Code Signing command line. # @param $1 Signing method: solaris_elf, solaris_pkg, driver (microsoft), ... # @param $2 The file to be submitted for signing. # @param $3 The directory to put the signed file in. Defaults to $(dir $2). # @param $4 Additional options. VBOX_CCS_SIGN_CMD = $(VBOX_RETRY) $(VBOX_JAVA) -jar "$(VBOX_CCS_CLIENT_JAR)" \ sign -user "$(VBOX_CCS_USER)" -global_uid "$(VBOX_CCS_GLOBAL_UID)" \ -job_timeout 90 -server_timeout 75 -server "$(VBOX_CCS_SERVER)" \ -sign_method "$1" -file_to_sign "$2" -signed_location "$(if $3,$3,$(call VBOX_DIRX,$2))" $4 ifeq ($(KBUILD_HOST),win) # # Windows # # VBOX_PATH_SELFSIGN points to the Vista WDK bin/SelfSign directory. ifndef VBOX_PATH_SELFSIGN VBOX_PATH_SELFSIGN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS)/win.x86/selfsign/*))) ifeq ($(VBOX_PATH_SELFSIGN),) VBOX_PATH_SELFSIGN := $(KBUILD_DEVTOOLS)/win.x86/selfsign/r1 endif endif ifndef VBOX_PATH_SIGN_TOOLS ifdef VBOX_WITH_NEW_WINDOWS_SDK VBOX_PATH_SIGN_TOOLS = $(PATH_SDK_$(VBOX_WINPSDK)_BIN) else VBOX_PATH_SIGN_TOOLS := $(firstword $(rsort $(wildcard \ $(addprefix $(KBUILD_DEVTOOLS)/win.x86/sdk/v8.1*/Bin/, x86 $(if-expr $(KBUILD_HOST_ARCH)=="amd64",x64,) ) ))) ifeq ($(VBOX_PATH_SIGN_TOOLS),) VBOX_PATH_SIGN_TOOLS := $(firstword $(rsort $(wildcard \ $(addprefix $(KBUILD_DEVTOOLS)/win.x86/sdk/v10*/Bin/, x86 $(if-expr $(KBUILD_HOST_ARCH)=="amd64",x64,) ) ))) ifeq ($(VBOX_PATH_SIGN_TOOLS),) VBOX_PATH_SIGN_TOOLS := $(VBOX_PATH_SELFSIGN) endif endif endif endif VBOX_SIGNTOOL ?= $(VBOX_RETRY) "$(VBOX_PATH_SIGN_TOOLS)/signtool.exe" VBOX_SIGNTOOL_SHA1 ?= $(VBOX_SIGNTOOL) VBOX_SIGNTOOL_SHA1_ORDERDEPS ?= VBOX_SIGNTOOL_SHA2 ?= $(VBOX_SIGNTOOL) VBOX_SIGNTOOL_SHA2_ORDERDEPS ?= VBOX_SIGNTOOL_ORDERDEPS ?= $(VBOX_SIGNTOOL_SHA1_ORDERDEPS) $(VBOX_SIGNTOOL_SHA2_ORDERDEPS) 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 ?= VirtualBox 2022 VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)" /a #VBOX_CERTIFICATE_FINGERPRINT ?= 7e 92 b6 6b e5 1b 79 d8 ce 3f f2 5c 15 c2 df 6a b8 c7 f2 f2 #VBOX_CERTIFICATE_FINGERPRINT ?= 5b de fe 58 0a 81 66 61 cd b5 7a 57 10 7b f4 18 74 86 ef cc #VBOX_CERTIFICATE_FINGERPRINT ?= 6f 47 42 06 bc bb 39 1b b8 2b a9 e5 dc 03 02 de f3 7a eb be VBOX_CERTIFICATE_FINGERPRINT ?= 5f 0b fe c5 53 17 c1 25 5a a4 7f cd bc 49 a2 fb 61 09 03 cc #VBOX_CROSS_CERTIFICATE_FILE ?= $(VBOX_PATH_SELFSIGN)/VeriSign Class 3 Public Primary Certification Authority - G5.cer #VBOX_CROSS_CERTIFICATE_FILE ?= $(VBOX_PATH_SELFSIGN)/DigiCert Assured ID Root CA.crt #VBOX_TSA_URL ?= http://timestamp.verisign.com/scripts/timstamp.dll - Appears to be broken between 2020-12-25 and 2020-12-30 (bugref:9849). VBOX_TSA_URL ?= http://timestamp.digicert.com endif if !defined(VBOX_CROSS_CERTIFICATE_FILE_ARGS) && defined(VBOX_CROSS_CERTIFICATE_FILE) VBOX_CROSS_CERTIFICATE_FILE_ARGS = /ac "$(VBOX_CROSS_CERTIFICATE_FILE)" endif if !defined(VBOX_TSA_URL_ARGS) && defined(VBOX_TSA_URL) VBOX_TSA_URL_ARGS = /t "$(VBOX_TSA_URL)" endif VBOX_CERTIFICATE_STORE ?= my VBOX_CERTIFICATE_STORE_ARGS ?= /s "$(VBOX_CERTIFICATE_STORE)" VBOX_CERTIFICATE_FINGERPRINT_ARGS := $(if-expr "$(VBOX_CERTIFICATE_FINGERPRINT)" != "" \ ,/sha1 "$(subst $(SP),,$(VBOX_CERTIFICATE_FINGERPRINT))",) ifeq ($(VBOX_SIGNING_MODE),test) #VBOX_CERTIFICATE_SHA2_SUBJECT_NAME ?= MyTestCertificateSha2 VBOX_CERTIFICATE_SHA2_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SHA2_SUBJECT_NAME)" else # release VBOX_CERTIFICATE_SHA2_SUBJECT_NAME ?= Oracle Corporation VBOX_CERTIFICATE_SHA2_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SHA2_SUBJECT_NAME)" /a #VBOX_CERTIFICATE_SHA2_FINGERPRINT ?= 31 31 bb 58 8b 19 9e 6e 85 0f d3 35 82 b0 c5 82 55 e1 6c 49 #VBOX_CERTIFICATE_SHA2_FINGERPRINT ?= 22 05 6a 4d 46 2e 3d 2b b2 c3 2f bf b0 5b 84 c4 65 9c f7 fe #VBOX_CERTIFICATE_SHA2_FINGERPRINT ?= 17 3a 19 bf 8e 62 72 be 25 04 d3 08 aa 68 b1 b0 0e 03 33 2c VBOX_CERTIFICATE_SHA2_FINGERPRINT ?= 30 65 6f ca 8c 48 b1 d9 86 23 a9 4b 40 a6 bc 98 bd 87 bf ad VBOX_CROSS_CERTIFICATE_SHA2_FILE ?= $(VBOX_PATH_SELFSIGN)/DigiCert Assured ID Root CA.crt #VBOX_TSA_SHA2_URL ?= http://sha256timestamp.ws.symantec.com/sha256/timestamp - phase out for consistency reasons VBOX_TSA_SHA2_URL ?= http://timestamp.digicert.com endif if !defined(VBOX_CROSS_CERTIFICATE_SHA2_FILE_ARGS) && defined(VBOX_CROSS_CERTIFICATE_SHA2_FILE) VBOX_CROSS_CERTIFICATE_SHA2_FILE_ARGS = /ac "$(VBOX_CROSS_CERTIFICATE_SHA2_FILE)" endif if !defined(VBOX_TSA_SHA2_URL_ARGS) && defined(VBOX_TSA_SHA2_URL) VBOX_TSA_SHA2_URL_ARGS = /tr "$(VBOX_TSA_SHA2_URL)" /td SHA256 endif VBOX_CERTIFICATE_SHA2_STORE ?= my VBOX_CERTIFICATE_SHA2_STORE_ARGS ?= /s "$(VBOX_CERTIFICATE_SHA2_STORE)" VBOX_CERTIFICATE_SHA2_FINGERPRINT_ARGS := $(if-expr "$(VBOX_CERTIFICATE_SHA2_FINGERPRINT)" != "" \ ,/sha1 "$(subst $(SP),,$(VBOX_CERTIFICATE_SHA2_FINGERPRINT))",) # Still using SHA-1 for fingerprinting, it's good enough for that! #VBOX_CERTIFICATE_EV_SUBJECT_NAME ?= MyEvCertificate VBOX_CERTIFICATE_EV_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_EV_SUBJECT_NAME)" VBOX_CERTIFICATE_EV_STORE ?= my VBOX_CERTIFICATE_EV_STORE_ARGS ?= /s "$(VBOX_CERTIFICATE_EV_STORE)" #VBOX_CERTIFICATE_EV_FINGERPRINT ?= my ev cert fingerprint VBOX_CERTIFICATE_EV_FINGERPRINT_ARGS := $(if-expr "$(VBOX_CERTIFICATE_EV_FINGERPRINT)" != "" \ ,/sha1 "$(subst $(SP),,$(VBOX_CERTIFICATE_EV_FINGERPRINT))",) # Still using SHA-1 for fingerprinting, it's good enough for that! ## Sign a file (generic). # @param 1 The file to sign. # @param 2 File description. Optional. # @param 3 Additional parameters. Optional. # @param 4 Set to 2 if the expression will be expanded twice before chopped into commands (for _CMDS). # @param 5 Disables dual signing if non-empty, picking the SHA2 signature (since 2022-07-18). # @param 6 non-zero for alternative command separator. This is used for generating repacking scripts. ifndef VBOX_SIGN_FILE_FN if $(intersects win all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) VBOX_SIGN_FILE_FN = $(call VBOX_CCS_SIGN_CMD,driver$(if-expr "$3" == "/ph",_pagehash,),$1,,-digest_algo $(if-expr "$5" == "",SHA1,SHA2)) \ $(if-expr "$5" == "", \ $(if-expr "$6" == "",$(if-expr "$4" == "2",$$(NLTAB),$(NLTAB)),$6) \ $(call VBOX_CCS_SIGN_CMD,driver$(if-expr "$3" == "/ph",_pagehash,),$1,,-dual_sign -digest_algo SHA2)) else ifdef VBOX_CERTIFICATE_SHA2_SUBJECT_NAME ifdef VBOX_CERTIFICATE_SUBJECT_NAME VBOX_SIGN_FILE_FN = $(if-expr "$5" == "",$(VBOX_SIGNTOOL_SHA1) \ sign /fd sha1 \ $(VBOX_CROSS_CERTIFICATE_FILE_ARGS) \ $(VBOX_CERTIFICATE_STORE_ARGS) \ $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \ $(VBOX_CERTIFICATE_FINGERPRINT_ARGS) \ $(VBOX_TSA_URL_ARGS) \ $(if $(strip $(2)),/d "$(strip $(2))",) \ $(3) \ "$(1)" \ $(if-expr "$6" == "",$(if-expr "$4" == "2",$$(NLTAB),$(NLTAB)),$6))$(VBOX_SIGNTOOL_SHA2) \ sign $(if-expr "$5" == "",/as,) /fd sha256 \ $(VBOX_CROSS_CERTIFICATE_SHA2_FILE_ARGS) \ $(VBOX_CERTIFICATE_SHA2_STORE_ARGS) \ $(VBOX_CERTIFICATE_SHA2_SUBJECT_NAME_ARGS) \ $(VBOX_CERTIFICATE_SHA2_FINGERPRINT_ARGS) \ $(VBOX_TSA_SHA2_URL_ARGS) \ $(if $(strip $(2)),/d "$(strip $(2))",) \ $(3) \ "$(1)" else VBOX_SIGN_FILE_FN = $(VBOX_SIGNTOOL_SHA2) \ sign /fd sha256 \ $(VBOX_CROSS_CERTIFICATE_SHA2_FILE_ARGS) \ $(VBOX_CERTIFICATE_SHA2_STORE_ARGS) \ $(VBOX_CERTIFICATE_SHA2_SUBJECT_NAME_ARGS) \ $(VBOX_CERTIFICATE_SHA2_FINGERPRINT_ARGS) \ $(VBOX_TSA_SHA2_URL_ARGS) \ $(if $(strip $(2)),/d "$(strip $(2))",) \ $(3) \ "$(1)" endif else VBOX_SIGN_FILE_FN = $(VBOX_SIGNTOOL) \ sign /fd $(firstword $(VBOX_TEST_SIGN_ALGORITHM) sha256) \ $(VBOX_CROSS_CERTIFICATE_FILE_ARGS) \ $(VBOX_CERTIFICATE_STORE_ARGS) \ $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \ $(VBOX_CERTIFICATE_FINGERPRINT_ARGS) \ $(VBOX_TSA_URL_ARGS) \ $(if $(strip $(2)),/d "$(strip $(2))",) \ $(3) \ "$(1)" endif endif ## EV sign a file (generic). # @param 1 The file to sign. # @param 2 The directory to put the signed file in. Defaults to $(dir $1). ifndef VBOX_SIGN_EV_FILE_FN if $(intersects win_ev all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) VBOX_SIGN_EV_FILE_FN = $(call VBOX_CCS_SIGN_CMD,microsoftev,$1,$(if $2,$2,)) else ifdef VBOX_CERTIFICATE_EV_SUBJECT_NAME VBOX_SIGN_EV_FILE_FN = $(VBOX_SIGNTOOL_SHA2) \ sign /fd sha256 \ $(VBOX_CERTIFICATE_EV_STORE_ARGS) \ $(VBOX_CERTIFICATE_EV_SUBJECT_NAME_ARGS) \ $(VBOX_CERTIFICATE_EV_FINGERPRINT_ARGS) \ $(VBOX_TSA_SHA2_URL_ARGS) \ "$(1)" endif endif ## Local SHA-1 and SHA-256 signatures with EV SHA-256 signature from corp code signing. # # This builds on Plan B, since the corp code signing always replaces existing # signatures. Since we're signing more, though, we do things slightly differently # so we can apply this to VBOX_RTSIGNTOOL as well - only that didn't work because # kmk tries to help windows caching images it executes. So HACK ALERT on that. # # So, here is what we do. # 1. Sign $1 using the regular signing, probably dual signing it using local certs. # 2. Make temporary copy of $1 as $1.dual # 3. Do SHA-256 corp code signing of $1 # 4. Add the SHA-256 signature from $1 to $1.dual using bldRTSignTool. # 5. Replace $1 with $1.dual. # # @param 1 The file to sign. # @param 2 File description. Optional. # @param 3 Additional parameters. Optional. # @param 4 Set to 2 if the expression will be expanded twice before chopped into commands (for _CMDS). # @param 5 Disables dual & tripple signing if non-empty. # @param 6 Disables tripple signing if non-empty. # # @remarks The parameters are the same as VBOX_SIGN_FILE_FN. VBOX_SIGN_IMAGE_WITH_EV_FN = $(call VBOX_SIGN_FILE_FN,$1,$2,$3,$4,$5)$(if-expr "$5" == "" && "$(target)" != "bldRTSignTool", \ $(if-expr "$4" == "2",$$(NLTAB),$(NLTAB))$(RM) -f -- "$1.dual" \ $(if-expr "$4" == "2",$$(NLTAB),$(NLTAB))$(CP) -- "$1" "$1.dual" \ $(if-expr "$4" == "2",$$(NLTAB),$(NLTAB))$(call VBOX_CCS_SIGN_CMD,microsoftev,$1,,-digest_algo SHA2) \ $(if-expr "$4" == "2",$$(NLTAB),$(NLTAB))$(VBOX_RTSIGNTOOL) add-nested-$(if-expr "$(suffix $1)" == ".cat",cat,exe)-signature -v "$1.dual" "$1" \ $(if-expr "$4" == "2",$$(NLTAB),$(NLTAB))$(MV) -f -- "$1.dual" "$1" \ ,) ## Corp code signing for drivers and catalogs, plan B. # # Since the corp code signing cannot dual signing and doesn't even have a # SHA-1 cert, we have to get creative: # 1. Sign $1 using local SHA-1 certificate. # 2. Make temporary copy of $1 as $1.ccs # 3. Do SHA-256 corp code signing of $1.ccs # 4. Add the SHA-256 signature from $1.ccs to $1 using bldRTSignTool. # 5. Delete $1.ccs. # # @param 1 The file to sign. # @param 2 File description. Optional. # @param 3 Additional parameters. Optional. # @param 4 Set to 2 if the expression will be expanded twice before chopped into commands (for _CMDS). # @param 5 Disables dual signing if non-empty. # # @remarks The parameters are the same as VBOX_SIGN_FILE_FN. VBOX_SIGN_IMAGE_PLAN_B_FN = $(VBOX_SIGNTOOL_SHA1) \ sign /fd sha1 \ $(VBOX_CROSS_CERTIFICATE_FILE_ARGS) \ $(VBOX_CERTIFICATE_STORE_ARGS) \ $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \ $(VBOX_CERTIFICATE_FINGERPRINT_ARGS) \ $(VBOX_TSA_URL_ARGS) \ $(if $(strip $(2)),/d "$(strip $(2))",) \ $(3) \ "$(1)" \ $(if-expr "$5" == "", \ $(if-expr "$4" == "2",$$(NLTAB),$(NLTAB))$(RM) -f -- "$1.ccs" \ $(if-expr "$4" == "2",$$(NLTAB),$(NLTAB))$(CP) -- "$1" "$1.ccs" \ $(if-expr "$4" == "2",$$(NLTAB),$(NLTAB))$(call VBOX_CCS_SIGN_CMD,driver$(if-expr "$3" == "/ph",_pagehash,),$1.ccs,,-digest_algo SHA2) \ $(if-expr "$4" == "2",$$(NLTAB),$(NLTAB))$(VBOX_RTSIGNTOOL) add-nested-$(if-expr "$(suffix $1)" == ".cat",cat,exe)-signature -v "$1" "$1.ccs" \ $(if-expr "$4" == "2",$$(NLTAB),$(NLTAB))$(RM) -f -- "$1.ccs" \ ,) ## Sign an executable image. # @param 1 The file to sign. # @param 2 File description. Optional. # @param 3 Set to 2 if the expression will be expanded twice before chopped into commands (for _CMDS). if1of (win_with_ev, $(VBOX_WITH_CORP_CODE_SIGNING)) VBOX_SIGN_IMAGE_FN ?= $(call VBOX_SIGN_IMAGE_WITH_EV_FN,$(1),$(2),/ph,$(3)) VBOX_SIGN_IMAGE_ORDERDEPS ?= $(VBOX_RTSIGNTOOL) $(VBOX_SIGNTOOL_ORDERDEPS) else VBOX_SIGN_IMAGE_FN ?= $(call VBOX_SIGN_FILE_FN,$(1),$(2),/ph,$(3)) VBOX_SIGN_IMAGE_ORDERDEPS ?= $(VBOX_SIGNTOOL_ORDERDEPS) endif ## Commands for signing a driver image after link. if $(intersects win_planb,$(VBOX_WITH_CORP_CODE_SIGNING)) VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_IMAGE_PLAN_B_FN,$(out),,/ph,2)) VBOX_SIGN_DRIVER_ORDERDEPS ?= $(VBOX_RTSIGNTOOL) $(VBOX_SIGNTOOL_ORDERDEPS) else VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_IMAGE_FN,$(out),,2)) VBOX_SIGN_DRIVER_ORDERDEPS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_SIGN_IMAGE_ORDERDEPS)) endif ## 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 ';'. ifndef VBOX_MAKE_CAT_HLP_FN 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)" if $(intersects win_planb,$(VBOX_WITH_CORP_CODE_SIGNING)) VBOX_MAKE_CAT_HLP_FN += $(NL)$(TAB)$(call VBOX_SIGN_IMAGE_PLAN_B_FN,$(2),,,$(NL)$(TAB)) else VBOX_MAKE_CAT_HLP_FN += $(NL)$(TAB)$(call VBOX_SIGN_FILE_FN,$(2),,,$(NL)$(TAB)) endif endif 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),,2)) VBOX_SIGN_IMAGE_CMDS_ORDERDEPS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_SIGN_IMAGE_ORDERDEPS)) endif ## Enable signing of the additions drivers, i.e. create CAT files. ## @todo r=bird: This bugger is entirely misplaced, as it belongs in the additions config section so it can be properly overriden. VBOX_SIGN_ADDITIONS ?= 1 ## Set if we should include the legacy timestamp CA. ifndef VBOX_WITH_VBOX_LEGACY_TS_CA if "$(findstring 55287c0d517e273696d67c690dd5d9f0a1d6d725,$(VBOX_TSA_URL_ARGS))" != "" VBOX_WITH_VBOX_LEGACY_TS_CA = 1 endif endif VBOX_LEGACY_TS_CA_FILE = $(VBOX_PATH_SRC_CERTIFICATES)/Timestamp-VBoxLegacyWinCA.crt else ifeq ($(KBUILD_HOST),darwin) ## Sign a VM process binary with the given entitlements # @param 1 The file to sign. # @param 2 Identifier, optional. ifeq ($(VBOX_SIGNING_MODE),adhoc) if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) ## @todo cannot handle $(2), the identifier. VBOX_SIGN_IMAGE_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB) \ $(call VBOX_CCS_SIGN_CMD,binary,$(1),,$(subst --entitlements=,-entitlement_file_path ,$(3)) \ $(if $(VBOX_WITH_MACOS_HARDENED_RUNTIME),-hardened_runtime)) else VBOX_SIGN_IMAGE_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(VBOX_CODESIGN) \ --verbose=9 \ --force \ $(if-expr $(KBUILD_HOST_VERSION_MAJOR) <= 14,--digest-algorithm sha256,) \ $(if $(VBOX_WITH_MACOS_HARDENED_RUNTIME),$(if-expr $(KBUILD_HOST_VERSION_MAJOR) <= 16,--options 0x10000,--options runtime)) \ --file-list - \ $(if-expr defined(VBOX_TSA_URL),--timestamp="$(VBOX_TSA_URL)") \ $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \ --entitlements="$(VBOX_DARWIN_ENTITLEMENTS_FILE)" \ "$(1)" \ $(if $(2),--identifier "$(2)",) endif else VBOX_SIGN_IMAGE_FN = endif # # Darwin code signing. # # Currently release signing is done when packing. This may change later. # (Installer package signing is done elsewhere (VBOX_MACOSX_INSTALLER_SIGN).) # if defined(VBOX_CERTIFICATE_FINGERPRINT) && !defined(VBOX_CERTIFICATE_SUBJECT_NAME) VBOX_CERTIFICATE_SUBJECT_NAME = $(subst $(SP),,$(VBOX_CERTIFICATE_FINGERPRINT)) endif 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)" VBOX_TSA_URL ?= none else ifeq ($(VBOX_SIGNING_MODE),adhoc) ifdef VBOX_CERTIFICATE_SUBJECT_NAME $(error VBOX_CERTIFICATE_SUBJECT_NAME must not be set in 'adhoc' signing mode) endif VBOX_CERTIFICATE_SUBJECT_NAME = - VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= --sign "$(VBOX_CERTIFICATE_SUBJECT_NAME)" VBOX_TSA_URL ?= none VBOX_SIGN_IMAGE_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_IMAGE_FN,$(out),,2)) 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 # Always enable the hardened runtime when signing. Can be disabled if # trying to build on quite old macOS, which will likely need some effort. VBOX_WITH_MACOS_HARDENED_RUNTIME ?= 1 ## # Corp Code Notarization command line. Modifies the file because the tickets are stapled. # @param 1 The file to be submitted for signing. # @param 2 Identifier, mandatory. # @param 3 The directory to put the notarized file in. Defaults to $(dir $1). VBOX_CCS_NOTARIZE_CMD = $(VBOX_RETRY) $(VBOX_JAVA) -jar "$(VBOX_CCS_CLIENT_JAR)" \ mac_notarize -user "$(VBOX_CCS_USER)" -global_uid "$(VBOX_CCS_GLOBAL_UID)" \ -job_timeout 90 -server_timeout 75 -server "$(VBOX_CCS_SERVER)" \ -file_to_notarize "$1" -bundle_id "$2" -download_location "$(if $3,$3,$(call VBOX_DIRX,$1))" ## Sign an application bundle, framework or kernel extension. # @param 1 The bundle to sign. # @param 2 Identifier, optional. # @param 3 Additional codesign command line parameters, optional. if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) ## @todo cannot handle $(2), the identifier. ## @todo $(3) is hopefully either empty, --deep or --entitlements=... VBOX_SIGN_BUNDLE_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB) \ ditto -c -k --keepParent "$(1)" "$(1).zip"$(NLTAB) \ $(call VBOX_CCS_SIGN_CMD,apple,$(1).zip,,$(subst --entitlements=,-entitlement_file_path ,$(subst --deep,-deep,$(3))) \ $(if $(VBOX_WITH_MACOS_HARDENED_RUNTIME),-hardened_runtime))$(NLTAB) \ ditto -x -k "$(1).zip" "$(1)/../"$(NLTAB) \ $(RM) -f -- "$(1).zip" else VBOX_SIGN_BUNDLE_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(VBOX_CODESIGN) \ --verbose=9 \ --force \ $(if-expr $(KBUILD_HOST_VERSION_MAJOR) <= 14,--digest-algorithm sha256,) \ $(if $(VBOX_WITH_MACOS_HARDENED_RUNTIME),$(if-expr $(KBUILD_HOST_VERSION_MAJOR) <= 16,--options 0x10000,--options runtime)) \ --file-list - \ $(if-expr defined(VBOX_TSA_URL),--timestamp="$(VBOX_TSA_URL)") \ $(3) \ $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \ "$(1)" $(if $(2),--identifier "$(2)",) endif ## Sign a Mach-O image. # @param 1 The file to sign. # @param 2 Identifier, optional. # @param 3 Additional codesign command line parameters, optional. if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) ## @todo cannot handle $(2), the identifier. ## @todo $(3) is hopefully either empty or --entitlements=... VBOX_SIGN_MACHO_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB) \ $(call VBOX_CCS_SIGN_CMD,binary,$(1),,$(subst --entitlements=,-entitlement_file_path ,$(3)) \ $(if $(VBOX_WITH_MACOS_HARDENED_RUNTIME),-hardened_runtime)) else VBOX_SIGN_MACHO_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(VBOX_CODESIGN) \ --verbose=9 \ --force \ $(if-expr $(KBUILD_HOST_VERSION_MAJOR) <= 14,--digest-algorithm sha256,) \ $(if $(VBOX_WITH_MACOS_HARDENED_RUNTIME),$(if-expr $(KBUILD_HOST_VERSION_MAJOR) <= 16,--options 0x10000,--options runtime)) \ --file-list - \ $(if-expr defined(VBOX_TSA_URL),--timestamp="$(VBOX_TSA_URL)") \ $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \ $(3) \ "$(1)" \ $(if $(2),--identifier "$(2)",) endif ## Commands for signing an extpack dylib file after link. if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) VBOX_SIGN_EXTPACK_DYLIB_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),, \ $(call VBOX_CCS_SIGN_CMD,binary,$(out),, \ $(if $(VBOX_WITH_MACOS_HARDENED_RUNTIME),-hardened_runtime)) ) else VBOX_SIGN_EXTPACK_DYLIB_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),, \ $(VBOX_CODESIGN) \ --verbose=9 \ --force \ $(if-expr $(KBUILD_HOST_VERSION_MAJOR) <= 14,--digest-algorithm sha256,) \ $(if $(VBOX_WITH_MACOS_HARDENED_RUNTIME),$(if-expr $(KBUILD_HOST_VERSION_MAJOR) <= 16,--options 0x10000,--options runtime)) \ --file-list - \ $(if-expr defined(VBOX_TSA_URL),--timestamp="$(VBOX_TSA_URL)") \ $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \ $(out) ) endif ## Sign a VMM Mach-O image. # @param 1 The file to sign. # @param 2 Identifier, optional. VBOX_SIGN_VMM_MOD_FN = $(VBOX_SIGN_MACHO_FN) ## Sign a non-executable file. # @param 1 The file to sign. # @param 2 Identifier, optional. if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) ## @todo cannot handle $(2), the identifier. VBOX_SIGN_FILE_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB) \ $(call VBOX_CCS_SIGN_CMD,mac_dmg,$(1))$(NLTAB) \ $(REDIRECT) -E 'LC_ALL=C' -we "$(1).tmp" -- ditto -x -k -V "$(1).zip" "$(call VBOX_DIRX,$(1))"$(NLTAB) \ dirname="$(call VBOX_DIRX,$(1))$(DOLLAR)($(SED) -n -e 's+^copying file \([0-9]\{1,\}\)/.\{1,\}$(DOLLAR)+\1+p' "$(1).tmp")" ; \ $(MV) -f -- "$(DOLLAR)dirname/$(DOLLAR)(basename "$(1)")" "$(call VBOX_DIRX,$(1))" ; \ $(RM) -Rf -- "$(DOLLAR)dirname/"$(NLTAB) \ $(RM) -f -- "$(1).zip" "$(1).tmp" else VBOX_SIGN_FILE_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(VBOX_CODESIGN) \ --verbose=9 \ --force \ $(if-expr $(KBUILD_HOST_VERSION_MAJOR) <= 14,--digest-algorithm sha256,) \ --file-list=- \ $(if-expr defined(VBOX_TSA_URL),--timestamp="$(VBOX_TSA_URL)") \ $(if $(2),--identifier "$(2)",) \ $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \ "$(1)" endif ## Sign a DMG image. # @param 1 The file to sign. # @param 2 Identifier, optional. # @note Will segfault if --file-list is used on 10.15.2 (kSecCodeInfoChangedFiles -> NULL, outputter doesn't check for NULL). if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) VBOX_SIGN_DMG_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(call VBOX_CCS_SIGN_CMD,binary,$(1)) else VBOX_SIGN_DMG_FN = $(filter-out --file-list=-,$(VBOX_SIGN_FILE_FN)) endif ## Sign a PKG file. Used with corp code signing only. # @param 1 The file to sign. # @param 2 Identifier, optional. if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) ## @todo cannot handle $(2), the identifier. VBOX_SIGN_PKG_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(call VBOX_CCS_SIGN_CMD,mac_pkg,$(1)) endif ## Notarize a file (usually DMG, can also be PKG). Used with corp code signing only. # @param 1 The file to notarize. # @param 2 Identifier, mandatory. if $(intersects darwin darwin_notarize all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) VBOX_NOTARIZE_FILE_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(call VBOX_CCS_NOTARIZE_CMD,$(1),$(2)) 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 there be more, add them as a list in # a 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 $1.kext_SOURCES += $$($1.kext_0_OUTDIR)/Contents/MacOS/$1=>MacOS/$1 \ $(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_BLDDIRS += $$($1.kext_0_OUTDIR)/Contents/MacOS/ $$$$($1.kext_0_OUTDIR)/Contents/MacOS/$1 \ + $(foreach file,$(VBOX_DARWIN_KEXT_SIGN_FILES), $$$$($1.kext_0_OUTDIR)/Contents/_CodeSignature/$(file)): \ $$$$($1.kext_0_OUTDIR)/Contents/Info.plist $$$$($1_1_TARGET) | $$$$($1.kext_0_OUTDIR)/ $(RM) -Rf -- "$$($1.kext_0_OUTDIR)/Contents/_CodeSignature/" "$$($1.kext_0_OUTDIR)/Contents/MacOS/" $(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 # 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)" ## Commands for signing a driver image after link. if $(intersects solaris all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_CCS_SIGN_CMD,solaris_elf,$(out))) else VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_ELF_FN,$(out))) endif 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/@DOT-NT-ARCH@/.NTx86/g' \ -e 's/@COMMA-NT-ARCH@/,NTx86/g' \ -e 's/^;edit-DriverVer.*/DriverVer = $(date-utc %m\/%d\/%Y),$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD).$(expr $(VBOX_SVN_REV) % 50000) ; r$(VBOX_SVN_REV)/' \ --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/@DOT-NT-ARCH@/.NTAMD64/g' \ -e 's/@COMMA-NT-ARCH@/,NTAMD64/g' \ -e 's/^;edit-DriverVer.*/DriverVer = $(date-utc %m\/%d\/%Y),$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD).$(expr $(VBOX_SVN_REV) % 50000) ; r$(VBOX_SVN_REV)/' \ --output $(2) \ $(1) ## @def VBOX_RE_SIGN_DLL_FN # 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. # @param 3 Optional prefix to avoid name collisions. # if defined(VBOX_SIGNING_MODE) && "$(KBUILD_TARGET)" == "win" if1of (quote, $(KMK_FEATURES)) VBOX_RE_SIGN_DLL_FN = $(if-expr !defined($(1)_VBOX_RE_SIGNED_$(3)$(qnotdir ,$(2))), \ $(evalcall VBOX_RE_SIGN_DLL_INTERNAL_FN,$1,$2,$3) \ ,)$($(1)_0_OUTDIR)/$(3)$(qnotdir ,$2) define VBOX_RE_SIGN_DLL_INTERNAL_FN local n = $(3)$(qnotdir ,$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 $$@) $(VBOX_SIGN_IMAGE_ORDERDEPS) $(call MSG_TOOL,SIGNTOOL,,$<,$@) $(RM) -f -- "$@" $(CP) -- "$(quote-sh-dq $<)" "$@" $(CHMOD) a+rw -- "$@" $(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_RE_SIGN_DLL_INTERNAL_FN else # old kmk: no quote feature VBOX_RE_SIGN_DLL_FN = $(if-expr !defined($(1)_VBOX_RE_SIGNED_$(3)$(notdir $(2))), \ $(evalcall VBOX_RE_SIGN_DLL_INTERNAL_FN,$1,$2,$3) \ ,)$($(1)_0_OUTDIR)/$(3)$(notdir $2) define VBOX_RE_SIGN_DLL_INTERNAL_FN local n = $(3)$(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 $$@) $(VBOX_SIGN_IMAGE_ORDERDEPS) $(call MSG_TOOL,SIGNTOOL,,$<,$@) $(RM) -f -- "$@" $(CP) -- "$<" "$@" $(CHMOD) a+rw -- "$@" $(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_RE_SIGN_DLL_INTERNAL_FN endif # old kmk: no quote feature else VBOX_RE_SIGN_DLL_FN = $(2) endif # # File version info and description macros (ignored on most OSes). # ## # Internal macro. # # @param 1 The target name. # @param 2 The description # @param 3 Optional icon file. # @param 4 The template base name. # @param 5 Additional RC options. # @param 6 Original filename to use. # # @remarks ASSUMES RCFLAGS isn't a simple variable (var := value). define VBOX_SET_VER_INFO_INTERNAL ifeq ($(KBUILD_TARGET),win) $(1)_SOURCES.win += $(PATH_ROOT)/src/VBox/Artwork/win/$(4) $(1)_RCFLAGS += /nologo /dIN_INTERNAL_NAME="\"$(1)\"" /dIN_FILE_DESCRIPTION="\"$(2)\"" \ /dIN_ORIGINAL_NAME="\"$(if $(6),$6,$$(notdir $$($(1)_1_INST_TARGET)))\"" \ $(if $(3), /dIN_ICON_FILE="\"$(subst \\,/,$(strip $(3)))\"") $(5) $$$$($(1)_0_OUTDIR)/src/VBox/Artwork/win/$(basename $(4)).res: \ $(PATH_ROOT)/include/VBox/version.h $$$$(VBOX_VERSION_HEADER) endif endef ## # Macro for setting DLL/SO/DYLIB version information and description. # # The macro must be invoked using evalcall2 after the whole target has # been declared. # # @param 1 The target name. # @param 2 The description # @param 3 Optional icon file. VBOX_SET_VER_INFO_DLL = $(evalcall2 VBOX_SET_VER_INFO_INTERNAL,$1,$2,$3,TemplateDll.rc,) ## # Macro for setting EXE version information and description. # # The macro must be invoked using call after the whole target has been declared. # # @param 1 The target name. # @param 2 The description # @param 3 Optional icon file. # @param 4 Optional OriginalFilename value to use. Defaults to target name w/o dir. VBOX_SET_VER_INFO_EXE = $(evalcall2 VBOX_SET_VER_INFO_INTERNAL,$1,$2,$3,TemplateExe.rc,,$4) ## # Macro for setting driver version information and description. # # The macro must be invoked using call after the whole target has been declared. # # @param 1 The target name. # @param 2 The description # @param 3 Optional icon file. # @param 4 Optional VFT2_DRV_xxx define for windows. Uses VFT2_UNKNOWN by default. VBOX_SET_VER_INFO_DRV = $(evalcall2 VBOX_SET_VER_INFO_INTERNAL,$1,$2,$3,TemplateDrv.rc,$(if $(4), /dIN_FILE_SUBTYPE=$(4))) ## # Macro for setting the version information and description for a ring-0 module. # # The macro must be invoked using call after the whole target has been declared. # # @param 1 The target name. # @param 2 The description # @param 3 Optional icon file. VBOX_SET_VER_INFO_R0 = $(evalcall2 VBOX_SET_VER_INFO_INTERNAL,$1,$2,$3,TemplateR0.rc,) ## # Macro for setting the version information and description for a raw-mode context module. # # The macro must be invoked using call after the whole target has been declared. # # @param 1 The target name. # @param 2 The description # @param 3 Optional icon file. VBOX_SET_VER_INFO_RC = $(evalcall2 VBOX_SET_VER_INFO_INTERNAL,$1,$2,$3,TemplateRc.rc,) # # Adjust kBuild defaults. # kBuildGlobalDefaults_DEBUG_NOSTAGE.win = true kBuildGlobalDefaults_DEBUG_NOSTAGE.os2 = true 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. # ifdef VBOX_WITH_DXVK SDK_VBoxDxVk := Direct3D 9/10/11 to Vulkan - for dll linking. SDK_VBoxDxVk_DEFAULT_INCS := \ $(PATH_ROOT)/src/libs/dxvk-native-1.9.2a/include/native/directx \ $(PATH_ROOT)/src/libs/dxvk-native-1.9.2a/include/native/windows SDK_VBoxDxVk_INCS ?= $(SDK_VBoxDxVk_DEFAULT_INCS) # Loaded dynamically SDK_VBoxDxVk_LIBS ?= endif ifdef VBOX_WITH_LIBCURL SDK_VBoxLibCurl := libcurl for dll linking. SDK_VBoxLibCurl_INCS ?= $(PATH_ROOT)/src/libs/curl-8.0.1/include SDK_VBoxLibCurl_LIBS ?= $(PATH_STAGE_LIB)/VBox-libcurl$(VBOX_SUFF_LIB) SDK_VBoxLibCurl_DEFS ?= BUILDING_LIBCURL SDK_VBoxLibCurl-x86 = libcurl/x86 for dll linking. SDK_VBoxLibCurl-x86_INCS ?= $(PATH_ROOT)/src/libs/curl-8.0.1/include SDK_VBoxLibCurl-x86_LIBS.x86 ?= $(PATH_STAGE_LIB)/VBox-libcurl-x86$(VBOX_SUFF_LIB) SDK_VBoxLibCurl-x86_DEFS ?= BUILDING_LIBCURL endif SDK_VBoxLibPng := protable network graphics (png) library for dll linking. SDK_VBoxLibPng_INCS ?= $(PATH_ROOT)/src/libs/libpng-1.6.37 SDK_VBoxLibPng_LIBS ?= $(PATH_STAGE_LIB)/VBox-libpng$(VBOX_SUFF_LIB) # lzf SDK_VBoxLzf := lzf compressor/decompressor for dll linking. SDK_VBoxLzf_INCS ?= $(PATH_ROOT)/src/libs/liblzf-3.6 SDK_VBoxLzf_LIBS ?= $(PATH_STAGE_LIB)/VBox-liblzf$(VBOX_SUFF_LIB) SDK_VBoxLzf-x86 := lzf/x86 compressor/decompressor for dll linking. SDK_VBoxLzf-x86_EXTENDS := VBoxLzf SDK_VBoxLzf-x86_LIBS ?= $(PATH_STAGE_LIB)/VBox-liblzf-x86$(VBOX_SUFF_LIB) SDK_VBoxLzf_STATIC := lzf compressor/decompressor for static linking. SDK_VBoxLzf_STATIC_EXTENDS := VBoxLzf if1of ($(KBUILD_TARGET), os2 win) SDK_VBoxLzf_STATIC_LIBS := $(PATH_STAGE_LIB)/VBox-liblzf-static$(VBOX_SUFF_LIB) endif # openssl SDK_VBoxOpenSslStatic := OpenSSL - Only for VBoxRT and/or statically linked programs. SDK_VBoxOpenSslStatic_VBOX_DEFAULT_INCS := $(PATH_OUT)/obj/crypto-3.0.7-headers/include SDK_VBoxOpenSslStatic_INCS ?= $(SDK_VBoxOpenSslStatic_VBOX_DEFAULT_INCS) SDK_VBoxOpenSslStatic_ORDERDEPS ?= $(crypto-headers_1_TARGET) if !defined(VBOX_ONLY_SDK) \ && (!defined(VBOX_ONLY_ADDITIONS) || !defined(VBOX_ONLY_ADDITIONS_WITHOUT_RTISOMAKER)) \ && (!defined(VBOX_ONLY_EXTPACKS) || !defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS)) \ && ("$(SDK_VBoxOpenSslStatic_INCS)" == "$(SDK_VBoxOpenSslStatic_VBOX_DEFAULT_INCS)") SDK_VBoxOpenSslStatic_DEPS ?= $(SDK_VBoxOpenSslStatic_INCS)/openssl/openssl-mangling.h endif SDK_VBoxOpenSslStatic_LIBS ?= \ $(PATH_STAGE_LIB)/VBox-libssl$(VBOX_SUFF_LIB) \ $(PATH_STAGE_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB) SDK_VBoxOpenSslStatic-x86 := OpenSSL/x86 - Only for VBoxRT and/or statically linked programs. SDK_VBoxOpenSslStatic-x86_VBOX_DEFAULT_INCS := $(PATH_OUT)/obj/crypto-3.0.7-headers/include SDK_VBoxOpenSslStatic-x86_INCS ?= $(SDK_VBoxOpenSslStatic_VBOX_DEFAULT_INCS) SDK_VBoxOpenSslStatic-x86_ORDERDEPS ?= $(crypto-headers_1_TARGET) if ("$(SDK_VBoxOpenSslStatic_INCS)" == "$(SDK_VBoxOpenSslStatic_VBOX_DEFAULT_INCS)") SDK_VBoxOpenSslStatic-x86_DEPS ?= $(SDK_VBoxOpenSslStatic_INCS)/openssl/openssl-mangling.h endif SDK_VBoxOpenSslStatic-x86_LIBS ?= \ $(PATH_STAGE_LIB)/VBox-libssl-x86$(VBOX_SUFF_LIB) \ $(PATH_STAGE_LIB)/VBox-libcrypto-x86$(VBOX_SUFF_LIB) ifdef VBOX_WITH_BLD_RTSIGNTOOL_SIGNING SDK_VBoxOpenSslBldProg := OpenSSL - Build tools verison (i.e. bldRTSignTool) SDK_VBoxOpenSslBldProg_INCS ?= $(SDK_VBoxOpenSslStatic_VBOX_DEFAULT_INCS) SDK_VBoxOpenSslBldProg_ORDERDEPS ?= $(crypto-headers_1_TARGET) if !defined(VBOX_ONLY_SDK) \ && ("$(SDK_VBoxOpenSsl_INCS)" == "$(SDK_VBoxOpenSslStatic_VBOX_DEFAULT_INCS)") SDK_VBoxOpenSslBldProg_DEPS ?= $(SDK_VBoxOpenSslStatic_INCS)/openssl/openssl-mangling.h endif SDK_VBoxOpenSslBldProg_LIBS ?= \ $(PATH_STAGE_LIB)/VBoxBldProg-libssl$(VBOX_SUFF_LIB) \ $(PATH_STAGE_LIB)/VBoxBldProg-libcrypto$(VBOX_SUFF_LIB) endif SDK_VBoxOpenSsl := This is what you should be using! It links against VBoxRT. SDK_VBoxOpenSsl_EXTENDS := VBoxOpenSslStatic if "$(SDK_VBoxOpenSsl_INCS)" == "$(SDK_VBoxOpenSslStatic_VBOX_DEFAULT_INCS)" SDK_VBoxOpenSsl_LIBS = $(NO_SUCH_VARIABLE) endif ifdef VBOX_WITH_LIBOGG SDK_VBoxLibOgg := libogg for dll linking. SDK_VBoxLibOgg_DEFAULT_INCS := $(PATH_ROOT)/src/libs/libogg-1.3.5/include SDK_VBoxLibOgg_INCS ?= $(SDK_VBoxLibOgg_DEFAULT_INCS) SDK_VBoxLibOgg_LIBS ?= $(PATH_STAGE_LIB)/VBox-libogg$(VBOX_SUFF_LIB) endif ifdef VBOX_WITH_LIBVORBIS SDK_VBoxLibVorbis := libvorbis for dll linking. SDK_VBoxLibVorbis_DEFAULT_INCS := $(PATH_ROOT)/src/libs/libvorbis-1.3.7/include SDK_VBoxLibVorbis_INCS ?= $(SDK_VBoxLibVorbis_DEFAULT_INCS) SDK_VBoxLibVorbis_LIBS ?= $(PATH_STAGE_LIB)/VBox-libvorbis$(VBOX_SUFF_LIB) endif # Our SoftFloat 3e variant. SDK_VBoxSoftFloatR3Shared := SoftFloat 3 for dll linking. SDK_VBoxSoftFloatR3Shared_DEFS := SOFTFLOAT_FAST_INT64 SDK_VBoxSoftFloatR3Shared_DEFS.amd64 := LITTLEENDIAN SDK_VBoxSoftFloatR3Shared_DEFS.arm64 := LITTLEENDIAN SDK_VBoxSoftFloatR3Shared_DEFS.x86 := LITTLEENDIAN if1of ($(KBUILD_TARGET), win) SDK_VBoxSoftFloatR3Shared_DEFS += THREAD_LOCAL=__declspec(thread) else SDK_VBoxSoftFloatR3Shared_DEFS += THREAD_LOCAL=__thread endif SDK_VBoxSoftFloatR3Shared_INCS = \ $(PATH_ROOT)/src/libs/softfloat-3e/source/include SDK_VBoxSoftFloatR3Shared_LIBS = \ $(PATH_STAGE_LIB)/VBox-SoftFloat$(VBOX_SUFF_LIB) SDK_VBoxSoftFloatR0 := SoftFloat 3 for ring-0 linking. SDK_VBoxSoftFloatR0_DEFS := SOFTFLOAT_FAST_INT64 SDK_VBoxSoftFloatR0_DEFS.amd64 := LITTLEENDIAN SDK_VBoxSoftFloatR0_DEFS.arm64 := LITTLEENDIAN SDK_VBoxSoftFloatR0_DEFS.x86 := LITTLEENDIAN SDK_VBoxSoftFloatR0_INCS = \ $(PATH_ROOT)/src/libs/softfloat-3e/source/include SDK_VBoxSoftFloatR0_LIBS = \ $(PATH_STAGE_LIB)/VBox-SoftFloatR0$(VBOX_SUFF_LIB) SDK_VBoxSoftFloatGuestR3Shared := SoftFloat 3 for ring-0 linking. SDK_VBoxSoftFloatGuestR3Shared_DEFS := SOFTFLOAT_FAST_INT64 SDK_VBoxSoftFloatGuestR3Shared_DEFS.amd64 := LITTLEENDIAN SDK_VBoxSoftFloatGuestR3Shared_DEFS.arm64 := LITTLEENDIAN SDK_VBoxSoftFloatGuestR3Shared_DEFS.x86 := LITTLEENDIAN SDK_VBoxSoftFloatGuestR3Shared_INCS = \ $(PATH_ROOT)/src/libs/softfloat-3e/source/include SDK_VBoxSoftFloatGuestR3Shared_LIBS.x86 = \ $(VBOX_PATH_ADDITIONS_LIB)/VBox-SoftFloatGuestR3Shared-x86$(VBOX_SUFF_LIB) SDK_VBoxSoftFloatGuestR3Shared_LIBS.$(KBUILD_TARGET_ARCH) = \ $(VBOX_PATH_ADDITIONS_LIB)/VBox-SoftFloatGuestR3Shared$(VBOX_SUFF_LIB) ifdef VBOX_WITH_LIBSSH SDK_VBoxLibSsh := libssh for dynamic dll loading with assembly stubs. SDK_VBoxLibSsh_INCS ?= $(PATH_ROOT)/src/libs/libssh-0.9.6/include # SDK_VBoxLibSsh_LIBS is not defined, as VBoxLibSsh dll is not linked, but loaded explicitly # by auto-generated stub code (lazy loading) endif ifdef VBOX_WITH_LIBTPMS SDK_VBoxLibTpms := libtpms for dll linking. SDK_VBoxLibTpms_DEFAULT_INCS := $(PATH_ROOT)/src/libs/libtpms-0.9.6/include SDK_VBoxLibTpms_INCS ?= $(SDK_VBoxLibTpms_DEFAULT_INCS) SDK_VBoxLibTpms_LIBS ?= $(PATH_STAGE_LIB)/VBox-libtpms$(VBOX_SUFF_LIB) endif ifdef VBOX_WITH_LIBVPX SDK_VBoxLibVpx := libvpx for dll linking. SDK_VBoxLibVpx_DEFAULT_INCS := $(PATH_ROOT)/src/libs/libvpx-1.11.0 SDK_VBoxLibVpx_INCS ?= $(SDK_VBoxLibVpx_DEFAULT_INCS) SDK_VBoxLibVpx_LIBS ?= $(PATH_STAGE_LIB)/VBox-libvpx$(VBOX_SUFF_LIB) endif ifdef VBOX_WITH_LIBLZMA SDK_VBoxLibLzma := liblzma for dll linking. SDK_VBoxLibLzma_DEFAULT_INCS := $(PATH_ROOT)/src/libs/liblzma-5.4.1/api SDK_VBoxLibLzma_INCS ?= $(SDK_VBoxLibLzma_DEFAULT_INCS) SDK_VBoxLibLzma_LIBS ?= $(PATH_STAGE_LIB)/VBox-liblzma$(VBOX_SUFF_LIB) SDK_VBoxLibLzma-x86 := liblzma/x86 compressor/decompressor for dll linking. SDK_VBoxLibLzma-x86_EXTENDS := VBoxLibLzma SDK_VBoxLibLzma-x86_LIBS ?= $(PATH_STAGE_LIB)/VBox-liblzma-x86$(VBOX_SUFF_LIB) SDK_VBoxLibLzmaStatic := liblzma for static linking SDK_VBoxLibLzmaStatic_EXTENDS := VBoxLibLzma SDK_VBoxLibLzmaStatic_LIBS ?= $(PATH_STAGE_LIB)/VBox-liblzma-static$(VBOX_SUFF_LIB) endif # libxml2 SDK_VBoxLibXml2 := libxml2 for dll linking. SDK_VBoxLibXml2_INCS ?= $(PATH_ROOT)/src/libs/libxml2-2.9.14/include SDK_VBoxLibXml2_DEFS ?= _REENTRANT LIBXML_STATIC LIBXML_STATIC_FOR_DLL SDK_VBoxLibXml2_DEFS.win ?= WIN32 _WINDOWS _MBCS HAVE_WIN32_THREADS HAVE_COMPILER_TLS # Note: no linking to LIB here, we do that explicitly in src/VBox/Runtime/Makefile.kmk to link # libxml against VBoxRT # zlib SDK_VBoxZlib := zlib for dll linking. if1of ($(KBUILD_TARGET), os2 solaris win) SDK_VBoxZlib_INCS ?= $(PATH_ROOT)/src/libs/zlib-1.2.13 SDK_VBoxZlib_LIBS ?= $(PATH_STAGE_LIB)/VBox-zlib$(VBOX_SUFF_LIB) else SDK_VBoxZlib_INCS ?= SDK_VBoxZlib_LIBS ?= z SDK_VBoxZlib_DEFS.linux ?= _LARGEFILE64_SOURCE endif SDK_VBoxZlib-x86 := zlib/x86 SDK_VBoxZlib-x86_EXTENDS = VBoxZlib if1of ($(KBUILD_TARGET), os2 solaris win) SDK_VBoxZlib_LIBS-x86 ?= $(PATH_STAGE_LIB)/VBox-zlib-x86$(VBOX_SUFF_LIB) endif SDK_VBoxZlibStatic := zlib for static linking SDK_VBoxZlibStatic_EXTENDS := VBoxZlib if1of ($(KBUILD_TARGET), os2 win) # Not required on solaris. SDK_VBoxZlibStatic_LIBS ?= $(PATH_STAGE_LIB)/VBox-zlib-static$(VBOX_SUFF_LIB) endif # # Special SDK for the problematic NTDLL.LIB. # SDK_VBoxNtDll := Mini NTDLL import library, required by IPRT. SDK_VBoxNtDll_LIBS.x86 ?= $(PATH_STAGE_LIB)/RuntimeR3NtDll-x86.lib SDK_VBoxNtDll_LIBS.amd64 ?= $(PATH_STAGE_LIB)/RuntimeR3NtDll-amd64.lib # # SDK for including newdev.lib. # It conceptually moved from the WDK to the PSDK with W10, as it's now in the um subdir. # SDK_VBoxWinNewDevLib := Abstracts where to find newdev.lib. ifn1of ($(VBOX_WINPSDK), WINPSDK71 WINPSDK80) SDK_VBoxWinNewDevLib_LIBS.x86 = $(PATH_SDK_$(VBOX_WINPSDK)_LIB.x86)/newdev.lib SDK_VBoxWinNewDevLib_LIBS.amd64 = $(PATH_SDK_$(VBOX_WINPSDK)_LIB.amd64)/newdev.lib else SDK_VBoxWinNewDevLib_LIBS.x86 = $(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/newdev.lib SDK_VBoxWinNewDevLib_LIBS.amd64 = $(PATH_SDK_$(VBOX_WINDDK)_LIB.amd64)/newdev.lib endif # # Determine Solaris version. # ifeq ($(KBUILD_TARGET),solaris) VBOX_SOLARIS_VERSION := $(expr $(KBUILD_HOST_VERSION_MAJOR) * 100 + $(KBUILD_HOST_VERSION_MINOR)) 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) # OSS audio support for Solaris VBOX_WITH_AUDIO_OSS := 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 := \ -h --host-$(VBOX_HC_ARCH_BITS)-bit #-vvv define TOOL_VBoxTpG_DTRACE_HDR_CMDS $(QUIET)$(VBOX_VBOXTPG) $(if-expr $(intersects $(bld_trg_arch),$(KBUILD_ARCHES_64)),-64,-32) \ $(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) --assembler "$(TOOL_$(VBOX_ASTOOL)_AS)" \ $(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. # # Disabled Visual C++ warnings: # -wd4505: 'iemRaisePageFaultJmp' : unreferenced local function has been removed # 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 = .rc 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 TEMPLATE_VBoxRc_RCDEFS = VBOX_SVN_REV=$(VBOX_SVN_REV) VBOX_SVN_REV_MOD_5K=$(expr $(VBOX_SVN_REV) % 50000) TEMPLATE_VBoxRc_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -GS- -Zc:wchar_t- -Gs8192 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP) \ -Gy $(VBOX_VCC_WARN_ALL) -wd4505 $(VBOX_VCC_WERR) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120" TEMPLATE_VBoxRc_CXXFLAGS += -Gw endif ifdef VBOX_WITH_MSC_ANALYZE_THIS TEMPLATE_VBoxRc_CXXFLAGS += /analyze 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 -Opt:Ref -Opt:Icf \ -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 += \ $(PATH_STAGE_LIB)/RuntimeRCStub$(VBOX_SUFF_LIB) TEMPLATE_VBoxRc_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS) TEMPLATE_VBoxRc_ORDERDEPS = $(VBOX_SIGN_IMAGE_CMDS_ORDERDEPS) endif # pe ifeq ($(VBOX_LDR_FMT32),elf) TEMPLATE_VBoxRc_TOOL = $(VBOX_GCC32_TOOL) TEMPLATE_VBoxRc_CXXFLAGS = -fno-pie -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 $(VBOX_GCC_IPRT_FMT_CHECK) TEMPLATE_VBoxRc_CFLAGS = -fno-pie -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) $(VBOX_GCC_IPRT_FMT_CHECK) if $(VBOX_GCC32_VERSION_CC) < 30400 TEMPLATE_VBoxRc_DEFS += RT_WITHOUT_PRAGMA_ONCE endif 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) # intrinsics 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 = $(VBOX_GCC_TOOL) TEMPLATE_VBoxRc_SDKS += $(VBOX_DARWIN_DEF_SDK_SDKS) 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 $(VBOX_GCC_std) 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 if $(VBOX_GCC_VERSION_CC) < 30400 TEMPLATE_VBoxRc_DEFS += RT_WITHOUT_PRAGMA_ONCE endif 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 -Opt:Ref -Opt:Icf \ -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 TEMPLATE_VBoxRcExe_LDFLAGS.dbgopt = -g TEMPLATE_VBoxRcExe_LDFLAGS.strict = -g TEMPLATE_VBoxRcExe_LDFLAGS.release = -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 TEMPLATE_VBoxRcExe_LIBS.$(KBUILD_TARGET) = /usr/lib32/crtend.o /usr/lib32/crtn.o /usr/lib32/libc.so 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. # # Disabled Visual C++ warnings: # -wd4505: 'iemRaisePageFaultJmp' : unreferenced local function has been removed # 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) TEMPLATE_VBoxR0_RCDEFS = VBOX_SVN_REV=$(VBOX_SVN_REV) VBOX_SVN_REV_MOD_5K=$(expr $(VBOX_SVN_REV) % 50000) TEMPLATE_VBoxR0_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -GS- -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP) \ -Gy $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_std) $(VBOX_VCC_WARN_ALL) -wd4505 $(VBOX_VCC_WERR) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120" TEMPLATE_VBoxR0_CXXFLAGS += -Gw endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC142" # Don't waste space on x86/amd64-on-arm emulation optimizations. TEMPLATE_VBoxR0_CXXFLAGS += /volatileMetadata- endif ifdef VBOX_WITH_MSC_ANALYZE_THIS TEMPLATE_VBoxR0_CXXFLAGS += /analyze endif TEMPLATE_VBoxR0_CFLAGS = $(filter-out $(VBOX_VCC_std),$(TEMPLATE_VBoxR0_CXXFLAGS)) TEMPLATE_VBoxR0_LDFLAGS = -Ignore:4197 \ -Driver -Subsystem:NATIVE -Incremental:NO -Align:4096 -MapInfo:Exports -NoD $(VBOX_VCC_LD_WERR) \ -Release -Debug -Opt:Ref -Opt:Icf $(VBOX_VCC_LD_GUARD_CF) \ -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 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC142" # Don't waste space on x86/amd64-on-arm emulation optimizations. TEMPLATE_VBoxR0_LDFLAGS += -EmitVolatileMetadata:NO endif TEMPLATE_VBoxR0_LDFLAGS.win.amd64 = $(VBOX_VCC_LD_HIGH_ENTRYOPY_VA) ifneq ($(VBOX_VCC_CC_GUARD_CF),) TEMPLATE_VBoxR0_LDFLAGS.win.amd64 += -Include:__security_init_cookie -Export:ModuleInitSecurityCookie=__security_init_cookie TEMPLATE_VBoxR0_LDFLAGS.win.x86 += -Include:___security_init_cookie -Export:ModuleInitSecurityCookie=__security_init_cookie endif TEMPLATE_VBoxR0_LIBS = \ $(PATH_STAGE_LIB)/RuntimeR0Stub$(VBOX_SUFF_LIB) ifneq ($(VBOX_VCC_CC_GUARD_CF),) TEMPLATE_VBoxR0_LIBS += \ $(PATH_SDK_$(VBOX_WINDDK)_LIB)/BufferOverflowK.lib include $(KBUILD_PATH)/sdks/$(VBOX_WINDDK).kmk ## TODO: Add a kBuild feature for loading SDKs. endif TEMPLATE_VBoxR0_ORDERDEPS = $(VBOX_SIGN_DRIVER_ORDERDEPS) TEMPLATE_VBoxR0_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS) endif # pe ifeq ($(VBOX_LDR_FMT),elf) TEMPLATE_VBoxR0_TOOL = $(VBOX_GCC_TOOL) TEMPLATE_VBoxR0_CFLAGS = -fno-pie -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 -ffreestanding $(VBOX_GCC_fvisibility-hidden) -std=gnu99 $(VBOX_GCC_IPRT_FMT_CHECK) TEMPLATE_VBoxR0_CXXFLAGS = -fno-pie -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 $(VBOX_GCC_std) $(VBOX_GCC_IPRT_FMT_CHECK) if $(VBOX_GCC_VERSION_CC) >= 40500 # 4.1.2 complains, 4.5.2 is okay, didn't check which version inbetween made it okay with g++. TEMPLATE_VBoxR0_CXXFLAGS += -ffreestanding endif TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -mno-red-zone -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fasynchronous-unwind-tables -ffreestanding TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fasynchronous-unwind-tables TEMPLATE_VBoxR0_CXXFLAGS.freebsd = -ffreestanding if $(VBOX_GCC_VERSION_CC) < 30400 TEMPLATE_VBoxR0_DEFS += RT_WITHOUT_PRAGMA_ONCE endif ifeq ($(KBUILD_TARGET),solaris) TEMPLATE_VBoxR0_LDFLAGS = -r TEMPLATE_VBoxR0_LDFLAGS.solaris = -u _init -u _info TEMPLATE_VBoxR0_LDFLAGS.solaris.amd64 = -m64 TEMPLATE_VBoxR0_LDFLAGS.solaris.x86 = -m32 TEMPLATE_VBoxR0_LIBS.solaris = \ $(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 if "$(KBUILD_TARGET)" == "linux" && !defined(VBOX_WITH_KMOD_WRAPPED_R0_MODS) VBOX_WITH_VBOXR0_AS_DLL = 1 TEMPLATE_VBoxR0_DLLSUFF = .r0 TEMPLATE_VBoxR0_CFLAGS += -fPIC TEMPLATE_VBoxR0_CXXFLAGS += -fPIC TEMPLATE_VBoxR0_LDFLAGS += TEMPLATE_VBoxR0_DTRACE_HDR_FLAGS += --pic TEMPLATE_VBoxR0_DTRACE_OBJ_FLAGS += --pic else TEMPLATE_VBoxR0_CFLAGS.amd64 += -mcmodel=kernel TEMPLATE_VBoxR0_CXXFLAGS.amd64 += -mcmodel=kernel endif ifdef VBOX_WITH_KMOD_WRAPPED_R0_MODS # For BTF/pahold issue we use -g1 TEMPLATE_VBoxR0_DEFS += VBOX_WITH_KMOD_WRAPPED_R0_MODS TEMPLATE_VBoxR0_LDFLAGS.linux += $(PATH_ROOT)/src/VBox/HostDrivers/Support/linux/VBoxR0-wrapped.lds TEMPLATE_VBoxR0_LNK_DEPS.linux += $(PATH_ROOT)/src/VBox/HostDrivers/Support/linux/VBoxR0-wrapped.lds TEMPLATE_VBoxR0_CFLAGS.linux += -g1 TEMPLATE_VBoxR0_CXXFLAGS.linux += -g1 endif ifn1of ($(KBUILD_TARGET), solaris freebsd) TEMPLATE_VBoxR0_LIBS = \ $(VBOX_GCC_LIBGCC) # intrinsics endif if1of ($(KBUILD_TARGET), linux) TEMPLATE_VBoxR0_POST_CMDS += $(NLTAB) \ $(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 # elf ifeq ($(VBOX_LDR_FMT),macho) TEMPLATE_VBoxR0_TOOL = $(VBOX_GCC_TOOL) TEMPLATE_VBoxR0_SDKS += $(VBOX_DARWIN_DEF_SDK_SDKS) 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 -static -fno-rtti -fno-exceptions $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing \ $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_std) TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -msoft-float -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-red-zone -mno-sse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -fno-unwind-tables TEMPLATE_VBoxR0_CXXFLAGS.x86 = -m32 -msoft-float -mno-sse -mno-mmx -mno-sse2 -mno-3dnow TEMPLATE_VBoxR0_CXXFLAGS.arm64 = -m64 -target arm64e-apple-macos11.0 # Assembly fixup issues w/o the -target bit. Why? 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 -static -fno-exceptions $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing \ $(VBOX_GCC_fno-stack-protector) TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -msoft-float -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-red-zone -mno-sse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -fno-unwind-tables TEMPLATE_VBoxR0_CFLAGS.x86 = -m32 -msoft-float -mno-sse -mno-mmx -mno-sse2 -mno-3dnow TEMPLATE_VBoxR0_CFLAGS.arm64 = -m64 -target arm64e-apple-macos11.0 TEMPLATE_VBoxR0_LDFLAGS = $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -nostdlib TEMPLATE_VBoxR0_LDFLAGS.amd64 = -m64 -static TEMPLATE_VBoxR0_LDFLAGS.arm64 = -m64 -static TEMPLATE_VBoxR0_LDFLAGS.x86 = -m32 TEMPLATE_VBoxR0_CXXFLAGS.amd64 += -mkernel TEMPLATE_VBoxR0_CFLAGS.amd64 += -mkernel TEMPLATE_VBoxR0_CXXFLAGS.arm64 += -mkernel TEMPLATE_VBoxR0_CFLAGS.arm64 += -mkernel TEMPLATE_VBoxR0_LDFLAGS += -Wl,-kext -mkernel TEMPLATE_VBoxR0_POST_CMDS = $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_VMM_MOD_FN,$(out),org.virtualbox.app.r0.$(target))) 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 if $(VBOX_GCC_VERSION_CC) < 30400 TEMPLATE_VBoxR0_DEFS += RT_WITHOUT_PRAGMA_ONCE endif TEMPLATE_VBoxR0_LDFLAGS = -nostdlib -Zdll TEMPLATE_VBoxR0_LIBS = \ $(VBOX_GCC_LIBGCC) \ $(VBOX_OBJ_SYS0) \ end endif # # Template for building SUPDRV R0 things. # # Disabled Visual C++ warnings: # -wd4996: deprecated / insecure. # -wd4127: conditional expression is constant [level 4] # -wd4201: nonstandard extension used : nameless struct/union [level 4] # -wd4214: nonstandard extension used : bit field types other than int [level 4] # -wd4706: assignment within conditional expression [level 4] # -wd4324: '_TDI_PNP_CONTEXT_XP' : structure was padded due to __declspec(align()) # # -wd4100: 'identifier' : unreferenced formal parameter [level 4] --- TODO: Enable this one! # 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) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" # for stddef.h ## @todo 8489: check if still needed TEMPLATE_VBoxR0Drv_SDKS = WINSDK10-UCRT-INCS endif TEMPLATE_VBoxR0Drv_RCDEFS = VBOX_SVN_REV=$(VBOX_SVN_REV) VBOX_SVN_REV_MOD_5K=$(expr $(VBOX_SVN_REV) % 50000) TEMPLATE_VBoxR0Drv_DEFS += _KERNEL_MODE=1 # Needed with W10 to access things like KeQueryInterruptTime 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_DEFS.amd64 += WIN9X_COMPAT_SPINLOCK # For Windows 8+ WDKs where it is no longer inlined but imported from ntoskrnl. TEMPLATE_VBoxR0Drv_DEFS.amd64 += NT_INLINE_IRQL NT_INLINE_GET_CURRENT_IRQL # Prevent W10 WDK from importing KeLowerIrql and KeGetCurrentIrql. TEMPLATE_VBoxR0Drv_DEFS.win = IPRT_NT_MAP_TO_ZW TEMPLATE_VBoxR0Drv_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -Gz -GS- -Zc:wchar_t- $(VBOX_VCC_FP) -Gs4096 $(VBOX_VCC_OPT) \ -Gy $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_WARN_ALL) $(VBOX_VCC_WERR) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120" TEMPLATE_VBoxR0Drv_CXXFLAGS += -Gw endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC142" # Don't waste space on x86/amd64-on-arm emulation optimizations. TEMPLATE_VBoxR0Drv_CXXFLAGS += /volatileMetadata- endif ifdef VBOX_WITH_MSC_ANALYZE_THIS TEMPLATE_VBoxR0Drv_CXXFLAGS += /analyze endif TEMPLATE_VBoxR0Drv_CFLAGS = $(TEMPLATE_VBoxR0Drv_CXXFLAGS) TEMPLATE_VBoxR0Drv_LDFLAGS = -Ignore:4197 \ -Driver -Subsystem:NATIVE -Incremental:NO -Align:4096 -MapInfo:Exports -NoD -Release -Debug -Opt:Ref -Opt:Icf \ $(VBOX_VCC_LD_GUARD_CF) \ -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 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC142" # Don't waste space on x86/amd64-on-arm emulation optimizations. TEMPLATE_VBoxR0Drv_LDFLAGS += -EmitVolatileMetadata:NO endif TEMPLATE_VBoxR0Drv_LDFLAGS.win.amd64 = $(VBOX_VCC_LD_HIGH_ENTRYOPY_VA) TEMPLATE_VBoxR0Drv_ORDERDEPS = $(VBOX_SIGN_DRIVER_ORDERDEPS) TEMPLATE_VBoxR0Drv_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS) endif ifeq ($(KBUILD_TARGET),linux) TEMPLATE_VBoxR0Drv_TOOL = $(NO_SUCH_VARIABLE) ifndef KERN_DIR ifndef KERN_VER KERN_VER := $(patsubst /lib/modules/%/build/.config,%,$(firstword $(shell LC_ALL=C ls -t /lib/modules/*/build/.config 2>/dev/null))) endif ifeq ($(KERN_VER),) KERN_VER := $(shell uname -r) endif KERN_DIR := /lib/modules/$(KERN_VER)/build endif ## ## Generates a rule for test-building a linux kernel module (use evalcall2 to invoke). ## ## Since Linux KBuild will not abort due to undefined symbols when building ## external modules we need to grep the error output ourselves. Since vboxdrv ## and vboxguest respectively provide symbols that other modules use, we use ## the rule target (tst*.run) to save those symbols so that KBuild can do its ## checking. ## ## @param 1 Module name. ## @param 2 The test build which symvers we need (empty if none) ## @param 3 Save symvers if non-empty. ## ## @note Using the extra expansion to replace $(1), $(2) and $(3) before eval, ## thus everything else needs escaped dollars. ## if defined(VBOX_WITH_TESTCASES) \ && "$(KBUILD_HOST)" == "linux" \ && "$(KBUILD_HOST_ARCH)" == "$(KBUILD_TARGET_ARCH)" \ && !defined(VBOX_WITHOUT_LINUX_TEST_BUILDS) \ && !defined(VBOX_ONLY_SDK) \ && !defined(VBOX_ONLY_DOCS) \ && !defined(VBOX_ONLY_VALIDATIONKIT) define VBOX_LINUX_KMOD_TEST_BUILD_RULE_FN ifneq ($(KERN_DIR),) TESTING += $$(PATH_TARGET)/tst$(1)$(subst /,_,$(KERN_DIR))_mod.run OTHERS += $$(PATH_TARGET)/tst$(1)$(subst /,_,$(KERN_DIR))_mod.run OTHERS_CLEAN += $$(PATH_TARGET)/tst$(1)$(subst /,_,$(KERN_DIR))_mod.run $$(PATH_TARGET)/tst$(1)$(subst /,_,$(KERN_DIR))_mod.run: \ $$(if $(2),$$(PATH_TARGET)/tst$(2)$(subst /,_,$(KERN_DIR))_mod.run,) \ $$$$($(1)_2_STAGE_TARGETS) $(QUIET)$$(call MSG_L1,Doing a test build of the $(1) kernel module) $(QUIET)$$(RM) -f -- "$$@" $(QUIET)$$(TEST) -n "$$($(1)_INST)" $(QUIET)$$(RM) -Rf -- "$$(PATH_TARGET)/tst$(1)_mod" $(QUIET)$$(MKDIR) -p -- "$$(PATH_TARGET)/tst$(1)_mod" $(QUIET)$$(CP) -R -- "$$(PATH_STAGE_BIN)/../$$($(1)_INST)" "$$(PATH_TARGET)/tst$(1)_mod/" + $(QUIET)make KBUILD_VERBOSE=$(KBUILD_VERBOSE) KERN_DIR=$(KERN_DIR) VBOX_KERN_QUIET=1 \ VBOX_KBUILD_TYPE=$(KBUILD_TYPE) VBOX_KBUILD_TARGET_ARCH=$(KBUILD_TARGET_ARCH) \ KBUILD_TYPE= KBUILD_TARGET= KBUILD_TARGET_ARCH= KBUILD_TARGET_CPU= KBUILD_HOST= KBUILD_HOST_ARCH= KBUILD_HOST_CPU= \ BUILD_TYPE= BUILD_TARGET= BUILD_TARGET_ARCH= BUILD_TARGET_CPU= BUILD_PLATFORM= BUILD_PLATFORM_ARCH= BUILD_PLATFORM_CPU= \ -C $$(PATH_TARGET)/tst$(1)_mod clean ifneq ($(2),) $(QUIET)$$(CP) -f -- "$$<" "$$(PATH_TARGET)/tst$(1)_mod/Module.symvers" endif + $(QUIET)$(REDIRECT_EXT) -d2=1 -w1 "$$(PATH_TARGET)/tst$(1)_mod/make.err" -- \ make KBUILD_VERBOSE=$(KBUILD_VERBOSE) KERN_DIR=$(KERN_DIR) VBOX_KERN_QUIET=1 $(if $(2),KBUILD_EXTRA_SYMBOLS="$$(PATH_TARGET)/tst$(1)_mod/Module.symvers",) $(if-expr $(KMK_OPTS_JOBS) != 0,JOBS=$(KMK_OPTS_JOBS),) \ VBOX_KBUILD_TYPE=$(KBUILD_TYPE) VBOX_KBUILD_TARGET_ARCH=$(KBUILD_TARGET_ARCH) \ KBUILD_TYPE= KBUILD_TARGET= KBUILD_TARGET_ARCH= KBUILD_TARGET_CPU= KBUILD_HOST= KBUILD_HOST_ARCH= KBUILD_HOST_CPU= \ BUILD_TYPE= BUILD_TARGET= BUILD_TARGET_ARCH= BUILD_TARGET_CPU= BUILD_PLATFORM= BUILD_PLATFORM_ARCH= BUILD_PLATFORM_CPU= \ -C $$(PATH_TARGET)/tst$(1)_mod $(CAT) "$$(PATH_TARGET)/tst$(1)_mod/make.err" $(QUIET)! grep "^WARNING: .* undefined!$$$$" "$$(PATH_TARGET)/tst$(1)_mod/make.err" if1of ($(USERNAME), bird) - nm -u "$$(PATH_TARGET)/tst$(1)_mod/"*.ko | sort endif ifneq ($(3),) $(QUIET)$$(CP) -f -- "$$(PATH_TARGET)/tst$(1)_mod/Module.symvers" "$$@" else $(QUIET)$$(APPEND) -t "$$@" "done" endif $(QUIET)$$(RM) -Rf -- "$$(PATH_TARGET)/tst$(1)_mod" vbox-linux-kmod-test-builds: $$(PATH_TARGET)/tst$(1)$(subst /,_,$(KERN_DIR))_mod.run $$(foreach src,$$(notdir $$(filter %.c,$$(subst =>,/,$$($(1)_SOURCES)))),$$(patsubst %.c,%.o,$$(src))): $$(PATH_TARGET)/tst$(1)$(subst /,_,$(KERN_DIR))_mod.run endif endef # VBOX_LINUX_KMOD_TEST_BUILD_RULE_FN else VBOX_LINUX_KMOD_TEST_BUILD_RULE_FN = endif else VBOX_LINUX_KMOD_TEST_BUILD_RULE_FN = endif # linux target ifeq ($(KBUILD_TARGET),os2) ifndef VBOX_USE_WATCOM_FOR_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 else TEMPLATE_VBoxR0Drv_TOOL = OPENWATCOM TEMPLATE_VBoxR0Drv_CTOOL = OPENWATCOM TEMPLATE_VBoxR0Drv_CXXTOOL = OPENWATCOM TEMPLATE_VBoxR0Drv_LDTOOL = OPENWATCOM-WL TEMPLATE_VBoxR0Drv_ARTOOL = OPENWATCOM TEMPLATE_VBoxR0Drv_ASTOOL = NASM TEMPLATE_VBoxR0Drv_ASFLAGS = -fobj -DASM_FORMAT_OMF -D__NASM__ -w+orphan-labels #-g -F borland TEMPLATE_VBoxR0Drv_DEFS.os2 = #_OS2EMX_H TEMPLATE_VBoxR0Drv_INCS = \ $(PATH_TOOL_OPENWATCOM)/h \ $(PATH_TOOL_OPENWATCOM)/h/os2 \ $(PATH_ROOT)/include \ $(PATH_KLIBC_TRUNK)/libc/include # for os2ddk TEMPLATE_VBoxR0Drv_CFLAGS = -s -ze -w4 -hd -d1+ -nt=TEXT32 -nc=CODE -4 -of+ TEMPLATE_VBoxR0Drv_CXXFLAGS = -s -ze -w4 -hd -d2t -nt=TEXT32 -nc=CODE -4 -of+ TEMPLATE_VBoxR0Drv_LDFLAGS = \ form os2 lx physdevice \ option NODefaultlibs, internalrelocs, togglerelocs \ debug dwarf all #option symfile # debug codeview all option symfile - wlink generates bad info, overwritten mod dir header. endif endif ifeq ($(KBUILD_TARGET),darwin) TEMPLATE_VBoxR0Drv_TOOL = $(VBOX_GCC_TOOL) TEMPLATE_VBoxR0Drv_SDKS += $(VBOX_DARWIN_DEF_SDK_SDKS) TEMPLATE_VBoxR0Drv_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS) KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT if1of ($(VBOX_GCC_TOOL), GXX4MACHO GXX42MACHO) TEMPLATE_VBoxR0Drv_INCS += \ $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/Kernel.framework/PrivateHeaders \ $(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_LDFLAGS.amd64 = -m64 TEMPLATE_VBoxR0Drv_LDFLAGS.x86 = -m32 TEMPLATE_VBoxR0Drv_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC) else # Note xcode uses -fstrict-aliasing, we currently don't dare... We also add -mno-red-zone. TEMPLATE_VBoxR0Drv_INCS += \ $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/Kernel.framework/PrivateHeaders \ $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/Kernel.framework/Headers ## @todo try use VBOX_GCC_PEDANTIC_CXX # -Wno-c++11-extensions -Wno-c99-extensions -Wno-extra-semi -Wno-zero-length-array TEMPLATE_VBoxR0Drv_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) -mkernel \ -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_CXX) -Wno-long-long $(VBOX_GCC_fdiagnostics-show-option) \ -Wno-c++11-extensions -Wno-c99-extensions -Wno-extra-semi -Wno-zero-length-array \ -Wno-gnu-zero-variadic-macro-arguments -Wno-four-char-constants \ -fno-common -nostdinc -fno-builtin $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden) \ -fno-exceptions -fapple-kext -fno-rtti -mkernel \ -fmodules -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -Wnon-modular-include-in-framework-module \ -Werror=non-modular-include-in-framework-module \ $(VBOX_GCC_Wno-nullability-extension) $(VBOX_GCC_Wno-gnu-statement-expression) \ $(VBOX_GCC_Wno-import-preprocessor-directive-pedantic) $(VBOX_GCC_Wno-c11-extensions) \ $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fasm-blocks -fno-strict-aliasing -stdlib=libc++ # if1of ($(VBOX_GCC_TOOL), CLANGXXMACHO) ## @todo check if we can safely use $(VBOX_GCC_std) @bugref{9790}, good for noexcept. #TEMPLATE_VBoxR0Drv_CXXFLAGS += $(VBOX_GCC_std) # endif # also used by xcode 6.2: \ # -Werror=return-type \ # -Werror=deprecated-objc-isa-usage \ # -Werror=objc-root-class \ # -Wno-missing-field-initializers -Wno-missing-prototypes -Wunreachable-code \ # -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function \ # -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body \ # -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants \ # -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion \ # -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion TEMPLATE_VBoxR0Drv_CXXFLAGS.amd64 = -m64 -msoft-float -mno-red-zone TEMPLATE_VBoxR0Drv_CXXFLAGS.x86 = -m32 -msoft-float TEMPLATE_VBoxR0Drv_CXXFLAGS.arm64 = -m64 -fno-sanitize=vptr -target arm64e-apple-macos11.0 TEMPLATE_VBoxR0Drv_CFLAGS = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -mkernel \ -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_C) -Wno-long-long $(VBOX_GCC_fdiagnostics-show-option) \ -fno-common -nostdinc -fno-builtin $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden) \ -fno-exceptions -fapple-kext -fno-rtti \ -fmodules -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -Wnon-modular-include-in-framework-module \ -Werror=non-modular-include-in-framework-module $(VBOX_GCC_Wno-c11-extensions) \ $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fasm-blocks -fno-strict-aliasing TEMPLATE_VBoxR0Drv_CFLAGS.amd64 = -m64 -msoft-float -mno-red-zone TEMPLATE_VBoxR0Drv_CFLAGS.x86 = -m32 -msoft-float TEMPLATE_VBoxR0Drv_CFLAGS.arm64 = -m64 -fno-sanitize=vptr -target arm64e-apple-macos11.0 if 1 TEMPLATE_VBoxR0Drv_CFLAGS += $(VBOX_GCC_WERR) TEMPLATE_VBoxR0Drv_CXXFLAGS += $(VBOX_GCC_WERR) endif TEMPLATE_VBoxR0Drv_LDFLAGS = $(filter-out $(VBOX_DARWIN_NO_COMPACT_LINKEDIT),$(VBOX_DARWIN_DEF_SDK_LDFLAGS)) \ -nostdlib -stdlib=libc++ -Wl,-kext -Wl,-keep_private_externs TEMPLATE_VBoxR0Drv_LDFLAGS.amd64 = -m64 TEMPLATE_VBoxR0Drv_LDFLAGS.arm64 = -m64 TEMPLATE_VBoxR0Drv_LDFLAGS.x86 = -m32 TEMPLATE_VBoxR0Drv_LIBS = kmodc++ kmod cc_kext endif 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 if $(VBOX_GCC_VERSION_CC) < 30400 TEMPLATE_VBoxR0Drv_DEFS += RT_WITHOUT_PRAGMA_ONCE endif 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 \ -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) TEMPLATE_VBoxR0Drv_CXXFLAGS.amd64 = $(TEMPLATE_VBoxR0Drv_CFLAGS.amd64) 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 # ld -d -warn-common -r -d -o my.kld my.o # :> export_syms # awk -f /usr/src/sys/modules/my/../../conf/kmod_syms.awk my.kld export_syms | xargs -J% objcopy % my.kld # ld -Bsharable -d warn-commnon -o my.ko 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 # ld -d -warn-common -r -d -o if_my.ko if_my.o # :> 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 if $(VBOX_GCC_VERSION_CC) < 30400 TEMPLATE_VBoxR0Drv_DEFS += RT_WITHOUT_PRAGMA_ONCE endif TEMPLATE_VBoxR0Drv_INCS = \ $(VBOX_FREEBSD_SRC) \ $(VBOX_FREEBSD_SRC)/contrib/altq \ $(VBOX_FREEBSD_SRC)/contrib/ck/include \ $(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 \ $(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 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 TEMPLATE_VBoxR0Drv_CFLAGS.amd64 = -m64 -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 \ $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \ -nostdinc TEMPLATE_VBoxR0Drv_CXXFLAGS.x86 = $(TEMPLATE_VBoxR0Drv_CFLAGS.x86) TEMPLATE_VBoxR0Drv_CXXFLAGS.amd64 = $(TEMPLATE_VBoxR0Drv_CFLAGS.amd64) 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),netbsd) # The location of the NetBSD sources. VBOX_NETBSD_SRC ?= /usr/src # NetBSD uses "i386" for 32-bit, "x86" for common 32- and 64-bit code. ifeq ($(KBUILD_TARGET_ARCH),amd64) VBOX_NETBSD_TARGET_ARCH = amd64 else VBOX_NETBSD_TARGET_ARCH = i386 endif VBOX_NETBSD_TARGET_SRC = $(VBOX_NETBSD_SRC)/sys/arch/$(VBOX_NETBSD_TARGET_ARCH) TEMPLATE_VBoxR0Drv_TOOL = $(VBOX_GCC_TOOL) TEMPLATE_VBoxR0Drv_DEFS += _KERNEL _MODULE if $(VBOX_GCC_VERSION_CC) < 30400 TEMPLATE_VBoxR0Drv_DEFS += RT_WITHOUT_PRAGMA_ONCE endif TEMPLATE_VBoxR0Drv_INCS = \ $(VBOX_NETBSD_SRC)/sys \ $(VBOX_NETBSD_SRC)/common/include \ $(PATH_OBJ)/netbsd/include 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 -msoft-float TEMPLATE_VBoxR0Drv_CFLAGS.x86 = -m32 -mno-mmx -mno-sse -mno-avx \ -mno-fp-ret-in-387 TEMPLATE_VBoxR0Drv_CFLAGS.amd64 = -m64 --param inline-unit-growth=100 \ --param large-function-growth=1000 -fno-omit-frame-pointer \ -mcmodel=kernel -mno-red-zone -mno-sse -mno-mmx -mno-avx \ -fno-asynchronous-unwind-tables -mno-fp-ret-in-387 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 -msoft-float TEMPLATE_VBoxR0Drv_CXXFLAGS.x86 = $(TEMPLATE_VBoxR0Drv_CFLAGS.x86) TEMPLATE_VBoxR0Drv_CXXFLAGS.amd64 = $(TEMPLATE_VBoxR0Drv_CFLAGS.amd64) TEMPLATE_VBoxR0Drv_SYSSUFF = .kmod TEMPLATE_VBoxR0Drv_LDFLAGS = -d --warn-common TEMPLATE_VBoxR0Drv_LDFLAGS.x86 = -m elf_i386 TEMPLATE_VBoxR0Drv_LDFLAGS.amd64 = -m elf_x86_64 # symlink kernel includes TEMPLATE_VBoxR0Drv_ORDERDEPS += \ $(PATH_OBJ)/netbsd/include/$(VBOX_NETBSD_TARGET_ARCH) \ $(PATH_OBJ)/netbsd/include/x86 \ $(PATH_OBJ)/netbsd/include/machine $$(PATH_OBJ)/netbsd/include/$(VBOX_NETBSD_TARGET_ARCH): $(QUIET)$(MKDIR) -p $(@D) $(QUIET)$(LN_SYMLINK) $(VBOX_NETBSD_TARGET_SRC)/include $@ $$(PATH_OBJ)/netbsd/include/x86: $(QUIET)$(MKDIR) -p $(@D) $(QUIET)$(LN_SYMLINK) $(VBOX_NETBSD_SRC)/sys/arch/x86/include $@ $$(PATH_OBJ)/netbsd/include/machine: $(QUIET)$(MKDIR) -p $(@D) $(QUIET)$(LN_SYMLINK) $(VBOX_NETBSD_TARGET_ARCH) $@ endif # NetBSD 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 if $(VBOX_GCC_VERSION_CC) < 30400 TEMPLATE_VBoxR0Drv_DEFS += RT_WITHOUT_PRAGMA_ONCE endif TEMPLATE_VBoxR0Drv_INCS = $(VBOX_HAIKU_SYS_INCS) #TODO: sort this out TEMPLATE_VBoxR0Drv_LDFLAGS = -shared $(VBOX_GCC_NO_UNDEFINED_R0) -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 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 freebsd) # 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 TEMPLATE_VBoxR0Drv_ASDEFS += RT_MANGLER_PREFIX=VBoxHost_ endif ifeq ($(KBUILD_TARGET),darwin) # # A variant of VBoxR0Drv that uses the 10.10 SDK. # TEMPLATE_VBoxR0DrvOSX10.10 = VBoxR0Drv variant using the 10.10 SDK TEMPLATE_VBoxR0DrvOSX10.10_EXTENDS = VBoxR0Drv TEMPLATE_VBoxR0DrvOSX10.10_SDKS = MACOSX1010 TEMPLATE_VBoxR0DrvOSX10.10_INCS = $(filter-out $(VBOX_PATH_MACOSX_SDK)/%,$(TEMPLATE_VBoxR0Drv_INCS)) \ $(PATH_SDK_MACOSX1010)/System/Library/Frameworks/Kernel.framework/PrivateHeaders \ $(PATH_SDK_MACOSX1010)/System/Library/Frameworks/Kernel.framework/Headers TEMPLATE_VBoxR0DrvOSX10.10_DEFS = $(filter-out $(VBOX_DARWIN_DEF_SDK_DEFS),$(TEMPLATE_VBoxR0Drv_DEFS)) 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_VBoxR0DrvLib_INSTTYPE.linux = stage # # Template for installing INF and CAT files. # TEMPLATE_VBoxR0DrvInfCat = VBox SUPDRV Ring 0 - Install .sys, .cat, .inf TEMPLATE_VBoxR0DrvInfCat_INST = $(INST_BIN) TEMPLATE_VBoxR0DrvInfCat_MODE = a+r,u+w TEMPLATE_VBoxR0DrvInfCat_IFFLAGS = --no-hard-link-files-when-possible # # 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. # # Disabled Visual C++ warnings: # -wd4065: switch statement contains 'default' but no 'case' labels # -wd4244: 'conversion' conversion from 'type1' to 'type2', possible loss of data # -wd4996: deprecated / insecure. # TEMPLATE_VBoxR3Exe = VBox Ring 3 Exe TEMPLATE_VBoxR3Exe_ASTOOL := $(VBOX_ASTOOL) TEMPLATE_VBoxR3Exe_ASFLAGS.x86 = $(VBOX_ASFLAGS32) TEMPLATE_VBoxR3Exe_ASFLAGS.sparc32 = $(VBOX_ASFLAGS32) TEMPLATE_VBoxR3Exe_ASFLAGS.amd64 = $(VBOX_ASFLAGS64) TEMPLATE_VBoxR3Exe_ASFLAGS.arm64 = $(VBOX_ASFLAGS64) TEMPLATE_VBoxR3Exe_ASFLAGS.sparc64 = $(VBOX_ASFLAGS64) TEMPLATE_VBoxR3Exe_DEFS = IN_RING3 $(VBOX_GC_ARCH_BITS_DEFS) TEMPLATE_VBoxR3Exe_DEFS.x86 = HC_ARCH_BITS=32 TEMPLATE_VBoxR3Exe_DEFS.arm32 = HC_ARCH_BITS=32 TEMPLATE_VBoxR3Exe_DEFS.sparc32 = HC_ARCH_BITS=32 TEMPLATE_VBoxR3Exe_DEFS.amd64 = HC_ARCH_BITS=64 TEMPLATE_VBoxR3Exe_DEFS.arm64 = HC_ARCH_BITS=64 TEMPLATE_VBoxR3Exe_DEFS.sparc64 = HC_ARCH_BITS=64 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_SVN_REV=$(VBOX_SVN_REV) VBOX_SVN_REV_MOD_5K=$(expr $(VBOX_SVN_REV) % 50000) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" TEMPLATE_VBoxR3Exe_SDKS = ReorderCompilerIncs WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER) $(VBOX_WINPSDK) else TEMPLATE_VBoxR3Exe_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK) endif TEMPLATE_VBoxR3Exe_CXXFLAGS = -Zi -Zl -GR- -EHsc -GF -MD$(VBOX_VCC_CRT_TYPE) -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP) \ -Gy $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS) $(VBOX_VCC_std) $(VBOX_VCC_WARN_ALL) $(VBOX_VCC_WERR) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120" TEMPLATE_VBoxR3Exe_CXXFLAGS += -Gw endif ifdef VBOX_WITH_MSC_ANALYZE_THIS TEMPLATE_VBoxR3Exe_CXXFLAGS += /analyze endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC142" # Don't waste space on x86/amd64-on-arm emulation optimizations. TEMPLATE_VBoxR3Exe_CXXFLAGS += /volatileMetadata- endif TEMPLATE_VBoxR3Exe_CXXFLAGS.debug = -RTCsu TEMPLATE_VBoxR3Exe_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxR3Exe_CXXFLAGS.kprofile = -Gh -GH TEMPLATE_VBoxR3Exe_CFLAGS = $(filter-out $(VBOX_VCC_std),$(TEMPLATE_VBoxR3Exe_CXXFLAGS)) TEMPLATE_VBoxR3Exe_CFLAGS.debug = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.debug) TEMPLATE_VBoxR3Exe_CFLAGS.dbgopt = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.dbgopt) TEMPLATE_VBoxR3Exe_CFLAGS.kprofile = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.kprofile) TEMPLATE_VBoxR3Exe_PCHFLAGS = $(TEMPLATE_VBoxR3Exe_CXXFLAGS) TEMPLATE_VBoxR3Exe_PCHFLAGS.debug = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.debug) TEMPLATE_VBoxR3Exe_PCHFLAGS.dbgopt = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.dbgopt) TEMPLATE_VBoxR3Exe_PCHFLAGS.kprofile = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.kprofile) TEMPLATE_VBoxR3Exe_LDFLAGS = -Ignore:4197 \ /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug /Opt:Ref /Opt:Icf \ $(VBOX_VCC_LD_GUARD_CF) $(VBOX_VCC_SANITIZER_LDFLAGS) \ /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 TEMPLATE_VBoxR3Exe_LDFLAGS.win.amd64 = $(VBOX_VCC_LD_HIGH_ENTRYOPY_VA) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC142" # Don't waste space on x86/amd64-on-arm emulation optimizations. TEMPLATE_VBoxR3Exe_LDFLAGS += -EmitVolatileMetadata:NO endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" TEMPLATE_VBoxR3Exe_LIBS.x86 = \ $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.x86)_LIB)/vcruntime$(VBOX_VCC_CRT_TYPE).lib \ $(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 TEMPLATE_VBoxR3Exe_LIBS.amd64 = \ $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.amd64)_LIB)/vcruntime$(VBOX_VCC_CRT_TYPE).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 ifeq ($(KBUILD_TYPE),asan) TEMPLATE_VBoxR3Exe_LIBS.x86 += \ $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.x86)_LIB)/clang_rt.asan_dynamic-i386.lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.x86)_LIB)/clang_rt.asan_dynamic_runtime_thunk-i386.lib TEMPLATE_VBoxR3Exe_LIBS.amd64 += \ $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.amd64)_LIB)/clang_rt.asan_dynamic-x86_64.lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.amd64)_LIB)/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib endif else TEMPLATE_VBoxR3Exe_LIBS.x86 = \ $(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 TEMPLATE_VBoxR3Exe_LIBS.amd64 = \ $(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 endif TEMPLATE_VBoxR3Exe_POST_CMDS = $(VBOX_UTF8_MANIFEST_CMDS)$(NLTAB)$(VBOX_SIGN_IMAGE_CMDS) TEMPLATE_VBoxR3Exe_ORDERDEPS = $(VBOX_SIGN_IMAGE_CMDS_ORDERDEPS) if defined(VBOX_WITH_MORE_NT4_COMPAT_BINARIES) && "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.x86" TEMPLATE_VBoxR3Exe_POST_CMDS.win.x86 = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION) $(out)$$(NLTAB)$(TEMPLATE_VBoxR3Exe_POST_CMDS)) TEMPLATE_VBoxR3Exe_LNK_DEPS.win.x86 = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION)) TEMPLATE_VBoxR3Exe_LDFLAGS.win.x86 = \ -Include:_vcc100_kernel32_fakes_cpp \ -Include:_vcc100_kernel32_fakes_asm TEMPLATE_VBoxR3Exe_LIBS.win.x86 = \ $(PATH_STAGE_LIB)/RuntimeR3VccTricks2$(VBOX_SUFF_LIB) TEMPLATE_VBoxR3Exe_LIBS.x86 = \ $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.x86)_LIB)/oldnames.lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib endif else # the gcc guys TEMPLATE_VBoxR3Exe_TOOL = $(VBOX_GCC_TOOL) if $(VBOX_GCC_VERSION_CC) < 30400 TEMPLATE_VBoxR3Exe_DEFS += RT_WITHOUT_PRAGMA_ONCE endif 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_std) $(VBOX_GCC_fvisibility-inlines-hidden) \ $(VBOX_GCC_IPRT_FMT_CHECK) $(VBOX_GCC_SANITIZER_FLAGS) ifdef VBOX_WITH_NO_GCC_WARNING_POLICY TEMPLATE_VBoxR3Exe_CXXFLAGS += $(VBOX_GCC_WERR) endif TEMPLATE_VBoxR3Exe_CXXFLAGS.x86 = -m32 TEMPLATE_VBoxR3Exe_CXXFLAGS.amd64 = -m64 TEMPLATE_VBoxR3Exe_CXXFLAGS.sparc32 = -m32 TEMPLATE_VBoxR3Exe_CXXFLAGS.sparc64 = -m64 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) $(VBOX_GCC_IPRT_FMT_CHECK) ifdef VBOX_WITH_NO_GCC_WARNING_POLICY TEMPLATE_VBoxR3Exe_CFLAGS += $(VBOX_GCC_WERR) endif TEMPLATE_VBoxR3Exe_CFLAGS.x86 = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.x86) TEMPLATE_VBoxR3Exe_CFLAGS.amd64 = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.amd64) TEMPLATE_VBoxR3Exe_CFLAGS.sparc32 = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.sparc32) TEMPLATE_VBoxR3Exe_CFLAGS.sparc64 = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.sparc64) TEMPLATE_VBoxR3Exe_CFLAGS.debug = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.debug) TEMPLATE_VBoxR3Exe_CFLAGS.kprofile = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.kprofile) TEMPLATE_VBoxR3Exe_OBJCFLAGS = $(TEMPLATE_VBoxR3Exe_CFLAGS) TEMPLATE_VBoxR3Exe_OBJCFLAGS.x86 = $(TEMPLATE_VBoxR3Exe_CFLAGS.x86) TEMPLATE_VBoxR3Exe_OBJCFLAGS.amd64 = $(TEMPLATE_VBoxR3Exe_CFLAGS.amd64) TEMPLATE_VBoxR3Exe_OBJCFLAGS.debug = $(TEMPLATE_VBoxR3Exe_CFLAGS.debug) TEMPLATE_VBoxR3Exe_OBJCFLAGS.kprofile = $(TEMPLATE_VBoxR3Exe_CFLAGS.kprofile) TEMPLATE_VBoxR3Exe_OBJCXXFLAGS = $(TEMPLATE_VBoxR3Exe_CXXFLAGS) TEMPLATE_VBoxR3Exe_OBJCXXFLAGS.x86 = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.x86) TEMPLATE_VBoxR3Exe_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.amd64) TEMPLATE_VBoxR3Exe_OBJCXXFLAGS.debug = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.debug) TEMPLATE_VBoxR3Exe_OBJCXXFLAGS.kprofile = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.kprofile) TEMPLATE_VBoxR3Exe_PCHFLAGS = $(TEMPLATE_VBoxR3Exe_CXXFLAGS) TEMPLATE_VBoxR3Exe_PCHFLAGS.x86 = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.x86) TEMPLATE_VBoxR3Exe_PCHFLAGS.amd64 = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.amd64) TEMPLATE_VBoxR3Exe_PCHFLAGS.debug = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.debug) TEMPLATE_VBoxR3Exe_PCHFLAGS.kprofile = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.kprofile) TEMPLATE_VBoxR3Exe_LDFLAGS = $(VBOX_GCC_SANITIZER_FLAGS) $(VBOX_GCC_SANITIZER_LDFLAGS) TEMPLATE_VBoxR3Exe_LDFLAGS.x86 = -m32 TEMPLATE_VBoxR3Exe_LDFLAGS.amd64 = -m64 TEMPLATE_VBoxR3Exe_LDFLAGS.sparc32 = -m32 TEMPLATE_VBoxR3Exe_LDFLAGS.sparc64 = -m64 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 = $(VBOX_GCC_TOOL) TEMPLATE_VBoxR3Exe_LIBS = TEMPLATE_VBoxR3Exe_DEFS += LIBICONV_PLUG # Avoid 3rd party libiconv (from macports). TEMPLATE_VBoxR3Exe_SDKS.darwin = $(VBOX_DARWIN_DEF_SDK_SDKS) 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_PCHFLAGS.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) -Wl,-headerpad_max_install_names TEMPLATE_VBoxR3Exe_LDFLAGS.darwin.x86 = -read_only_relocs suppress TEMPLATE_VBoxR3Exe_POST_CMDS.darwin = $(VBOX_SIGN_IMAGE_CMDS) 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 += \ /boot/common/lib # 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 openbsd) TEMPLATE_VBoxR3Exe_TOOL = GXX3 TEMPLATE_VBoxR3Exe_LIBS = pthread TEMPLATE_VBoxR3Exe_INCS += \ /usr/include \ /usr/X11R6/include \ /usr/local/include TEMPLATE_VBoxR3Exe_LIBPATH += \ /usr/lib \ /usr/X11R6/lib \ /usr/local/lib else ifeq ($(KBUILD_TARGET),netbsd) TEMPLATE_VBoxR3Exe_TOOL = GXX3 TEMPLATE_VBoxR3Exe_LIBS = pthread TEMPLATE_VBoxR3Exe_INCS += \ /usr/include \ /usr/X11R7/include TEMPLATE_VBoxR3Exe_LIBPATH += \ /usr/lib \ /usr/X11R7/lib else ifeq ($(KBUILD_TARGET),solaris) TEMPLATE_VBoxR3Exe_TOOL = GXX3PLAIN TEMPLATE_VBoxR3Exe_DEFS += LIBICONV_PLUG _REENTRANT # Avoid the GNU libiconv, for now at least. if $(VBOX_GCC_VERSION_CC) < 30500 TEMPLATE_VBoxR3Exe_CFLAGS += -std=gnu99 endif TEMPLATE_VBoxR3Exe_LIBS = rt socket else $(warning Warning: VBOX Build: Target $(KBUILD_TARGET) is not officially supported!) TEMPLATE_VBoxR3Exe_CXXFLAGS.profile = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.release) TEMPLATE_VBoxR3Exe_CXXFLAGS.kprofile = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.krelease) 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 - base template, don't use directly. # This is mostly identical to the VBoxR3Exe template. (Avoid PIC if possible!) # ## @todo Eliminate VBoxR3DllBase in favor of VBoxR3Dll. TEMPLATE_VBoxR3DllBase = VBox Ring 3 SO/DLLs Base Template - do not use directly! TEMPLATE_VBoxR3DllBase_EXTENDS = VBoxR3Exe TEMPLATE_VBoxR3DllBase_DEFS.darwin = $(TEMPLATE_VBoxR3Exe_DEFS.darwin) PIC TEMPLATE_VBoxR3DllBase_LDFLAGS.darwin = $(TEMPLATE_VBoxR3Exe_LDFLAGS.darwin) \ -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_VBoxR3DllBase_DEFS = $(TEMPLATE_VBoxR3Exe_DEFS) PIC TEMPLATE_VBoxR3DllBase_CFLAGS = $(TEMPLATE_VBoxR3Exe_CFLAGS) -fPIC TEMPLATE_VBoxR3DllBase_CXXFLAGS = $(TEMPLATE_VBoxR3Exe_CXXFLAGS) -fPIC TEMPLATE_VBoxR3DllBase_PCHFLAGS = $(TEMPLATE_VBoxR3Exe_PCHFLAGS) -fPIC TEMPLATE_VBoxR3DllBase_LDFLAGS = $(TEMPLATE_VBoxR3Exe_LDFLAGS) -fPIC endif # # Temporary: Renaming the template and warnings will be errors ("soon"). # TEMPLATE_VBoxR3Dll = VBox ring-3 SO/DLLs, no warnings TEMPLATE_VBoxR3Dll_EXTENDS += VBoxR3DllBase TEMPLATE_VBoxR3Dll_EXTENDS_BY += appending ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxR3Dll_CFLAGS += $(VBOX_VCC_WERR) TEMPLATE_VBoxR3Dll_CXXFLAGS += $(VBOX_VCC_WERR) TEMPLATE_VBoxR3Dll_PCHFLAGS += $(VBOX_VCC_WERR) TEMPLATE_VBoxR3Dll_LDFLAGS += $(VBOX_VCC_LD_WERR) else TEMPLATE_VBoxR3Dll_CFLAGS += $(VBOX_GCC_WERR) TEMPLATE_VBoxR3Dll_CXXFLAGS += $(VBOX_GCC_WERR) TEMPLATE_VBoxR3Dll_PCHFLAGS += $(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 = VBoxR3DllBase 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_PCHFLAGS = $(TEMPLATE_VBoxR3Exe_CXXFLAGS) $(VBOX_GCC_WERR) TEMPLATE_VBoxR3DllNoPic_LDFLAGS = $(TEMPLATE_VBoxR3Exe_LDFLAGS) else ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxR3DllNoPic_CFLAGS = $(filter-out -W3 -wd%,$(TEMPLATE_VBoxR3DllBase_CFLAGS)) $(VBOX_VCC_WARN_ALL) $(VBOX_VCC_WERR) TEMPLATE_VBoxR3DllNoPic_CFLAGS.debug = $(filter-out -RTC%,$(TEMPLATE_VBoxR3DllBase_CFLAGS.debug)) TEMPLATE_VBoxR3DllNoPic_CFLAGS.release = $(TEMPLATE_VBoxR3DllBase_CFLAGS.release) -GS- TEMPLATE_VBoxR3DllNoPic_CXXFLAGS = $(filter-out -W3 -wd%,$(TEMPLATE_VBoxR3DllBase_CXXFLAGS)) $(VBOX_VCC_WARN_ALL) $(VBOX_VCC_WERR) TEMPLATE_VBoxR3DllNoPic_CXXFLAGS.debug = $(filter-out -RTC%,$(TEMPLATE_VBoxR3DllBase_CXXFLAGS.debug)) # RTCsu Prevents IEM opt. TEMPLATE_VBoxR3DllNoPic_CXXFLAGS.release = $(TEMPLATE_VBoxR3DllBase_CXXFLAGS.release) -GS- TEMPLATE_VBoxR3DllNoPic_PCHFLAGS = $(filter-out -W3 -wd%,$(TEMPLATE_VBoxR3DllBase_PCHFLAGS)) $(VBOX_VCC_WARN_ALL) $(VBOX_VCC_WERR) TEMPLATE_VBoxR3DllNoPic_PCHFLAGS.debug = $(filter-out -RTC%,$(TEMPLATE_VBoxR3DllBase_PCHFLAGS.debug)) # RTCsu Prevents IEM opt. TEMPLATE_VBoxR3DllNoPic_PCHFLAGS.release = $(TEMPLATE_VBoxR3DllBase_PCHFLAGS.release) -GS- TEMPLATE_VBoxR3DllNoPic_LDFLAGS = $(TEMPLATE_VBoxR3DllBase_LDFLAGS) $(VBOX_VCC_LD_WERR) else TEMPLATE_VBoxR3DllNoPic_CFLAGS = $(TEMPLATE_VBoxR3DllBase_CFLAGS) $(VBOX_GCC_WERR) TEMPLATE_VBoxR3DllNoPic_CXXFLAGS = $(TEMPLATE_VBoxR3DllBase_CXXFLAGS) $(VBOX_GCC_WERR) TEMPLATE_VBoxR3DllNoPic_PCHFLAGS = $(TEMPLATE_VBoxR3DllBase_PCHFLAGS) $(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 = VBoxR3DllBase 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_PCHFLAGS = $(TEMPLATE_VBoxR3Exe_PCHFLAGS) TEMPLATE_VBoxR3DllWarnNoPic_LDFLAGS = $(TEMPLATE_VBoxR3Exe_LDFLAGS) else ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxR3DllWarnNoPic_CFLAGS.release = $(TEMPLATE_VBoxR3DllBase_CFLAGS.release) -GS- TEMPLATE_VBoxR3DllWarnNoPic_CXXFLAGS.release = $(TEMPLATE_VBoxR3DllBase_CXXFLAGS.release) -GS- TEMPLATE_VBoxR3DllWarnNoPic_PCHFLAGS.release = $(TEMPLATE_VBoxR3DllBase_PCHFLAGS.release) -GS- endif # # Base template for building static R3 executables and any static # libraries they link with. Do _not_ use directly! # ## @todo Bake this into VBoxR3Static. TEMPLATE_VBoxR3StaticBase = VBox Static Ring 3 EXE TEMPLATE_VBoxR3StaticBase_EXTENDS = VBoxR3Exe TEMPLATE_VBoxR3StaticBase_DEFS = IN_RT_STATIC IN_RT_R3 IN_SUP_STATIC $(TEMPLATE_VBoxR3Exe_DEFS) ifdef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxR3StaticBase_DEFS += IPRT_NO_CRT TEMPLATE_VBoxR3StaticBase_INCS = $(PATH_ROOT)/include/iprt/nocrt $(TEMPLATE_VBoxR3Exe_INCS) endif ifeq ($(KBUILD_TARGET),win) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" ifdef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxR3StaticBase_SDKS = $(subst WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER),,$(TEMPLATE_VBoxR3Exe_SDKS)) else TEMPLATE_VBoxR3StaticBase_SDKS = $(subst WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER), WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER)-STATIC,$(TEMPLATE_VBoxR3Exe_SDKS)) endif endif ifdef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxR3StaticBase_CFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE) -EHsc -GR, $(TEMPLATE_VBoxR3Exe_CFLAGS)) \ -Zl -EHc-s- -Gy -GR- TEMPLATE_VBoxR3StaticBase_CXXFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE) -EHsc -GR, $(TEMPLATE_VBoxR3Exe_CXXFLAGS)) \ -Zl -EHc-s- -Gy -GR- TEMPLATE_VBoxR3StaticBase_PCHFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE) -EHsc -GR, $(TEMPLATE_VBoxR3Exe_PCHFLAGS)) \ -Zl -EHc-s- -Gy -GR- else TEMPLATE_VBoxR3StaticBase_CFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBoxR3Exe_CFLAGS)) \ -MT$(VBOX_VCC_CRT_TYPE) -Gy TEMPLATE_VBoxR3StaticBase_CXXFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBoxR3Exe_CXXFLAGS)) \ -MT$(VBOX_VCC_CRT_TYPE) -Gy TEMPLATE_VBoxR3StaticBase_PCHFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBoxR3Exe_PCHFLAGS)) \ -MT$(VBOX_VCC_CRT_TYPE) -Gy endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120" # Do not use SSE so valkit stuff can run on NT4 w/o needing a separate runtime library. TEMPLATE_VBoxR3StaticBase_CFLAGS.win.x86 = $(TEMPLATE_VBoxR3Exe_CFLAGS.win.86) /arch:IA32 TEMPLATE_VBoxR3StaticBase_CXXFLAGS.win.x86 = $(TEMPLATE_VBoxR3Exe_CXXFLAGS.win.86) /arch:IA32 TEMPLATE_VBoxR3StaticBase_PCHFLAGS.win.x86 = $(TEMPLATE_VBoxR3Exe_PCHFLAGS.win.86) /arch:IA32 TEMPLATE_VBoxR3StaticBase_CFLAGS += -Gw TEMPLATE_VBoxR3StaticBase_CXXFLAGS += -Gw TEMPLATE_VBoxR3StaticBase_PCHFLAGS += -Gw endif ifdef VBOX_WITH_NOCRT_STATIC # .0000cfg normally merges into .idata, but the linker won't let us do so via /MERGE. Doesn't matter much, # because .idata can be writable when targeting x86 (NT 3.1 fun) and we don't want .0000cfg to be writable. TEMPLATE_VBoxR3StaticBase_LDFLAGS = $(TEMPLATE_VBoxR3Exe_LDFLAGS) /NODEFAULTLIB /Merge:.0000cfg=.rdata else TEMPLATE_VBoxR3StaticBase_LDFLAGS = $(filter-out /DISALLOWLIB:libcmt$(VBOX_VCC_CRT_TYPE).lib /DISALLOWLIB:libcpmt$(VBOX_VCC_CRT_TYPE).lib, $(TEMPLATE_VBoxR3Exe_LDFLAGS)) endif TEMPLATE_VBoxR3StaticBase_LDFLAGS += \ /DISALLOWLIB:msvcrt.lib \ /DISALLOWLIB:msvcrtd.lib \ /DISALLOWLIB:msvcprt.lib \ /DISALLOWLIB:msvcprtd.lib \ /DISALLOWLIB:vcruntime.lib \ /DISALLOWLIB:vcruntimed.lib \ /DISALLOWLIB:ucrt.lib \ /DISALLOWLIB:ucrtd.lib if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" ifdef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxR3StaticBase_LIBS.amd64 = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxR3StaticBase_LIBS.x86 = $(NO_SUCH_VARIABLE) else TEMPLATE_VBoxR3StaticBase_LIBS.x86 = \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.x86)_LIB)/libvcruntime$(VBOX_VCC_CRT_TYPE).lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.x86)_LIB)/oldnames.lib TEMPLATE_VBoxR3StaticBase_LIBS.amd64 = \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.amd64)_LIB)/libvcruntime$(VBOX_VCC_CRT_TYPE).lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.amd64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.amd64)_LIB)/oldnames.lib endif ifeq ($(KBUILD_TYPE),asan) TEMPLATE_VBoxR3StaticBase_LIBS.x86 += \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.x86)_LIB)/clang_rt.asan-i386.lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.x86)_LIB)/clang_rt.asan_cxx-i386.lib TEMPLATE_VBoxR3StaticBase_LIBS.amd64 += \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.amd64)_LIB)/clang_rt.asan-x86_64.lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.amd64)_LIB)/clang_rt.asan_cxx-x86_64.lib endif else ifdef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxR3StaticBase_LIBS.amd64 = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxR3StaticBase_LIBS.x86 = $(NO_SUCH_VARIABLE) else TEMPLATE_VBoxR3StaticBase_LIBS.x86 = \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.x86)_LIB)/oldnames.lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib TEMPLATE_VBoxR3StaticBase_LIBS.amd64 = \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.amd64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticBase_TOOL.win.amd64)_LIB)/oldnames.lib endif endif else ifdef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxR3StaticBase_DEFS += RT_WITH_NOCRT_WRAPPERS endif ifn1of ($(KBUILD_TARGET), darwin linux solaris) # The gcc guys sans darwin, linux and solaris (don't depend on statically compiled system libs there) TEMPLATE_VBoxR3StaticBase_CFLAGS = $(TEMPLATE_VBoxR3Exe_CFLAGS) -static TEMPLATE_VBoxR3StaticBase_CXXFLAGS = $(TEMPLATE_VBoxR3Exe_CXXFLAGS) -static TEMPLATE_VBoxR3StaticBase_PCHFLAGS = $(TEMPLATE_VBoxR3Exe_PCHFLAGS) -static TEMPLATE_VBoxR3StaticBase_OBJCFLAGS = $(TEMPLATE_VBoxR3Exe_OBJCFLAGS) -static TEMPLATE_VBoxR3StaticBase_OBJCXXFLAGS = $(TEMPLATE_VBoxR3Exe_OBJCXXFLAGS) -static TEMPLATE_VBoxR3StaticBase_LDFLAGS = $(TEMPLATE_VBoxR3Exe_LDFLAGS) -static else ifeq ($(KBUILD_TARGET),solaris) TEMPLATE_VBoxR3StaticBase_LIBS = $(TEMPLATE_VBoxR3Exe_LIBS) nsl TEMPLATE_VBoxR3StaticBase_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)',$(TEMPLATE_VBoxR3Exe_LDFLAGS)) else TEMPLATE_VBoxR3StaticBase_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)',$(TEMPLATE_VBoxR3Exe_LDFLAGS)) endif ifn1of ($(KBUILD_TARGET), darwin os2) # ELF only. Present in gcc 3.2.3 & binutils 2.15, possibly earlier. ifdef VBOX_LD_gc_sections # Older solaris linker versions doesn't grok --gc-sections (e.g. add build box). ifndef TEMPLATE_VBoxR3StaticBase_CXXFLAGS TEMPLATE_VBoxR3StaticBase_CXXFLAGS = $(TEMPLATE_VBoxR3Exe_CXXFLAGS) TEMPLATE_VBoxR3StaticBase_CFLAGS = $(TEMPLATE_VBoxR3Exe_CFLAGS) endif TEMPLATE_VBoxR3StaticBase_CXXFLAGS += -ffunction-sections -fdata-sections TEMPLATE_VBoxR3StaticBase_CFLAGS += -ffunction-sections -fdata-sections TEMPLATE_VBoxR3StaticBase_LDFLAGS += $(VBOX_LD_gc_sections) endif endif endif # # Temporary: Renaming the template and warnings will be errors (soon). # Unlike VBoxR3StaticBase, this is strict wrt warnings and includes IPRT. # TEMPLATE_VBoxR3Static = New name for VBoxR3StaticBase TEMPLATE_VBoxR3Static_EXTENDS = VBoxR3StaticBase TEMPLATE_VBoxR3Static_EXTENDS_BY = appending TEMPLATE_VBoxR3Static_SDKS.$(KBUILD_TARGET_ARCH) += VBoxOpenSslStatic TEMPLATE_VBoxR3Static_SDKS.win += VBoxNtDll ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxR3Static_CFLAGS += $(VBOX_VCC_WERR) TEMPLATE_VBoxR3Static_CXXFLAGS += $(VBOX_VCC_WERR) TEMPLATE_VBoxR3Static_PCHFLAGS += $(VBOX_VCC_WERR) TEMPLATE_VBoxR3Static_LDFLAGS += $(VBOX_VCC_LD_WERR) else TEMPLATE_VBoxR3Static_CFLAGS += $(VBOX_GCC_WERR) TEMPLATE_VBoxR3Static_CXXFLAGS += $(VBOX_GCC_WERR) TEMPLATE_VBoxR3Static_PCHFLAGS += $(VBOX_GCC_WERR) TEMPLATE_VBoxR3Static_LDFLAGS.darwin.arm64 += $(TEMPLATE_VBoxR3StaticBase_LDFLAGS.darwin.arm64) -framework IOKit endif TEMPLATE_VBoxR3Static_LIBS.$(KBUILD_TARGET_ARCH) += \ $(VBOX_LIB_RUNTIME_STATIC) ifneq ($(KBUILD_TARGET_ARCH),x86) TEMPLATE_VBoxR3Static_LIBS.x86 += \ $(VBOX_LIB_RUNTIME_STATIC_X86) endif ifndef SDK_VBoxLibXml2_LIBS TEMPLATE_VBoxR3Static_LIBS.$(KBUILD_TARGET_ARCH) += \ $(PATH_STAGE_LIB)/VBox-libxml2-static$(VBOX_SUFF_LIB) endif if1of ($(KBUILD_TARGET), os2 win) TEMPLATE_VBoxR3Static_LIBS.$(KBUILD_TARGET_ARCH) += \ $(SDK_VBoxLzf_STATIC_LIBS) \ $(SDK_VBoxZlibStatic_LIBS) \ $(SDK_VBoxLibLzmaStatic_LIBS) else TEMPLATE_VBoxR3Static_LIBS.$(KBUILD_TARGET_ARCH) += \ $(SDK_VBoxLzf_LIBS) \ $(SDK_VBoxZlib_LIBS) \ $(SDK_VBoxLibLzma_LIBS) if1of ($(KBUILD_TARGET), darwin freebsd) TEMPLATE_VBoxR3Static_LIBS += iconv else ifeq ($(KBUILD_TARGET),solaris) TEMPLATE_VBoxR3Static_LIBS += kstat endif endif # # A no-ASAN version of VBoxR3Static for things like that automatically executed tests. # TEMPLATE_VBoxR3StaticExeNoAsan = VBoxR3Static but w/o ASAN TEMPLATE_VBoxR3StaticExeNoAsan_EXTENDS = VBoxR3Static if "$(KBUILD_TARGET)" == "win" && "$(KBUILD_TYPE)" == "asan" TEMPLATE_VBoxR3StaticExeNoAsan_CFLAGS = $(filter-out $(VBOX_VCC_SANITIZER_FLAGS) , $(TEMPLATE_VBoxR3Static_CFLAGS)) TEMPLATE_VBoxR3StaticExeNoAsan_CXXFLAGS = $(filter-out $(VBOX_VCC_SANITIZER_FLAGS) , $(TEMPLATE_VBoxR3Static_CXXFLAGS)) TEMPLATE_VBoxR3StaticExeNoAsan_PCHFLAGS = $(filter-out $(VBOX_VCC_SANITIZER_FLAGS) , $(TEMPLATE_VBoxR3Static_PCHFLAGS)) TEMPLATE_VBoxR3StaticExeNoAsan_LDFLAGS = $(filter-out $(VBOX_VCC_SANITIZER_LDFLAGS), $(TEMPLATE_VBoxR3Static_LDFLAGS)) -InferAsanLibs:No TEMPLATE_VBoxR3StaticExeNoAsan_LIBS.x86 = $(subst $(VBOX_LIB_RUNTIME_STATIC),$(VBOX_LIB_RUNTIME_STATIC_NO_ASAN),$(filter-out %clang_rt.asan-i386.lib %clang_rt.asan_cxx-i386.lib , $(TEMPLATE_VBoxR3Static_LIBS.x86))) TEMPLATE_VBoxR3StaticExeNoAsan_LIBS.amd64 = $(subst $(VBOX_LIB_RUNTIME_STATIC),$(VBOX_LIB_RUNTIME_STATIC_NO_ASAN),$(filter-out %clang_rt.asan-x86_64.lib %clang_rt.asan_cxx-x86_64.lib, $(TEMPLATE_VBoxR3Static_LIBS.amd64))) endif # # A DLL capable version of VBoxR3Static # ## @todo make VBoxR3StaticDll work on non-windows. TEMPLATE_VBoxR3StaticDll = VBox Static Ring-3 DLL TEMPLATE_VBoxR3StaticDll_EXTENDS = VBoxR3Static if "$(KBUILD_TARGET)" == "win" && "$(KBUILD_TYPE)" == "asan" TEMPLATE_VBoxR3StaticDll_LIBS.x86 = $(patsubst %clang_rt.asan-i386.lib, %clang_rt.asan_dll_thunk-i386.lib, $(filter-out %clang_rt.asan_cxx-i386.lib,$(TEMPLATE_VBoxR3Static_LIBS.x86))) TEMPLATE_VBoxR3StaticDll_LIBS.amd64 = $(patsubst %clang_rt.asan-x86_64.lib, %clang_rt.asan_dll_thunk-x86_64.lib, $(filter-out %clang_rt.asan_cxx-x86_64.lib,$(TEMPLATE_VBoxR3Static_LIBS.amd64))) endif # # A no-ASAN version of VBoxR3StaticDll for the installer helper DLL. # # Note! Not compatible with BLD_TRG_ARCH overrides yet. # TEMPLATE_VBoxR3StaticDllNoAsan = VBoxR3StaticDll but w/o ASAN TEMPLATE_VBoxR3StaticDllNoAsan_EXTENDS = VBoxR3StaticDll if "$(KBUILD_TARGET)" == "win" && "$(KBUILD_TYPE)" == "asan" TEMPLATE_VBoxR3StaticDllNoAsan_CFLAGS = $(filter-out $(VBOX_VCC_SANITIZER_FLAGS) , $(TEMPLATE_VBoxR3StaticDll_CFLAGS)) TEMPLATE_VBoxR3StaticDllNoAsan_CXXFLAGS = $(filter-out $(VBOX_VCC_SANITIZER_FLAGS) , $(TEMPLATE_VBoxR3StaticDll_CXXFLAGS)) TEMPLATE_VBoxR3StaticDllNoAsan_PCHFLAGS = $(filter-out $(VBOX_VCC_SANITIZER_FLAGS) , $(TEMPLATE_VBoxR3StaticDll_PCHFLAGS)) TEMPLATE_VBoxR3StaticDllNoAsan_LDFLAGS = $(filter-out $(VBOX_VCC_SANITIZER_LDFLAGS), $(TEMPLATE_VBoxR3StaticDll_LDFLAGS)) -InferAsanLibs:No TEMPLATE_VBoxR3StaticDllNoAsan_LIBS.x86 = $(subst $(VBOX_LIB_RUNTIME_STATIC),$(VBOX_LIB_RUNTIME_STATIC_NO_ASAN),$(filter-out %clang_rt.asan_dll_thunk-i386.lib, $(TEMPLATE_VBoxR3StaticDll_LIBS.x86))) TEMPLATE_VBoxR3StaticDllNoAsan_LIBS.amd64 = $(subst $(VBOX_LIB_RUNTIME_STATIC),$(VBOX_LIB_RUNTIME_STATIC_NO_ASAN),$(filter-out %clang_rt.asan_dll_thunk-x86_64.lib, $(TEMPLATE_VBoxR3StaticDll_LIBS.amd64))) endif # # Non-pedantic variation of VBoxR3Static # TEMPLATE_VBoxR3StaticNonPedantic = VBox Static Ring-3 EXE, non-pedantic. TEMPLATE_VBoxR3StaticNonPedantic_EXTENDS = VBoxR3Static ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxR3StaticNonPedantic_CFLAGS = $(TEMPLATE_VBoxR3Static_CFLAGS) $(VBOX_VCC_NON_PEDANTIC) TEMPLATE_VBoxR3StaticNonPedantic_CXXFLAGS = $(TEMPLATE_VBoxR3Static_CXXFLAGS) $(VBOX_VCC_NON_PEDANTIC) TEMPLATE_VBoxR3StaticNonPedantic_PCHFLAGS = $(TEMPLATE_VBoxR3Static_PCHFLAGS) $(VBOX_VCC_NON_PEDANTIC) else # gcc: TEMPLATE_VBoxR3StaticNonPedantic_TOOL = $(VBOX_GCC_TOOL) TEMPLATE_VBoxR3StaticNonPedantic_CFLAGS = $(filter-out $(VBOX_GCC_WERR) $(VBOX_GCC_WARN_MASOCHISTIC) $(VBOX_GCC_PEDANTIC_C) ,$(TEMPLATE_VBoxR3Static_CFLAGS)) \ $(VBOX_GCC_NON_PEDANTIC_CXX) TEMPLATE_VBoxR3StaticNonPedantic_CXXFLAGS = $(filter-out $(VBOX_GCC_WERR) $(VBOX_GCC_WARN_MASOCHISTIC) $(VBOX_GCC_PEDANTIC_CXX),$(TEMPLATE_VBoxR3Static_CXXFLAGS)) \ $(VBOX_GCC_NON_PEDANTIC_CXX) TEMPLATE_VBoxR3StaticNonPedantic_PCHFLAGS = $(filter-out $(VBOX_GCC_WERR) $(VBOX_GCC_WARN_MASOCHISTIC) $(VBOX_GCC_PEDANTIC_CXX),$(TEMPLATE_VBoxR3Static_PCHFLAGS)) \ $(VBOX_GCC_NON_PEDANTIC_CXX) endif # # VBoxR3Static w/o any CRT (windows only atm, experimental). # Implies no fancy C++, no exceptions, no static constructors or destructors, ++. # # Note! Not compatible with BLD_TRG_ARCH overrides yet. # TEMPLATE_VBoxR3StaticNoCrt = Static TEMPLATE_VBoxR3StaticNoCrt_EXTENDS = VBoxR3Static TEMPLATE_VBoxR3StaticNoCrt_SDKS = $(subst WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER)-STATIC,WINSDK10-UCRT-INCS, $(TEMPLATE_VBoxR3Static_SDKS)) TEMPLATE_VBoxR3StaticNoCrt_SDKS.$(KBUILD_TARGET_ARCH) = $(filter-out VBoxOpenSslStatic,$(TEMPLATE_VBoxR3Static_SDKS.$(KBUILD_TARGET_ARCH))) TEMPLATE_VBoxR3StaticNoCrt_DEFS = $(TEMPLATE_VBoxR3Static_DEFS) \ RT_NO_CRT \ IN_RT_STATIC ifndef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxR3StaticNoCrt_DEFS.win = $(TEMPLATE_VBoxR3Static_DEFS.win) \ RT_WITHOUT_NOCRT_WRAPPERS endif TEMPLATE_VBoxR3StaticNoCrt_LIBS = \ $(PATH_STAGE_LIB)/RuntimeR3NoCrt$(VBOX_SUFF_LIB) ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxR3StaticNoCrt_LIBS.x86 = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxR3StaticNoCrt_LIBS.amd64 = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxR3StaticNoCrt_LIBS.win = $(NO_SUCH_VARIABLE) ifdef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxR3StaticNoCrt_LIBS.$(KBUILD_TARGET_ARCH) = \ $(PATH_STAGE_LIB)/RuntimeR3NoCrt$(VBOX_SUFF_LIB) ifneq ($(KBUILD_TARGET_ARCH),x86) TEMPLATE_VBoxR3StaticNoCrt_LIBS.x86 = \ $(PATH_STAGE_LIB)/RuntimeR3NoCrt-x86$(VBOX_SUFF_LIB) # place holder, we don't have this library endif else TEMPLATE_VBoxR3StaticNoCrt_LIBS.win.x86 = \ $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticNoCrt_TOOL.win.x86)_LIB)/chkstk.obj endif TEMPLATE_VBoxR3StaticNoCrt_LDFLAGS = $(filter-out $(VBOX_VCC_LD_GUARD_CF) $(VBOX_VCC_SANITIZER_LDFLAGS), $(TEMPLATE_VBoxR3Static_LDFLAGS)) TEMPLATE_VBoxR3StaticNoCrt_LDFLAGS.win.x86 = $(filter-out -Include%, $(TEMPLATE_VBoxR3Static_LDFLAGS.win.x86)) TEMPLATE_VBoxR3StaticNoCrt_CFLAGS = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxR3Static_CFLAGS)) /GS- -EHs- TEMPLATE_VBoxR3StaticNoCrt_CXXFLAGS = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxR3Static_CXXFLAGS)) /GS- -EHs- TEMPLATE_VBoxR3StaticNoCrt_PCHFLAGS = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxR3Static_PCHFLAGS)) /GS- -EHs- TEMPLATE_VBoxR3StaticNoCrt_CXXFLAGS.debug = $(filter-out /RTC% -RTC%, $(TEMPLATE_VBoxR3Static_CXXFLAGS.debug)) else TEMPLATE_VBoxR3StaticNoCrt_CXXFLAGS = $(TEMPLATE_VBoxR3Static_CXXFLAGS) -fno-exceptions TEMPLATE_VBoxR3StaticNoCrt_PCHFLAGS = $(TEMPLATE_VBoxR3Static_PCHFLAGS) -fno-exceptions endif # # Executable w/o CRT (windows only atm, experimental). # Implies no fancy C++, no exceptions, no static constructors or destructors, ++. # TEMPLATE_VBoxR3StaticNoCrtExe := VBoxR3StaticNoCrt with EXE startup code calling a main() function TEMPLATE_VBoxR3StaticNoCrtExe_EXTENDS := VBoxR3StaticNoCrt TEMPLATE_VBoxR3StaticNoCrtExe_EXTENDS_BY := appending TEMPLATE_VBoxR3StaticNoCrtExe_LDFLAGS.win := /entry:CustomMainEntrypoint /subsystem:console # # 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/ TEMPLATE_VBoxR3HardenedExe_DEFS = $(TEMPLATE_VBoxR3Exe_DEFS) RTMEM_NO_WRAP_TO_EF_APIS 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 = VBoxNtDll $(TEMPLATE_VBoxR3Exe_SDKS) ifneq ($(VBOX_VCC_LD_GUARD_CF),) TEMPLATE_VBoxR3HardenedExe_CXXFLAGS = $(filter-out -RTC% -GZ $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxR3Exe_CXXFLAGS)) TEMPLATE_VBoxR3HardenedExe_CXXFLAGS.debug = $(filter-out -RTC% -GZ $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxR3Exe_CXXFLAGS.debug)) #-O2 -Oy- TEMPLATE_VBoxR3HardenedExe_PCHFLAGS = $(filter-out -RTC% -GZ $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxR3Exe_PCHFLAGS)) TEMPLATE_VBoxR3HardenedExe_PCHFLAGS.debug = $(filter-out -RTC% -GZ $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxR3Exe_PCHFLAGS.debug)) #-O2 -Oy- TEMPLATE_VBoxR3HardenedExe_CFLAGS = $(filter-out -RTC% -GZ $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxR3Exe_CFLAGS)) TEMPLATE_VBoxR3HardenedExe_CFLAGS.debug = $(filter-out -RTC% -GZ $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxR3Exe_CFLAGS.debug)) -O2 -Oy- else TEMPLATE_VBoxR3HardenedExe_CXXFLAGS = $(filter-out -RTC% -GZ $(VBOX_VCC_SANITIZER_FLAGS) -GS,$(TEMPLATE_VBoxR3Exe_CXXFLAGS)) -GS- TEMPLATE_VBoxR3HardenedExe_CXXFLAGS.debug = $(filter-out -RTC% -GZ $(VBOX_VCC_SANITIZER_FLAGS) -GS,$(TEMPLATE_VBoxR3Exe_CXXFLAGS.debug)) -GS- #-O2 -Oy- TEMPLATE_VBoxR3HardenedExe_PCHFLAGS = $(filter-out -RTC% -GZ $(VBOX_VCC_SANITIZER_FLAGS) -GS,$(TEMPLATE_VBoxR3Exe_PCHFLAGS)) -GS- TEMPLATE_VBoxR3HardenedExe_PCHFLAGS.debug = $(filter-out -RTC% -GZ $(VBOX_VCC_SANITIZER_FLAGS) -GS,$(TEMPLATE_VBoxR3Exe_PCHFLAGS.debug)) -GS- #-O2 -Oy- TEMPLATE_VBoxR3HardenedExe_CFLAGS = $(filter-out -RTC% -GZ $(VBOX_VCC_SANITIZER_FLAGS) -GS,$(TEMPLATE_VBoxR3Exe_CFLAGS)) -GS- TEMPLATE_VBoxR3HardenedExe_CFLAGS.debug = $(filter-out -RTC% -GZ $(VBOX_VCC_SANITIZER_FLAGS) -GS,$(TEMPLATE_VBoxR3Exe_CFLAGS.debug)) -GS- -O2 -Oy- endif TEMPLATE_VBoxR3HardenedExe_LDFLAGS = $(filter-out $(VBOX_VCC_SANITIZER_LDFLAGS), $(TEMPLATE_VBoxR3Exe_LDFLAGS)) \ /DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE).lib \ /DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE).lib \ /DISALLOWLIB:vcruntime$(VBOX_VCC_CRT_TYPE).lib \ /DISALLOWLIB:ucrt$(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) TEMPLATE_VBoxR3HardenedExe_USES.win = $(TEMPLATE_VBoxR3Exe_USES.win) vboximportchecker TEMPLATE_VBoxR3HardenedExe_VBOX_IMPORT_CHECKER.win = noimports else ifn1of ($(KBUILD_TARGET), os2) ifneq ($(KBUILD_TYPE),asan) # Keep RPATH in asan builds so we can find libasan.so.X and libubsan.so.Y. 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 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_VBoxR3HardenedLib_USES.win = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxR3HardenedLib_POST_CMDS = $(NO_SUCH_VARIABLE) # # Template for building hardened Ring-3 testcase executables. # TEMPLATE_VBoxR3HardenedTstExe = VBox Ring-3 Hardened Testcase Exe (currently windows only!) TEMPLATE_VBoxR3HardenedTstExe_EXTENDS = VBoxR3HardenedExe TEMPLATE_VBoxR3HardenedTstExe_INST = $(INST_TESTCASE) # # Template for building hardened Ring-3 testcase DLLs (pairs with VBoxR3HardenedTstExe). # TEMPLATE_VBoxR3HardenedTstDll = VBox Ring-3 Hardened Testcase Dll (currently windows only!) TEMPLATE_VBoxR3HardenedTstDll_EXTENDS = VBoxR3TstDll TEMPLATE_VBoxR3HardenedTstDll_INST = $(INST_TESTCASE) TEMPLATE_VBoxR3HardenedTstDll_LDFLAGS.win = $(TEMPLATE_VBoxR3TstDll_LDFLAGS.win) -IntegrityCheck ifn1of ($(KBUILD_TARGET), win os2) TEMPLATE_VBoxR3HardenedTstDll_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%,$(TEMPLATE_VBoxR3TstDll_LDFLAGS)) TEMPLATE_VBoxR3HardenedTstDll_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBoxR3TstDll_LDFLAGS.linux)) endif # # 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 TEMPLATE_VBoxR3SetUidToRoot_LDFLAGS = $(VBOX_GCC_SANITIZER_FLAGS) $(VBOX_GCC_SANITIZER_LDFLAGS) 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_PCHFLAGS = $(TEMPLATE_VBoxR3Exe_PCHFLAGS) $(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) TEMPLATE_VBoxR3Tool_PCHFLAGS = $(TEMPLATE_VBoxR3Exe_PCHFLAGS) $(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) if defined(VBOX_WITH_MORE_NT4_COMPAT_BINARIES) && "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.x86" TEMPLATE_VBoxR3Tool_LIBS.x86 = \ $(PATH_STAGE_LIB)/RuntimeR3VccTricks2$(VBOX_SUFF_LIB) \ $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.x86)_LIB)/oldnames.lib endif # # Ring-3 testcase, running automatically during the build. # This is the VBoxR3Exe template only with a different install dir. # TEMPLATE_VBoxR3AutoTest = VBox Ring 3 Testcase Exe TEMPLATE_VBoxR3AutoTest_EXTENDS := VBoxR3Static TEMPLATE_VBoxR3AutoTest_SDKS.$(KBUILD_TARGET_ARCH) = $(filter-out VBoxOpenSslStatic,$(TEMPLATE_$(TEMPLATE_VBoxR3AutoTest_EXTENDS)_SDKS.$(KBUILD_TARGET_ARCH))) ifeq ($(KBUILD_TARGET),win) if "$(KBUILD_HOST_VERSION)" vlt "10.0.0.0.10240" # The windows ASAN requires windows 10 APIs to work. TEMPLATE_VBoxR3AutoTest_EXTENDS := VBoxR3StaticExeNoAsan endif ifdef VBOX_SIGNING_MODE TEMPLATE_VBoxR3AutoTest_LDFLAGS = $(filter-out -IntegrityCheck, $(TEMPLATE_$(TEMPLATE_VBoxR3AutoTest_EXTENDS)_LDFLAGS)) TEMPLATE_VBoxR3AutoTest_POST_CMDS = $(NO_SUCH_VARIABLE) endif endif TEMPLATE_VBoxR3AutoTest_INST = $(INST_TESTCASE) TEMPLATE_VBoxR3AutoTest_LIBS.$(KBUILD_TARGET_ARCH) = $(filter-out \ $(if-expr !defined(SDK_VBoxLibXml2_LIBS),$(PATH_STAGE_LIB)/VBox-libxml2-static$(VBOX_SUFF_LIB),) \ $(if-expr "$(KBUILD_TARGET)" == "win" || "$(KBUILD_TARGET)" == "os2" \ ,$(SDK_VBoxLzf_STATIC_LIBS) $(SDK_VBoxZlibStatic_LIBS) $(SDK_VBoxLibLzmaStatic_LIBS) \ ,$(SDK_VBoxLzf_LIBS) $(SDK_VBoxZlib_LIBS) $(SDK_VBoxLibLzma_LIBS)) \ ,$(TEMPLATE_$(TEMPLATE_VBoxR3AutoTest_EXTENDS)_LIBS.$(KBUILD_TARGET_ARCH))) # # 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_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBoxR3Exe_LIBS) TEMPLATE_VBoxR3TstExe_INST = $(INST_TESTCASE) 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 if defined(VBOX_WITH_MORE_NT4_COMPAT_BINARIES) && "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.x86" TEMPLATE_VBoxR3TstExe_POST_CMDS.win.x86 = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION) $(out)) TEMPLATE_VBoxR3TstExe_LIBS.x86 = \ $(PATH_STAGE_LIB)/RuntimeR3VccTricks2$(VBOX_SUFF_LIB) \ $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.x86)_LIB)/oldnames.lib endif # x86 version of VBoxR3TstExe TEMPLATE_VBoxR3TstExe-x86 := 32-bit VBox Ring 3 Testcase Exe TEMPLATE_VBoxR3TstExe-x86_EXTENDS := VBoxR3TstExe TEMPLATE_VBoxR3TstExe-x86_BLD_TRG_ARCH := x86 TEMPLATE_VBoxR3TstExe-x86_LIBS = $(LIB_RUNTIME_X86) $(TEMPLATE_VBoxR3Exe_LIBS) # # 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_PCHFLAGS = $(TEMPLATE_VBoxR3TstExe_PCHFLAGS) -fPIC TEMPLATE_VBoxR3TstDll_LDFLAGS = $(TEMPLATE_VBoxR3TstExe_LDFLAGS) -fPIC 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 = VBoxR3DllBase ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxR3DllNonPedantic_CFLAGS = $(TEMPLATE_VBoxR3DllBase_CFLAGS) $(VBOX_VCC_NON_PEDANTIC) TEMPLATE_VBoxR3DllNonPedantic_CXXFLAGS = $(TEMPLATE_VBoxR3DllBase_CXXFLAGS) $(VBOX_VCC_NON_PEDANTIC) TEMPLATE_VBoxR3DllNonPedantic_PCHFLAGS = $(TEMPLATE_VBoxR3DllBase_PCHFLAGS) $(VBOX_VCC_NON_PEDANTIC) else # gcc: TEMPLATE_VBoxR3DllNonPedantic_TOOL = $(VBOX_GCC_TOOL) TEMPLATE_VBoxR3DllNonPedantic_CFLAGS = $(filter-out $(VBOX_GCC_WERR) $(VBOX_GCC_WARN_MASOCHISTIC) $(VBOX_GCC_PEDANTIC_C) ,$(TEMPLATE_VBoxR3DllBase_CFLAGS)) \ $(VBOX_GCC_NON_PEDANTIC_C) TEMPLATE_VBoxR3DllNonPedantic_CXXFLAGS = $(filter-out $(VBOX_GCC_WERR) $(VBOX_GCC_WARN_MASOCHISTIC) $(VBOX_GCC_PEDANTIC_CXX),$(TEMPLATE_VBoxR3DllBase_CXXFLAGS)) \ $(VBOX_GCC_NON_PEDANTIC_CXX) TEMPLATE_VBoxR3DllNonPedantic_PCHFLAGS = $(filter-out $(VBOX_GCC_WERR) $(VBOX_GCC_WARN_MASOCHISTIC) $(VBOX_GCC_PEDANTIC_CXX),$(TEMPLATE_VBoxR3DllBase_PCHFLAGS)) \ $(VBOX_GCC_NON_PEDANTIC_CXX) 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_VBoxR3DllNonPedantic_DEFS)) \ HC_ARCH_BITS=32 ARCH_BITS=32 # # Same as VBoxR3DllNonPedantic, only it optimizes debug builds. # TEMPLATE_VBoxR3DllNonPedanticFast = VBox ring-3 Non-pedantic, with warnings, optimized debug. TEMPLATE_VBoxR3DllNonPedanticFast_EXTENDS = VBoxR3DllNonPedantic ifeq ($(KBUILD_TYPE),debug) ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxR3DllNonPedanticFast_CFLAGS = $(filter-out -O0, $(TEMPLATE_VBoxR3DllNonPedantic_CFLAGS)) -O2 -Oy- TEMPLATE_VBoxR3DllNonPedanticFast_CFLAGS.debug = $(filter-out -RTC%, $(TEMPLATE_VBoxR3DllNonPedantic_CFLAGS.debug)) TEMPLATE_VBoxR3DllNonPedanticFast_CXXFLAGS = $(filter-out -O0, $(TEMPLATE_VBoxR3DllNonPedantic_CXXFLAGS)) -O2 -Oy- TEMPLATE_VBoxR3DllNonPedanticFast_CXXFLAGS.debug = $(filter-out -RTC%, $(TEMPLATE_VBoxR3DllNonPedantic_CXXFLAGS.debug)) TEMPLATE_VBoxR3DllNonPedanticFast_PCHFLAGS = $(filter-out -O0, $(TEMPLATE_VBoxR3DllNonPedantic_PCHFLAGS)) -O2 -Oy- TEMPLATE_VBoxR3DllNonPedanticFast_PCHFLAGS.debug = $(filter-out -RTC%, $(TEMPLATE_VBoxR3DllNonPedantic_PCHFLAGS.debug)) else TEMPLATE_VBoxR3DllNonPedanticFast_CFLAGS = $(TEMPLATE_VBoxR3DllNonPedantic_CFLAGS) -O2 -fno-omit-frame-pointer TEMPLATE_VBoxR3DllNonPedanticFast_CXXFLAGS = $(TEMPLATE_VBoxR3DllNonPedantic_CXXFLAGS) -O2 -fno-omit-frame-pointer TEMPLATE_VBoxR3DllNonPedanticFast_PCHFLAGS = $(TEMPLATE_VBoxR3DllNonPedantic_PCHFLAGS) -O2 -fno-omit-frame-pointer endif endif # # Template for building libraries that are linked into VBoxRT.dll # and it's variations, pedantic variation. # TEMPLATE_VBoxR3RuntimeDll = For libraries that are linked into VBoxRT. TEMPLATE_VBoxR3RuntimeDll_EXTENDS = VBoxR3Dll TEMPLATE_VBoxR3RuntimeDll_DEFS = $(TEMPLATE_VBoxR3Dll_DEFS) IN_RT_R3 if defined(VBOX_WITH_MORE_NT4_COMPAT_BINARIES) && "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.x86" TEMPLATE_VBoxR3RuntimeDll_CFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBoxR3Dll_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE) TEMPLATE_VBoxR3RuntimeDll_CXXFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBoxR3Dll_CXXFLAGS)) -MT$(VBOX_VCC_CRT_TYPE) TEMPLATE_VBoxR3RuntimeDll_PCHFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBoxR3Dll_PCHFLAGS)) -MT$(VBOX_VCC_CRT_TYPE) TEMPLATE_VBoxR3RuntimeDll_LIBS.x86 = $(filter-out $(PATH_TOOL_$(TEMPLATE_VBoxR3Exe_TOOL.win.x86)_LIB)/%, $(TEMPLATE_VBoxR3Dll_LIBS.x86)) \ $(PATH_TOOL_$(TEMPLATE_VBoxR3RuntimeDll_TOOL.win.x86)_LIB)/oldnames.lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3RuntimeDll_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \ $(PATH_TOOL_$(TEMPLATE_VBoxR3RuntimeDll_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib endif # # Template for building libraries that are linked into VBoxRT.dll # and it's variations, non-pedantic variation. # TEMPLATE_VBoxR3RuntimeDllNonPedantic = For libraries that are linked into VBoxRT, but must be excluded from -pedantic warnings. TEMPLATE_VBoxR3RuntimeDllNonPedantic_EXTENDS = VBoxR3DllNonPedantic TEMPLATE_VBoxR3RuntimeDllNonPedantic_DEFS = $(TEMPLATE_VBoxR3DllNonPedantic_DEFS) IN_RT_R3 if defined(VBOX_WITH_MORE_NT4_COMPAT_BINARIES) && $(KBUILD_TARGET_ARCH) == "x86" TEMPLATE_VBoxR3RuntimeDllNonPedantic_CFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBoxR3DllNonPedantic_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE) TEMPLATE_VBoxR3RuntimeDllNonPedantic_CXXFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBoxR3DllNonPedantic_CXXFLAGS)) -MT$(VBOX_VCC_CRT_TYPE) TEMPLATE_VBoxR3RuntimeDllNonPedantic_PCHFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBoxR3DllNonPedantic_PCHFLAGS)) -MT$(VBOX_VCC_CRT_TYPE) endif # # Same as VBoxR3RuntimeDllNonPedantic, only it optimized debug builds too. # TEMPLATE_VBoxR3RuntimeDllNonPedanticFast = For libraries that are linked into VBoxRT, but must be excluded from -pedantic warnings, optmized debug. TEMPLATE_VBoxR3RuntimeDllNonPedanticFast_EXTENDS = VBoxR3RuntimeDllNonPedantic ifeq ($(KBUILD_TYPE),debug) ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxR3RuntimeDllNonPedanticFast_CFLAGS = $(filter-out -O0, $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CFLAGS)) -O2 -Oy- TEMPLATE_VBoxR3RuntimeDllNonPedanticFast_CFLAGS.debug = $(filter-out -RTC%, $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CFLAGS.debug)) TEMPLATE_VBoxR3RuntimeDllNonPedanticFast_CXXFLAGS = $(filter-out -O0, $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CXXFLAGS)) -O2 -Oy- TEMPLATE_VBoxR3RuntimeDllNonPedanticFast_CXXFLAGS.debug = $(filter-out -RTC%, $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CXXFLAGS.debug)) TEMPLATE_VBoxR3RuntimeDllNonPedanticFast_PCHFLAGS = $(filter-out -O0, $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_PCHFLAGS)) -O2 -Oy- TEMPLATE_VBoxR3RuntimeDllNonPedanticFast_PCHFLAGS.debug = $(filter-out -RTC%, $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_PCHFLAGS.debug)) else TEMPLATE_VBoxR3RuntimeDllNonPedanticFast_CFLAGS = $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CFLAGS) -O2 -fno-omit-frame-pointer TEMPLATE_VBoxR3RuntimeDllNonPedanticFast_CXXFLAGS = $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_CXXFLAGS) -O2 -fno-omit-frame-pointer TEMPLATE_VBoxR3RuntimeDllNonPedanticFast_PCHFLAGS = $(TEMPLATE_VBoxR3RuntimeDllNonPedantic_PCHFLAGS) -O2 -fno-omit-frame-pointer endif 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_TOOL = $(VBOX_VCC_TOOL) TEMPLATE_VBoxMainExe_TOOL.win.x86 = $(VBOX_VCC_TOOL_STEM)X86 TEMPLATE_VBoxMainExe_TOOL.win.amd64 = $(VBOX_VCC_TOOL_STEM)AMD64 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" TEMPLATE_VBoxMainExe_SDKS = ReorderCompilerIncs WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER) $(VBOX_WINPSDK) $(VBOX_WINDDK) else TEMPLATE_VBoxMainExe_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) endif TEMPLATE_VBoxMainExe_CXXFLAGS = -Zi -Zl -GR -EHsc -GF -MD$(VBOX_VCC_CRT_TYPE) -Zc:wchar_t- \ $(VBOX_VCC_OPT) $(VBOX_VCC_FP) $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS) $(VBOX_VCC_std) # -wd4625: 'DisplaySourceBitmap' : copy constructor could not be generated because a base class copy constructor is inaccessible # -wd4626: 'DisplaySourceBitmap' : assignment operator could not be generated because a base class assignment operator is inaccessible # The two above can be cured by adding private: DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(xxxx); but too much work. # -wd4355: 'this' : used in base member initializer list (e.g. VirtualBoxBase.cpp) TEMPLATE_VBoxMainExe_CXXFLAGS += $(VBOX_VCC_WARN_ALL) -wd4625 -wd4626 -wd4355 $(VBOX_VCC_WERR) TEMPLATE_VBoxMainExe_CXXFLAGS += -Gy if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120" TEMPLATE_VBoxMainExe_CXXFLAGS += -Gw endif ifdef VBOX_WITH_MSC_ANALYZE_THIS TEMPLATE_VBoxMainExe_CXXFLAGS += /analyze endif TEMPLATE_VBoxMainExe_CXXFLAGS.debug = -RTCsu TEMPLATE_VBoxMainExe_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxMainExe_CXXFLAGS.kprofile = -Gh -GH TEMPLATE_VBoxMainExe_CFLAGS = $(filter-out $(VBOX_VCC_std),$(TEMPLATE_VBoxMainExe_CXXFLAGS)) TEMPLATE_VBoxMainExe_CFLAGS.debug = $(TEMPLATE_VBoxMainExe_CXXFLAGS.debug) TEMPLATE_VBoxMainExe_CFLAGS.dbgopt = $(TEMPLATE_VBoxMainExe_CXXFLAGS.dbgopt) TEMPLATE_VBoxMainExe_CFLAGS.kprofile = $(TEMPLATE_VBoxMainExe_CXXFLAGS.kprofile) TEMPLATE_VBoxMainExe_PCHFLAGS = $(TEMPLATE_VBoxMainExe_CXXFLAGS) TEMPLATE_VBoxMainExe_PCHFLAGS.debug = $(TEMPLATE_VBoxMainExe_CXXFLAGS.debug) TEMPLATE_VBoxMainExe_PCHFLAGS.dbgopt = $(TEMPLATE_VBoxMainExe_CXXFLAGS.dbgopt) TEMPLATE_VBoxMainExe_PCHFLAGS.kprofile = $(TEMPLATE_VBoxMainExe_CXXFLAGS.kprofile) TEMPLATE_VBoxMainExe_LDFLAGS = -Ignore:4197 \ /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug /Opt:Ref /Opt:Icf \ $(VBOX_VCC_LD_GUARD_CF) $(VBOX_VCC_SANITIZER_LDFLAGS) \ /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 \ /DISALLOWLIB:vcruntime$(VBOX_VCC_CRT_TYPE_N).lib \ /DISALLOWLIB:ucrt$(VBOX_VCC_CRT_TYPE_N).lib \ /DISALLOWLIB:libvcruntime.lib \ /DISALLOWLIB:libvcruntimed.lib \ /DISALLOWLIB:libucrt.lib \ /DISALLOWLIB:libucrtd.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_LDFLAGS.win.amd64 = $(VBOX_VCC_LD_HIGH_ENTRYOPY_VA) TEMPLATE_VBoxMainExe_LIBS = \ $(LIB_RUNTIME) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" TEMPLATE_VBoxMainExe_LIBS.x86 = \ $(PATH_TOOL_$(TEMPLATE_VBoxMainExe_TOOL.win.x86)_LIB)/vcruntime$(VBOX_VCC_CRT_TYPE).lib \ $(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 TEMPLATE_VBoxMainExe_LIBS.amd64 = \ $(PATH_TOOL_$(TEMPLATE_VBoxMainExe_TOOL.win.amd64)_LIB)/vcruntime$(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 ifeq ($(KBUILD_TYPE),asan) TEMPLATE_VBoxMainExe_LIBS.x86 += \ $(PATH_TOOL_$(TEMPLATE_VBoxMainExe_TOOL.win.x86)_LIB)/clang_rt.asan_dynamic-i386.lib \ $(PATH_TOOL_$(TEMPLATE_VBoxMainExe_TOOL.win.x86)_LIB)/clang_rt.asan_dynamic_runtime_thunk-i386.lib TEMPLATE_VBoxMainExe_LIBS.amd64 += \ $(PATH_TOOL_$(TEMPLATE_VBoxMainExe_TOOL.win.amd64)_LIB)/clang_rt.asan_dynamic-x86_64.lib \ $(PATH_TOOL_$(TEMPLATE_VBoxMainExe_TOOL.win.amd64)_LIB)/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib endif else TEMPLATE_VBoxMainExe_LIBS.x86 = \ $(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 TEMPLATE_VBoxMainExe_LIBS.amd64 = \ $(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 endif TEMPLATE_VBoxMainExe_POST_CMDS = $(VBOX_UTF8_MANIFEST_CMDS)$(NLTAB)$(VBOX_SIGN_IMAGE_CMDS) TEMPLATE_VBoxMainExe_ORDERDEPS = $(VBOX_SIGN_IMAGE_CMDS_ORDERDEPS) else # the GCC guys: TEMPLATE_VBoxMainExe_TOOL = $(VBOX_GCC_TOOL) if $(VBOX_GCC_VERSION_CC) < 30400 TEMPLATE_VBoxMainExe_DEFS += RT_WITHOUT_PRAGMA_ONCE endif TEMPLATE_VBoxMainExe_CXXFLAGS = -g $(VBOX_GCC_pipe) \ $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_Wno-multistatement-macros) $(VBOX_GCC_Wno-class-memaccess) -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) $(VBOX_GCC_IPRT_FMT_CHECK) \ $(VBOX_GCC_SANITIZER_FLAGS) if !defined("VBOX_GCC_Wno-delete-non-virtual-dtor") && defined("VBOX_GCC_Wno-non-virtual-dtor") TEMPLATE_VBoxMainExe_CXXFLAGS += $(VBOX_GCC_Wno-non-virtual-dtor) endif ifdef VBOX_WITH_NO_GCC_WARNING_POLICY TEMPLATE_VBoxMainExe_CXXFLAGS += $(VBOX_GCC_WERR) endif 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.x86 = -m32 TEMPLATE_VBoxMainExe_CXXFLAGS.amd64 = -m64 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) $(VBOX_GCC_IPRT_FMT_CHECK) \ $(VBOX_GCC_SANITIZER_FLAGS) ifdef VBOX_WITH_NO_GCC_WARNING_POLICY TEMPLATE_VBoxMainExe_CFLAGS += $(VBOX_GCC_WERR) endif TEMPLATE_VBoxMainExe_CFLAGS.x86 = -m32 TEMPLATE_VBoxMainExe_CFLAGS.amd64 = -m64 TEMPLATE_VBoxMainExe_CFLAGS.kprofile = $(TEMPLATE_VBoxMainExe_CXXFLAGS.kprofile) TEMPLATE_VBoxMainExe_CFLAGS.debug = $(TEMPLATE_VBoxMainExe_CXXFLAGS.debug) TEMPLATE_VBoxMainExe_OBJCFLAGS = $(TEMPLATE_VBoxMainExe_CFLAGS) TEMPLATE_VBoxMainExe_OBJCFLAGS.x86 = $(TEMPLATE_VBoxMainExe_CFLAGS.x86) TEMPLATE_VBoxMainExe_OBJCFLAGS.amd64 = $(TEMPLATE_VBoxMainExe_CFLAGS.amd64) TEMPLATE_VBoxMainExe_OBJCFLAGS.debug = $(TEMPLATE_VBoxMainExe_CFLAGS.debug) TEMPLATE_VBoxMainExe_OBJCFLAGS.kprofile = $(TEMPLATE_VBoxMainExe_CFLAGS.kprofile) TEMPLATE_VBoxMainExe_OBJCXXFLAGS = $(TEMPLATE_VBoxMainExe_CXXFLAGS) TEMPLATE_VBoxMainExe_OBJCXXFLAGS.x86 = $(TEMPLATE_VBoxMainExe_CXXFLAGS.x86) TEMPLATE_VBoxMainExe_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBoxMainExe_CXXFLAGS.amd64) TEMPLATE_VBoxMainExe_OBJCXXFLAGS.debug = $(TEMPLATE_VBoxMainExe_CXXFLAGS.debug) TEMPLATE_VBoxMainExe_OBJCXXFLAGS.kprofile = $(TEMPLATE_VBoxMainExe_CXXFLAGS.kprofile) TEMPLATE_VBoxMainExe_PCHFLAGS = $(TEMPLATE_VBoxMainExe_CXXFLAGS) TEMPLATE_VBoxMainExe_PCHFLAGS.x86 = $(TEMPLATE_VBoxMainExe_CXXFLAGS.x86) TEMPLATE_VBoxMainExe_PCHFLAGS.amd64 = $(TEMPLATE_VBoxMainExe_CXXFLAGS.amd64) TEMPLATE_VBoxMainExe_PCHFLAGS.debug = $(TEMPLATE_VBoxMainExe_CXXFLAGS.debug) TEMPLATE_VBoxMainExe_PCHFLAGS.kprofile = $(TEMPLATE_VBoxMainExe_CXXFLAGS.kprofile) TEMPLATE_VBoxMainExe_LDFLAGS = $(VBOX_GCC_SANITIZER_FLAGS) $(VBOX_GCC_SANITIZER_LDFLAGS) TEMPLATE_VBoxMainExe_LDFLAGS.x86 = -m32 TEMPLATE_VBoxMainExe_LDFLAGS.amd64 = -m64 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 = $(VBOX_GCC_TOOL) TEMPLATE_VBoxMainExe_SDKS += $(VBOX_DARWIN_DEF_SDK_SDKS) 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 -Wl,-headerpad_max_install_names TEMPLATE_VBoxMainExe_LIBS = $(LIB_RUNTIME) TEMPLATE_VBoxMainExe_POST_CMDS.darwin = $(VBOX_SIGN_IMAGE_CMDS) else ifeq ($(KBUILD_TARGET),haiku) TEMPLATE_VBoxMainExe_TOOL = GXX3 TEMPLATE_VBoxMainExe_LIBS = $(LIB_RUNTIME) network stdc++ supc++ else if1of ($(KBUILD_TARGET), freebsd openbsd) TEMPLATE_VBoxMainExe_TOOL = GXX3 TEMPLATE_VBoxMainExe_LIBS = $(LIB_RUNTIME) TEMPLATE_VBoxMainExe_INCS += \ /usr/include \ /usr/X11R6/include \ /usr/local/include TEMPLATE_VBoxMainExe_LIBPATH += \ /usr/lib \ /usr/X11R6/lib \ /usr/local/lib else ifeq ($(KBUILD_TARGET),netbsd) TEMPLATE_VBoxMainExe_TOOL = GXX3 TEMPLATE_VBoxMainExe_LIBS = $(LIB_RUNTIME) TEMPLATE_VBoxMainExe_INCS += \ /usr/include \ /usr/X11R7/include TEMPLATE_VBoxMainExe_LIBPATH += \ /usr/lib \ /usr/X11R7/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_PCHFLAGS = -fPIC $(TEMPLATE_VBoxMainExe_PCHFLAGS) 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) TEMPLATE_VBoxMainComp_PCHFLAGS = -fPIC $(TEMPLATE_VBoxMainExe_PCHFLAGS) 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) # x86 version of VBoxMainComp 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_INST.win = $(INST_DLL)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 TEMPLATE_VBoxMainClientExe_LIBS.win = $(TEMPLATE_VBoxMainExe_LIBS.win) \ $(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 TEMPLATE_VBoxMainClientExe_CXXFLAGS.linux = $(TEMPLATE_VBoxMainExe_CXXFLAGS.linux) -pthread TEMPLATE_VBoxMainClientExe_PCHFLAGS.linux = $(TEMPLATE_VBoxMainExe_PCHFLAGS.linux) -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_PCHFLAGS = -fPIC $(TEMPLATE_VBoxMainClientExe_PCHFLAGS) TEMPLATE_VBoxMainClientDll_LDFLAGS = -fPIC $(TEMPLATE_VBoxMainClientExe_LDFLAGS) endif TEMPLATE_VBoxMainClientDll_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBoxMainClientExe_LDFLAGS.darwin)) # x86 version of VBoxMainClientDll TEMPLATE_VBoxMainClientDll-x86 := 32-bit VBox MAIN Client (shared library) TEMPLATE_VBoxMainClientDll-x86_EXTENDS := VBoxMainClientDll TEMPLATE_VBoxMainClientDll-x86_BLD_TRG_ARCH := x86 TEMPLATE_VBoxMainClientDll-x86_INST.win = $(INST_DLL)x86/ TEMPLATE_VBoxMainClientDll-x86_DEFS = $(filter-out HC_ARCH_BITS%,$(TEMPLATE_VBoxMainClientDll_DEFS)) \ HC_ARCH_BIT=32 ARCH_BITS=32 VBOX_IN_32_ON_64_MAIN_API TEMPLATE_VBoxMainClientDll-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_VBoxMainClientDll_LIBS)))) # # 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 = VBoxR3Dll TEMPLATE_VBoxR3ExtPack_DEFS = $(TEMPLATE_VBoxR3Dll_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_VBoxR3Dll_INCS) endif ifneq ($(KBUILD_TARGET),win) TEMPLATE_VBoxR3ExtPack_CXXFLAGS = $(TEMPLATE_VBoxR3Dll_CXXFLAGS) -fno-rtti TEMPLATE_VBoxR3ExtPack_PCHFLAGS = $(TEMPLATE_VBoxR3Dll_PCHFLAGS) -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_VBoxR3Dll_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_VBoxR3Dll_LDFLAGS)) endif ifdef VBOX_ONLY_EXTPACKS_USE_IMPLIBS if1of ($(KBUILD_TARGET), win os2) TEMPLATE_VBoxR3ExtPack_LIBS = \ $(PATH_STAGE_LIB)/VBoxRTImp$(VBOX_SUFF_LIB) else TEMPLATE_VBoxR3ExtPack_LIBS = \ $(PATH_STAGE_LIB)/VBoxRTImp$(VBOX_SUFF_DLL) endif else TEMPLATE_VBoxR3ExtPack_LIBS = \ $(LIB_RUNTIME) endif ifeq ($(KBUILD_TARGET),darwin) TEMPLATE_VBoxR3ExtPack_POST_CMDS = $(VBOX_SIGN_EXTPACK_DYLIB_CMDS) endif TEMPLATE_VBoxR3ExtPackApi = For the ring-3 context extension pack modules using the Main API. TEMPLATE_VBoxR3ExtPackApi_EXTENDS = VBoxMainDll TEMPLATE_VBoxR3ExtPackApi_DEFS = $(TEMPLATE_VBoxMainDll_DEFS) VBOX_IN_EXTPACK VBOX_IN_EXTPACK_R3 TEMPLATE_VBoxR3ExtPackApi_INST = $(INST_EXTPACK)YouShallOverrideThis/ ifeq ($(KBUILD_TARGET),linux) TEMPLATE_VBoxR3ExtPackApi_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)', $(TEMPLATE_VBoxMainDll_LDFLAGS)) else if !defined(VBOX_WITH_RUNPATH) && defined(VBOX_WITH_RELATIVE_RUNPATH) TEMPLATE_VBoxR3ExtPackApi_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/../../..' $(filter-out '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)', $(TEMPLATE_VBoxMainDll_LDFLAGS)) endif ifdef VBOX_ONLY_EXTPACKS_USE_IMPLIBS if1of ($(KBUILD_TARGET), win os2) TEMPLATE_VBoxR3ExtPackApi_LIBS = \ $(PATH_STAGE_LIB)/VBoxRTImp$(VBOX_SUFF_LIB) else TEMPLATE_VBoxR3ExtPackApi_LIBS = \ $(PATH_STAGE_LIB)/VBoxRTImp$(VBOX_SUFF_DLL) endif else TEMPLATE_VBoxR3ExtPackApi_LIBS = \ $(LIB_RUNTIME) endif ifeq ($(KBUILD_TARGET),darwin) TEMPLATE_VBoxR3ExtPackApi_POST_CMDS = $(VBOX_SIGN_EXTPACK_DYLIB_CMDS) 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) endif TEMPLATE_VBoxR0ExtPack_LIBS += \ $(VBOX_LIB_SUPR0) 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_VBoxR3ExtPackPuel_DEFS = $(TEMPLATE_VBoxR3ExtPack_DEFS) VBOX_IN_PUEL_EXTPACK TEMPLATE_VBoxR3ExtPackPuel_LD_DEBUG = split TEMPLATE_VBoxR3ExtPackApiPuel = For the ring-3 context modules in the PUEL extension pack. TEMPLATE_VBoxR3ExtPackApiPuel_EXTENDS = VBoxR3ExtPackApi TEMPLATE_VBoxR3ExtPackApiPuel_INST = $(INST_EXTPACK_PUEL)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/ TEMPLATE_VBoxR3ExtPackApiPuel_DEFS = $(TEMPLATE_VBoxR3ExtPackApi_DEFS) VBOX_IN_PUEL_EXTPACK TEMPLATE_VBoxR3ExtPackApiPuel_LD_DEBUG = split TEMPLATE_VBoxR3ExtPackPuelWithOpenSsl = For the ring-3 context modules in the PUEL extension pack using ExtPack OpenSSL. TEMPLATE_VBoxR3ExtPackPuelWithOpenSsl_EXTENDS = VBoxR3ExtPackPuel 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_VBoxR0ExtPackPuel_DEFS = $(TEMPLATE_VBoxR0ExtPack_DEFS) VBOX_IN_PUEL_EXTPACK 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_VBoxRcExtPackPuel_DEFS = $(TEMPLATE_VBoxRcExtPack_DEFS) VBOX_IN_PUEL_EXTPACK 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 # Qt # Qt # if defined(VBOX_WITH_QTGUI) || defined(VBOX_WITH_NLS) # Guess VBOX_WITH_ORACLE_QT ifndef VBOX_WITH_ORACLE_QT ifndef VBOX_OSE if1of ($(KBUILD_TARGET), darwin solaris win) VBOX_WITH_ORACLE_QT := 1 endif endif endif # # Handmade configuration of Qt - very annoying, this needs to # be cleaned up properly later some time (not important now). # # When using a debug QT build set VBOX_QT_DBG:=d in LocalConfig.kmk. # ifeq ($(VBOX_PATH_QT),) ifeq ($(KBUILD_TARGET),darwin) VBOX_PATH_QT := $(lastword $(sort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v5*))) ifeq ($(VBOX_PATH_QT),) ifneq ($(wildcard /Library/Frameworks/QtCore.framework),) # Using the global installation (for OSE). VBOX_PATH_QT ?= /usr VBOX_PATH_QT_FRAMEWORKS ?= /Library/Frameworks endif endif else if1of ($(KBUILD_TARGET), win) VBOX_PATH_QT := $(rsort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v5*)) VBOX_PATH_QT := $(firstword $(filter %-$(tolower $(VBOX_VCC_TOOL_STEM)),$(VBOX_PATH_QT)) \ $(filter-out %-vcc100 %-vcc110 %-vcc120 %-vcc140 %-vcc141 %-vcc142 %-vcc143 %-vcc150, $(VBOX_PATH_QT))) ifdef VBOX_PATH_QT PATH_SDK_QT5 := $(VBOX_PATH_QT) PATH_TOOL_QT5 := $(VBOX_PATH_QT) endif else if1of ($(KBUILD_TARGET), linux solaris) VBOX_PATH_QT ?= $(lastword $(sort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v5*))) ifneq ($(VBOX_PATH_QT),) VBOX_WITH_ORACLE_QT = 1 endif endif endif ifeq ($(VBOX_PATH_QT),) if1of ($(USERNAME), bird) # gentoo (64-bit) VBOX_PATH_QT ?= /usr VBOX_PATH_QT_LIB ?= /usr/lib/qt5 endif endif VBOX_PATH_QT ?= /usr VBOX_PATH_QT_LIB ?= $(VBOX_PATH_QT)/lib if defined(VBOX_WITH_ORACLE_QT) && (!defined(VBOX_WITH_QT6) || "$(KBUILD_TARGET)" != "darwin") VBOX_QT_INFIX := VBox$(VBOX_QT_DBG) endif if "$(VBOX_QT_DBG)" != "" && "$(VBOX_QT_DBG)" != "$(VBOX_VCC_CRT_TYPE)" && "$(KBUILD_TARGET)" == "win" $(warning WARNING! VBOX_QT_DBG (=$(VBOX_QT_DBG)) and VBOX_VCC_CRT_TYPE (=$(VBOX_VCC_CRT_TYPE)) does not match!) $(warning WARNING! This may cause heap troubles in the GUI in places where something is) $(warning WARNING! allocated in the Qt DLLs freed in our code (or vice versa) because they) $(warning WARNING! will be using different allocators. See r156914 for more details.) $(warning WARNING! VBOX_WITH_DEBUG_VCC_CRT=1 in enabled debug CRT.) endif ifeq ($(KBUILD_TARGET),darwin) VBOX_QT_MOD := QtCore QtGui QtWidgets QtPrintSupport ifdef VBOX_WITH_QT6 VBOX_QT_MOD += QtStateMachine QtCore5Compat else VBOX_QT_MOD += QtMacExtras endif ifdef VBOX_GUI_USE_QGL VBOX_QT_MOD += QtOpenGL endif else if1of ($(KBUILD_TARGET), linux freebsd netbsd openbsd solaris win) VBOX_QT_MOD += Qt5Core Qt5Gui Qt5Widgets Qt5PrintSupport $(if $(VBOX_GUI_USE_QGL),Qt5OpenGL,) if1of ($(KBUILD_TARGET), linux freebsd netbsd openbsd solaris) VBOX_QT_MOD += Qt5DBus Qt5Xml Qt5XcbQpa Qt5X11Extras VBOX_QT_PLUGINS = \ plugins/platforms/libqxcb.so \ plugins/platformthemes/libqgtk2.so \ plugins/platformthemes/libqgtk3.so \ plugins/sqldrivers/libqsqlite.so \ plugins/styles/libqgtk2style.so \ plugins/xcbglintegrations/libqxcb-glx-integration.so else ifeq ($(KBUILD_TARGET),win) VBOX_QT_MOD += Qt5WinExtras endif # win endif # linux freebsd netbsd openbsd solaris win ifdef VBOX_WITH_QHELP_VIEWER ifeq ($(KBUILD_TARGET),darwin) VBOX_QT_MOD += QtHelp QtNetwork QtSql else if1of ($(KBUILD_TARGET), linux freebsd netbsd openbsd solaris win) VBOX_QT_MOD += Qt5Help Qt5Network Qt5Sql endif endif VBOX_QT_MOD_NAMES = $(foreach qtmod,$(VBOX_QT_MOD),$(qtmod)$(VBOX_QT_INFIX)) # Hack LD_LIBRARY_PATH for stuff in tools. ifdef VBOX_WITH_ORACLE_QT if1of ($(KBUILD_TARGET), linux solaris) export LD_LIBRARY_PATH := $(VBOX_PATH_QT_LIB):$(LD_LIBRARY_PATH) endif endif # WORKAROUND: # Both files included automatically, 1st include is included from 2nd one, # but moc can't include it due to problem with parsing framework structure, # as a result QT_VERSION can't be calculated and it's not only used in our # GUI but by the moc itself to parse modern signal/slot definitions. # We were hardcoding QT_VERSION for TEMPLATE_VBoxQtGuiExe below for quite # a long, but this have to end. Instead we can pass both includes manually. TOOL_QT5_MOCFLAGS.darwin += --include qconfig.h --include qglobal.h endif # defined(VBOX_WITH_QTGUI) || defined(VBOX_WITH_NLS) ifdef VBOX_WITH_QTGUI # # Template for building Qt GUI executables. # TEMPLATE_VBoxQtGuiExe = VBox Qt GUI Executable ifndef VBOX_WITH_QT6 TEMPLATE_VBoxQtGuiExe_USES := qt5 TEMPLATE_VBoxQtGuiExe_QTTOOL := QT5 TEMPLATE_VBoxQtGuiExe_MOCTOOL := QT5 TEMPLATE_VBoxQtGuiExe_UICTOOL := QT5 TEMPLATE_VBoxQtGuiExe_RCCTOOL := QT5 TEMPLATE_VBoxQtGuiExe_LRCTOOL := QT5 TEMPLATE_VBoxQtGuiExe_SDKS := QT5 else TEMPLATE_VBoxQtGuiExe_USES := qt6 TEMPLATE_VBoxQtGuiExe_QTTOOL := QT6 TEMPLATE_VBoxQtGuiExe_MOCTOOL := QT6 TEMPLATE_VBoxQtGuiExe_UICTOOL := QT6 TEMPLATE_VBoxQtGuiExe_RCCTOOL := QT6 TEMPLATE_VBoxQtGuiExe_LRCTOOL := QT6 TEMPLATE_VBoxQtGuiExe_SDKS := QT6 TEMPLATE_VBoxQtGuiExe_QT_MODULES := Core5Compat endif TEMPLATE_VBoxQtGuiExe_QT_INFIX = $(VBOX_QT_INFIX) TEMPLATE_VBoxQtGuiExe_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT QT_SHARED HAVE_CONFIG_H $(ARCH_BITS_DEFS) TEMPLATE_VBoxQtGuiExe_RCDEFS = $(TEMPLATE_VBoxR3Exe_RCDEFS) ifeq ($(KBUILD_TARGET),win) # Note! Only use VBOX_VCC_CRT_TYPE when it matches VBOX_QT_DBG. TEMPLATE_VBoxQtGuiExe_TOOL = $(VBOX_VCC_TOOL) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" TEMPLATE_VBoxQtGuiExe_SDKS = WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER) endif TEMPLATE_VBoxQtGuiExe_DEFS += \ _WIN32_WINNT=0x0500 UNICODE _UNICODE \ QT_DLL _CRT_SECURE_NO_DEPRECATE \ $(QMAKE_PRL_DEFINES) TEMPLATE_VBoxQtGuiExe_CXXFLAGS = -nologo -Zm200 -MD$(if-expr "$(VBOX_QT_DBG)" == "$(VBOX_VCC_CRT_TYPE)",$(VBOX_VCC_CRT_TYPE),) \ -Zi -EHsc -Zc:wchar_t- $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS) $(VBOX_VCC_std) # -wd4481: nonstandard extension used: override specifier 'override' # -wd4625: 'QRubberBand' : copy constructor could not be generated because a base class copy constructor is inaccessible # -wd4626: 'QRubberBand' : assignment operator could not be generated because a base class assignment operator is inaccessible # -wd4640: qmetatype.h(2210): warning C4640: 'f' : construction of local static object is not thread-safe [too bad] # -wd4350: behavior change: 'int QStringList::indexOf(const QRegExp &,int) const' called instead of 'int QStringList::indexOf(QRegExp &,int) const' # -wd4121: UIActionPool.h(393) : warning C4121: 'UIActionPool::PointerToFunction' : alignment of a member was sensitive to packing # -wd4718: qmap.h(222) : warning C4718: 'QMapNode::destroySubTree' : recursive call has no side effects, deleting # -wd5204: pplwin.h(78): warning C5204: 'Concurrency::details::_DefaultPPLTaskScheduler': class has virtual functions TEMPLATE_VBoxQtGuiExe_CXXFLAGS += $(VBOX_VCC_WARN_ALL) -wd4481 -wd4625 -wd4626 -wd4640 -wd4350 -wd4371 -wd4121 -wd4718 -wd5204 $(VBOX_VCC_WERR) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120" # -wd4619: qvectro.h(305 : warning C4619: #pragma warning : there is no warning number '4345' TEMPLATE_VBoxQtGuiExe_CXXFLAGS += -wd4619 endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" # -wd4774: string(530): warning C4774: '_scprintf' : format string expected in argument 1 is not a string literal # -wd4456: UICommon.cpp(1471): warning C4456: declaration of '_container_' hides previous local declaration [nested foreach] # -wd4458: UISettingsDialogSpecific.cpp(416): warning C4458: declaration of 'data' hides class member # qwidget.h(730): note: see declaration of 'QWidget::data' # -wd4946: qmap.h(213): warning C4946: reinterpret_cast used between related classes: 'QMapNodeBase' and 'QMapNode' TEMPLATE_VBoxQtGuiExe_CXXFLAGS += -wd4774 -wd4456 -wd4458 -wd4946 endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC141" # -wd4866: UIVirtualBoxManager.cpp(221) : warning C4866: compiler may not enforce left-to-right evaluation order for call to 'QStringList::operator<<' # Only with -std=c++17 and later. TEMPLATE_VBoxQtGuiExe_CXXFLAGS += -wd4866 endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC142" # With v16.11.9, not with v16.6.0 4242 # -wd5219: qpoint.h(187): warning C5219: implicit conversion from 'const int' to 'float', possible loss of data # -wd5240: qcolor.h(235): warning C5240: 'nodiscard': attribute is ignored in this syntactic position TEMPLATE_VBoxQtGuiExe_CXXFLAGS += -wd5219 -wd5240 TEMPLATE_VBoxQtGuiExe_CXXFLAGS += /volatileMetadata- # Don't waste space on x86/amd64-on-arm emulation optimizations. endif TEMPLATE_VBoxQtGuiExe_CXXFLAGS += -Gy if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120" TEMPLATE_VBoxQtGuiExe_CXXFLAGS += -Gw endif ifdef VBOX_WITH_MSC_ANALYZE_THIS TEMPLATE_VBoxQtGuiExe_CXXFLAGS += /analyze endif TEMPLATE_VBoxQtGuiExe_CXXFLAGS.debug = -RTCsu TEMPLATE_VBoxQtGuiExe_CXXFLAGS.debug = -RTCsu TEMPLATE_VBoxQtGuiExe_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxQtGuiExe_PCHFLAGS = $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS) TEMPLATE_VBoxQtGuiExe_PCHFLAGS.debug = $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS.debug) TEMPLATE_VBoxQtGuiExe_PCHFLAGS.dbgopt = $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS.dbgopt) TEMPLATE_VBoxQtGuiExe_LDFLAGS = -Ignore:4197 \ /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug /Opt:Ref /Opt:Icf \ $(VBOX_VCC_LD_GUARD_CF) $(VBOX_VCC_SANITIZER_LDFLAGS) \ /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_VBoxQtGuiExe_LDFLAGS += -IntegrityCheck endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC142" # Don't waste space on x86/amd64-on-arm emulation optimizations. TEMPLATE_VBoxQtGuiExe_LDFLAGS += -EmitVolatileMetadata:NO endif TEMPLATE_VBoxQtGuiExe_LDFLAGS.win.amd64 = $(VBOX_VCC_LD_HIGH_ENTRYOPY_VA) TEMPLATE_VBoxQtGuiExe_SDKS += $(VBOX_WINPSDK) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" TEMPLATE_VBoxQtGuiExe_LIBS = \ $(VBOX_LIBS_QT) \ $(LIB_RUNTIME) \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/vcruntime$(if-expr "$(VBOX_QT_DBG)" == "$(VBOX_VCC_CRT_TYPE)",$(VBOX_VCC_CRT_TYPE),).lib \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt$(if-expr "$(VBOX_QT_DBG)" == "$(VBOX_VCC_CRT_TYPE)",$(VBOX_VCC_CRT_TYPE),).lib \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt$(if-expr "$(VBOX_QT_DBG)" == "$(VBOX_VCC_CRT_TYPE)",$(VBOX_VCC_CRT_TYPE),).lib \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib ifeq ($(KBUILD_TYPE),asan) TEMPLATE_VBoxQtGuiExe_LIBS += \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/clang_rt.asan_dynamic-x86_64.lib \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib endif else TEMPLATE_VBoxQtGuiExe_LIBS = \ $(VBOX_LIBS_QT) \ $(LIB_RUNTIME) \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt$(if-expr "$(VBOX_QT_DBG)" == "$(VBOX_VCC_CRT_TYPE)",$(VBOX_VCC_CRT_TYPE),).lib \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt$(if-expr "$(VBOX_QT_DBG)" == "$(VBOX_VCC_CRT_TYPE)",$(VBOX_VCC_CRT_TYPE),).lib \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib endif TEMPLATE_VBoxQtGuiExe_POST_CMDS = $(VBOX_UTF8_MANIFEST_CMDS)$(NLTAB)$(VBOX_SIGN_IMAGE_CMDS) TEMPLATE_VBoxQtGuiExe_ORDERDEPS = $(VBOX_SIGN_IMAGE_CMDS_ORDERDEPS) else # the gcc guys: TEMPLATE_VBoxQtGuiExe_TOOL = $(VBOX_GCC_TOOL) if $(VBOX_GCC_VERSION_CC) < 30400 TEMPLATE_VBoxQtGuiExe_DEFS += RT_WITHOUT_PRAGMA_ONCE endif TEMPLATE_VBoxQtGuiExe_DEFS.linux = _REENTRANT TEMPLATE_VBoxQtGuiExe_DEFS.solaris = _REENTRANT ## @todo Use VBOX_GCC_PEDANTIC_CXX? TEMPLATE_VBoxQtGuiExe_CXXFLAGS = \ -g $(VBOX_GCC_pipe) $(filter-out -Wno-unused $(VBOX_GCC_Wno-unused-parameter),$(VBOX_GCC_WARN)) -frtti -fno-exceptions \ -Wno-long-long -fshort-wchar -fno-strict-aliasing \ $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_Wno-multistatement-macros) $(VBOX_GCC_Wno-ignored-qualifiers) \ $(VBOX_GCC_Wno-return-type-c-linkage) $(VBOX_GCC_std) $(VBOX_GCC_IPRT_FMT_CHECK) $(VBOX_GCC_SANITIZER_FLAGS) ifdef VBOX_WITH_NO_GCC_WARNING_POLICY TEMPLATE_VBoxQtGuiExe_CXXFLAGS += $(VBOX_GCC_WERR) endif ifn1of ($(USERNAME), dsen serkan) # Bunch of stuff deprecated after 5.6.*. These guys knows how to deal with it. :) TEMPLATE_VBoxQtGuiExe_CXXFLAGS += $(VBOX_GCC_Wno-deprecated-declarations) endif ifdef VBOX_WITH_QT6 TEMPLATE_VBoxQtGuiExe_CXXFLAGS += -std=gnu++17 endif TEMPLATE_VBoxQtGuiExe_CXXFLAGS.x86 = -m32 TEMPLATE_VBoxQtGuiExe_CXXFLAGS.amd64 = -m64 TEMPLATE_VBoxQtGuiExe_CXXFLAGS.linux = -pthread TEMPLATE_VBoxQtGuiExe_PCHFLAGS = $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS) TEMPLATE_VBoxQtGuiExe_PCHFLAGS.x86 = $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS.x86) TEMPLATE_VBoxQtGuiExe_PCHFLAGS.amd64 = $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS.amd64) TEMPLATE_VBoxQtGuiExe_PCHFLAGS.linux = $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS.linux) TEMPLATE_VBoxQtGuiExe_PCHFLAGS.debug = $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS.debug) TEMPLATE_VBoxQtGuiExe_PCHFLAGS.dbgopt = $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS.dbgopt) TEMPLATE_VBoxQtGuiExe_OBJCFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_C) -fno-exceptions $(VBOX_GCC_IPRT_FMT_CHECK) TEMPLATE_VBoxQtGuiExe_OBJCFLAGS.x86 = $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS.x86) TEMPLATE_VBoxQtGuiExe_OBJCFLAGS.amd64 = $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS.amd64) TEMPLATE_VBoxQtGuiExe_OBJCXXFLAGS = \ -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_CXX) \ -frtti -fno-exceptions $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_IPRT_FMT_CHECK) ifdef VBOX_WITH_NO_GCC_WARNING_POLICY TEMPLATE_VBoxQtGuiExe_OBJCXXFLAGS += $(VBOX_GCC_WERR) endif ifdef VBOX_WITH_QT6 TEMPLATE_VBoxQtGuiExe_OBJCXXFLAGS += -std=gnu++17 endif TEMPLATE_VBoxQtGuiExe_OBJCXXFLAGS.x86 = $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS.x86) TEMPLATE_VBoxQtGuiExe_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS.amd64) TEMPLATE_VBoxQtGuiExe_LDFLAGS = $(VBOX_GCC_SANITIZER_FLAGS) $(VBOX_GCC_SANITIZER_LDFLAGS) TEMPLATE_VBoxQtGuiExe_LDFLAGS.x86 = -m32 TEMPLATE_VBoxQtGuiExe_LDFLAGS.amd64 = -m64 TEMPLATE_VBoxQtGuiExe_LIBS = \ $(VBOX_LIBS_QT) \ $(LIB_RUNTIME) ifeq ($(KBUILD_TARGET),linux) TEMPLATE_VBoxQtGuiExe_LDFLAGS += -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed) TEMPLATE_VBoxQtGuiExe_LIBS += \ $(VBOX_XCURSOR_LIBS) \ Xext \ X11 TEMPLATE_VBoxQtGuiExe_LIBPATH += \ $(VBOX_LIBPATH_X11) else ifeq ($(KBUILD_TARGET),darwin) TEMPLATE_VBoxQtGuiExe_SDKS.darwin += $(VBOX_DARWIN_DEF_SDK_SDKS) TEMPLATE_VBoxQtGuiExe_DEFS.darwin += $(VBOX_DARWIN_DEF_SDK_DEFS) TEMPLATE_VBoxQtGuiExe_CFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CFLAGS) TEMPLATE_VBoxQtGuiExe_CXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) TEMPLATE_VBoxQtGuiExe_PCHFLAGS.darwin += $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS.darwin) TEMPLATE_VBoxQtGuiExe_OBJCFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS) ifdef VBOX_WITH_QT6 TEMPLATE_VBoxQtGuiExe_OBJCXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS) else TEMPLATE_VBoxQtGuiExe_OBJCXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS) $(VBOX_GCC_std) endif TEMPLATE_VBoxQtGuiExe_LDFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -bind_at_load -Wl,-headerpad_max_install_names TEMPLATE_VBoxQtGuiExe_LIBS += TEMPLATE_VBoxQtGuiExe_LIBPATH += TEMPLATE_VBoxQtGuiExe_POST_CMDS.darwin = $(VBOX_SIGN_IMAGE_CMDS) else TEMPLATE_VBoxQtGuiExe_INCS += \ $(VBOX_XCURSOR_INCS) TEMPLATE_VBoxQtGuiExe_LIBS += \ $(VBOX_XCURSOR_LIBS) \ Xext \ X11 \ m \ $(LIB_PTHREAD) TEMPLATE_VBoxQtGuiExe_LIBPATH += \ $(VBOX_LIBPATH_X11) ifeq ($(KBUILD_TARGET),freebsd) TEMPLATE_VBoxQtGuiExe_INCS += \ /usr/include \ /usr/X11R6/include \ /usr/local/include TEMPLATE_VBoxQtGuiExe_LIBPATH += \ /usr/lib \ /usr/X11R6/lib \ /usr/local/lib endif ifeq ($(KBUILD_TARGET),solaris) TEMPLATE_VBoxQtGuiExe_LDFLAGS.solaris = -Wl,-z,ignore # Same as VBOX_LD_as_needed. TEMPLATE_VBoxQtGuiExe_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_VBoxQtGuiExe_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' else ifdef VBOX_WITH_RELATIVE_RUNPATH TEMPLATE_VBoxQtGuiExe_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)' endif endif # Add COM/XPCOM stuff TEMPLATE_VBoxQtGuiExe_LIBS += \ $(PATH_STAGE_LIB)/VBoxCOM$(if-expr "$(VBOX_QT_DBG)" != "$(VBOX_VCC_CRT_TYPE)" && $(KBUILD_TARGET) == win,-GUI,)$(VBOX_SUFF_LIB) ifdef VBOX_WITH_XPCOM ## @todo may be worth creating the VBOX_XPCOM SDK def, or just a SDK_VBOXXPCOM. TEMPLATE_VBoxQtGuiExe_DEFS += VBOX_WITH_XPCOM ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP TEMPLATE_VBoxQtGuiExe_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP endif TEMPLATE_VBoxQtGuiExe_INCS += \ $(VBOX_XPCOM_INCS) TEMPLATE_VBoxQtGuiExe_LIBS += \ $(LIB_XPCOM) TEMPLATE_VBoxQtGuiExe_INTERMEDIATES += \ $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h else # COM TEMPLATE_VBoxQtGuiExe_INCS += \ $(VBOX_PATH_SDK)/bindings/mscom/include TEMPLATE_VBoxQtGuiExe_INTERMEDIATES += \ $(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h endif # COM ifn1of ($(KBUILD_TARGET), darwin os2 win) TEMPLATE_VBoxQtGuiExe_DEFS += PIC TEMPLATE_VBoxQtGuiExe_CFLAGS += -fPIC TEMPLATE_VBoxQtGuiExe_CXXFLAGS += -fPIC # Needed for GCC 9. Even system's Qt 5.12.4 (on Ubuntu 19.10) did not have this fixed yet. TEMPLATE_VBoxQtGuiExe_CXXFLAGS.linux = $(VBOX_GCC_Wno-deprecated-copy) $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS) TEMPLATE_VBoxQtGuiExe_LDFLAGS += -fPIC endif # not darwin, os2 or win ifeq ($(KBUILD_TARGET),darwin) ifndef VBOX_WITH_QT6 TEMPLATE_VBoxQtGuiExe_POST_CMDS = $(QUIET)install_name_tool $(foreach qtmod, $(VBOX_QT_MOD_NAMES), \ $(foreach prefix, @executable_path/../Frameworks/ $(VBOX_PATH_QT)/Frameworks/ $(PATH_SDK_QT5)/, \ -change "$(prefix)$(qtmod).framework/Versions/5/$(qtmod)" \ "$(if $(VBOX_WITH_HARDENING),/Applications/VirtualBox.app/Contents/Frameworks,@rpath)/$(qtmod).framework/Versions/5/$(qtmod)" ) ) "$(out)" else TEMPLATE_VBoxQtGuiExe_POST_CMDS = $(QUIET)install_name_tool $(foreach qtmod, $(VBOX_QT_MOD_NAMES), \ $(foreach prefix, @executable_path/../Frameworks/ $(VBOX_PATH_QT)/Frameworks/ $(PATH_SDK_QT6)/, \ -change "$(prefix)$(qtmod).framework/Versions/A/$(qtmod)" \ "$(if $(VBOX_WITH_HARDENING),/Applications/VirtualBox.app/Contents/Frameworks,@rpath)/$(qtmod).framework/Versions/A/$(qtmod)" ) ) "$(out)" endif endif # # Template for building Qt GUI components. # TEMPLATE_VBoxQtGuiDll = VBox Qt GUI Components TEMPLATE_VBoxQtGuiDll_EXTENDS = VBoxQtGuiExe TEMPLATE_VBoxQtGuiDll_LIBS = $(filter-out $(QTMAIN),$(TEMPLATE_VBoxQtGuiExe_LIBS)) ifeq ($(KBUILD_TARGET),darwin) TEMPLATE_VBoxQtGuiDll_LDFLAGS.darwin += $(filter-out -bind_at_load,$(TEMPLATE_VBoxQtGuiExe_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_VBoxQtGuiDll_DEFS = PIC $(TEMPLATE_VBoxQtGuiExe_DEFS) TEMPLATE_VBoxQtGuiDll_CFLAGS = -fPIC $(TEMPLATE_VBoxQtGuiExe_CFLAGS) TEMPLATE_VBoxQtGuiDll_CXXFLAGS = -fPIC $(TEMPLATE_VBoxQtGuiExe_CXXFLAGS) TEMPLATE_VBoxQtGuiDll_PCHFLAGS = $(TEMPLATE_VBoxQtGuiDll_CXXFLAGS) TEMPLATE_VBoxQtGuiDll_LDFLAGS = -fPIC $(TEMPLATE_VBoxQtGuiExe_LDFLAGS) endif endif # VBOX_WITH_QTGUI ifdef VBOX_WITH_NLS # # Template for translation compilation. # Made as simple program without installing itself. # To archive it, the dummy code without runtime is used, # i.e. only compiler and system standard libs are linked. # TEMPLATE_VBoxNLS = VBox NLS template for installing translation files TEMPLATE_VBoxNLS_EXTENDS = VBoxR3Static ifndef VBOX_WITH_QT6 TEMPLATE_VBoxNLS_USES := qt5 TEMPLATE_VBoxNLS_QTTOOL := QT5 else TEMPLATE_VBoxNLS_USES := qt6 TEMPLATE_VBoxNLS_QTTOOL := QT6 endif TEMPLATE_VBoxNLS_QT_INFIX = $(VBOX_QT_INFIX) TEMPLATE_VBoxNLS_INSTTYPE = none TEMPLATE_VBoxNLS_LRCFLAGS += -silent TEMPLATE_VBoxNLS_QT_TRANSLATIONS_INST = $(INST_BIN)nls/ TEMPLATE_VBoxNLS_SOURCES = \ $(PATH_ROOT)/src/VBox/Main/nls/dummy.c TEMPLATE_VBoxNLS_SDKS.$(KBUILD_TARGET_ARCH) = $(filter-out VBoxOpenSslStatic,$(TEMPLATE_VBoxR3Static_SDKS.$(KBUILD_TARGET_ARCH))) ifdef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxNLS_LIBS.$(KBUILD_TARGET_ARCH) = $(filter-out \ $(PATH_STAGE_LIB)/VBox-libxml2-static$(VBOX_SUFF_LIB), \ $(TEMPLATE_VBoxR3Static_LIBS.$(KBUILD_TARGET_ARCH))) else TEMPLATE_VBoxNLS_LIBS.$(KBUILD_TARGET_ARCH) = $(filter-out \ $(VBOX_LIB_RUNTIME_STATIC) \ $(PATH_STAGE_LIB)/VBox-libxml2-static$(VBOX_SUFF_LIB), \ $(TEMPLATE_VBoxR3Static_LIBS.$(KBUILD_TARGET_ARCH))) endif endif # !VBOX_WITH_NLS # # 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 IN_BLD_PROG 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.arm32 := $(VBOX_ASFLAGS32) TEMPLATE_VBoxBldProg_ASFLAGS.sparc32 := $(VBOX_ASFLAGS32) TEMPLATE_VBoxBldProg_ASFLAGS.amd64 := $(VBOX_ASFLAGS64) TEMPLATE_VBoxBldProg_ASFLAGS.arm64 := $(VBOX_ASFLAGS64) TEMPLATE_VBoxBldProg_ASFLAGS.sparc64 := $(VBOX_ASFLAGS64) else if1of ($(KBUILD_TARGET_ARCH), amd64 x86) TEMPLATE_VBoxBldProg_ASTOOL := YASM TEMPLATE_VBoxBldProg_ASFLAGS := -D__YASM__ -Worphan-labels $(VBOX_YASM_Wno-segreg-in-64bit) 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 endif ifeq ($(KBUILD_HOST),win) TEMPLATE_VBoxBldProg_TOOL := $(VBOX_VCC_TOOL_STEM)$(toupper $(KBUILD_HOST_ARCH)) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" TEMPLATE_VBoxBldProg_SDKS := ReorderCompilerIncs WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER)-STATIC $(VBOX_WINPSDK) else TEMPLATE_VBoxBldProg_SDKS := ReorderCompilerIncs $(VBOX_WINPSDK) endif TEMPLATE_VBoxBldProg_CXXFLAGS := -Zi -Zl -GR- -EHsc -GF -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP) \ -MT$(VBOX_VCC_CRT_TYPE) -Gy $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_std) $(VBOX_VCC_WARN_ALL) $(VBOX_VCC_WERR) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120" TEMPLATE_VBoxBldProg_CXXFLAGS += -Gw endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC142" # Don't waste space on x86/amd64-on-arm emulation optimizations. TEMPLATE_VBoxBldProg_CXXFLAGS += /volatileMetadata- endif ifdef VBOX_WITH_MSC_ANALYZE_THIS TEMPLATE_VBoxBldProg_CXXFLAGS += /analyze endif TEMPLATE_VBoxBldProg_CXXFLAGS.debug := -RTCsu TEMPLATE_VBoxBldProg_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxBldProg_CXXFLAGS.profile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.release) TEMPLATE_VBoxBldProg_CXXFLAGS.kprofile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.release) TEMPLATE_VBoxBldProg_CFLAGS = $(filter-out $(VBOX_VCC_std),$(TEMPLATE_VBoxBldProg_CXXFLAGS)) TEMPLATE_VBoxBldProg_CFLAGS.debug = $(TEMPLATE_VBoxBldProg_CXXFLAGS.debug) TEMPLATE_VBoxBldProg_CFLAGS.dbgopt = $(TEMPLATE_VBoxBldProg_CXXFLAGS.dbgopt) TEMPLATE_VBoxBldProg_CFLAGS.release = $(TEMPLATE_VBoxBldProg_CXXFLAGS.release) TEMPLATE_VBoxBldProg_CFLAGS.profile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.profile) TEMPLATE_VBoxBldProg_CFLAGS.kprofile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.kprofile) TEMPLATE_VBoxBldProg_PCHFLAGS = $(TEMPLATE_VBoxBldProg_CXXFLAGS) TEMPLATE_VBoxBldProg_PCHFLAGS.debug = $(TEMPLATE_VBoxBldProg_CXXFLAGS.debug) TEMPLATE_VBoxBldProg_PCHFLAGS.dbgopt = $(TEMPLATE_VBoxBldProg_CXXFLAGS.dbgopt) TEMPLATE_VBoxBldProg_PCHFLAGS.release = $(TEMPLATE_VBoxBldProg_CXXFLAGS.release) TEMPLATE_VBoxBldProg_PCHFLAGS.profile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.profile) TEMPLATE_VBoxBldProg_PCHFLAGS.kprofile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.kprofile) TEMPLATE_VBoxBldProg_LDFLAGS = -Ignore:4197 \ /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug /Opt:Ref /Opt:Icf \ $(VBOX_VCC_LD_GUARD_CF) \ /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 \ /DISALLOWLIB:libvcruntime$(VBOX_VCC_CRT_TYPE_N).lib \ /DISALLOWLIB:libucrt$(VBOX_VCC_CRT_TYPE_N).lib \ /DISALLOWLIB:vcruntime.lib \ /DISALLOWLIB:vcruntimed.lib \ /DISALLOWLIB:ucrt.lib \ /DISALLOWLIB:ucrtd.lib TEMPLATE_VBoxBldProg_LDFLAGS.win.amd64 = $(VBOX_VCC_LD_HIGH_ENTRYOPY_VA) if "$(VBOX_VCC_TOOL_STEM)" >= "VCC142" # Don't waste space on x86/amd64-on-arm emulation optimizations. TEMPLATE_VBoxBldProg_LDFLAGS += -EmitVolatileMetadata:NO endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" TEMPLATE_VBoxBldProg_LIBS = \ $(PATH_TOOL_$(TEMPLATE_VBoxBldProg_TOOL)_LIB)/libvcruntime$(VBOX_VCC_CRT_TYPE).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 \ $(PATH_TOOL_$(TEMPLATE_VBoxBldProg_TOOL)_LIB)/oldnames.lib else 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 endif else # (gcc of some kind ) TEMPLATE_VBoxBldProg_TOOL = GXX3 if $(VBOX_GCC_VERSION_CC) < 30400 TEMPLATE_VBoxBldProg_DEFS += RT_WITHOUT_PRAGMA_ONCE endif TEMPLATE_VBoxBldProg_CFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) ifdef VBOX_WITH_NO_GCC_WARNING_POLICY TEMPLATE_VBoxBldProg_CFLAGS += $(VBOX_GCC_WERR) endif TEMPLATE_VBoxBldProg_CFLAGS.x86 = -m32 TEMPLATE_VBoxBldProg_CFLAGS.sparc32 = -m32 TEMPLATE_VBoxBldProg_CFLAGS.amd64 = -m64 TEMPLATE_VBoxBldProg_CFLAGS.sparc64 = -m64 TEMPLATE_VBoxBldProg_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing TEMPLATE_VBoxBldProg_CFLAGS.profile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.profile) TEMPLATE_VBoxBldProg_CFLAGS.kprofile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.kprofile) TEMPLATE_VBoxBldProg_CXXFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_std) ifdef VBOX_WITH_NO_GCC_WARNING_POLICY TEMPLATE_VBoxBldProg_CXXFLAGS += $(VBOX_GCC_WERR) endif TEMPLATE_VBoxBldProg_CXXFLAGS.x86 = -m32 TEMPLATE_VBoxBldProg_CXXFLAGS.sparc32 = -m32 TEMPLATE_VBoxBldProg_CXXFLAGS.amd64 = -m64 TEMPLATE_VBoxBldProg_CXXFLAGS.sparc64 = -m64 TEMPLATE_VBoxBldProg_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing TEMPLATE_VBoxBldProg_CXXFLAGS.profile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.release) TEMPLATE_VBoxBldProg_CXXFLAGS.kprofile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.release) TEMPLATE_VBoxBldProg_OBJCFLAGS = $(TEMPLATE_VBoxBldProg_CFLAGS) TEMPLATE_VBoxBldProg_OBJCFLAGS.x86 = $(TEMPLATE_VBoxBldProg_CFLAGS.x86) TEMPLATE_VBoxBldProg_OBJCFLAGS.amd64 = $(TEMPLATE_VBoxBldProg_CFLAGS.amd64) TEMPLATE_VBoxBldProg_OBJCFLAGS.release = $(TEMPLATE_VBoxBldProg_CFLAGS.release) TEMPLATE_VBoxBldProg_OBJCFLAGS.profile = $(TEMPLATE_VBoxBldProg_CFLAGS.profile) TEMPLATE_VBoxBldProg_OBJCFLAGS.kprofile = $(TEMPLATE_VBoxBldProg_CFLAGS.kprofile) TEMPLATE_VBoxBldProg_OBJCXXFLAGS = $(TEMPLATE_VBoxBldProg_CXXFLAGS) TEMPLATE_VBoxBldProg_OBJCXXFLAGS.x86 = $(TEMPLATE_VBoxBldProg_CXXFLAGS.x86) TEMPLATE_VBoxBldProg_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBoxBldProg_CXXFLAGS.amd64) TEMPLATE_VBoxBldProg_OBJCXXFLAGS.release = $(TEMPLATE_VBoxBldProg_CXXFLAGS.release) TEMPLATE_VBoxBldProg_OBJCXXFLAGS.profile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.profile) TEMPLATE_VBoxBldProg_OBJCXXFLAGS.kprofile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.kprofile) TEMPLATE_VBoxBldProg_PCHFLAGS = $(TEMPLATE_VBoxBldProg_CXXFLAGS) TEMPLATE_VBoxBldProg_PCHFLAGS.x86 = $(TEMPLATE_VBoxBldProg_CXXFLAGS.x86) TEMPLATE_VBoxBldProg_PCHFLAGS.amd64 = $(TEMPLATE_VBoxBldProg_CXXFLAGS.amd64) TEMPLATE_VBoxBldProg_PCHFLAGS.release = $(TEMPLATE_VBoxBldProg_CXXFLAGS.release) TEMPLATE_VBoxBldProg_PCHFLAGS.profile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.profile) TEMPLATE_VBoxBldProg_PCHFLAGS.kprofile = $(TEMPLATE_VBoxBldProg_CXXFLAGS.kprofile) TEMPLATE_VBoxBldProg_LDFLAGS.x86 = -m32 TEMPLATE_VBoxBldProg_LDFLAGS.sparc32 = -m32 TEMPLATE_VBoxBldProg_LDFLAGS.amd64 = -m64 TEMPLATE_VBoxBldProg_LDFLAGS.sparc64 = -m64 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 = $(VBOX_GCC_TOOL) 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_PCHFLAGS.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_PCHFLAGS.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_PCHFLAGS.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_SDKS.darwin = $(VBOX_DARWIN_DEF_SDK_SDKS) 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_PCHFLAGS.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 += \ /boot/common/lib else if1of ($(KBUILD_HOST), freebsd openbsd) TEMPLATE_VBoxBldProg_TOOL = $(VBOX_GCC_TOOL) TEMPLATE_VBoxBldProg_LIBS = pthread TEMPLATE_VBoxBldProg_INCS += \ /usr/include \ /usr/X11R6/include \ /usr/local/include TEMPLATE_VBoxBldProg_LIBPATH += \ /usr/lib \ /usr/X11R6/lib \ /usr/local/lib else ifeq ($(KBUILD_HOST),netbsd) TEMPLATE_VBoxBldProg_TOOL = GXX3 TEMPLATE_VBoxBldProg_LIBS = pthread TEMPLATE_VBoxBldProg_INCS += \ /usr/include \ /usr/X11R7/include TEMPLATE_VBoxBldProg_LIBPATH += \ /usr/lib \ /usr/X11R7/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) VBoxNtDll TEMPLATE_VBoxAdvBldProg_DEFS = $(TEMPLATE_VBoxBldProg_DEFS) IN_RT_R3 IN_ADV_BLD_PROG ifeq ($(KBUILD_HOST),win) TEMPLATE_VBoxAdvBldProg_CFLAGS = $(TEMPLATE_VBoxBldProg_CFLAGS) $(VBOX_VCC_WERR) TEMPLATE_VBoxAdvBldProg_CXXFLAGS = $(TEMPLATE_VBoxBldProg_CXXFLAGS) $(VBOX_VCC_WERR) TEMPLATE_VBoxAdvBldProg_PCHFLAGS = $(TEMPLATE_VBoxAdvBldProg_CXXFLAGS) endif TEMPLATE_VBoxAdvBldProg_LDFLAGS.darwin.arm64 = \ $(TEMPLATE_VBoxBldProg_LDFLAGS.darwin.arm64) -framework IOKit TEMPLATE_VBoxAdvBldProg_LIBS = \ $(PATH_STAGE_LIB)/RuntimeBldProg$(VBOX_HOSTSUFF_LIB) \ $(TEMPLATE_VBoxBldProg_LIBS) TEMPLATE_VBoxAdvBldProg_LIBS.darwin = \ $(TEMPLATE_VBoxAdvBldProg_LIBS) \ iconv \ $(TEMPLATE_VBoxBldProg_LIBS.darwin) TEMPLATE_VBoxAdvBldProg_LIBS.freebsd = \ $(TEMPLATE_VBoxAdvBldProg_LIBS) \ iconv \ rt \ $(TEMPLATE_VBoxBldProg_LIBS.freebsd) TEMPLATE_VBoxAdvBldProg_LIBS.linux = \ $(TEMPLATE_VBoxAdvBldProg_LIBS) \ $(TEMPLATE_VBoxBldProg_LIBS.linux) TEMPLATE_VBoxAdvBldProg_LIBS.solaris = \ $(TEMPLATE_VBoxAdvBldProg_LIBS) \ contract \ kstat \ rt \ socket \ nsl \ $(TEMPLATE_VBoxBldProg_LIBS.solaris) # # 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 # # Base template for building R3 programs for the guest additions. # Do _note_ use directly! # ## @todo bake it into VBoxGuestR3Exe. TEMPLATE_VBoxGuestR3ExeBase = VBox Guest Program ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxGuestR3ExeBase_EXTENDS = VBoxR3StaticBase if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" ifdef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxGuestR3ExeBase_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK_GST) VBoxNtDll else TEMPLATE_VBoxGuestR3ExeBase_SDKS = ReorderCompilerIncs WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER)-STATIC $(VBOX_WINPSDK_GST) VBoxNtDll endif else TEMPLATE_VBoxGuestR3ExeBase_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK_GST) VBoxNtDll endif # Hack for running on NT3x, NT4, W2K and XP w/o SP: # 1. Change OS and subsystem version in the image. # 2. NT 3.1 requires the IAT to be writable. To avoid making all of .rdata # writable we use the undocumented -NoOptIData option to prevent .idata$* # from being merged into .rdata. # 3. NT 3.1 doesn't support merging initialized and uninitialized section # because it doesn't recognize Misc.VirtualSize. So, we set the uncached # flag (!K) on the .bss section make it incompatible with .data. # VBOX_PE_SET_VERSION will clear the !K flag. (Not needed in no-CRT mode, # as the init code zeros uninitialized data there when running on NT 3.1.) # Similarly, for XP64 and 64-bit W2K3 we need to make sure the subsystem version # in the binaries are set to 5.2. The Visual C++ 2019 linker defaults to 6.0. # HACK ALERT! Double expansion of $$(NLTAB). TEMPLATE_VBoxGuestR3ExeBase_USES.win = $(TEMPLATE_VBoxR3StaticBase_USES.win) vboximportchecker TEMPLATE_VBoxGuestR3ExeBase_VBOX_IMPORT_CHECKER.win.x86 = nt31 TEMPLATE_VBoxGuestR3ExeBase_VBOX_IMPORT_CHECKER.win.amd64 = xp64 TEMPLATE_VBoxGuestR3ExeBase_POST_CMDS.win.x86 = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION) $(out)$$(NLTAB)$(TEMPLATE_$(TEMPLATE_VBoxGuestR3ExeBase_EXTENDS)_POST_CMDS)) TEMPLATE_VBoxGuestR3ExeBase_LNK_DEPS.win.x86 = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION)) TEMPLATE_VBoxGuestR3ExeBase_POST_CMDS.win.amd64 = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION) $(out)$$(NLTAB)$(TEMPLATE_$(TEMPLATE_VBoxGuestR3ExeBase_EXTENDS)_POST_CMDS)) TEMPLATE_VBoxGuestR3ExeBase_LNK_DEPS.win.amd64 = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION)) ifdef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxGuestR3ExeBase_LDFLAGS.win.x86 = $(TEMPLATE_$(TEMPLATE_VBoxGuestR3ExeBase_EXTENDS)_LDFLAGS.win.x86) -NoOptIData else TEMPLATE_VBoxGuestR3ExeBase_LDFLAGS.win.x86 = -NoOptIData -Section:.bss,RW!K $(TEMPLATE_$(TEMPLATE_VBoxGuestR3ExeBase_EXTENDS)_LDFLAGS.win.x86) endif if defined(VBOX_WITH_MORE_NT4_COMPAT_BINARIES) && "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.x86" TEMPLATE_VBoxGuestR3ExeBase_LIBS.win.x86 = $(NO_SUCH_VARIABLE)# Ditch RuntimeR3VccTricks2 endif else # the gcc guys TEMPLATE_VBoxGuestR3ExeBase_EXTENDS = VBoxR3Exe ifn1of ($(KBUILD_TARGET), darwin) TEMPLATE_VBoxGuestR3ExeBase_TOOL := $(subst GXX,GCC,$(TEMPLATE_$(TEMPLATE_VBoxGuestR3ExeBase_EXTENDS)_TOOL)) endif TEMPLATE_VBoxGuestR3ExeBase_CXXFLAGS = $(TEMPLATE_$(TEMPLATE_VBoxGuestR3ExeBase_EXTENDS)_CXXFLAGS) -fno-exceptions -fno-rtti # Do not inherit sanitizer flags from VBoxR3Exe in guest executables. Deal with them separately. TEMPLATE_VBoxGuestR3ExeBase_CXXFLAGS.debug = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxGuestR3ExeBase_CFLAGS.debug = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxGuestR3ExeBase_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_$(TEMPLATE_VBoxGuestR3ExeBase_EXTENDS)_LDFLAGS.linux)) TEMPLATE_VBoxGuestR3ExeBase_LDFLAGS.debug = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxGuestR3ExeBase_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%,$(TEMPLATE_$(TEMPLATE_VBoxGuestR3ExeBase_EXTENDS)_LDFLAGS)) ifn1of ($(KBUILD_TARGET), darwin os2) # ELF only. Present in gcc 3.2.3 & binutils 2.15, possibly earlier. ifdef VBOX_LD_gc_sections # Older solaris linker versions doesn't grok --gc-sections (e.g. add build box). TEMPLATE_VBoxGuestR3ExeBase_CXXFLAGS += -ffunction-sections -fdata-sections TEMPLATE_VBoxGuestR3ExeBase_CFLAGS += -ffunction-sections -fdata-sections TEMPLATE_VBoxGuestR3ExeBase_LDFLAGS += $(VBOX_LD_gc_sections) endif endif endif TEMPLATE_VBoxGuestR3ExeBase_INST = $(INST_ADDITIONS) TEMPLATE_VBoxGuestR3ExeBase_DEFS := \ $(filter-out $(ARCH_BITS_DEFS) VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R3, $(TEMPLATE_$(TEMPLATE_VBoxGuestR3ExeBase_EXTENDS)_DEFS)) \ IN_GUEST \ IN_GUEST_R3 \ IN_RT_R3 \ IN_RT_STATIC \ $(VBOX_GC_ARCH_BITS_DEFS) \ RT_NEED_NEW_AND_DELETE ifeq ($(KBUILD_TARGET),linux) # As few libs as possible on linux. TEMPLATE_VBoxGuestR3ExeBase_LIBS = pthread rt m dl else if1of ($(KBUILD_TARGET), darwin freebsd openbsd) TEMPLATE_VBoxGuestR3ExeBase_LIBS = $(TEMPLATE_$(TEMPLATE_VBoxGuestR3ExeBase_EXTENDS)_LIBS) iconv else ifeq ($(KBUILD_TARGET),solaris) TEMPLATE_VBoxGuestR3ExeBase_LIBS = $(TEMPLATE_$(TEMPLATE_VBoxGuestR3ExeBase_EXTENDS)_LIBS) nsl endif # Use older versions of APIs which were improved in versions of glibc later # than what we are targetting, and do not use the stack protector, which # needs glibc 2.4 or later. TEMPLATE_VBoxGuestR3ExeBase_CXXFLAGS.linux = \ -include $(PATH_ROOT)/include/iprt/linux/symvers.h \ $(VBOX_GCC_fno-stack-protector) TEMPLATE_VBoxGuestR3ExeBase_CFLAGS.linux = $(TEMPLATE_VBoxGuestR3ExeBase_CXXFLAGS.linux) # The GNU_HASH ELF tag is not supported by older systems. TEMPLATE_VBoxGuestR3ExeBase_LDFLAGS.linux += $(VBOX_LD_hash_style_sysv) # # Template for building normal R3 programs for the guest additions, strict. # TEMPLATE_VBoxGuestR3Exe = VBox Guest Program w/ IPRT and VBGL. TEMPLATE_VBoxGuestR3Exe_EXTENDS = VBoxGuestR3ExeBase ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxGuestR3Exe_CFLAGS = $(TEMPLATE_VBoxGuestR3ExeBase_CFLAGS) $(VBOX_VCC_WERR) TEMPLATE_VBoxGuestR3Exe_CXXFLAGS = $(TEMPLATE_VBoxGuestR3ExeBase_CXXFLAGS) $(VBOX_VCC_WERR) if1of ($(VBOX_VCC_TOOL_STEM), VCC120) # VBoxDrvInst.cpp(520) : warning C4313: 'wprintf' : '%d' in format string conflicts with argument 1 of type 'const TCHAR *' [false positive - buggy compiler?] TEMPLATE_VBoxGuestR3Exe_CXXFLAGS += -wd4313 endif TEMPLATE_VBoxGuestR3Exe_LDFLAGS = $(TEMPLATE_VBoxGuestR3ExeBase_LDFLAGS) $(VBOX_VCC_LD_WERR) ifndef VBOX_WITH_NOCRT_STATIC # Temporary kludge to deal with some link order issues. TEMPLATE_VBoxGuestR3Exe_LDFLAGS.win.x86 = $(TEMPLATE_VBoxGuestR3ExeBase_LDFLAGS.win.x86) -Include:_vcc100_kernel32_fakes_asm endif TEMPLATE_VBoxGuestR3Exe_LIBS.x86 = \ $(VBOX_LIB_IPRT_GUEST_R3_X86) \ $(VBOX_LIB_VBGL_R3_X86) \ $(VBOX_LIB_IPRT_GUEST_R3_X86) \ $(TEMPLATE_VBoxGuestR3ExeBase_LIBS.x86) TEMPLATE_VBoxGuestR3Exe_LIBS.$(KBUILD_TARGET_ARCH) = \ $(VBOX_LIB_IPRT_GUEST_R3) \ $(VBOX_LIB_VBGL_R3) \ $(VBOX_LIB_IPRT_GUEST_R3) \ $(TEMPLATE_VBoxGuestR3ExeBase_LIBS.$(KBUILD_TARGET_ARCH)) else TEMPLATE_VBoxGuestR3Exe_CFLAGS = $(TEMPLATE_VBoxGuestR3ExeBase_CFLAGS) $(VBOX_GCC_WERR) TEMPLATE_VBoxGuestR3Exe_CXXFLAGS = $(TEMPLATE_VBoxGuestR3ExeBase_CXXFLAGS) $(VBOX_GCC_WERR) TEMPLATE_VBoxGuestR3Exe_LIBS = \ $(VBOX_LIB_IPRT_GUEST_R3) \ $(VBOX_LIB_VBGL_R3) \ $(VBOX_LIB_IPRT_GUEST_R3) \ $(TEMPLATE_VBoxGuestR3ExeBase_LIBS) ifeq ($(KBUILD_TARGET),solaris) TEMPLATE_VBoxGuestR3Exe_LIBS += contract endif endif # # Template for building R3 (dynamic) libraries for the guest additions, relaxed. # TEMPLATE_VBoxGuestR3DllNonPedantic := VBox Guest User Dynamic Libraries w/ IPRT and VBGL, non-pedantic. TEMPLATE_VBoxGuestR3DllNonPedantic_EXTENDS := VBoxGuestR3ExeBase ## @todo add a INSTFUN that separates dlls and libs. ifeq ($(KBUILD_TARGET),win) ifeq ($(KBUILD_TYPE),asan) TEMPLATE_VBoxGuestR3DllNonPedantic_LIBS.x86 = $(patsubst %clang_rt.asan-i386.lib, %clang_rt.asan_dll_thunk-i386.lib, $(filter-out %clang_rt.asan_cxx-i386.lib,$(TEMPLATE_VBoxGuestR3ExeBase_LIBS.x86))) TEMPLATE_VBoxGuestR3DllNonPedantic_LIBS.amd64 = $(patsubst %clang_rt.asan-x86_64.lib, %clang_rt.asan_dll_thunk-x86_64.lib, $(filter-out %clang_rt.asan_cxx-x86_64.lib,$(TEMPLATE_VBoxGuestR3ExeBase_LIBS.amd64))) endif else ifn1of ($(KBUILD_TARGET), darwin os2 win) TEMPLATE_VBoxGuestR3DllNonPedantic_DEFS = $(TEMPLATE_VBoxGuestR3ExeBase_DEFS) PIC TEMPLATE_VBoxGuestR3DllNonPedantic_CFLAGS = $(TEMPLATE_VBoxGuestR3ExeBase_CFLAGS) -fPIC TEMPLATE_VBoxGuestR3DllNonPedantic_CXXFLAGS = $(TEMPLATE_VBoxGuestR3ExeBase_CXXFLAGS) -fPIC -fno-exceptions TEMPLATE_VBoxGuestR3DllNonPedantic_LDFLAGS = $(TEMPLATE_VBoxGuestR3ExeBase_LDFLAGS) -fPIC endif ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxGuestR3DllNonPedantic_LIBS.x86 = \ $(VBOX_LIB_IPRT_GUEST_R3_SHARED_X86) \ $(VBOX_LIB_VBGL_R3_SHARED_X86) \ $(VBOX_LIB_IPRT_GUEST_R3_SHARED_X86) \ $(TEMPLATE_VBoxGuestR3ExeBase_LIBS.x86) TEMPLATE_VBoxGuestR3DllNonPedantic_LIBS.$(KBUILD_TARGET_ARCH) = \ $(VBOX_LIB_IPRT_GUEST_R3_SHARED) \ $(VBOX_LIB_VBGL_R3_SHARED) \ $(VBOX_LIB_IPRT_GUEST_R3_SHARED) \ $(TEMPLATE_VBoxGuestR3ExeBase_LIBS.$(KBUILD_TARGET_ARCH)) else TEMPLATE_VBoxGuestR3DllNonPedantic_LIBS = \ $(VBOX_LIB_IPRT_GUEST_R3_SHARED) \ $(VBOX_LIB_VBGL_R3_SHARED) \ $(VBOX_LIB_IPRT_GUEST_R3_SHARED) \ $(TEMPLATE_VBoxGuestR3ExeBase_LIBS) endif # # 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 := VBoxGuestR3DllNonPedantic ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxGuestR3Dll_CFLAGS = $(TEMPLATE_VBoxGuestR3DllNonPedantic_CFLAGS) $(VBOX_VCC_WERR) TEMPLATE_VBoxGuestR3Dll_CXXFLAGS = $(TEMPLATE_VBoxGuestR3DllNonPedantic_CXXFLAGS) $(VBOX_VCC_WERR) TEMPLATE_VBoxGuestR3Dll_LDFLAGS = $(TEMPLATE_VBoxGuestR3DllNonPedantic_LDFLAGS) $(VBOX_VCC_LD_WERR) else TEMPLATE_VBoxGuestR3Dll_CFLAGS = $(TEMPLATE_VBoxGuestR3DllNonPedantic_CFLAGS) $(VBOX_GCC_WERR) TEMPLATE_VBoxGuestR3Dll_CXXFLAGS = $(TEMPLATE_VBoxGuestR3DllNonPedantic_CXXFLAGS) $(VBOX_GCC_WERR) endif # # Variant of VBoxGuestR3Dll that requires Windows 2000 or later for x86, and W2K3 for AMD64. # TEMPLATE_VBoxGuestR3DllMinW2K = VBox Guest User Dynamic Libraries w/ IPRT and VBGL. TEMPLATE_VBoxGuestR3DllMinW2K_EXTENDS = VBoxGuestR3Dll TEMPLATE_VBoxGuestR3DllMinW2K_VBOX_IMPORT_CHECKER.win.x86 = w2k ifeq ($(KBUILD_TARGET),win) ifdef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxGuestR3DllMinW2K_LDFLAGS.win.x86 = $(filter-out -NoOptIData,$(TEMPLATE_VBoxGuestR3Dll_LDFLAGS.win.x86)) else TEMPLATE_VBoxGuestR3DllMinW2K_LDFLAGS.win.x86 = $(filter-out -NoOptIData -Section:.bss$(COMMA)RW!K,$(TEMPLATE_VBoxGuestR3Dll_LDFLAGS.win.x86)) endif TEMPLATE_VBoxGuestR3DllMinW2K_POST_CMDS.win.x86 = $(subst $(VBOX_PE_SET_VERSION), $(VBOX_PE_SET_VERSION) --w2k,$(TEMPLATE_VBoxGuestR3Dll_POST_CMDS.win.x86)) endif # # Variant of VBoxGuestR3Dll that requires Windows Vista or later. # TEMPLATE_VBoxGuestR3DllMinVista = VBox Guest User Dynamic Libraries w/ IPRT and VBGL. TEMPLATE_VBoxGuestR3DllMinVista_EXTENDS = VBoxGuestR3Dll TEMPLATE_VBoxGuestR3DllMinVista_VBOX_IMPORT_CHECKER.win.x86 = vista TEMPLATE_VBoxGuestR3DllMinVista_VBOX_IMPORT_CHECKER.win.amd64 = vista ifeq ($(KBUILD_TARGET),win) ifdef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxGuestR3DllMinVista_LDFLAGS.win.x86 = $(filter-out -NoOptIData,$(TEMPLATE_VBoxGuestR3Dll_LDFLAGS.win.x86)) else TEMPLATE_VBoxGuestR3DllMinVista_LDFLAGS.win.x86 = $(filter-out -NoOptIData -Section:.bss$(COMMA)RW!K,$(TEMPLATE_VBoxGuestR3Dll_LDFLAGS.win.x86)) endif TEMPLATE_VBoxGuestR3DllMinVista_POST_CMDS.win.x86 = $(subst $(VBOX_PE_SET_VERSION), $(VBOX_PE_SET_VERSION) --vista,$(TEMPLATE_VBoxGuestR3Dll_POST_CMDS.win.x86)) TEMPLATE_VBoxGuestR3DllMinVista_POST_CMDS.win.amd64 = $(subst $(VBOX_PE_SET_VERSION), $(VBOX_PE_SET_VERSION) --vista,$(TEMPLATE_VBoxGuestR3Dll_POST_CMDS.win.amd64)) endif # # Template for building normal R3 (dynamic) libraries for the guest additions with Visual C++ 2013 or later, strict. # TEMPLATE_NewerVccVBoxGuestR3Dll = VBoxGuestR3DllNonPedantic with the newer Visual C++ version (2013 or later). TEMPLATE_NewerVccVBoxGuestR3Dll_EXTENDS = VBoxGuestR3DllNonPedantic if "$(KBUILD_TARGET)" == "win" && "$(VBOX_NEWER_VCC_TOOL_STEM)" != "$(VBOX_VCC_TOOL_STEM)" TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.x86 = $(VBOX_NEWER_VCC_TOOL_STEM)X86 TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.amd64 = $(VBOX_NEWER_VCC_TOOL_STEM)AMD64 TEMPLATE_NewerVccVBoxGuestR3Dll_CXXFLAGS = \ $(filter-out $(VBOX_VCC_WARN_ALL) $(VBOX_VCC_WERR), $(TEMPLATE_VBoxGuestR3DllNonPedantic_CXXFLAGS)) \ $(VBOX_NEWER_VCC_WARN_ALL) $(VBOX_VCC_WERR) TEMPLATE_NewerVccVBoxGuestR3Dll_CFLAGS = $(TEMPLATE_NewerVccVBoxGuestR3DllNonPedantic_CXXFLAGS) ifndef VBOX_WITH_NOCRT_STATIC # Hack begin # Does not work when building x86 for amd64 build (No rule to make target /oldnames.lib). # TEMPLATE_NewerVccVBoxGuestR3Dll_LIBS.x86 = \ # $(subst $(PATH_TOOL_$(TEMPLATE_VBoxGuestR3DllNonPedantic_TOOL.win.x86)_LIB),$(PATH_TOOL_$(TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.x86)_LIB), $(TEMPLATE_VBoxGuestR3DllNonPedantic_LIBS.x86)) # TEMPLATE_NewerVccVBoxGuestR3Dll_LIBS.amd64 = \ # $(subst $(PATH_TOOL_$(TEMPLATE_VBoxGuestR3DllNonPedantic_TOOL.win.amd64)_LIB),$(PATH_TOOL_$(TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.amd64)_LIB), $(TEMPLATE_VBoxGuestR3DllNonPedantic_LIBS.amd64)) # Directly assign TEMPLATE_NewerVccVBoxGuestR3Dll_LIBS. TEMPLATE_NewerVccVBoxGuestR3Dll_LIBS.x86 = \ $(PATH_TOOL_$(TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.x86)_LIB)/oldnames.lib \ $(PATH_TOOL_$(TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \ $(PATH_TOOL_$(TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib TEMPLATE_NewerVccVBoxGuestR3Dll_LIBS.amd64 = \ $(PATH_TOOL_$(TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.amd64)_LIB)/oldnames.lib \ $(PATH_TOOL_$(TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.amd64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \ $(PATH_TOOL_$(TEMPLATE_NewerVccVBoxGuestR3Dll_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib endif # !VBOX_WITH_NOCRT_STATIC # Hack end endif TEMPLATE_NewerVccVBoxGuestR3Dll_LIBS = \ $(TEMPLATE_VBoxGuestR3ExeBase_LIBS) # # Variant of NewerVccVBoxGuestR3Dll that requires Windows Vista or later. # TEMPLATE_NewerVccVBoxGuestR3DllMinVista = NewerVccVBoxGuestR3Dll with the newer Visual C++ version (2013 or later). TEMPLATE_NewerVccVBoxGuestR3DllMinVista_EXTENDS := NewerVccVBoxGuestR3Dll ifeq ($(KBUILD_TARGET),win) ifdef VBOX_WITH_NOCRT_STATIC TEMPLATE_NewerVccVBoxGuestR3DllMinVista_LDFLAGS.win.x86 = $(filter-out -NoOptIData,$(TEMPLATE_NewerVccVBoxGuestR3Dll_LDFLAGS.win.x86)) else TEMPLATE_NewerVccVBoxGuestR3DllMinVista_LDFLAGS.win.x86 = $(filter-out -NoOptIData -Section:.bss$(COMMA)RW!K,$(TEMPLATE_NewerVccVBoxGuestR3Dll_LDFLAGS.win.x86)) endif TEMPLATE_NewerVccVBoxGuestR3DllMinVista_POST_CMDS.win.x86 = $(subst $(VBOX_PE_SET_VERSION), $(VBOX_PE_SET_VERSION) --vista,$(TEMPLATE_NewerVccVBoxGuestR3Dll_POST_CMDS.win.x86)) TEMPLATE_NewerVccVBoxGuestR3DllMinVista_POST_CMDS.win.amd64 = $(subst $(VBOX_PE_SET_VERSION), $(VBOX_PE_SET_VERSION) --vista,$(TEMPLATE_NewerVccVBoxGuestR3Dll_POST_CMDS.win.amd64)) endif # # 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 := VBoxGuestR3ExeBase TEMPLATE_VBoxGuestR3Lib_EXTENDS_BY := appending TEMPLATE_VBoxGuestR3Lib_INST = $(INST_ADDITIONS_LIB) ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxGuestR3Lib_CFLAGS += $(VBOX_VCC_WERR) TEMPLATE_VBoxGuestR3Lib_CXXFLAGS += $(VBOX_VCC_WERR) TEMPLATE_VBoxGuestR3Lib_LDFLAGS += $(VBOX_VCC_LD_WERR) else TEMPLATE_VBoxGuestR3Lib_CFLAGS += $(VBOX_GCC_WERR) TEMPLATE_VBoxGuestR3Lib_CXXFLAGS += $(VBOX_GCC_WERR) endif # # Guest version of VBoxR3StaticNoCrtExe. # TEMPLATE_VBoxGuestR3NoCrtExe := ... TEMPLATE_VBoxGuestR3NoCrtExe_EXTENDS := VBoxGuestR3Exe TEMPLATE_VBoxGuestR3NoCrtExe_SDKS = $(subst WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER)-STATIC,WINSDK10-UCRT-INCS, $(TEMPLATE_VBoxGuestR3Exe_SDKS)) TEMPLATE_VBoxGuestR3NoCrtExe_SDKS.$(KBUILD_TARGET_ARCH) = $(filter-out VBoxOpenSslStatic,$(TEMPLATE_VBoxGuestR3Exe_SDKS.$(KBUILD_TARGET_ARCH))) TEMPLATE_VBoxGuestR3NoCrtExe_DEFS = $(TEMPLATE_VBoxGuestR3Exe_DEFS) \ RT_NO_CRT \ IN_RT_STATIC ifndef VBOX_WITH_NOCRT_STATIC TEMPLATE_VBoxGuestR3NoCrtExe_DEFS.win = $(TEMPLATE_VBoxGuestR3Exe_DEFS.win) \ RT_WITHOUT_NOCRT_WRAPPERS endif TEMPLATE_VBoxGuestR3NoCrtExe_LIBS = \ $(PATH_STAGE_LIB)/RuntimeR3NoCrt$(VBOX_SUFF_LIB) ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBoxGuestR3NoCrtExe_LIBS.x86 = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxGuestR3NoCrtExe_LIBS.amd64 = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxGuestR3NoCrtExe_LIBS.win = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxGuestR3NoCrtExe_LIBS.win.x86 = \ $(PATH_TOOL_$(TEMPLATE_VBoxGuestR3NoCrtExe_TOOL.win.x86)_LIB)/chkstk.obj TEMPLATE_VBoxGuestR3NoCrtExe_LDFLAGS = $(filter-out $(VBOX_VCC_LD_GUARD_CF) $(VBOX_VCC_SANITIZER_LDFLAGS), $(TEMPLATE_VBoxGuestR3Exe_LDFLAGS)) TEMPLATE_VBoxGuestR3NoCrtExe_LDFLAGS.win.x86 = $(filter-out -Include%, $(TEMPLATE_VBoxGuestR3Exe_LDFLAGS.win.x86)) TEMPLATE_VBoxGuestR3NoCrtExe_LDFLAGS.win = $(TEMPLATE_VBoxGuestR3Exe_LDFLAGS.win) /entry:CustomMainEntrypoint /subsystem:console TEMPLATE_VBoxGuestR3NoCrtExe_CFLAGS = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxGuestR3Exe_CFLAGS)) /GS- -EHs- TEMPLATE_VBoxGuestR3NoCrtExe_CXXFLAGS = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxGuestR3Exe_CXXFLAGS)) /GS- -EHs- TEMPLATE_VBoxGuestR3NoCrtExe_PCHFLAGS = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxGuestR3Exe_PCHFLAGS)) /GS- -EHs- TEMPLATE_VBoxGuestR3NoCrtExe_CXXFLAGS.debug = $(filter-out /RTC% -RTC%, $(TEMPLATE_VBoxGuestR3Exe_CXXFLAGS.debug)) else TEMPLATE_VBoxGuestR3NoCrtExe_CXXFLAGS = $(TEMPLATE_VBoxGuestR3Exe_CXXFLAGS) -fno-exceptions TEMPLATE_VBoxGuestR3NoCrtExe_PCHFLAGS = $(TEMPLATE_VBoxGuestR3Exe_PCHFLAGS) -fno-exceptions endif # # Template for XFree86 guest modules (relocatable module, i.e. sysmod). # This mostly about zapping the VBoxR3Exe linker flags and libraries. # TEMPLATE_VBoxGuestR3XFree86Mod := VBox XFree86 Guest Module TEMPLATE_VBoxGuestR3XFree86Mod_EXTENDS := VBoxGuestR3ExeBase TEMPLATE_VBoxGuestR3XFree86Mod_SYSSUFF := .o TEMPLATE_VBoxGuestR3XFree86Mod_DEFS = $(TEMPLATE_VBoxGuestR3ExeBase_DEFS) VBOX_GUESTR3XF86MOD RTMEM_NO_WRAP_TO_EF_APIS TEMPLATE_VBoxGuestR3XFree86Mod_CFLAGS = $(filter-out $(VBOX_GCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxGuestR3ExeBase_CFLAGS)) \ -fno-pie -fno-merge-constants -std=c99 -ffreestanding TEMPLATE_VBoxGuestR3XFree86Mod_CXXFLAGS = $(filter-out $(VBOX_GCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxGuestR3ExeBase_CXXFLAGS)) \ -fno-pie -fno-merge-constants -ffreestanding TEMPLATE_VBoxGuestR3XFree86Mod_CFLAGS.linux = $(VBOX_GCC_fno-stack-protector) # Remove symvers.h TEMPLATE_VBoxGuestR3XFree86Mod_CXXFLAGS.linux = $(VBOX_GCC_fno-stack-protector) # Remove symvers.h TEMPLATE_VBoxGuestR3XFree86Mod_LDFLAGS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE) # The GNU_HASH ELF tag is not supported by older glibc dynamic linkers. TEMPLATE_VBoxGuestR3XFree86Mod_LDFLAGS.linux = $(subst -Wl$(COMMA),,$(VBOX_LD_hash_style_sysv)) TEMPLATE_VBoxGuestR3XFree86Mod_LDFLAGS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxGuestR3XFree86Mod_LDFLAGS := -r if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd) # the gnu ld guys. TEMPLATE_VBoxGuestR3XFree86Mod_LDFLAGS.release := -S TEMPLATE_VBoxGuestR3XFree86Mod_LDFLAGS.x86 := -m elf_i386 TEMPLATE_VBoxGuestR3XFree86Mod_LDFLAGS.amd64 := -m elf_x86_64 endif TEMPLATE_VBoxGuestR3XFree86Mod_LIBS = $(VBOX_LIB_VBGL_R3_XFREE86) TEMPLATE_VBoxGuestR3XFree86Mod_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxGuestR3XFree86Mod_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE) # # Template for XFree86 guest libraries. # TEMPLATE_VBoxGuestR3XFree86Lib := VBox XFree86 Guest Library TEMPLATE_VBoxGuestR3XFree86Lib_EXTENDS := VBoxGuestR3XFree86Mod TEMPLATE_VBoxGuestR3XFree86Lib_INST = $(INST_ADDITIONS_LIB) TEMPLATE_VBoxGuestR3XFree86Lib_LIBS = $(INST_ADDITIONS_LIB) # # Template for X.Org guest modules (shared libs). # This mostly about zapping unnecessary LIBS from VBoxGuestR3DllNonPedantic and adding some flags. # TEMPLATE_VBoxGuestR3XOrgMod := VBox X.Org Guest Module TEMPLATE_VBoxGuestR3XOrgMod_EXTENDS := VBoxGuestR3DllNonPedantic TEMPLATE_VBoxGuestR3XOrgMod_DEFS = $(TEMPLATE_VBoxGuestR3DllNonPedantic_DEFS) VBOX_GUESTR3XORGMOD RTMEM_NO_WRAP_TO_EF_APIS ifeq ($(KBUILD_TARGET_ARCH),amd64) TEMPLATE_VBoxGuestR3XOrgMod_DEFS += _XSERVER64 endif TEMPLATE_VBoxGuestR3XOrgMod_CFLAGS = $(filter-out $(VBOX_GCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxGuestR3DllNonPedantic_CFLAGS)) -std=c99 TEMPLATE_VBoxGuestR3XOrgMod_CXXFLAGS = $(filter-out $(VBOX_GCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxGuestR3DllNonPedantic_CXXFLAGS)) if1of ($(KBUILD_TARGET), linux) TEMPLATE_VBoxGuestR3XOrgMod_CFLAGS += -Wno-conversion -Wno-unused-parameter endif TEMPLATE_VBoxGuestR3XOrgMod_LDFLAGS = $(filter-out $(VBOX_GCC_SANITIZER_FLAGS) $(VBOX_GCC_SANITIZER_LDFLAGS),$(TEMPLATE_VBoxGuestR3DllNonPedantic_LDFLAGS)) TEMPLATE_VBoxGuestR3XOrgMod_LIBS = $(VBOX_LIB_VBGL_R3_XORG) TEMPLATE_VBoxGuestR3XOrgMod_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxGuestR3XOrgMod_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE) TEMPLATE_VBoxGuestR3XOrgMod_LIBS.freebsd += 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_VBoxGuestR0Drv = VBox Guest Driver TEMPLATE_VBoxGuestR0Drv_EXTENDS = VBoxR0Drv TEMPLATE_VBoxGuestR0Drv_INST = $(INST_ADDITIONS) TEMPLATE_VBoxGuestR0Drv_SDKS.win.x86 = ReorderCompilerIncs $(VBOX_WINDDK_GST) $(VBOX_WINPSDK_GST_INCS) TEMPLATE_VBoxGuestR0Drv_SDKS.win.amd64 = ReorderCompilerIncs $(VBOX_WINDDK_GST) $(VBOX_WINPSDK_GST_INCS) TEMPLATE_VBoxGuestR0Drv_DEFS = $(TEMPLATE_VBoxR0Drv_DEFS) IN_GUEST IN_GUEST_R0 TEMPLATE_VBoxGuestR0Drv_DEFS.linux = RT_NO_EXPORT_SYMBOL ifeq ($(KBUILD_TARGET),solaris) TEMPLATE_VBoxGuestR0Drv_LDFLAGS = -r -dy endif ifn1of ($(KBUILD_TARGET), darwin os2 win) TEMPLATE_VBoxGuestR0Drv_CFLAGS = $(patsubst %/VBox/SUPDrvMangling.h,%/VBox/VBoxGuestMangling.h,$(TEMPLATE_VBoxR0Drv_CFLAGS)) TEMPLATE_VBoxGuestR0Drv_CXXFLAGS = $(patsubst %/VBox/SUPDrvMangling.h,%/VBox/VBoxGuestMangling.h,$(TEMPLATE_VBoxR0Drv_CXXFLAGS)) TEMPLATE_VBoxGuestR0Drv_ASDEFS = $(patsubst RT_MANGLER_PREFIX=%,RT_MANGLER_PREFIX=VBoxGuest_,$(TEMPLATE_VBoxR0Drv_ASDEFS)) endif if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120" # Do not use SSE so the binaries might works on NT4 and earlier. TEMPLATE_VBoxGuestR0Drv_CFLAGS.win.x86 = $(TEMPLATE_VBoxR0Drv_CFLAGS.win.x86) /arch:IA32 TEMPLATE_VBoxGuestR0Drv_CXXFLAGS.win.x86 = $(TEMPLATE_VBoxR0Drv_CXXFLAGS.win.x86) /arch:IA32 endif # # Template for building R0 libraries for the guest additions. # TEMPLATE_VBoxGuestR0DrvLib = VBox Guest Driver Libraries TEMPLATE_VBoxGuestR0DrvLib_EXTENDS = VBoxGuestR0Drv TEMPLATE_VBoxGuestR0DrvLib_INSTTYPE = stage TEMPLATE_VBoxGuestR0DrvLib_INSTTYPE.linux = stage TEMPLATE_VBoxGuestR0DrvLib_INST = $(INST_ADDITIONS_LIB) ifeq ($(KBUILD_TARGET),haiku) TEMPLATE_VBoxGuestR0DrvLib_LDFLAGS = -r -dy endif # # Guest additions libraries (all static). # The _SHARED variants are 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) 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_ARCH),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 !defined(VBOX_BUILD_TAG) && $(length $(VBOX_BUILD_PUBLISHER)) > 10 $(error VBox: VBOX_BUILD_PUBLISHER must not be longer than 10 characters!) else if defined(VBOX_BUILD_TAG) && $(length $(VBOX_BUILD_PUBLISHER)) > 48 $(error VBox: VBOX_BUILD_PUBLISHER must not be longer than 48 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)-$(USERNAME),$(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)' ifneq ($(VBOX_VERSION_PRERELEASE),) $(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_PRERELEASE "$(strip $(VBOX_VERSION_PRERELEASE))"' endif $(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 '' ifdef VBOX_BUILD_SERVER_BUILD $(QUIET)$(APPEND) $@.tmp '#define VBOX_BUILD_SERVER_BUILD 1' else $(QUIET)$(APPEND) $@.tmp '#define VBOX_PRIVATE_BUILD_DESC "Private build by $(USERNAME)"' endif $(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)' ifneq ($(VBOX_VERSION_PRERELEASE),) $(QUIET)$(APPEND) $@.tmp 'VBOX_VERSION_PRERELEASE = $(strip $(VBOX_VERSION_PRERELEASE))' endif $(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)' ifdef VBOX_BUILD_SERVER_BUILD $(QUIET)$(APPEND) $@.tmp 'VBOX_BUILD_SERVER_BUILD = 1' else $(QUIET)$(APPEND) $@.tmp 'VBOX_PRIVATE_BUILD_DESC = Private build by $(USERNAME)' endif $(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 ifeq ($(KBUILD_TARGET),darwin) $(VBOX_DARWIN_ENTITLEMENTS_FILE): $(call MSG_GENERATE,,$@) $(QUIET)$(MKDIR) -p $(@D) $(QUIET)$(RM) -f $@ $@.tmp $(QUIET)$(APPEND) $@.tmp '' $(QUIET)$(APPEND) $@.tmp '' $(QUIET)$(APPEND) $@.tmp '' $(QUIET)$(APPEND) $@.tmp '' $(QUIET)$(APPEND) -n $@.tmp $(foreach entitlement,$(VBOX_DARWIN_ENTITLEMENTS_LIST), ' $(entitlement)') $(QUIET)$(APPEND) $@.tmp '' $(QUIET)$(APPEND) $@.tmp '' $(QUIET)$(MV) -f $@.tmp $@ 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) ifeq ($(KBUILD_TARGET),darwin) Makefile.kmk: | $(VBOX_DARWIN_ENTITLEMENTS_FILE) endif 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 maximum value of Config.kmk and # Version.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_CONFIG_FALLBACK := $(patsubst %:,, $Rev: 99480 $ ) VBOX_SVN_REV_FALLBACK := $(if-expr $(VBOX_SVN_REV_CONFIG_FALLBACK) > $(VBOX_SVN_REV_VERSION_FALLBACK),$(VBOX_SVN_REV_CONFIG_FALLBACK),$(VBOX_SVN_REV_VERSION_FALLBACK)) 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) # Append fallback. Will be ignored if "svn info" provides meaningful data. $(QUIET)$(APPEND) $@.tmp 'Last Changed Rev: $(VBOX_SVN_REV_FALLBACK)' $(SED) -e '/^Last Changed Rev/!d' -e 's/Last Changed Rev\: */export VBOX_SVN_REV=/; t a; :a q' --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 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 # # 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 # Java compiler options, needs some version checking. if defined(VBOX_JAVA_VERSION) && $(VBOX_JAVA_VERSION) >= 110000 VBOX_JAVA_WS_PATH ?= /usr/share/java VBOX_JAVA_WS_EXTRA_JARS ?= $(VBOX_JAVA_WS_PATH)/jws-api.jar$(VBOX_SEP)$(VBOX_JAVA_WS_PATH)/jaxb-api.jar$(VBOX_SEP)$(VBOX_JAVA_WS_PATH)/jaxws-api.jar else if defined(VBOX_JAVA_VERSION) && $(VBOX_JAVA_VERSION) >= 10900 VBOX_JAVA_WS_OPTS ?= --add-modules java.xml.ws endif if defined(VBOX_JAVA_VERSION) && $(VBOX_JAVA_VERSION) >= 110000 VBOX_JAVAC_OPTS = -encoding UTF-8 -source 9 -target 9 -Xlint:unchecked else if defined(VBOX_JAVA_VERSION) && $(VBOX_JAVA_VERSION) >= 90000 VBOX_JAVAC_OPTS = -encoding UTF-8 -source 6 -target 6 -Xlint:unchecked else VBOX_JAVAC_OPTS = -encoding UTF-8 -source 1.5 -target 1.5 -Xlint:unchecked endif VBOX_JAVADOC_OPTS = -encoding UTF-8 # # Legacy. # ## @todo try remove this. ifneq ($(LOCALCFG),) include $(LOCALCFG) endif # # For efficiently build serveral build types / archs. # both-debug-release both-release-debug: \ build-release-$(KBUILD_TARGET_ARCH) \ build-debug-$(KBUILD_TARGET_ARCH) both-x86-amd64 both-amd64-x86: \ build-$(KBUILD_TYPE)-x86 \ build-$(KBUILD_TYPE)-x86 both-types-archs both-archs-types: \ build-debug-x86 \ build-release-x86 \ build-debug-amd64 \ build-release-amd64 build-release-x86: +$(MAKE) KBUILD_TYPE=release KBUILD_TARGET_ARCH=x86 build-debug-x86: +$(MAKE) KBUILD_TYPE=debug KBUILD_TARGET_ARCH=x86 build-release-amd64: +$(MAKE) KBUILD_TYPE=release KBUILD_TARGET_ARCH=amd64 build-debug-amd64: +$(MAKE) KBUILD_TYPE=debug KBUILD_TARGET_ARCH=amd64 # # Some extra goals. # .PHONY: up update st stat status up update:: $(SVN) up up2 update2:: $(SVN) up --ignore-externals st stat status: $(SVN) status