VirtualBox

source: vbox/trunk/Config.kmk@ 37840

Last change on this file since 37840 was 37781, checked in by vboxsync, 13 years ago

PCI passthrough fixes

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