VirtualBox

source: vbox/trunk/Config.kmk@ 38231

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

*.kmk: OpenSSL symbol mangling.

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