VirtualBox

source: vbox/trunk/Config.kmk@ 81305

Last change on this file since 81305 was 81270, checked in by vboxsync, 5 years ago

Shared Clipboard/Transfers: Enabled by default on Windows guests/hosts now (experimental).

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