VirtualBox

source: vbox/trunk/Config.kmk@ 60974

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

New Xcode fix.

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