VirtualBox

source: vbox/trunk/Config.kmk@ 37016

Last change on this file since 37016 was 37016, checked in by vboxsync, 14 years ago

Added VBOX_VERSION_STRING_RAW to only handle/store the pure VBox version without any suffixes. Fixes bug #8844.

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