VirtualBox

source: vbox/trunk/Config.kmk@ 46390

Last change on this file since 46390 was 46390, checked in by vboxsync, 11 years ago

s/XGCCAMD64LINUXGNU/VBoxXGccAmd64LinuxGnu/g s/XGCCX86REDHATLINUX/VBoxXGccX86RedHatLinux/g, adding the two tools files to tools/kBuildTools/ instead of kBuild/tools since these are rather VBox specific and better kept here.

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