VirtualBox

source: vbox/trunk/Config.kmk@ 60987

Last change on this file since 60987 was 60987, checked in by vboxsync, 9 years ago

Config.kmk: The Qt5 GUI requires OS X 10.9 build host for our normal setup (OSE may differ, more on that later some time). Keep the Qt4 option going as long as we can for those of us with old OS X gear.

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette