VirtualBox

source: vbox/trunk/Config.kmk@ 57358

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

*: scm cleanup run.

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