VirtualBox

source: vbox/trunk/Config.kmk@ 72180

Last change on this file since 72180 was 72152, checked in by vboxsync, 7 years ago

Additions/x11/VBoxClient: clean up the Make file and remove unneeded defines.

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