VirtualBox

source: vbox/trunk/Config.kmk@ 42287

Last change on this file since 42287 was 42287, checked in by vboxsync, 12 years ago

USE not WITH. duh2.

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