VirtualBox

source: vbox/trunk/Config.kmk@ 38213

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

Config.kmk: Windows burn fix. Require kBuild revision 2520.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 201.1 KB
Line 
1# $Id: Config.kmk 38184 2011-07-26 13:28: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_BLD_OPENSSL = .
2448SDK_VBOX_BLD_OPENSSL_EXTENDS = VBOX_OPENSSL
2449SDK_VBOX_BLD_OPENSSL_LIBS ?= \
2450 $(PATH_STAGE_LIB)/VBoxBldProg-libcrypto$(VBOX_SUFF_LIB)
2451
2452ifdef VBOX_WITH_S3
2453VBOX_WITH_LIBCURL = 1
2454SDK_VBOX_LIBCURL = .
2455SDK_VBOX_LIBCURL_INCS ?= $(PATH_ROOT)/src/libs/curl-7.19.4/include
2456SDK_VBOX_LIBCURL_LIBS ?= $(PATH_STAGE_LIB)/VBox-libcurl$(VBOX_SUFF_LIB)
2457SDK_VBOX_LIBCURL_DEFS ?= BUILDING_LIBCURL
2458endif
2459
2460SDK_VBOX_FFMPEG = .
2461if1of ($(KBUILD_TARGET), darwin linux os2 solaris win)
2462 SDK_VBOX_FFMPEG_INCS ?= \
2463 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavutil \
2464 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavcodec \
2465 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavformat
2466 ifeq ($(KBUILD_TARGET),win)
2467 ## @todo Michael! Where is $(PATH_STAGE_LIB)/VBoxFFmpegImp$(VBOX_SUFF_LIB) supposed to come from?
2468 #SDK_VBOX_FFMPEG_LIBS ?= $(PATH_STAGE_LIB)/VBoxFFmpeg.a
2469 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_STAGE_LIB)/VBoxFFmpegImp.lib
2470 else
2471 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_STAGE_BIN)/VBoxFFmpeg$(SUFF_DLL)
2472 endif
2473else
2474 SDK_VBOX_FFMPEG_INCS ?= /usr/include/ffmpeg /usr/include/libpng
2475 SDK_VBOX_FFMPEG_LIBS ?= avutil avcodec avformat
2476endif
2477
2478SDK_VBOX_BOOST = .
2479SDK_VBOX_BOOST_DEFS ?= BOOST_DISABLE_ASSERTS
2480SDK_VBOX_BOOST_INCS ?= $(PATH_ROOT)/src/libs/boost-1.37.0
2481
2482#
2483# Special SDK for the problematic NTDLL.LIB.
2484#
2485SDK_VBOX_NTDLL = Mini NTDLL import library, required IPRT.
2486SDK_VBOX_NTDLL_LIBS.x86 ?= $(PATH_STAGE_LIB)/RuntimeR3NtDll-x86.lib
2487SDK_VBOX_NTDLL_LIBS.amd64 ?= $(PATH_STAGE_LIB)/RuntimeR3NtDll-amd64.lib
2488
2489#
2490# The linux kernel headers(/sources).
2491#
2492if1of ($(KBUILD_TARGET), linux)
2493 ifeq ($(origin VBOX_LINUX_SRC),undefined)
2494 ifneq ($(wildcard /lib/modules/$(shell uname -r)/build/include/linux/autoconf.h /lib/modules/$(shell uname -r)/build/include/generated/autoconf.h),)
2495 export VBOX_LINUX_SRC := /lib/modules/$(shell uname -r)/build
2496 else
2497 export VBOX_LINUX_SRC := /usr/src/linux
2498 endif
2499 endif
2500 ifneq ($(VBOX_LINUX_SRC),)
2501 ifeq ($(origin VBOX_LINUX_INCS),undefined)
2502 export VBOX_LINUX_INCS := $(VBOX_LINUX_SRC)/include
2503 # XXX hack alert! support splitted Linux kernels (make O=<build directory>)
2504 # XXX put this crap elsewhere
2505 kernelpath := $(shell $(SED_EXT) -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(VBOX_LINUX_SRC)/Makefile)
2506 ifeq ($(kernelpath),)
2507 # Linux >= 2.6.25
2508 kernelpath := $(shell $(SED_EXT) -ne 's+^MAKEARGS *:= *-C *\(\S*\).*+\1+p' $(VBOX_LINUX_SRC)/Makefile)
2509 endif
2510 ifneq ($(kernelpath),)
2511 # absolute path?
2512 ifneq ($(patsubst /%,,$(kernelpath)),)
2513 # no, relative path
2514 kernelpath := $(realpath $(VBOX_LINUX_SRC)/$(kernelpath))
2515 endif
2516 endif
2517 ifneq ($(kernelpath),)
2518 VBOX_LINUX_INCS += $(VBOX_LINUX_SRC)/include2 $(kernelpath)/include
2519 else
2520 kernelpath := $(VBOX_LINUX_SRC)
2521 endif
2522 VBOX_LINUX_INCS += $(kernelpath)/include/asm-i386/mach-default \
2523 $(kernelpath)/include/asm-x86/mach-default \
2524 $(kernelpath)/arch/x86/include \
2525 $(kernelpath)/arch/x86/include/asm/mach-default \
2526 $(kernelpath)/include
2527 endif
2528 endif
2529 # Since Linux 2.6.15, <linux/autoconf.h> is included like this. It cannot hurt to do the
2530 # same for older Linux kernels
2531 ifneq ($(wildcard $(VBOX_LINUX_SRC)/include/generated/autoconf.h),)
2532 # Linux >= 2.6.33
2533 export VBOX_LINUX_INCLUDE := -include $(VBOX_LINUX_SRC)/include/generated/autoconf.h
2534 else ifneq ($(wildcard $(VBOX_LINUX_SRC)/include/linux/autoconf.h),)
2535 # Linux < 2.6.33
2536 export VBOX_LINUX_INCLUDE := -include $(VBOX_LINUX_SRC)/include/linux/autoconf.h
2537 endif
2538endif
2539
2540#
2541# Determine Solaris version.
2542#
2543ifeq ($(KBUILD_TARGET),solaris)
2544 ifeq ($(origin VBOX_SOLARIS_VERSION),undefined)
2545 $(eval export VBOX_SOLARIS_VERSION := $(shell uname -r | $(SED_EXT) 's|\([0-9]*\)\.\([0-9]*\)|$$(int-add $$(int-mul 100, \1), \2)|' ))
2546 endif
2547 ifeq ($(VBOX_SOLARIS_VERSION),510)
2548 DEFS.solaris += RT_OS_SOLARIS_10
2549 # Solaris 10 does not include crossbow.
2550 VBOX_WITH_CROSSBOW =
2551 VBOX_SOLARIS_10 = 1
2552 # We cannot compile additions on Solaris 10, due kernel interface deps
2553 VBOX_WITHOUT_ADDITIONS := 1
2554 VBOX_WITH_ADDITIONS =
2555 else
2556 ## @todo r=bird: Why eval, and why export? Actually, since this isn't used anywhere, why not
2557 # VBOX_WITH_SOLARIS_OSS := $(if-expr $(shell uname -v | cut -f2 -d'_')) >= 115,1,)
2558 $(eval export VBOX_SOLARIS_SNV_VERSION := $(shell uname -v | cut -f2 -d'_'))
2559
2560 # OSS audio support for Solaris
2561 VBOX_WITH_SOLARIS_OSS := $(if-expr $(VBOX_SOLARIS_SNV_VERSION) >= 115,1,)
2562 endif
2563endif
2564
2565ifdef VBOX_WITH_RAW_MODE
2566 #
2567 # Template for building RC things.
2568 #
2569 TEMPLATE_VBoxRc = VBox Raw-Mode Context
2570 TEMPLATE_VBoxRc_ASTOOL = $(VBOX_ASTOOL)
2571 TEMPLATE_VBoxRc_ASFLAGS = $(VBOX_ASFLAGS32)
2572 TEMPLATE_VBoxRc_DEFS = IN_RC IPRT_NO_CRT RT_WITH_NOCRT_ALIASES $(ARCH_BITS_DEFS)
2573 TEMPLATE_VBoxRc_INCS = $(PATH_ROOT)/include/iprt/nocrt
2574 TEMPLATE_VBoxRc_SYSSUFF = .gc
2575 TEMPLATE_VBoxRc_BLD_TRG_ARCH = x86
2576 TEMPLATE_VBoxRc_MODE = a+r,u+w
2577
2578 ifeq ($(VBOX_LDR_FMT32),pe)
2579 ifndef VBOX_USE_VCC70
2580 TEMPLATE_VBoxRc_TOOL = $(VBOX_VCC_TOOL_STEM)X86
2581 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)
2582 else
2583 TEMPLATE_VBoxRc_TOOL = VCC70
2584 TEMPLATE_VBoxRc_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -W3 -wd4244 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP) $(VBOX_VCC_WERR)
2585 endif
2586 TEMPLATE_VBoxRc_CFLAGS = $(TEMPLATE_VBoxRc_CXXFLAGS)
2587 TEMPLATE_VBoxRc_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Exports -NoD $(VBOX_VCC_LD_WERR) -Debug
2588 ifdef VBOX_USE_WINDDK
2589 ifndef VBOX_NOINC_MISC
2590 include $(KBUILD_PATH)/sdks/$(VBOX_WINDDK).kmk
2591 endif
2592 TEMPLATE_VBoxRc_LIBS = \
2593 $(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/int64.lib
2594 else
2595 ifndef VBOX_NOINC_MISC
2596 include $(KBUILD_PATH)/sdks/W2K3DDKX86.kmk
2597 endif
2598 TEMPLATE_VBoxRc_LIBS = \
2599 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
2600 endif
2601 TEMPLATE_VBoxRc_LIBS += \
2602 $(PATH_STAGE_LIB)/RuntimeRCStub$(VBOX_SUFF_LIB)
2603 TEMPLATE_VBoxRc_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2604 endif # pe
2605
2606 ifeq ($(VBOX_LDR_FMT32),elf)
2607 TEMPLATE_VBoxRc_TOOL = $(VBOX_GCC32_TOOL)
2608 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
2609 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)
2610 ifeq ($(KBUILD_TARGET),solaris)
2611 TEMPLATE_VBoxRc_LDFLAGS = -r
2612 else
2613 TEMPLATE_VBoxRc_LDFLAGS = -nostdlib -Bsymbolic
2614 # "temporarily", must fix the loader.
2615 TEMPLATE_VBoxRc_LDFLAGS += $(if $(VBOX_DO_STRIP_MODULES),-S,)
2616 TEMPLATE_VBoxRc_LDFLAGS.release = $(if $(VBOX_DO_STRIP_MODULES),-S,)
2617 endif
2618 ifn1of ($(KBUILD_TARGET), solaris freebsd)
2619 TEMPLATE_VBoxRc_LIBS = \
2620 $(VBOX_GCC32_LIBGCC) # instricts
2621 endif
2622 endif
2623
2624 ifeq ($(VBOX_LDR_FMT32),macho)
2625 TEMPLATE_VBoxRc_TOOL = GXX4MACHO
2626 TEMPLATE_VBoxRc_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
2627 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
2628 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
2629 TEMPLATE_VBoxRc_LDFLAGS = $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -m32 -nostdlib
2630 #TEMPLATE_VBoxRc_LDFLAGS.release = -Wl,-S ???
2631 endif
2632
2633 ifeq ($(VBOX_LDR_FMT32),lx)
2634 TEMPLATE_VBoxRc_TOOL = GXX3OMF
2635 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
2636 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
2637 TEMPLATE_VBoxRc_LDFLAGS = -Zdll -nostdlib
2638 TEMPLATE_VBoxRc_LIBS = \
2639 $(VBOX_GCC32_LIBGCC) \
2640 $(VBOX_OBJ_SYS0) \
2641 end
2642 endif
2643
2644
2645 #
2646 # Template for building a RC ring-3 testcase (tstVMStructGC, tstDevStructGC).
2647 #
2648 TEMPLATE_VBoxRcExe = VBox Raw-Mode as ring-3 testcase
2649 TEMPLATE_VBoxRcExe_EXTENDS = VBoxRc
2650 TEMPLATE_VBoxRcExe_DEFS = $(filter-out IPRT_NO_CRT RT_WITH_NOCRT_ALIASES,$(TEMPLATE_VBoxRc_DEFS))
2651 TEMPLATE_VBoxRcExe_INCS = $(NO_SUCH_VARIABLE)
2652 TEMPLATE_VBoxRcExe_MODE = $(NO_SUCH_VARIABLE)
2653
2654 ifeq ($(VBOX_LDR_FMT32),pe)
2655 TEMPLATE_VBoxRcExe_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD -Debug
2656 TEMPLATE_VBoxRcExe_SDKS = WIN32SDK
2657 ifndef VBOX_USE_VCC70
2658 TEMPLATE_VBoxRcExe_LIBS = \
2659 $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_LIB)/libcmt.lib \
2660 $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_LIB)/oldnames.lib
2661 else
2662 TEMPLATE_VBoxRcExe_LIBS = \
2663 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
2664 $(PATH_TOOL_VCC70_LIB)/oldnames.lib
2665 endif
2666 endif
2667
2668 ifeq ($(VBOX_LDR_FMT32),elf)
2669 TEMPLATE_VBoxRcExe_CFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CFLAGS)) -O0
2670 TEMPLATE_VBoxRcExe_CXXFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CXXFLAGS)) -O0
2671 TEMPLATE_VBoxRcExe_LDFLAGS = -g
2672 TEMPLATE_VBoxRcExe_LDFLAGS.dbgopt = -g
2673 TEMPLATE_VBoxRcExe_LDFLAGS.strict = -g
2674 TEMPLATE_VBoxRcExe_LDFLAGS.release = -g
2675 if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), freebsd.amd64)
2676 # The FreeBSD port of gcc isn't picking up -m32 where it should. the .o order below isn't
2677 # quite right (target source comes first), if it stops working we'll have to write a linker tool.
2678 TEMPLATE_VBoxRcExe_DEFS.$(KBUILD_TARGET) = $(TEMPLATE_VBoxRc_DEFS.$(KBUILD_TARGET)) IPRT_DONT_USE_SYSTEM_STDINT_H
2679 TEMPLATE_VBoxRcExe_LDFLAGS.$(KBUILD_TARGET) = $(TEMPLATE_VBoxRc_LDFLAGS.$(KBUILD_TARGET)) -nostdlib -v
2680 TEMPLATE_VBoxRcExe_SOURCES.$(KBUILD_TARGET) = /usr/lib32/crtend.o /usr/lib32/crtn.o
2681 TEMPLATE_VBoxRcExe_SOURCES = /usr/lib32/crt1.o /usr/lib32/crti.o /usr/lib32/crtbegin.o
2682 TEMPLATE_VBoxRcExe_LIBPATH.$(KBUILD_TARGET) = /usr/lib32
2683 TEMPLATE_VBoxRcExe_LIBS.$(KBUILD_TARGET) = /usr/lib32/libc.so
2684 endif
2685 endif
2686
2687 ifeq ($(VBOX_LDR_FMT32),macho)
2688 TEMPLATE_VBoxRcExe_CFLAGS = $(filter-out -static -nostdinc,$(TEMPLATE_VBoxRc_CFLAGS))
2689 TEMPLATE_VBoxRcExe_CXXFLAGS = $(filter-out -static -nostdinc,$(TEMPLATE_VBoxRc_CXXFLAGS))
2690 TEMPLATE_VBoxRcExe_LDFLAGS = -g -m32
2691 endif
2692
2693 ifeq ($(VBOX_LDR_FMT32),lx)
2694 TEMPLATE_VBoxRcExe_CFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CFLAGS))
2695 TEMPLATE_VBoxRcExe_CXXFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CXXFLAGS))
2696 TEMPLATE_VBoxRcExe_LDFLAGS = -g
2697 TEMPLATE_VBoxRcExe_LIBS = $(NO_SUCH_VARIABLE)
2698 endif
2699endif # VBOX_WITH_RAW_MODE
2700
2701
2702#
2703# Template for building R0 things.
2704#
2705TEMPLATE_VBoxR0 = VBox Ring 0
2706TEMPLATE_VBoxR0_ASTOOL = $(VBOX_ASTOOL)
2707TEMPLATE_VBoxR0_ASFLAGS = $(VBOX_ASFLAGS)
2708TEMPLATE_VBoxR0_DEFS = IN_RING0 IN_RING0_AGNOSTIC IPRT_NO_CRT RT_WITH_NOCRT_ALIASES $(ARCH_BITS_DEFS)
2709TEMPLATE_VBoxR0_INCS = $(PATH_ROOT)/include/iprt/nocrt
2710TEMPLATE_VBoxR0_SYSSUFF = .r0
2711TEMPLATE_VBoxR0_MODE = a+r,u+w
2712
2713ifeq ($(VBOX_LDR_FMT),pe)
2714TEMPLATE_VBoxR0_TOOL = $(VBOX_VCC_TOOL)
2715 ifndef VBOX_USE_VCC70
2716TEMPLATE_VBoxR0_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -W3 -wd4244 -GS- -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP) $(VBOX_VCC_WERR)
2717 else
2718TEMPLATE_VBoxR0_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -W3 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP) $(VBOX_VCC_WERR)
2719 endif
2720TEMPLATE_VBoxR0_CFLAGS = $(TEMPLATE_VBoxR0_CXXFLAGS)
2721TEMPLATE_VBoxR0_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:4096 -MapInfo:Exports -NoD $(VBOX_VCC_LD_WERR) -Debug
2722TEMPLATE_VBoxR0_LIBS = \
2723 $(PATH_STAGE_LIB)/RuntimeR0Stub$(VBOX_SUFF_LIB)
2724 ifdef VBOX_USE_WINDDK
2725TEMPLATE_VBoxR0_LIBS.x86 = \
2726 $(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/int64.lib
2727 else
2728TEMPLATE_VBoxR0_LIBS.x86 = \
2729 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
2730 endif
2731TEMPLATE_VBoxR0_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
2732endif # pe
2733
2734ifeq ($(VBOX_LDR_FMT),elf)
2735TEMPLATE_VBoxR0_TOOL = $(VBOX_GCC_TOOL)
2736TEMPLATE_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
2737TEMPLATE_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
2738TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding
2739TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables
2740ifeq ($(KBUILD_TARGET),solaris)
2741 TEMPLATE_VBoxR0_LDFLAGS = -r
2742 TEMPLATE_VBoxR0_LDFLAGS.solaris = -u _init -u _info
2743 TEMPLATE_VBoxR0_LIBS.solaris = \
2744 $(PATH_STAGE_LIB)/RuntimeR0Stub$(VBOX_SUFF_LIB)
2745else
2746 TEMPLATE_VBoxR0_LDFLAGS = -nostdlib -Bsymbolic
2747 # temporarily, must fix the loader.
2748 TEMPLATE_VBoxR0_LDFLAGS += $(if $(VBOX_DO_STRIP_MODULES),-S,)
2749 TEMPLATE_VBoxR0_LDFLAGS.release = $(if $(VBOX_DO_STRIP_MODULES),-S,)
2750endif
2751ifn1of ($(KBUILD_TARGET),solaris freebsd)
2752 TEMPLATE_VBoxR0_LIBS = \
2753 $(VBOX_GCC_LIBGCC) # instricts
2754endif
2755endif
2756
2757ifeq ($(VBOX_LDR_FMT),macho)
2758TEMPLATE_VBoxR0_TOOL = GXX4MACHO
2759TEMPLATE_VBoxR0_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
2760TEMPLATE_VBoxR0_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) \
2761 -fno-common -msoft-float -static -fno-rtti -fno-exceptions $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing \
2762 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_fno-stack-protector)
2763TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mno-sse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -fno-unwind-tables
2764TEMPLATE_VBoxR0_CXXFLAGS.x86 = -m32
2765TEMPLATE_VBoxR0_CFLAGS = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) \
2766 -fno-common -msoft-float -static -fno-exceptions $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing \
2767 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_fno-stack-protector)
2768TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -mno-red-zone -mno-sse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -fno-unwind-tables
2769TEMPLATE_VBoxR0_CFLAGS.x86 = -m32
2770TEMPLATE_VBoxR0_LDFLAGS = $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -nostdlib
2771#TEMPLATE_VBoxR0_LDFLAGS.release = -Wl,-S ???
2772TEMPLATE_VBoxR0_LDFLAGS.amd64 = -m64 -static
2773TEMPLATE_VBoxR0_LDFLAGS.x86 = -m32
2774endif
2775
2776ifeq ($(VBOX_LDR_FMT),lx)
2777TEMPLATE_VBoxR0_TOOL = GXX3OMF
2778TEMPLATE_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
2779TEMPLATE_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
2780TEMPLATE_VBoxR0_LDFLAGS = -nostdlib -Zdll
2781TEMPLATE_VBoxR0_LIBS = \
2782 $(VBOX_GCC_LIBGCC) \
2783 $(VBOX_OBJ_SYS0) \
2784 end
2785endif
2786
2787
2788#
2789# Template for building SUPDRV R0 things.
2790#
2791TEMPLATE_VBOXR0DRV = VBox SUPDRV Ring 0
2792TEMPLATE_VBOXR0DRV_ASTOOL = $(VBOX_ASTOOL)
2793TEMPLATE_VBOXR0DRV_ASFLAGS = $(VBOX_ASFLAGS)
2794TEMPLATE_VBOXR0DRV_DEFS = IN_RING0 IN_RT_R0 $(ARCH_BITS_DEFS)
2795
2796ifeq ($(KBUILD_TARGET),win)
2797 TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_VCC_TOOL)
2798 TEMPLATE_VBOXR0DRV_RCDEFS = \
2799 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
2800 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
2801 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
2802 VBOX_SVN_REV=\"$(VBOX_SVN_REV)\" \
2803 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
2804 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
2805 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD) \
2806 VBOX_SVN_REV_NR=$(VBOX_SVN_REV)
2807 TEMPLATE_VBOXR0DRV_DEFS.x86 = _X86_
2808 TEMPLATE_VBOXR0DRV_DEFS.amd64 = _AMD64_
2809 ifndef VBOX_USE_VCC70
2810 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -Gz -W3 -GS- -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
2811 else
2812 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -Gz -W3 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
2813 endif
2814 TEMPLATE_VBOXR0DRV_CFLAGS = $(TEMPLATE_VBOXR0DRV_CXXFLAGS)
2815 TEMPLATE_VBOXR0DRV_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:4096 -MapInfo:Exports -NoD -Debug
2816 TEMPLATE_VBOXR0DRV_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
2817 ifdef VBOX_USE_VCC100 # HACK ALERT!
2818 TEMPLATE_VBOXR0DRV_CINCS = $(TOOL_$(VBOX_VCC_TOOL)_CINCS)
2819 TEMPLATE_VBOXR0DRV_CXXINCS = $(TOOL_$(VBOX_VCC_TOOL)_CXXINCS)
2820 endif
2821endif
2822
2823ifeq ($(KBUILD_TARGET),linux)
2824TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
2825TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0
2826TEMPLATE_VBOXR0DRV_INCS = $(VBOX_LINUX_INCS)
2827TEMPLATE_VBOXR0DRV_CFLAGS = -nostdinc -iwithprefix include $(VBOX_LINUX_INCLUDE) \
2828 $(VBOX_GCC_WARN) -Wstrict-prototypes $(VBOX_GCC_Wno-pointer-sign) -Wno-sign-compare \
2829 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
2830TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mpreferred-stack-boundary=2 -msoft-float
2831TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
2832 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
2833 -Wno-sign-compare -Wdeclaration-after-statement
2834TEMPLATE_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
2835 ifndef VBOX_LINUX_VERSION_2_4
2836# 2.6
2837TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
2838TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
2839TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
2840 else
2841# 2.4
2842TEMPLATE_VBOXR0DRV_SYSSUFF = .o
2843TEMPLATE_VBOXR0DRV_LDFLAGS = -r -s
2844 endif
2845endif
2846
2847ifeq ($(KBUILD_TARGET),os2)
2848TEMPLATE_VBOXR0DRV_TOOL = GXX3OMF
2849TEMPLATE_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
2850TEMPLATE_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
2851TEMPLATE_VBOXR0DRV_LIBS = $(VBOX_GCC_LIBGCC)
2852# wlink thinks physdevice doesn't need fixups and should have a stack - stupid!
2853TEMPLATE_VBOXR0DRV_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
2854endif
2855
2856ifeq ($(KBUILD_TARGET),darwin)
2857TEMPLATE_VBOXR0DRV_TOOL = GXX4MACHO
2858TEMPLATE_VBOXR0DRV_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS) KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT
2859TEMPLATE_VBOXR0DRV_INCS += $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/Kernel.framework/Headers
2860## @todo try use VBOX_GCC_PEDANTIC_CXX
2861TEMPLATE_VBOXR0DRV_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) \
2862 -g -pipe $(VBOX_GCC_WARN) -Wno-long-long -fno-common -nostdinc -fno-builtin -finline \
2863 -fno-keep-inline-functions -fno-exceptions -msoft-float \
2864 -fapple-kext -fno-rtti -fcheck-new -force_cpusubtype_ALL \
2865 $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fasm-blocks
2866TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = -m64 -mkernel -mno-red-zone -gdwarf-2
2867TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = -m32 -static
2868TEMPLATE_VBOXR0DRV_CFLAGS = $(VBOX_DARWIN_DEF_SDK_CFLAGS) \
2869 -g -pipe $(VBOX_GCC_WARN) -Wno-long-long -fno-common -nostdinc -fno-builtin -finline \
2870 -fno-keep-inline-functions -fno-exceptions -msoft-float \
2871 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations \
2872 -Werror-implicit-function-declaration -force_cpusubtype_ALL \
2873 $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fasm-blocks
2874TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mkernel -mno-red-zone -gdwarf-2
2875TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -static
2876TEMPLATE_VBOXR0DRV_LDFLAGS = $(filter-out $(VBOX_DARWIN_NO_COMPACT_LINKEDIT),$(VBOX_DARWIN_DEF_SDK_LDFLAGS)) -static -nostdlib -r -Wl,-Y,1455 -keep_private_extern
2877TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m64 -Xlinker -kext
2878TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m32
2879TEMPLATE_VBOXR0DRV_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC)
2880endif
2881
2882ifeq ($(KBUILD_TARGET),solaris)
2883## The Solaris /usr/platform/i86pc/include and /usr/include directories.
2884VBOX_SOLARIS_SYS_INCS ?= /usr/platform/i86pc/include /usr/include
2885
2886TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
2887TEMPLATE_VBOXR0DRV_DEFS = _MACHDEP _KERNEL _STRICT_STDC IN_RING0 IN_RT_R0
2888TEMPLATE_VBOXR0DRV_INCS = $(VBOX_SOLARIS_SYS_INCS)
2889TEMPLATE_VBOXR0DRV_LDFLAGS = -r -dy
2890TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -64
2891# Exclude -Wall because of solaris headers' pragma ident warnings that gcc refuses to supress.
2892TEMPLATE_VBOXR0DRV_CFLAGS = -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
2893 -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \
2894 -Wshadow -Wuninitialized -Wunused-function -Wunused-label -Wunused-value -Wunused-variable \
2895 -Wformat -Wimplicit-int -Wimplicit-function-declaration -Werror-implicit-function-declaration -Wparentheses \
2896 -O2 -fno-omit-frame-pointer -ffreestanding -nodefaultlibs -fno-strict-aliasing -fno-common -std=c99
2897TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
2898TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(if $(VBOX_SOLARIS_10),,-msave-args) -mno-red-zone -mcmodel=kernel \
2899 -fno-reorder-blocks -fno-asynchronous-unwind-tables -funit-at-a-time
2900TEMPLATE_VBOXR0DRV_CXXFLAGS = -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
2901 -Wshadow -Wuninitialized -Wunused-function -Wunused-label -Wunused-value -Wunused-variable \
2902 -Wformat \
2903 -O2 -nodefaultlibs -fno-omit-frame-pointer -fno-strict-aliasing -fno-common -fno-exceptions -fno-rtti
2904TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86)
2905TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = $(TEMPLATE_VBOXR0DRV_CFLAGS.amd64)
2906endif # Solaris
2907
2908ifeq ($(KBUILD_TARGET),freebsd)
2909# x86 FreeBSD (6.2 or something):
2910# cc -O2 -fno-strict-aliasing -pipe -Werror -D_KERNEL -DKLD_MODULE \
2911# -nostdinc -I- -I. -I@ -I@/contrib/altq -I@/../include -I/usr/include \
2912# -finline-limit=8000 -fno-common -mno-align-long-strings -mpreferred-stack-boundary=2 \
2913# -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -ffreestanding -Wall -Wredundant-decls -Wnested-externs \
2914# -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions \
2915# -std=c99 -c ../my.c
2916# ld -d -warn-common -r -d -o my.kld my.o
2917# :> export_syms
2918# awk -f /usr/src/sys/modules/my/../../conf/kmod_syms.awk my.kld export_syms | xargs -J% objcopy % my.kld
2919# ld -Bsharable -d warn-commnon -o my.ko my.kld
2920#
2921# AMD64 FreeBSD (7.1):
2922# cc -O2 -fno-strict-aliasing -pipe -D_KERNEL -DKLD_MODULE -std=c99 -nostdinc -I. -I@ -I@/contrib/altq \
2923# -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common \
2924# -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx \
2925# -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -ffreestanding \
2926# -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign \
2927# -fformat-extensions -c /usr/src/sys/modules/my/../../dev/my/if_my.c
2928# ld -d -warn-common -r -d -o if_my.ko if_my.o
2929# :> export_syms
2930# awk -f /usr/src/sys/modules/my/../../conf/kmod_syms.awk if_my.ko export_syms | xargs -J% objcopy % if_my.ko
2931
2932# Note: @ -> /usr/src/sys and machine -> /usr/src/sys/i386/include
2933
2934## The location of the FreeBSD kernel source.
2935VBOX_FREEBSD_SRC ?= /usr/src/sys
2936## The FreeBSD /usr/include.
2937VBOX_FREEBSD_SYS_INCS ?= /usr/include
2938
2939TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
2940TEMPLATE_VBOXR0DRV_LDTOOL = FREEBSDKMODLD
2941TEMPLATE_VBOXR0DRV_DEFS = _KERNEL KLD_MODULE IN_RING0 IN_RT_R0
2942TEMPLATE_VBOXR0DRV_INCS = \
2943 $(VBOX_FREEBSD_SRC) \
2944 $(VBOX_FREEBSD_SRC)/contrib/altq \
2945 $(VBOX_FREEBSD_SRC)/../include \
2946 $(VBOX_FREEBSD_SYS_INCS)
2947# omitting: -Wcast-qual, -Wredundant-decls
2948TEMPLATE_VBOXR0DRV_CFLAGS = \
2949 $(VBOX_GCC_WARN) -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
2950 -Wstrict-prototypes -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \
2951 -Wimplicit-function-declaration -Werror-implicit-function-declaration \
2952 -O2 -fformat-extensions -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
2953 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
2954 -nostdinc -std=c99
2955TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2
2956TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 --param inline-unit-growth=100 --param large-function-growth=1000 \
2957 -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx \
2958 -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -Wundef
2959TEMPLATE_VBOXR0DRV_CXXFLAGS = -fno-exceptions -fno-rtti \
2960 $(VBOX_GCC_WARN) -Wpointer-arith -Winline \
2961 -O2 -fno-format-extensions -fno-strict-aliasing -fno-common -finline-limit=8000 \
2962 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
2963 -nostdinc
2964TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86)
2965TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = $(TEMPLATE_VBOXR0DRV_CFLAGS.amd64)
2966TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
2967TEMPLATE_VBOXR0DRV_LDFLAGS = -d --warn-common
2968TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386_fbsd
2969TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64_fbsd
2970
2971TOOL_FREEBSDKMODLD = FreeBSD kernel module linker.
2972# See kBuild/tools/GCC3.kmk for docs.
2973TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
2974TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
2975TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPORD =
2976 ifeq ($(KBUILD_TARGET_ARCH),amd64)
2977TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT =
2978define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
2979# Link intermediate .kld (a relocatable object).
2980 ld $(flags) -r -o $(out) $(objs) \
2981 $(foreach p,$(libpath), -L$(p))\
2982 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
2983# Strip non-exported symbols private and localize the exported ones.
2984 awk -f $(VBOX_FREEBSD_SRC)/conf/kmod_syms.awk $(out) $(if $(othersrc), $(othersrc),/dev/null) \
2985 | xargs -J% objcopy % $(out)
2986
2987## Strip debug info (comment out if debugging or something).
2988 objcopy --strip-debug $(out)
2989endef
2990 else # x86
2991TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT = $(outbase).kld
2992define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
2993# Link intermediate .kld (a relocatable object).
2994 ld $(flags) -r -o $(outbase).kld $(objs) \
2995 $(foreach p,$(libpath), -L$(p))\
2996 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
2997# Strip non-exported symbols private and localize the exported ones.
2998 awk -f $(VBOX_FREEBSD_SRC)/conf/kmod_syms.awk $(outbase).kld $(if $(othersrc), $(othersrc),/dev/null) \
2999 | xargs -J% objcopy % $(outbase).kld
3000
3001# Link the final .ko (a shared object).
3002 ld $(flags) -Bshareable -o $(out) $(outbase).kld
3003endef
3004 endif # x86
3005
3006endif # FreeBSD
3007
3008ifdef VBOX_WITH_VBOXDRV
3009 ifndef TEMPLATE_VBOXR0DRV_TOOL
3010 $(warning Warning: VBox Build: Target $(KBUILD_HOST) is not officially supported!)
3011 endif
3012endif
3013
3014ifn1of ($(KBUILD_TARGET), darwin os2 win solaris)
3015 # This doesn't work if supdrv is natively loading VMMR0.r0 et al, but
3016 # fortunately it isn't really necessary.
3017 TEMPLATE_VBOXR0DRV_CFLAGS += -include $(PATH_ROOT)/include/VBox/SUPDrvMangling.h
3018 TEMPLATE_VBOXR0DRV_CXXFLAGS += -include $(PATH_ROOT)/include/VBox/SUPDrvMangling.h
3019endif
3020
3021
3022#
3023# Template for building R3 executables and static libraries which are linked into executables.
3024# Note! This is the base template for a whole lot of other ones, so be careful when changing it.
3025#
3026TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
3027TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
3028TEMPLATE_VBOXR3EXE_ASFLAGS.x86 = $(VBOX_ASFLAGS32)
3029TEMPLATE_VBOXR3EXE_ASFLAGS.amd64 = $(VBOX_ASFLAGS64)
3030TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
3031TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
3032ifeq ($(KBUILD_TARGET),win)
3033# TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
3034ifdef VBOX_USE_VCC70
3035 TEMPLATE_VBOXR3EXE_TOOL.win.x86 = $(VBOX_VCC_TOOL)
3036 TEMPLATE_VBOXR3EXE_TOOL.win.amd64 = VCC80AMD64
3037else
3038 TEMPLATE_VBOXR3EXE_TOOL.win.x86 = $(VBOX_VCC_TOOL_STEM)X86
3039 TEMPLATE_VBOXR3EXE_TOOL.win.amd64 = $(VBOX_VCC_TOOL_STEM)AMD64
3040endif
3041 TEMPLATE_VBOXR3EXE_RCDEFS = \
3042 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
3043 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
3044 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
3045 VBOX_SVN_REV=\"$(VBOX_SVN_REV)\" \
3046 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
3047 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
3048 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD) \
3049 VBOX_SVN_REV_NR=$(VBOX_SVN_REV)
3050 TEMPLATE_VBOXR3EXE_SDKS = WINPSDK
3051 ifndef VBOX_USE_VCC70
3052 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)
3053 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
3054 else
3055 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHsc -GF -MD$(VBOX_VCC_CRT_TYPE) -W3 -wd4065 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
3056 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -GZ
3057 endif
3058 TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
3059 TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
3060 TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
3061 TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
3062 TEMPLATE_VBOXR3EXE_LDFLAGS = \
3063 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
3064 /DISALLOWLIB:libc.lib \
3065 /DISALLOWLIB:libcd.lib \
3066 /DISALLOWLIB:libcmt.lib \
3067 /DISALLOWLIB:libcmtd.lib \
3068 /DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE_N).lib \
3069 /DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE_N).lib
3070
3071 TEMPLATE_VBOXR3EXE_LIBS.x86 = \
3072 $(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.x86)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
3073 $(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.x86)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
3074 $(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.x86)_LIB)/oldnames.lib
3075 TEMPLATE_VBOXR3EXE_LIBS.amd64 = \
3076 $(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.amd64)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
3077 $(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.amd64)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
3078 $(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.amd64)_LIB)/oldnames.lib
3079 TEMPLATE_VBOXR3EXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
3080 ifdef VBOX_USE_VCC100 # HACK ALERT!
3081 TEMPLATE_VBOXR3EXE_CINCS.win = $(TOOL_$(VBOX_VCC_TOOL)_CINCS)
3082 TEMPLATE_VBOXR3EXE_CXXINCS.win = $(TOOL_$(VBOX_VCC_TOOL)_CXXINCS)
3083 endif
3084
3085else # the gcc guys
3086TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
3087TEMPLATE_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)
3088TEMPLATE_VBOXR3EXE_CXXFLAGS.x86 = -m32
3089TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64 = -m64
3090TEMPLATE_VBOXR3EXE_CXXFLAGS.sparc32 = -m32
3091TEMPLATE_VBOXR3EXE_CXXFLAGS.sparc64 = -m64
3092# L4 currently can't handle exception handling.
3093TEMPLATE_VBOXR3EXE_CXXFLAGS.l4 = -fno-exceptions -nostdinc \
3094 $(addprefix -I,$(VBOX_PATH_GCC_INCS) $(L4_INCDIR) $(FILE_TOOL_GPP3_INCDIR)) \
3095 $(DEBUG_L4)
3096TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
3097TEMPLATE_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)
3098TEMPLATE_VBOXR3EXE_CFLAGS.x86 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.x86)
3099TEMPLATE_VBOXR3EXE_CFLAGS.amd64 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64)
3100TEMPLATE_VBOXR3EXE_CFLAGS.sparc32 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.sparc32)
3101TEMPLATE_VBOXR3EXE_CFLAGS.sparc64 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.sparc64)
3102TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
3103TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
3104TEMPLATE_VBOXR3EXE_CFLAGS.l4 = -nostdinc \
3105 $(addprefix -I,$(VBOX_PATH_GCC_INCS) $(L4_INCDIR)) $(DEBUG_L4)
3106TEMPLATE_VBOXR3EXE_OBJCFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS)
3107TEMPLATE_VBOXR3EXE_OBJCFLAGS.x86 = $(TEMPLATE_VBOXR3EXE_CFLAGS.x86)
3108TEMPLATE_VBOXR3EXE_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXR3EXE_CFLAGS.amd64)
3109TEMPLATE_VBOXR3EXE_OBJCFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CFLAGS.debug)
3110TEMPLATE_VBOXR3EXE_OBJCFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CFLAGS.kprofile)
3111TEMPLATE_VBOXR3EXE_OBJCXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
3112TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.x86)
3113TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64)
3114TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
3115TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.kprofile= $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
3116TEMPLATE_VBOXR3EXE_DEFS.l4 = L4_THREAD_SAFE
3117TEMPLATE_VBOXR3EXE_LDFLAGS.x86 = -m32
3118TEMPLATE_VBOXR3EXE_LDFLAGS.amd64 = -m64
3119TEMPLATE_VBOXR3EXE_LDFLAGS.sparc32 = -m32
3120TEMPLATE_VBOXR3EXE_LDFLAGS.sparc64 = -m64
3121TEMPLATE_VBOXR3EXE_LDFLAGS.l4 = \
3122 $(L4_LIBDIR)/../crt0.o \
3123 -T$(L4_LIBDIR)/../main_dyn.ld -nostdlib \
3124 -Wl,--export-dynamic,--dynamic-linker=libld-l4.s.so \
3125 -Wl,--rpath-link,$(L4_LIBDIR)
3126TEMPLATE_VBOXR3EXE_LDFLAGS.linux = -Wl,-z,noexecstack $(VBOX_LD_as_needed)
3127 ifeq ($(KBUILD_TARGET),linux)
3128TEMPLATE_VBOXR3EXE_LIBS = pthread m rt dl
3129 else ifeq ($(KBUILD_TARGET),l4)
3130TEMPLATE_VBOXR3EXE_LIBS = \
3131 $(L4_LIBDIR)/libvboxserver.s.so \
3132 $(L4_LIBDIR)/libuc++.0.s.so \
3133 supc++ gcc_eh gcc \
3134 $(L4_LIBDIR)/libdl.s.so \
3135 $(L4_LIBDIR)/libuc.0.s.so
3136 else ifeq ($(KBUILD_TARGET),os2)
3137TEMPLATE_VBOXR3EXE_TOOL = GXX3OMF
3138TEMPLATE_VBOXR3EXE_LIBS = socket iconv
3139 else ifeq ($(KBUILD_TARGET),darwin)
3140TEMPLATE_VBOXR3EXE_TOOL = GXX4MACHO
3141TEMPLATE_VBOXR3EXE_LIBS =
3142TEMPLATE_VBOXR3EXE_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_DEFS)
3143TEMPLATE_VBOXR3EXE_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -fno-common
3144TEMPLATE_VBOXR3EXE_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
3145TEMPLATE_VBOXR3EXE_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
3146TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS)
3147TEMPLATE_VBOXR3EXE_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
3148TEMPLATE_VBOXR3EXE_LDFLAGS.darwin.x86 = -read_only_relocs suppress
3149 else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd)
3150TEMPLATE_VBOXR3EXE_TOOL = GXX3
3151TEMPLATE_VBOXR3EXE_LIBS = pthread
3152TEMPLATE_VBOXR3EXE_INCS += \
3153 /usr/include \
3154 /usr/X11R6/include \
3155 /usr/local/include
3156TEMPLATE_VBOXR3EXE_LIBPATH += \
3157 /usr/lib \
3158 /usr/X11R6/lib \
3159 /usr/local/lib
3160 else ifeq ($(KBUILD_TARGET),solaris)
3161TEMPLATE_VBOXR3EXE_TOOL = GXX3PLAIN
3162TEMPLATE_VBOXR3EXE_DEFS += LIBICONV_PLUG _REENTRANT # Avoid the GNU libiconv, for now at least.
3163TEMPLATE_VBOXR3EXE_LIBS = rt socket
3164 else
3165$(warning Warning: VBOX Build: Target $(KBUILD_TARGET) is not officially supported!)
3166TEMPLATE_VBOXR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.release)
3167TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease)
3168 endif
3169 ifdef VBOX_WITH_RUNPATH
3170 TEMPLATE_VBOXR3EXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
3171 else ifdef VBOX_WITH_RELATIVE_RUNPATH
3172 TEMPLATE_VBOXR3EXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
3173 endif
3174 ifdef VBOX_WITH_ORIGIN
3175 TEMPLATE_VBOXR3EXE_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT)
3176 endif
3177endif
3178
3179#
3180# Template for building R3 shared objects / DLLs.
3181# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
3182# -
3183TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
3184TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
3185TEMPLATE_VBOXR3_LDFLAGS.l4 = $(L4_LIBDIR)/../crt0.s.o -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
3186TEMPLATE_VBOXR3_DEFS.l4 = $(TEMPLATE_VBOXR3EXE_DEFS.l4) __PIC__
3187TEMPLATE_VBOXR3_DEFS.darwin = $(TEMPLATE_VBOXR3EXE_DEFS.darwin) PIC
3188TEMPLATE_VBOXR3_LDFLAGS.darwin = $(TEMPLATE_VBOXR3EXE_LDFLAGS.darwin) \
3189 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
3190 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
3191ifn1of ($(KBUILD_TARGET), darwin win os2)
3192 TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
3193 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
3194 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
3195 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
3196endif
3197
3198#
3199# Temporary: Renaming the template and warnings will be errors (soon).
3200#
3201TEMPLATE_VBoxR3Dll += VBox ring-3 SO/DLLs, no warnings
3202TEMPLATE_VBoxR3Dll_EXTENDS += VBOXR3
3203TEMPLATE_VBoxR3Dll_EXTENDS_BY += appending
3204ifeq ($(KBUILD_TARGET),win)
3205 TEMPLATE_VBoxR3Dll_CFLAGS += $(VBOX_VCC_WERR)
3206 TEMPLATE_VBoxR3Dll_CXXFLAGS += $(VBOX_VCC_WERR)
3207 TEMPLATE_VBoxR3Dll_LDFLAGS += $(VBOX_VCC_LD_WERR)
3208else
3209 TEMPLATE_VBoxR3Dll_CFLAGS += $(VBOX_GCC_WERR)
3210 TEMPLATE_VBoxR3Dll_CXXFLAGS += $(VBOX_GCC_WERR)
3211endif
3212
3213#
3214# Template for building performance critical stuff with warnings-as-errors.
3215# -
3216TEMPLATE_VBoxR3DllNoPic = VBox ring-3 SO/DLLs without PIC, without warnings.
3217TEMPLATE_VBoxR3DllNoPic_EXTENDS = VBOXR3
3218if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), linux.x86 freebsd.x86)
3219 TEMPLATE_VBoxR3DllNoPic_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS)
3220 TEMPLATE_VBoxR3DllNoPic_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) $(VBOX_GCC_WERR)
3221 TEMPLATE_VBoxR3DllNoPic_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) $(VBOX_GCC_WERR)
3222 TEMPLATE_VBoxR3DllNoPic_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS)
3223else ifeq ($(KBUILD_TARGET),win)
3224 TEMPLATE_VBoxR3DllNoPic_CFLAGS = $(TEMPLATE_VBOXR3_CFLAGS) $(VBOX_VCC_WERR)
3225 TEMPLATE_VBoxR3DllNoPic_CXXFLAGS = $(TEMPLATE_VBOXR3_CXXFLAGS) $(VBOX_VCC_WERR)
3226 TEMPLATE_VBoxR3DllNoPic_LDFLAGS = $(TEMPLATE_VBOXR3_LDFLAGS) $(VBOX_VCC_LD_WERR)
3227else
3228 TEMPLATE_VBoxR3DllNoPic_CFLAGS = $(TEMPLATE_VBOXR3_CFLAGS) $(VBOX_GCC_WERR)
3229 TEMPLATE_VBoxR3DllNoPic_CXXFLAGS = $(TEMPLATE_VBOXR3_CXXFLAGS) $(VBOX_GCC_WERR)
3230endif
3231
3232#
3233# Template for building performance critical stuff without warnings-as-errors.
3234# -
3235TEMPLATE_VBoxR3DllWarnNoPic = VBox ring-3 SO/DLLs without PIC, with warnings.
3236TEMPLATE_VBoxR3DllWarnNoPic_EXTENDS = VBOXR3
3237if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), linux.x86 freebsd.x86)
3238 TEMPLATE_VBoxR3DllWarnNoPic_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS)
3239 TEMPLATE_VBoxR3DllWarnNoPic_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS)
3240 TEMPLATE_VBoxR3DllWarnNoPic_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
3241 TEMPLATE_VBoxR3DllWarnNoPic_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS)
3242endif
3243
3244#
3245# Template for building static R3 executables and any static
3246# libraries they link with.
3247#
3248TEMPLATE_VBOXR3STATIC = VBox Static Ring 3 EXE
3249TEMPLATE_VBOXR3STATIC_EXTENDS = VBOXR3EXE
3250ifeq ($(KBUILD_TARGET),win)
3251 TEMPLATE_VBOXR3STATIC_CFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
3252 TEMPLATE_VBOXR3STATIC_CXXFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
3253 TEMPLATE_VBOXR3STATIC_LDFLAGS = $(filter-out /DISALLOWLIB:libcmt$(VBOX_VCC_CRT_TYPE).lib /DISALLOWLIB:libcpmt$(VBOX_VCC_CRT_TYPE).lib, $(TEMPLATE_VBOXR3EXE_LDFLAGS)) \
3254 /DISALLOWLIB:msvcrt.lib \
3255 /DISALLOWLIB:msvcrtd.lib \
3256 /DISALLOWLIB:msvcprt.lib \
3257 /DISALLOWLIB:msvcprtd.lib
3258 TEMPLATE_VBOXR3STATIC_LIBS.x86 = \
3259 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.x86)_LIB)/oldnames.lib \
3260 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
3261 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
3262 TEMPLATE_VBOXR3STATIC_LIBS.amd64 = \
3263 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
3264 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \
3265 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/oldnames.lib
3266else ifn1of ($(KBUILD_TARGET), darwin solaris)
3267 # The gcc guys sans darwin and solaris.
3268 TEMPLATE_VBOXR3STATIC_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -static
3269 TEMPLATE_VBOXR3STATIC_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -static
3270 TEMPLATE_VBOXR3STATIC_OBJCFLAGS = $(TEMPLATE_VBOXR3EXE_OBJCFLAGS) -static
3271 TEMPLATE_VBOXR3STATIC_OBJCXXFLAGS = $(TEMPLATE_VBOXR3EXE_OBJCXXFLAGS) -static
3272 TEMPLATE_VBOXR3STATIC_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -static
3273else ifeq ($(KBUILD_TARGET),solaris)
3274 TEMPLATE_VBOXR3STATIC_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS) nsl
3275endif
3276
3277#
3278# Temporary: Renaming the template and warnings will be errors (soon).
3279#
3280TEMPLATE_VBoxR3Static = New name for VBOXR3STATIC
3281TEMPLATE_VBoxR3Static_EXTENDS = VBOXR3STATIC
3282TEMPLATE_VBoxR3Static_EXTENDS_BY = appending
3283ifeq ($(KBUILD_TARGET),win)
3284 TEMPLATE_VBoxR3Static_CFLAGS += $(VBOX_VCC_WERR)
3285 TEMPLATE_VBoxR3Static_CXXFLAGS += $(VBOX_VCC_WERR)
3286 TEMPLATE_VBoxR3Static_LDFLAGS += $(VBOX_VCC_LD_WERR)
3287else
3288 TEMPLATE_VBoxR3Static_CFLAGS += $(VBOX_GCC_WERR)
3289 TEMPLATE_VBoxR3Static_CXXFLAGS += $(VBOX_GCC_WERR)
3290endif
3291
3292#
3293# Same as VBOXR3EXE but without C++ exceptions.
3294#
3295# VBOXR3EXE does C++ exceptions and may assumes that extern "C" functions
3296# doesn't throw them. Use this template (and VBOXR3DLLNOXCPT) with care
3297# and only where the C++ overhead is really unwanted.
3298#
3299TEMPLATE_VBOXR3EXENOXCPT = VBox Ring 3 Exe without C++ exception
3300TEMPLATE_VBOXR3EXENOXCPT_EXTENDS = VBOXR3EXE
3301ifeq ($(KBUILD_TARGET),win)
3302 TEMPLATE_VBOXR3EXENOXCPT_CFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3EXE_CFLAGS) ) -EHs-
3303 TEMPLATE_VBOXR3EXENOXCPT_CXXFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3EXE_CXXFLAGS)) -EHs-
3304else
3305 TEMPLATE_VBOXR3EXENOXCPT_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fno-exceptions
3306endif
3307
3308#
3309# Same as VBOXR3 but without C++ exceptions.
3310#
3311TEMPLATE_VBOXR3DLLNOXCPT = VBox Ring 3 SO/DLLs without C++ exception
3312TEMPLATE_VBOXR3DLLNOXCPT_EXTENDS = VBOXR3
3313ifeq ($(KBUILD_TARGET),win)
3314 TEMPLATE_VBOXR3DLLNOXCPT_CFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3_CFLAGS) ) -EHs-
3315 TEMPLATE_VBOXR3DLLNOXCPT_CXXFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3_CXXFLAGS)) -EHs-
3316else
3317 TEMPLATE_VBOXR3DLLNOXCPT_CXXFLAGS = $(TEMPLATE_VBOXR3_CXXFLAGS) -fno-exceptions
3318endif
3319
3320#
3321# Template for building hardened Ring-3 executables.
3322# These shall have no extra runpaths, esp. not origin ones.
3323#
3324TEMPLATE_VBOXR3HARDENEDEXE = Hardened VBox Ring-3 EXE
3325TEMPLATE_VBOXR3HARDENEDEXE_EXTENDS = VBOXR3EXE
3326TEMPLATE_VBOXR3HARDENEDEXE_LIBS = $(VBOX_LIB_SUPHARDENED) $(TEMPLATE_VBOXR3EXE_LIBS)
3327TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.darwin = $(TEMPLATE_VBOXR3EXE_LDFLAGS.darwin) -framework IOKit
3328ifeq ($(KBUILD_TARGET),linux)
3329# not necessary except USE_LIB_PCAP is defined in SUPR3HardenedMain.cpp
3330# TEMPLATE_VBOXR3HARDENEDEXE_LIBS += cap
3331endif
3332ifn1of ($(KBUILD_TARGET), win os2)
3333 TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%,$(TEMPLATE_VBOXR3EXE_LDFLAGS))
3334 TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBOXR3EXE_LDFLAGS.linux))
3335endif
3336
3337#
3338# Template for building hardened Ring-3 libraries.
3339#
3340TEMPLATE_VBOXR3HARDENEDLIB = Hardened VBox Ring-3 LIB
3341TEMPLATE_VBOXR3HARDENEDLIB_EXTENDS = VBOXR3HARDENEDEXE
3342TEMPLATE_VBOXR3HARDENEDLIB_LIBS = $(NO_SUCH_VARIABLE)
3343
3344
3345#
3346# Template for building set-uid-to-root helper programs.
3347# In hardened builds, these may only contain absolute runpaths!
3348#
3349TEMPLATE_VBoxR3SetUidToRoot = Set-uid-to-root helper program.
3350TEMPLATE_VBoxR3SetUidToRoot_EXTENDS = VBOXR3HARDENEDEXE
3351TEMPLATE_VBoxR3SetUidToRoot_LIBS = $(NO_SUCH_VARIABLE)
3352ifdef VBOX_WITH_RUNPATH
3353 TEMPLATE_VBoxR3SetUidToRoot_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
3354endif
3355ifndef VBOX_WITH_HARDENING
3356 ifdef VBOX_WITH_RELATIVE_RUNPATH
3357 TEMPLATE_VBoxR3SetUidToRoot_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
3358 endif
3359 ifdef VBOX_WITH_ORIGIN
3360 TEMPLATE_VBoxR3SetUidToRoot_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT)
3361 endif
3362endif
3363
3364
3365#
3366# Template for building R3 shared objects / DLLs with the 10.5 Mac OS X SDK.
3367# Identical to VBOXR3EXE, except for the DYLIB, the classic_linker and SDK bits.
3368#
3369TEMPLATE_VBOXR3OSX105 = VBox Ring 3 SO/DLLs for OS X 10.5
3370TEMPLATE_VBOXR3OSX105_EXTENDS = VBOXR3EXE
3371TEMPLATE_VBOXR3OSX105_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_DEFS) PIC
3372TEMPLATE_VBOXR3OSX105_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CFLAGS) -fno-common
3373TEMPLATE_VBOXR3OSX105_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS)
3374TEMPLATE_VBOXR3OSX105_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS)
3375TEMPLATE_VBOXR3OSX105_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS)
3376TEMPLATE_VBOXR3OSX105_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS) \
3377 -read_only_relocs suppress \
3378 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
3379 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
3380
3381
3382#
3383# Ring-3 testcase, running automatically during the build.
3384# This is the VBOXR3EXE template only with a different install dir.
3385#
3386TEMPLATE_VBOXR3AUTOTST = VBox Ring 3 Testcase Exe
3387TEMPLATE_VBOXR3AUTOTST_EXTENDS = VBOXR3EXE
3388TEMPLATE_VBOXR3AUTOTST_INST = $(INST_TESTCASE)
3389TEMPLATE_VBOXR3AUTOTST_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS)
3390TEMPLATE_VBOXR3AUTOTST_LIBS.l4 = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS.l4)
3391ifeq ($(KBUILD_TARGET),win)
3392 ifdef VBOX_SIGNING_MODE
3393 TEMPLATE_VBOXR3AUTOTST_POST_CMDS =
3394 endif
3395endif
3396
3397#
3398# Ring-3 testcase.
3399# This is the VBOXR3EXE template only with a different install dir.
3400#
3401TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
3402TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
3403TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
3404TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
3405ifdef VBOX_WITH_RUNPATH
3406 TEMPLATE_VBOXR3TSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' $(TEMPLATE_VBOXR3EXE_LDFLAGS)
3407else ifdef VBOX_WITH_RELATIVE_RUNPATH
3408 TEMPLATE_VBOXR3TSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..' $(TEMPLATE_VBOXR3EXE_LDFLAGS)
3409endif
3410ifeq ($(KBUILD_TARGET),win)
3411 ifdef VBOX_SIGNING_MODE
3412 TEMPLATE_VBOXR3TSTEXE_POST_CMDS =
3413 endif
3414endif
3415
3416#
3417# Ring-3 testcase (no -pedantic)
3418#
3419TEMPLATE_VBOXR3TSTNPEXE = VBox Ring 3 Testcase Exe Non-pedantic
3420TEMPLATE_VBOXR3TSTNPEXE_EXTENDS = VBOXR3TSTEXE
3421ifneq ($(KBUILD_TARGET),win) # (only gcc)
3422 TEMPLATE_VBOXR3TSTNPEXE_TOOL = $(VBOX_GCC_TOOL)
3423 TEMPLATE_VBOXR3TSTNPEXE_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3TSTEXE_CXXFLAGS)) -Wno-sign-compare
3424 TEMPLATE_VBOXR3TSTNPEXE_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3TSTEXE_CFLAGS)) -Wno-sign-compare
3425endif
3426
3427
3428#
3429# Template for the CppUnit kind of testcases.
3430#
3431TEMPLATE_VBOXCPPUNITEXE = VBox CppUnit Testcase Exe
3432TEMPLATE_VBOXCPPUNITEXE_EXTENDS = VBOXR3TSTEXE
3433## @todo make a CPPUNIT SDK and add cppunit tools packages for windows, mac, solaris and OS/2.
3434#TEMPLATE_VBOXCPPUNITEXE_SDKS = CPPUNIT -
3435TEMPLATE_VBOXCPPUNITEXE_LIBS = \
3436 $(TEMPLATE_VBOXR3TSTEXE_LIBS) \
3437 cppunit
3438
3439#
3440# Template for building bad C/C++ style R3 executables (no -pedantic).
3441#
3442TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
3443TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
3444ifneq ($(KBUILD_TARGET),win) # (only gcc)
3445 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
3446 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3EXE_CXXFLAGS)) -Wno-sign-compare
3447 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3EXE_CFLAGS)) \
3448 -Wno-sign-compare -Werror-implicit-function-declaration
3449endif
3450
3451
3452#
3453# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
3454# (Same transformation as for VBOXR3NPEXE.)
3455#
3456TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
3457TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3
3458ifneq ($(KBUILD_TARGET),win) # (only gcc)
3459 TEMPLATE_VBOXR3NP_TOOL = $(VBOX_GCC_TOOL)
3460 TEMPLATE_VBOXR3NP_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3_CXXFLAGS)) -Wno-sign-compare
3461 TEMPLATE_VBOXR3NP_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3_CFLAGS)) \
3462 -Wno-sign-compare -Werror-implicit-function-declaration
3463endif
3464
3465
3466#
3467# Template for building libraries, shared libraries / modules
3468# which only depends on IPRT for crt.
3469#
3470TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
3471TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
3472TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
3473TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno $(VBOX_GCC_WARN) -Werror-implicit-function-declaration
3474TEMPLATE_VBOXNOCRTGCC_CFLAGS.x86 = -m32
3475TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -m64 -mcmodel=medium -fno-common
3476TEMPLATE_VBOXNOCRTGCC_CFLAGS.sparc32 = -m32
3477TEMPLATE_VBOXNOCRTGCC_CFLAGS.sparc64 = -m64
3478TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
3479TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
3480TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
3481TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -static
3482TEMPLATE_VBOXNOCRTGCC_CXXFLAGS = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS)
3483TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(KBUILD_TARGET) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(KBUILD_TARGET))
3484TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(KBUILD_TARGET_ARCH) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(KBUILD_TARGET_ARCH))
3485TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
3486
3487ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
3488 # cross compile to 64-bit ELF (linux).
3489 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
3490 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
3491 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
3492 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
3493 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
3494
3495else ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
3496 # Use the default GCC (MinGW) with the Microsoft linker.
3497 # (Drop all '-g' options as we're unable to strip the debug info.)
3498 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
3499 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
3500 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
3501 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
3502 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
3503 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
3504 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
3505
3506else
3507 # Use the default GCC.
3508 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
3509 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
3510 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
3511 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
3512 TEMPLATE_VBOXNOCRTGCC_CFLAGS += $(VBOX_GCC_fno-stack-protector)
3513 TEMPLATE_VBOXNOCRTGCC_CXXFLAGS += $(VBOX_GCC_fno-stack-protector)
3514 ifeq ($(KBUILD_TARGET_ARCH),amd64)
3515 # in 64-bit mode we'll build a sys-module (VBoxREM2).
3516 if1of ($(KBUILD_TARGET), darwin solaris)
3517 TEMPLATE_VBOXNOCRTGCC_LDFLAGS.solaris= -64 -r
3518 else
3519 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
3520 endif
3521 else # x86:
3522 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
3523 ifn1of ($(KBUILD_TARGET), os2 darwin solaris)
3524 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
3525 endif
3526 endif # x86
3527 TEMPLATE_VBOXNOCRTGCC_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
3528 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
3529endif
3530
3531
3532#
3533# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
3534#
3535TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
3536TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
3537TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
3538ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
3539 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
3540else
3541 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
3542endif
3543TEMPLATE_VBOXNOCRTGAS_ASFLAGS.x86 = -m32
3544TEMPLATE_VBOXNOCRTGAS_ASFLAGS.amd64 = -m64
3545
3546
3547#
3548# Template for building executables that are part of the VBox Main component
3549# (COM/XPCOM interface to VirtualBox).
3550#
3551TEMPLATE_VBOXMAINEXE = VBox Main Executable
3552TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
3553TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
3554TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE NDEBUG=1
3555TEMPLATE_VBOXMAINEXE_DEFS.win = _UNICODE
3556TEMPLATE_VBOXMAINEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
3557TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
3558
3559ifeq ($(KBUILD_TARGET),win)
3560 TEMPLATE_VBOXMAINEXE_SDKS = WINPSDK $(VBOX_WINDDK)
3561 # Note: C4250 is the dominance warning, see r32789.
3562 # C4065 is about default only switches.
3563 # C4996 is about deprected function (CRT only?).
3564 ifndef VBOX_USE_VCC70
3565 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
3566 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)
3567 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
3568 else
3569 TEMPLATE_VBOXMAINEXE_TOOL = VCC70
3570 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -EHsc -GF -MD$(VBOX_VCC_CRT_TYPE) -W3 -wd4065 -wd4250 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
3571 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -GZ
3572 endif
3573 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
3574 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
3575 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
3576 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
3577 TEMPLATE_VBOXMAINEXE_INCS += \
3578 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
3579 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
3580 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
3581 /DISALLOWLIB:libc.lib \
3582 /DISALLOWLIB:libcd.lib \
3583 /DISALLOWLIB:libcmt.lib \
3584 /DISALLOWLIB:libcmtd.lib \
3585 /DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE_N).lib \
3586 /DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE_N).lib
3587 TEMPLATE_VBOXMAINEXE_LIBS = \
3588 $(LIB_RUNTIME) \
3589 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
3590 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
3591 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
3592 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls$(VBOX_VCC_CRT_TYPE).lib
3593 TEMPLATE_VBOXMAINEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
3594 ifdef VBOX_USE_VCC100 # HACK ALERT!
3595 TEMPLATE_VBOXMAINEXE_CINCS = $(TOOL_$(VBOX_VCC_TOOL)_CINCS)
3596 TEMPLATE_VBOXMAINEXE_CXXINCS = $(TOOL_$(VBOX_VCC_TOOL)_CXXINCS)
3597 endif
3598
3599else # the GCC guys:
3600
3601TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
3602TEMPLATE_VBOXMAINEXE_CXXFLAGS = -g -pipe \
3603 $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) -Wno-long-long -Wno-non-virtual-dtor -Wshadow \
3604 -fshort-wchar -fpermissive -fexceptions -frtti $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing \
3605 $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
3606TEMPLATE_VBOXMAINEXE_CXXFLAGS.x86 = -m32
3607TEMPLATE_VBOXMAINEXE_CXXFLAGS.amd64 = -m64
3608TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
3609TEMPLATE_VBOXMAINEXE_CFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) \
3610 $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-hidden)
3611TEMPLATE_VBOXMAINEXE_CFLAGS.x86 = -m32
3612TEMPLATE_VBOXMAINEXE_CFLAGS.amd64 = -m64
3613TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
3614TEMPLATE_VBOXMAINEXE_OBJCFLAGS = $(TEMPLATE_VBOXMAINEXE_CFLAGS)
3615TEMPLATE_VBOXMAINEXE_OBJCFLAGS.x86 = $(TEMPLATE_VBOXMAINEXE_CFLAGS.x86)
3616TEMPLATE_VBOXMAINEXE_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXMAINEXE_CFLAGS.amd64)
3617TEMPLATE_VBOXMAINEXE_OBJCFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile)
3618TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
3619TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.x86)
3620TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.amd64)
3621TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS.kprofile= $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
3622TEMPLATE_VBOXMAINEXE_LDFLAGS.x86 = -m32
3623TEMPLATE_VBOXMAINEXE_LDFLAGS.amd64 = -m64
3624 ifeq ($(KBUILD_TARGET),linux)
3625TEMPLATE_VBOXMAINEXE_LIBS = pthread m rt $(LIB_RUNTIME) dl
3626TEMPLATE_VBOXMAINEXE_LDFLAGS.linux = $(VBOX_LD_as_needed)
3627 else ifeq ($(KBUILD_TARGET),l4)
3628TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
3629# no libs as yet in l4 target - must be added later
3630 else ifeq ($(KBUILD_TARGET),os2)
3631TEMPLATE_VBOXMAINEXE_TOOL = GXX3OMF
3632TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
3633 else ifeq ($(KBUILD_TARGET),darwin)
3634TEMPLATE_VBOXMAINEXE_TOOL = GXX4MACHO
3635TEMPLATE_VBOXMAINEXE_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
3636TEMPLATE_VBOXMAINEXE_CFLAGS += $(VBOX_DARWIN_DEF_SDK_CFLAGS)
3637TEMPLATE_VBOXMAINEXE_CXXFLAGS += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
3638TEMPLATE_VBOXMAINEXE_OBJCFLAGS += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
3639TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS += $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS)
3640TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin += -bind_at_load
3641TEMPLATE_VBOXMAINEXE_LDFLAGS += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -framework Carbon
3642TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
3643 else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd)
3644TEMPLATE_VBOXMAINEXE_TOOL = GXX3
3645TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
3646TEMPLATE_VBOXMAINEXE_INCS += \
3647 /usr/include \
3648 /usr/X11R6/include \
3649 /usr/local/include
3650TEMPLATE_VBOXMAINEXE_LIBPATH += \
3651 /usr/lib \
3652 /usr/X11R6/lib \
3653 /usr/local/lib
3654else ifeq ($(KBUILD_TARGET),solaris)
3655TEMPLATE_VBOXMAINEXE_TOOL = GXX3PLAIN
3656TEMPLATE_VBOXMAINEXE_DEFS += _REENTRANT
3657TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt thread
3658 else
3659$(warning Warning: VBOX Build: Target $(KBUILD_TARGET) is not officially supported!)
3660TEMPLATE_VBOXMAINEXE_LIBS =
3661 endif
3662 ifdef VBOX_WITH_RUNPATH
3663TEMPLATE_VBOXMAINEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
3664 else ifdef VBOX_WITH_RELATIVE_RUNPATH
3665TEMPLATE_VBOXMAINEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
3666 endif
3667 ifdef VBOX_WITH_ORIGIN
3668TEMPLATE_VBOXMAINEXE_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT)
3669 endif
3670
3671endif # !win
3672
3673# Add COM/XPCOM stuff
3674TEMPLATE_VBOXMAINEXE_LIBS += \
3675 $(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
3676ifdef VBOX_WITH_XPCOM
3677 ## @todo may be worth creating the VBOX_XPCOM SDK def
3678 TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
3679 ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
3680 TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
3681 endif
3682 TEMPLATE_VBOXMAINEXE_INCS += \
3683 $(VBOX_XPCOM_INCS)
3684 TEMPLATE_VBOXMAINEXE_LIBS += \
3685 $(LIB_XPCOM)
3686 TEMPLATE_VBOXMAINEXE_INTERMEDIATES += \
3687 $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h
3688
3689else # COM
3690 TEMPLATE_VBOXMAINEXE_INCS += \
3691 $(VBOX_PATH_SDK)/bindings/mscom/include
3692 TEMPLATE_VBOXMAINEXE_INTERMEDIATES += \
3693 $(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h
3694endif # COM
3695
3696#
3697# Template for building the Main DLL modules (such as in-process COM/XPCOM
3698# components for Main).
3699#
3700# This differs from VBOXMAINEXE only in PIC handling and similar DLL stuff.
3701#
3702TEMPLATE_VBOXMAINDLL = VBox Main Component (shared library)
3703TEMPLATE_VBOXMAINDLL_EXTENDS = VBOXMAINEXE
3704ifn1of ($(KBUILD_TARGET), darwin os2 win)
3705 TEMPLATE_VBOXMAINDLL_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
3706 TEMPLATE_VBOXMAINDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
3707 TEMPLATE_VBOXMAINDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
3708 TEMPLATE_VBOXMAINDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
3709endif
3710TEMPLATE_VBOXMAINDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin)) \
3711 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
3712 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
3713
3714#
3715# Template identical to VBOXMAINDLL except for where the stuff is
3716# installed when using XPCOM (components/).
3717#
3718# Note! In the hardened build this gets a bit ugly since $ORIGIN/..
3719# doesn't work. So, we keep the $ORIGIN from VBOXMAINEXE and let
3720# the installers do the necessary .so symlinking.
3721#
3722# (No difference when building against COM on Windows.)
3723#
3724TEMPLATE_VBOXMAINCOMP = VBox Main COM/XPCOM Component (shared library)
3725TEMPLATE_VBOXMAINCOMP_EXTENDS = VBOXMAINEXE
3726ifn1of ($(KBUILD_TARGET), win)
3727 TEMPLATE_VBOXMAINCOMP_INST = $(INST_BIN)components/
3728endif
3729ifneq ($(KBUILD_TARGET),win)
3730 ifeq ($(filter-out solaris.x86 %.amd64 %.sparc32 %.sparc64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) ## TODO: cleanup!
3731 TEMPLATE_VBOXMAINCOMP_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
3732 TEMPLATE_VBOXMAINCOMP_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
3733 TEMPLATE_VBOXMAINCOMP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
3734 if defined(VBOX_WITH_RELATIVE_RUNPATH) && !defined(VBOX_WITH_HARDENING)
3735 TEMPLATE_VBOXMAINCOMP_LDFLAGS = -fPIC $(filter-out '$(VBOX_GCC_RPATH_OPT)%',$(TEMPLATE_VBOXMAINEXE_LDFLAGS)) '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..'
3736 else
3737 TEMPLATE_VBOXMAINCOMP_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
3738 endif
3739 else ifndef VBOX_WITH_HARDENING
3740 ifdef VBOX_WITH_RELATIVE_RUNPATH
3741 TEMPLATE_VBOXMAINCOMP_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%',$(TEMPLATE_VBOXMAINEXE_LDFLAGS)) '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..'
3742 endif
3743 endif
3744endif
3745TEMPLATE_VBOXMAINCOMP_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin)) \
3746 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
3747 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
3748
3749#
3750# Template for building the Main static libraries.
3751#
3752# This differs from VBOXMAINDLL only that it zeroes out the _LIBS definition.
3753#
3754TEMPLATE_VBOXMAINLIB = VBox Main Component (static library)
3755TEMPLATE_VBOXMAINLIB_EXTENDS = VBOXMAINDLL
3756TEMPLATE_VBOXMAINLIB_LIBS =
3757
3758#
3759# Template for building executables that use the VBox Main component.
3760#
3761TEMPLATE_VBOXMAINCLIENTEXE = VBox Main Client (executable)
3762TEMPLATE_VBOXMAINCLIENTEXE_EXTENDS = VBOXMAINEXE
3763ifeq ($(KBUILD_TARGET),win)
3764 TEMPLATE_VBOXMAINCLIENTEXE_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
3765 $(PATH_SDK_WINPSDK_LIB)/User32.Lib \
3766 $(PATH_SDK_WINPSDK_LIB)/Shell32.Lib \
3767 $(PATH_SDK_WINPSDK_LIB)/ShLwApi.Lib \
3768 $(PATH_SDK_WINPSDK_LIB)/Ole32.Lib \
3769 $(PATH_SDK_WINPSDK_LIB)/OleAut32.Lib \
3770 $(PATH_SDK_WINPSDK_LIB)/Uuid.Lib
3771else
3772 TEMPLATE_VBOXMAINCLIENTEXE_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
3773 NDEBUG TRIMMED
3774 TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
3775 -pthread
3776endif
3777
3778#
3779# Template for building shared libraries / DLLs that use the VBox Main component.
3780#
3781# This differs from VBOXMAINCLIENTEXE only in PIC handling and similar DLL stuff.
3782#
3783TEMPLATE_VBOXMAINCLIENTDLL = VBox MAIN Client (shared library)
3784TEMPLATE_VBOXMAINCLIENTDLL_EXTENDS = VBOXMAINCLIENTEXE
3785ifn1of ($(KBUILD_TARGET), darwin os2 win)
3786 TEMPLATE_VBOXMAINCLIENTDLL_DEFS = PIC $(TEMPLATE_VBOXMAINCLIENTEXE_DEFS)
3787 TEMPLATE_VBOXMAINCLIENTDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CFLAGS)
3788 TEMPLATE_VBOXMAINCLIENTDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS)
3789 TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)
3790endif
3791TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin))
3792
3793
3794
3795#
3796# Templates used for building the extension packs.
3797#
3798ifdef VBOX_WITH_EXTPACK
3799 # Base templates (native or portable).
3800 TEMPLATE_VBoxR3ExtPack = For the ring-3 context extension pack modules.
3801 if 1 # Native for now.
3802 TEMPLATE_VBoxR3ExtPack_EXTENDS = VBOXR3DLLNOXCPT
3803 TEMPLATE_VBoxR3ExtPack_DEFS = $(TEMPLATE_VBOXR3DLLNOXCPT_DEFS) VBOX_IN_EXTPACK VBOX_IN_EXTPACK_R3
3804 else
3805 TEMPLATE_VBoxR3ExtPack_EXTENDS = VBOXNOCRTGCC
3806 TEMPLATE_VBoxR3ExtPack_DEFS = $(TEMPLATE_VBOXNOCRTGCC_DEFS) VBOX_IN_EXTPACK VBOX_IN_EXTPACK_R3 IPRT_NO_CRT IN_RING3
3807 TEMPLATE_VBoxR3ExtPack_INCS = $(PATH_ROOT)/include/iprt/nocrt $(TEMPLATE_VBOXR3DLLNOXCPT_INCS)
3808 endif
3809 ifneq ($(KBUILD_TARGET),win)
3810 TEMPLATE_VBoxR3ExtPack_CXXFLAGS = $(TEMPLATE_VBOXR3DLLNOXCPT_CXXFLAGS) -fno-rtti
3811 endif
3812 TEMPLATE_VBoxR3ExtPack_INST = $(INST_EXTPACK)YouShallOverrideThis/
3813 ifeq ($(KBUILD_TARGET),linux)
3814 TEMPLATE_VBoxR3ExtPack_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)', $(TEMPLATE_VBOXR3DLLNOXCPT_LDFLAGS))
3815 else
3816 if !defined(VBOX_WITH_RUNPATH) && defined(VBOX_WITH_RELATIVE_RUNPATH)
3817 TEMPLATE_VBoxR3ExtPack_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/../../..' $(filter-out '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)', $(TEMPLATE_VBOXR3DLLNOXCPT_LDFLAGS))
3818 endif
3819 endif
3820 ifdef VBOX_ONLY_EXTPACKS_USE_IMPLIBS
3821 if1of ($(KBUILD_TARGET), win os2)
3822 TEMPLATE_VBoxR3ExtPack_LIBS = \
3823 $(TEMPLATE_LIBS_VBOXR3) \
3824 $(PATH_STAGE_LIB)/VMMR3Imp$(VBOX_SUFF_LIB) \
3825 $(PATH_STAGE_LIB)/VBoxRTImp$(VBOX_SUFF_LIB)
3826 else
3827 TEMPLATE_VBoxR3ExtPack_LIBS = \
3828 $(TEMPLATE_LIBS_VBOXR3) \
3829 $(PATH_STAGE_LIB)/VMMR3Imp$(VBOX_SUFF_DLL) \
3830 $(PATH_STAGE_LIB)/VBoxRTImp$(VBOX_SUFF_DLL)
3831 endif
3832 else
3833 TEMPLATE_VBoxR3ExtPack_LIBS = \
3834 $(TEMPLATE_LIBS_VBOXR3) \
3835 $(LIB_RUNTIME) \
3836 $(LIB_VMM)
3837 endif
3838
3839 TEMPLATE_VBoxR0ExtPack = For the ring-0 context extension pack modules.
3840 TEMPLATE_VBoxR0ExtPack_EXTENDS = VBoxR0
3841 TEMPLATE_VBoxR0ExtPack_EXTENDS_BY = appending
3842 TEMPLATE_VBoxR0ExtPack_INST = $(INST_EXTPACK)YouShallOverrideThis/
3843 TEMPLATE_VBoxR0ExtPack_DEFS = VBOX_IN_EXTPACK VBOX_IN_EXTPACK_R0
3844 if1of ($(VBOX_LDR_FMT), pe lx)
3845 TEMPLATE_VBoxR0ExtPack_LIBS = \
3846 $(PATH_STAGE_LIB)/VMMR0Imp$(VBOX_SUFF_LIB) \
3847 $(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
3848 endif
3849
3850 TEMPLATE_VBoxRcExtPack = For the raw-mode context extension pack modules.
3851 TEMPLATE_VBoxRcExtPack_EXTENDS = VBoxRc
3852 TEMPLATE_VBoxRcExtPack_EXTENDS_BY = appending
3853 TEMPLATE_VBoxRcExtPack_SYSSUFF = .rc
3854 TEMPLATE_VBoxRcExtPack_INST = $(INST_EXTPACK)YouShallOverrideThis/
3855 TEMPLATE_VBoxRcExtPack_DEFS = VBOX_IN_EXTPACK VBOX_IN_EXTPACK_RC
3856 if1of ($(VBOX_LDR_FMT32), pe lx)
3857 TEMPLATE_VBoxRcExtPack_LIBS = \
3858 $(PATH_STAGE_LIB)/VMMRCBuiltin$(VBOX_SUFF_LIB) \
3859 $(PATH_STAGE_LIB)/VMMRCImp$(VBOX_SUFF_LIB)
3860 endif
3861
3862 TEMPLATE_VBoxInsExtPack = For the install targets of an extension pack.
3863 TEMPLATE_VBoxInsExtPack_MODE = 0644
3864 TEMPLATE_VBoxInsExtPack_INST = $(INST_EXTPACK)YouShallOverrideThis/
3865
3866 # For each individual extension pack
3867 ifdef VBOX_WITH_EXTPACK_PUEL
3868 TEMPLATE_VBoxR3ExtPackPuel = For the ring-3 context modules in the PUEL extension pack.
3869 TEMPLATE_VBoxR3ExtPackPuel_EXTENDS = VBoxR3ExtPack
3870 TEMPLATE_VBoxR3ExtPackPuel_INST = $(INST_EXTPACK_PUEL)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
3871
3872 TEMPLATE_VBoxR0ExtPackPuel = For the ring-0 context modules in the PUEL extension pack.
3873 TEMPLATE_VBoxR0ExtPackPuel_EXTENDS = VBoxR0ExtPack
3874 TEMPLATE_VBoxR0ExtPackPuel_INST = $(INST_EXTPACK_PUEL)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
3875
3876 TEMPLATE_VBoxRcExtPackPuel = For the raw-mode context modules in the PUEL extension pack.
3877 TEMPLATE_VBoxRcExtPackPuel_EXTENDS = VBoxRcExtPack
3878 TEMPLATE_VBoxRcExtPackPuel_INST = $(INST_EXTPACK_PUEL)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
3879
3880 TEMPLATE_VBoxInsExtPackPuel = For the install targets of an extension pack.
3881 TEMPLATE_VBoxInsExtPackPuel_EXTENDS = VBoxR0ExtPack
3882 TEMPLATE_VBoxInsExtPackPuel_INST = $(INST_EXTPACK_PUEL)
3883endif
3884endif # VBOX_WITH_EXTPACK
3885
3886
3887#
3888# Qt 4
3889# Qt 4
3890# Qt 4
3891#
3892ifdef VBOX_WITH_QTGUI
3893
3894 # Guess VBOX_WITH_QT4_SUN
3895 ifndef VBOX_WITH_QT4_SUN
3896 ifndef VBOX_OSE
3897 if1of ($(KBUILD_TARGET), darwin solaris win)
3898 VBOX_WITH_QT4_SUN := 1
3899 endif
3900 endif
3901 endif
3902
3903 ifdef VBOX_WITH_QT4_SUN
3904 VBOX_QT4_INFIX=VBox
3905 endif
3906
3907 VBOX_QT4_MOD = QtCore QtGui QtNetwork $(if $(VBOX_GUI_USE_QGL),QtOpenGL,)
3908 VBOX_QT4_MOD_NAMES = $(foreach qtmod,$(VBOX_QT4_MOD),$(qtmod)$(VBOX_QT4_INFIX))
3909
3910 #
3911 # Handmade configuration of qt4 - very annoying, this needs to
3912 # be cleaned up properly later some time (not important now).
3913 #
3914 ifeq ($(VBOX_PATH_QT4),)
3915 ifeq ($(KBUILD_TARGET),darwin)
3916 VBOX_PATH_QT4 := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
3917 ifeq ($(VBOX_PATH_QT4),)
3918 ifneq ($(wildcard /Library/Frameworks/QtCore.framework),)
3919 # Using the global installation (for OSE).
3920 VBOX_PATH_QT4 ?= /usr
3921 VBOX_PATH_QT4_FRAMEWORKS ?= /Library/Frameworks
3922 endif
3923 endif
3924 else if1of ($(KBUILD_TARGET), win)
3925 VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
3926 else if1of ($(KBUILD_TARGET), solaris)
3927 VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
3928 ifneq ($(VBOX_PATH_QT4),)
3929 VBOX_WITH_QT4_SUN = 1
3930 endif
3931 endif
3932 endif
3933 ifeq ($(VBOX_PATH_QT4),)
3934 if1of ($(USERNAME), bird)
3935 # gentoo (64-bit)
3936 VBOX_PATH_QT4 ?= /usr
3937 VBOX_PATH_QT4_LIB ?= /usr/lib/qt4
3938 endif
3939 endif
3940 VBOX_PATH_QT4 ?= /usr
3941 VBOX_PATH_QT4_LIB ?= $(VBOX_PATH_QT4)/lib
3942
3943 # Hack LD_LIBRARY_PATH for stuff in tools.
3944 ifdef VBOX_WITH_QT4_SUN
3945 if1of ($(KBUILD_TARGET), linux)
3946 export LD_LIBRARY_PATH := $(VBOX_PATH_QT4_LIB):$(LD_LIBRARY_PATH)
3947 endif
3948 endif
3949
3950
3951 #
3952 # Template for building Qt GUI executables.
3953 #
3954 TEMPLATE_VBOXQT4GUIEXE = VBox Qt GUI Executable
3955 TEMPLATE_VBOXQT4GUIEXE_USES = qt4
3956 TEMPLATE_VBOXQT4GUIEXE_QTTOOL = QT4
3957 TEMPLATE_VBOXQT4GUIEXE_MOCTOOL = QT4
3958 TEMPLATE_VBOXQT4GUIEXE_UICTOOL = QT4
3959 TEMPLATE_VBOXQT4GUIEXE_RCCTOOL = QT4
3960 TEMPLATE_VBOXQT4GUIEXE_LRCTOOL = QT4
3961 TEMPLATE_VBOXQT4GUIEXE_SDKS = QT4
3962 TEMPLATE_VBOXQT4GUIEXE_QT_INFIX = $(VBOX_QT4_INFIX)
3963 TEMPLATE_VBOXQT4GUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT QT_SHARED HAVE_CONFIG_H $(ARCH_BITS_DEFS)
3964 TEMPLATE_VBOXQT4GUIEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
3965
3966 ifeq ($(KBUILD_TARGET),win)
3967 # Note! No use of VBOX_VCC_CRT_TYPE here yet as it requires a /MDd build of Qt as well.
3968 TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_VCC_TOOL)
3969 TEMPLATE_VBOXQT4GUIEXE_DEFS += \
3970 _WIN32_WINNT=0x0500 UNICODE _UNICODE \
3971 QT_DLL _CRT_SECURE_NO_DEPRECATE \
3972 $(QMAKE_PRL_DEFINES)
3973 ## @todo VCC70 flags?
3974 ifndef VBOX_USE_VCC70
3975 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
3976 -nologo -Zm200 -W3 -MD -Zi -EHsc -Zc:wchar_t-
3977 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.debug = -RTCsu
3978 else
3979 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
3980 -nologo -Zm200 -W3 -MD -Zi -GX
3981 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.debug = -GZ
3982 endif
3983 TEMPLATE_VBOXQT4GUIEXE_INCS += \
3984 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
3985 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS = \
3986 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
3987 /DELAYLOAD:oleaut32.dll
3988 TEMPLATE_VBOXQT4GUIEXE_SDKS += WINPSDK
3989 TEMPLATE_VBOXQT4GUIEXE_LIBS = \
3990 $(VBOX_LIBS_QT4) \
3991 $(LIB_RUNTIME) \
3992 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
3993 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
3994 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
3995 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
3996 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
3997 ifdef VBOX_WITH_DEBUG_VCC_CRT # VBoxCOM (static) is causing trouble of course.
3998 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
3999 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
4000 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib
4001 endif
4002 TEMPLATE_VBOXQT4GUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
4003 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.win.x86 += /LARGEADDRESSAWARE
4004
4005 ifdef VBOX_USE_VCC100 # HACK ALERT!
4006 TEMPLATE_VBOXQT4GUIEXE_CINCS = $(TOOL_$(VBOX_VCC_TOOL)_CINCS)
4007 TEMPLATE_VBOXQT4GUIEXE_CXXINCS = $(TOOL_$(VBOX_VCC_TOOL)_CXXINCS)
4008 endif
4009
4010 else # the gcc guys:
4011 TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_GCC_TOOL)
4012 TEMPLATE_VBOXQT4GUIEXE_DEFS.linux = _REENTRANT
4013
4014 TEMPLATE_VBOXQT4GUIEXE_DEFS.solaris = _REENTRANT
4015
4016 TEMPLATE_VBOXQT4GUIEXE_INCS += \
4017 $(LIB_SDL_INC)
4018 ## @todo Use VBOX_GCC_PEDANTIC_CXX?
4019 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
4020 -g -pipe $(filter-out -Wno-unused,$(VBOX_GCC_WARN)) -frtti -fno-exceptions -Wno-non-virtual-dtor \
4021 -Wno-long-long -fshort-wchar -fno-strict-aliasing \
4022 $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
4023 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.x86 = -m32
4024 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.amd64 = -m64
4025 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.linux = -pthread
4026 TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_C) -Wno-long-long -fno-exceptions
4027 TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS.x86 = $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.x86)
4028 TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.amd64)
4029 TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS = \
4030 -g -pipe $(VBOX_GCC_PEDANTIC_CXX) -Wno-non-virtual-dtor -Wno-long-long \
4031 -frtti -fno-exceptions $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
4032 TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.x86)
4033 TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.amd64)
4034 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.x86 = -m32
4035 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.amd64 = -m64
4036 TEMPLATE_VBOXQT4GUIEXE_LIBS = \
4037 $(VBOX_LIBS_QT4) \
4038 $(LIB_SDL) \
4039 $(LIB_RUNTIME) \
4040 $(LIB_REM) \
4041 $(LIB_VMM)
4042
4043 ifeq ($(KBUILD_TARGET),linux)
4044 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += $(VBOX_LD_as_needed)
4045 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
4046 $(VBOX_XCURSOR_LIBS) \
4047 Xext \
4048 X11
4049 TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
4050 $(VBOX_LIBPATH_X11)
4051 else ifeq ($(KBUILD_TARGET),darwin)
4052 TEMPLATE_VBOXQT4GUIEXE_DEFS.darwin += $(VBOX_DARWIN_DEF_SDK_DEFS)
4053 TEMPLATE_VBOXQT4GUIEXE_CFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CFLAGS)
4054 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
4055 TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
4056 TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS)
4057 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -bind_at_load
4058 TEMPLATE_VBOXQT4GUIEXE_LIBS +=
4059 TEMPLATE_VBOXQT4GUIEXE_LIBPATH +=
4060 else
4061 TEMPLATE_VBOXQT4GUIEXE_INCS += \
4062 $(VBOX_XCURSOR_INCS)
4063 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
4064 $(VBOX_XCURSOR_LIBS) \
4065 Xext \
4066 X11 \
4067 m \
4068 $(LIB_PTHREAD)
4069 TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
4070 $(VBOX_LIBPATH_X11)
4071 ifeq ($(KBUILD_TARGET),freebsd)
4072 TEMPLATE_VBOXQT4GUIEXE_INCS += \
4073 /usr/include \
4074 /usr/X11R6/include \
4075 /usr/local/include
4076 TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
4077 /usr/lib \
4078 /usr/X11R6/lib \
4079 /usr/local/lib
4080 endif
4081 ifeq ($(KBUILD_TARGET),solaris)
4082 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
4083 rt socket nsl
4084 endif
4085 endif
4086 # Assume the Qt shared objects are in the same directory as the executable, on Solaris too.
4087 ifdef VBOX_WITH_RUNPATH
4088 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
4089 else ifdef VBOX_WITH_RELATIVE_RUNPATH
4090 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
4091 endif
4092
4093 endif
4094
4095 # Add COM/XPCOM stuff
4096 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
4097 $(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
4098 ifdef VBOX_WITH_XPCOM
4099 ## @todo may be worth creating the VBOX_XPCOM SDK def, or just a SDK_VBOXXPCOM.
4100 TEMPLATE_VBOXQT4GUIEXE_DEFS += VBOX_WITH_XPCOM
4101 ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
4102 TEMPLATE_VBOXQT4GUIEXE_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
4103 endif
4104 TEMPLATE_VBOXQT4GUIEXE_INCS += \
4105 $(VBOX_XPCOM_INCS)
4106 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
4107 $(LIB_XPCOM)
4108 TEMPLATE_VBOXQT4GUIEXE_INTERMEDIATES += \
4109 $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h
4110 else # COM
4111 TEMPLATE_VBOXQT4GUIEXE_INCS += \
4112 $(VBOX_PATH_SDK)/bindings/mscom/include
4113 TEMPLATE_VBOXQT4GUIEXE_INTERMEDIATES += \
4114 $(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h
4115 endif # COM
4116
4117
4118 #
4119 # Template for building Qt GUI components.
4120 #
4121 TEMPLATE_VBOXQT4GUI = VBox Qt GUI Components
4122 TEMPLATE_VBOXQT4GUI_EXTENDS = VBOXQT4GUIEXE
4123 TEMPLATE_VBOXQT4GUI_LIBS = $(filter-out $(QTMAIN),$(TEMPLATE_VBOXQT4GUIEXE_LIBS))
4124 ifeq ($(KBUILD_TARGET),darwin)
4125 TEMPLATE_VBOXQT4GUI_LDFLAGS.darwin += $(filter-out -bind_at_load,$(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.darwin)) \
4126 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
4127 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
4128 endif
4129 ifn1of ($(KBUILD_TARGET), darwin os2 win)
4130 TEMPLATE_VBOXQT4GUI_DEFS = PIC $(TEMPLATE_VBOXQT4GUIEXE_DEFS)
4131 TEMPLATE_VBOXQT4GUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CFLAGS)
4132 TEMPLATE_VBOXQT4GUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS)
4133 TEMPLATE_VBOXQT4GUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS)
4134 endif
4135
4136endif # VBOX_WITH_QTGUI
4137
4138
4139#
4140# Template for building build bldprogs.
4141#
4142# HACK ALERT! The BLD_TRG_* is a hack to allow building libraries as well.
4143#
4144TEMPLATE_VBOXBLDPROG = VBox Build Program
4145TEMPLATE_VBOXBLDPROG_BLD_TRG := $(KBUILD_HOST)
4146TEMPLATE_VBOXBLDPROG_BLD_TRG_ARCH := $(KBUILD_HOST_ARCH)
4147TEMPLATE_VBOXBLDPROG_BLD_TRG_CPU := $(KBUILD_HOST_CPU)
4148TEMPLATE_VBOXBLDPROG_DEFS := IN_RING3 LOG_DISABLED
4149TEMPLATE_VBOXBLDPROG_DEFS.win := _CRT_SECURE_NO_DEPRECATE
4150TEMPLATE_VBOXBLDPROG_ASTOOL := YASM
4151TEMPLATE_VBOXBLDPROG_ASFLAGS.x86 := $(VBOX_ASFLAGS32)
4152TEMPLATE_VBOXBLDPROG_ASFLAGS.amd64 := $(VBOX_ASFLAGS64)
4153ifeq ($(KBUILD_HOST),win)
4154 ifndef VBOX_USE_VCC70
4155 TEMPLATE_VBOXBLDPROG_TOOL := $(VBOX_VCC_TOOL_STEM)$(toupper $(KBUILD_HOST_ARCH))
4156 TEMPLATE_VBOXBLDPROG_SDKS := $(if-expr "$(KBUILD_HOST_ARCH)" == "x86",WIN32SDK,WIN64SDK)
4157 else if1of ($(KBUILD_HOST_ARCH), x86)
4158 TEMPLATE_VBOXBLDPROG_TOOL := VCC70
4159 TEMPLATE_VBOXBLDPROG_SDKS := WIN32SDK
4160 else if1of ($(KBUILD_HOST_ARCH), amd64)
4161 TEMPLATE_VBOXBLDPROG_TOOL := VCC80AMD64
4162 TEMPLATE_VBOXBLDPROG_SDKS := WIN64SDK
4163 else
4164 $(error KBUILD_HOST_ARCH=$(KBUILD_HOST_ARCH))
4165 endif
4166 ifneq ($(TEMPLATE_VBOXBLDPROG_TOOL),VCC70)
4167 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -MT$(VBOX_VCC_CRT_TYPE) -W3 -wd4996 -Zc:wchar_t-
4168 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -RTCsu
4169 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -Oy- -GS-
4170 else
4171 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -MT$(VBOX_VCC_CRT_TYPE) -W3
4172 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -GZ
4173 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -Ogitb2 -Oy-
4174 endif
4175 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
4176 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
4177 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
4178 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
4179 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
4180 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
4181 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
4182 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
4183 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
4184 /DISALLOWLIB:libc$(VBOX_VCC_CRT_TYPE_N).lib \
4185 /DISALLOWLIB:libcmt$(VBOX_VCC_CRT_TYPE_N).lib \
4186 /DISALLOWLIB:msvcrt.lib \
4187 /DISALLOWLIB:msvcrtd.lib \
4188 /DISALLOWLIB:msvcprt.lib \
4189 /DISALLOWLIB:msvcprtd.lib
4190 TEMPLATE_VBOXBLDPROG_LIBS = \
4191 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
4192 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
4193 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
4194
4195else
4196# (gcc of some kind )
4197TEMPLATE_VBOXBLDPROG_TOOL = GXX3
4198TEMPLATE_VBOXBLDPROG_CFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros)
4199TEMPLATE_VBOXBLDPROG_CFLAGS.x86 = -m32
4200TEMPLATE_VBOXBLDPROG_CFLAGS.sparc32 = -m32
4201TEMPLATE_VBOXBLDPROG_CFLAGS.amd64 = -m64
4202TEMPLATE_VBOXBLDPROG_CFLAGS.sparc64 = -m64
4203TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
4204TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
4205TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
4206TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros)
4207TEMPLATE_VBOXBLDPROG_CXXFLAGS.x86 = -m32
4208TEMPLATE_VBOXBLDPROG_CXXFLAGS.sparc32 = -m32
4209TEMPLATE_VBOXBLDPROG_CXXFLAGS.amd64 = -m64
4210TEMPLATE_VBOXBLDPROG_CXXFLAGS.sparc64 = -m64
4211TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
4212TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
4213TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
4214TEMPLATE_VBOXBLDPROG_OBJCFLAGS = $(TEMPLATE_VBOXBLDPROG_CFLAGS)
4215TEMPLATE_VBOXBLDPROG_OBJCFLAGS.x86 = $(TEMPLATE_VBOXBLDPROG_CFLAGS.x86)
4216TEMPLATE_VBOXBLDPROG_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXBLDPROG_CFLAGS.amd64)
4217TEMPLATE_VBOXBLDPROG_OBJCFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CFLAGS.release)
4218TEMPLATE_VBOXBLDPROG_OBJCFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CFLAGS.profile)
4219TEMPLATE_VBOXBLDPROG_OBJCFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile)
4220TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
4221TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.x86)
4222TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.amd64)
4223TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
4224TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
4225TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.kprofile= $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
4226TEMPLATE_VBOXBLDPROG_LDFLAGS.x86 = -m32
4227TEMPLATE_VBOXBLDPROG_LDFLAGS.sparc32 = -m32
4228TEMPLATE_VBOXBLDPROG_LDFLAGS.amd64 = -m64
4229TEMPLATE_VBOXBLDPROG_LDFLAGS.sparc64 = -m64
4230 ifeq ($(KBUILD_HOST),linux)
4231TEMPLATE_VBOXBLDPROG_LIBS = pthread m rt dl
4232 else ifeq ($(KBUILD_HOST),os2)
4233TEMPLATE_VBOXBLDPROG_TOOL = GXX3OMF
4234TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
4235 else ifeq ($(KBUILD_HOST),darwin)
4236TEMPLATE_VBOXBLDPROG_TOOL = GXX4MACHO
4237 if "$(VBOX_DEF_MACOSX_VERSION_MIN)" == "10.7" || "$(VBOX_DARWIN_HOST_VERSION_MAJOR)" == "7"
4238TEMPLATE_VBOXBLDPROG_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_DEFS)
4239TEMPLATE_VBOXBLDPROG_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_CFLAGS) -fno-common
4240TEMPLATE_VBOXBLDPROG_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_CXXFLAGS)
4241TEMPLATE_VBOXBLDPROG_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
4242TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
4243TEMPLATE_VBOXBLDPROG_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_7_LDFLAGS)
4244 else if "$(VBOX_DEF_MACOSX_VERSION_MIN)" == "10.6" || "$(VBOX_DARWIN_HOST_VERSION_MAJOR)" == "6"
4245TEMPLATE_VBOXBLDPROG_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_DEFS)
4246TEMPLATE_VBOXBLDPROG_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_CFLAGS) -fno-common
4247TEMPLATE_VBOXBLDPROG_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_CXXFLAGS)
4248TEMPLATE_VBOXBLDPROG_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
4249TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
4250TEMPLATE_VBOXBLDPROG_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_LDFLAGS)
4251 else if "$(VBOX_DEF_MACOSX_VERSION_MIN)" == "10.5" || "$(VBOX_DARWIN_HOST_VERSION_MAJOR)" == "5" || defined(VBOX_MACOS_10_5_WORKAROUND)
4252TEMPLATE_VBOXBLDPROG_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_DEFS)
4253TEMPLATE_VBOXBLDPROG_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CFLAGS) -fno-common
4254TEMPLATE_VBOXBLDPROG_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS)
4255TEMPLATE_VBOXBLDPROG_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
4256TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
4257TEMPLATE_VBOXBLDPROG_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS)
4258 else
4259TEMPLATE_VBOXBLDPROG_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_DEFS)
4260TEMPLATE_VBOXBLDPROG_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -fno-common
4261TEMPLATE_VBOXBLDPROG_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
4262TEMPLATE_VBOXBLDPROG_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
4263TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
4264TEMPLATE_VBOXBLDPROG_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
4265 endif
4266TEMPLATE_VBOXBLDPROG_LIBS =
4267 else if1of ($(KBUILD_HOST), freebsd netbsd openbsd)
4268TEMPLATE_VBOXBLDPROG_TOOL = GXX3
4269TEMPLATE_VBOXBLDPROG_LIBS = pthread
4270TEMPLATE_VBOXBLDPROG_INCS += \
4271 /usr/include \
4272 /usr/X11R6/include \
4273 /usr/local/include
4274TEMPLATE_VBOXBLDPROG_LIBPATH += \
4275 /usr/lib \
4276 /usr/X11R6/lib \
4277 /usr/local/lib
4278 else ifeq ($(KBUILD_HOST),solaris)
4279TEMPLATE_VBOXBLDPROG_TOOL = GXX3PLAIN
4280TEMPLATE_VBOXBLDPROG_LIBS = rt
4281 else
4282$(warning Warning: VBOX Build: Target $(KBUILD_HOST) is not officially supported!)
4283 endif
4284
4285endif # !win
4286
4287
4288#
4289# Advanced build programs using IPRT, openssl and worse stuff.
4290#
4291TEMPLATE_VBoxAdvBldProg = Advanced VBox Build Program
4292TEMPLATE_VBoxAdvBldProg_EXTENDS = VBOXBLDPROG
4293TEMPLATE_VBoxAdvBldProg_SDKS = $(TEMPLATE_VBOXBLDPROG_SDKS) VBOX_BLD_OPENSSL
4294TEMPLATE_VBoxAdvBldProg_SDKS.win= $(TEMPLATE_VBOXBLDPROG_SDKS.win) VBOX_NTDLL
4295TEMPLATE_VBoxAdvBldProg_DEFS = $(TEMPLATE_VBOXBLDPROG_DEFS) IN_RT_R3
4296TEMPLATE_VBoxAdvBldProg_LIBS = \
4297 $(PATH_STAGE_LIB)/RuntimeBldProg$(VBOX_SUFF_LIB) \
4298 $(TEMPLATE_VBOXBLDPROG_LIBS)
4299TEMPLATE_VBoxAdvBldProg_LIBS.darwin = \
4300 $(TEMPLATE_VBOXBLDPROG_LIBS) \
4301 iconv \
4302 $(TEMPLATE_VBOXBLDPROG_LIBS.darwin)
4303TEMPLATE_VBoxAdvBldProg_LIBS.freebsd = \
4304 $(TEMPLATE_VBOXBLDPROG_LIBS) \
4305 iconv \
4306 rt \
4307 $(TEMPLATE_VBOXBLDPROG_LIBS.freebsd)
4308TEMPLATE_VBoxAdvBldProg_LIBS.linux = \
4309 $(TEMPLATE_VBOXBLDPROG_LIBS) \
4310 crypt \
4311 $(TEMPLATE_VBOXBLDPROG_LIBS.linux)
4312TEMPLATE_VBoxAdvBldProg_LIBS.solaris = \
4313 $(TEMPLATE_VBOXBLDPROG_LIBS) \
4314 contract \
4315 kstat \
4316 rt \
4317 socket \
4318 nsl \
4319 $(TEMPLATE_VBOXBLDPROG_LIBS.solaris)
4320
4321
4322#
4323# Windows rc workaround for crosscompiling.
4324# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
4325#
4326ifneq ($(KBUILD_HOST),win)
4327 TOOL_VCC100X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
4328 TOOL_VCC100AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
4329 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
4330 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
4331 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
4332 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
4333else
4334 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
4335 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
4336 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
4337 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
4338 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
4339 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
4340 ) Sorry_Cannot_find_mc_in_the_PSDK)
4341endif
4342
4343
4344#
4345# Template for building Linux host tools (only for KBUILD_TARGET=l4).
4346#
4347TEMPLATE_VBOXLNXHOSTR3EXE = Template for building linux host programs when targeting L4.
4348TEMPLATE_VBOXLNXHOSTR3EXE_INST = $(INST_BIN)
4349TEMPLATE_VBOXLNXHOSTR3EXE_BLD_TRG = linux
4350TEMPLATE_VBOXLNXHOSTR3EXE_TOOL = $(VBOX_GCC_TOOL)
4351TEMPLATE_VBOXLNXHOSTR3EXE_ASTOOL = YASM
4352TEMPLATE_VBOXLNXHOSTR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
4353TEMPLATE_VBOXLNXHOSTR3EXE_DLLSUFF = .so
4354TEMPLATE_VBOXLNXHOSTR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
4355TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_fno-stack-protector)
4356TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.debug = -fno-inline
4357TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
4358TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release)
4359TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release)
4360TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.release = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release)
4361TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.debug)
4362TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.profile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.profile)
4363TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.kprofile)
4364TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_fno-stack-protector)
4365TEMPLATE_VBOXLNXHOSTR3EXE_LIBS = pthread m rt dl
4366
4367TEMPLATE_VBOXLNXHOSTR3LIB = Template for linux host libraries.
4368TEMPLATE_VBOXLNXHOSTR3LIB_EXTENDS = VBOXLNXHOSTR3EXE
4369TEMPLATE_VBOXLNXHOSTR3LIB_INST = $(INST_LIB)
4370
4371
4372#
4373# Template for building R3 programs for the guest additions.
4374#
4375TEMPLATE_VBOXGUESTR3EXE = VBox Guest Program
4376ifeq ($(KBUILD_TARGET),win)
4377 TEMPLATE_VBOXGUESTR3EXE_EXTENDS = VBOXR3EXE
4378 TEMPLATE_VBOXGUESTR3EXE_SDKS = $(TEMPLATE_VBOXR3EXE_SDKS) VBOX_NTDLL
4379 TEMPLATE_VBOXGUESTR3EXE_CFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
4380 TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
4381 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS = $(filter-out /DISALLOWLIB:libcmt$(VBOX_VCC_CRT_TYPE).lib /DISALLOWLIB:libcpmt$(VBOX_VCC_CRT_TYPE).lib, $(TEMPLATE_VBOXR3EXE_LDFLAGS)) \
4382 /DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE).lib \
4383 /DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE).lib
4384 TEMPLATE_VBOXGUESTR3EXE_LIBS.x86 = \
4385 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.x86)_LIB)/oldnames.lib \
4386 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
4387 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
4388 TEMPLATE_VBOXGUESTR3EXE_LIBS.amd64 = \
4389 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.amd64)_LIB)/oldnames.lib \
4390 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.amd64)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
4391 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
4392else # the gcc guys
4393 TEMPLATE_VBOXGUESTR3EXE_EXTENDS = VBOXR3EXE
4394 TEMPLATE_VBOXGUESTR3EXE_TOOL := $(subst GXX,GCC,$(TEMPLATE_VBOXR3EXE_TOOL))
4395 TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fno-exceptions
4396 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%,$(TEMPLATE_VBOXR3EXE_LDFLAGS))
4397 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBOXR3EXE_LDFLAGS.linux))
4398endif
4399TEMPLATE_VBOXGUESTR3EXE_INST = $(INST_ADDITIONS)
4400TEMPLATE_VBOXGUESTR3EXE_DEFS := $(filter-out $(ARCH_BITS_DEFS), $(TEMPLATE_VBOXR3EXE_DEFS)) IN_GUEST IN_GUEST_R3 IN_RT_R3 $(VBOX_GC_ARCH_BITS_DEFS)
4401TEMPLATE_VBOXGUESTR3EXE_DEFS.linux := $(TEMPLATE_VBOXR3EXE_DEFS.linux) LOG_USE_C99 RT_WITHOUT_EXEC_ALLOC
4402ifeq ($(KBUILD_TARGET),linux) # As few libs as possible on linux.
4403 TEMPLATE_VBOXGUESTR3EXE_LIBS = pthread rt m
4404else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd)
4405 TEMPLATE_VBOXGUESTR3EXE_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS) iconv
4406else ifeq ($(KBUILD_TARGET), solaris)
4407 TEMPLATE_VBOXGUESTR3EXE_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS) nsl
4408endif
4409
4410
4411#
4412# Template for building R3 (dynamic) libraries for the guest additions.
4413#
4414TEMPLATE_VBOXGUESTR3DLL = VBox Guest User Dynamic Libraries
4415TEMPLATE_VBOXGUESTR3DLL_EXTENDS = VBOXGUESTR3EXE
4416## @todo add a INSTFUN that separates dlls and libs.
4417ifn1of ($(KBUILD_TARGET), darwin os2 win)
4418 TEMPLATE_VBOXGUESTR3DLL_DEFS = $(TEMPLATE_VBOXGUESTR3EXE_DEFS) PIC
4419 TEMPLATE_VBOXGUESTR3DLL_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fPIC
4420 TEMPLATE_VBOXGUESTR3DLL_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fPIC -fno-exceptions
4421 TEMPLATE_VBOXGUESTR3DLL_LDFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_LDFLAGS) -fPIC
4422endif
4423
4424#
4425# Template for building R3 (static) libraries for the guest additions.
4426#
4427TEMPLATE_VBOXGUESTR3LIB = VBox Guest User Libraries
4428TEMPLATE_VBOXGUESTR3LIB_EXTENDS = VBOXGUESTR3EXE
4429TEMPLATE_VBOXGUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
4430if1of ($(KBUILD_TARGET), solaris) ## @todo r=bird: Fix the *R3Mini template to VBOXGUESTR3DLL and remove this hack.
4431 TEMPLATE_VBOXGUESTR3LIB_DEFS = $(TEMPLATE_VBOXGUESTR3EXE_DEFS) PIC
4432 TEMPLATE_VBOXGUESTR3LIB_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fPIC
4433 TEMPLATE_VBOXGUESTR3LIB_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fPIC -fno-exceptions
4434endif
4435
4436#
4437# Template for building R3 programs for the guest additions (no -pedantic)
4438#
4439TEMPLATE_VBOXGUESTR3NPEXE = VBox Guest Program Non-pedantic
4440TEMPLATE_VBOXGUESTR3NPEXE_EXTENDS = VBOXGUESTR3EXE
4441ifneq ($(KBUILD_TARGET),win) # gcc only
4442TEMPLATE_VBOXGUESTR3NPEXE_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS)) -Wno-sign-compare
4443TEMPLATE_VBOXGUESTR3NPEXE_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXGUESTR3EXE_CFLAGS)) -Wno-sign-compare
4444endif
4445
4446#
4447# Template for building R3 (dynamic) libraries for the guest additions (no -pedantic)
4448#
4449TEMPLATE_VBOXGUESTR3NPDLL = VBox Guest User Dynamic Libraries Non-pedantic
4450TEMPLATE_VBOXGUESTR3NPDLL_EXTENDS = VBOXGUESTR3NPEXE
4451## @todo add a INSTFUN that separates dlls and libs.
4452ifn1of ($(KBUILD_TARGET), darwin os2 win)
4453 TEMPLATE_VBOXGUESTR3NPDLL_DEFS = $(TEMPLATE_VBOXGUESTR3NPEXE_DEFS) PIC
4454 TEMPLATE_VBOXGUESTR3NPDLL_CFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CFLAGS) -fPIC
4455 TEMPLATE_VBOXGUESTR3NPDLL_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CXXFLAGS) -fPIC -fno-exceptions
4456 TEMPLATE_VBOXGUESTR3NPDLL_LDFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_LDFLAGS) -fPIC
4457endif
4458
4459#
4460# Template for building R3 (static) libraries for the guest additions (no -pedantic)
4461#
4462TEMPLATE_VBOXGUESTR3NPLIB = VBox Guest User Libraries Non-pedantic
4463TEMPLATE_VBOXGUESTR3NPLIB_EXTENDS = VBOXGUESTR3NPEXE
4464TEMPLATE_VBOXGUESTR3NPLIB_INST = $(INST_ADDITIONS_LIB)
4465## @todo r=bird: Fix the *R3Mini template to VBOXGUESTR3DLL and remove this hack.
4466ifeq ($(filter-out solaris.x86 %.amd64 %.sparc32 %.sparc64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) ## TODO: Remove these checks!
4467 ifn1of ($(KBUILD_TARGET), darwin os2 win)
4468 TEMPLATE_VBOXGUESTR3NPLIB_DEFS = $(TEMPLATE_VBOXGUESTR3NPEXE_DEFS) PIC
4469 TEMPLATE_VBOXGUESTR3NPLIB_CFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CFLAGS) -fPIC
4470 TEMPLATE_VBOXGUESTR3NPLIB_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CXXFLAGS) -fPIC -fno-exceptions
4471 endif
4472endif
4473
4474
4475#
4476# Template for XFree86 guest modules (relocatable module, i.e. sysmod).
4477# This mostly about zapping the VBOXR3EXE linker flags and libraries.
4478#
4479TEMPLATE_VBOXGUESTR3XF86MOD = VBox XFree86 Guest Module
4480TEMPLATE_VBOXGUESTR3XF86MOD_EXTENDS = VBOXGUESTR3EXE
4481TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
4482TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
4483TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
4484TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
4485TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS = -r
4486if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd) # the gnu ld guys.
4487 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.release = -S
4488 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.x86 = -m elf_i386
4489 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.amd64 = -m elf_x86_64
4490endif
4491TEMPLATE_VBOXGUESTR3XF86MOD_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fno-merge-constants -std=c99 $(VBOX_GCC_fno-stack-protector) -ffreestanding
4492TEMPLATE_VBOXGUESTR3XF86MOD_CXXFLAGS= $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fno-merge-constants $(VBOX_GCC_fno-stack-protector) -ffreestanding
4493TEMPLATE_VBOXGUESTR3XF86MOD_SYSSUFF = .o
4494TEMPLATE_VBOXGUESTR3XF86MOD_LIBS = \
4495 $(VBOX_LIB_VBGL_R3_XFREE86)
4496TEMPLATE_VBOXGUESTR3XF86MOD_DEFS = $(TEMPLATE_VBOXGUESTR3DLL_DEFS) VBOX_GUESTR3XF86MOD RTMEM_NO_WRAP_TO_EF_APIS
4497
4498
4499#
4500# Template for XFree86 guest libraries.
4501#
4502TEMPLATE_VBOXGUESTR3XF86LIB = VBox XFree86 Guest Library
4503TEMPLATE_VBOXGUESTR3XF86LIB_EXTENDS = VBOXGUESTR3XF86MOD
4504TEMPLATE_VBOXGUESTR3XF86LIB_INST = $(INST_ADDITIONS_LIB)
4505
4506
4507#
4508# Template for X.org guest modules (shared libs).
4509# This mostly about zapping unnecessary LIBS from VBOXGUESTR3DLL and adding some flags.
4510#
4511TEMPLATE_VBOXGUESTR3XORGMOD = VBox X.org Guest Module
4512TEMPLATE_VBOXGUESTR3XORGMOD_EXTENDS = VBOXGUESTR3DLL
4513TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
4514TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
4515TEMPLATE_VBOXGUESTR3XORGMOD_CFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_CFLAGS) -std=c99
4516TEMPLATE_VBOXGUESTR3XORGMOD_DEFS = $(TEMPLATE_VBOXGUESTR3DLL_DEFS) LOG_TO_BACKDOOR VBOX_GUESTR3XORGMOD RTMEM_NO_WRAP_TO_EF_APIS
4517ifeq ($(KBUILD_TARGET_ARCH),amd64)
4518 TEMPLATE_VBOXGUESTR3XORGMOD_DEFS += _XSERVER64
4519endif
4520if1of ($(KBUILD_TARGET), linux)
4521 TEMPLATE_VBOXGUESTR3XORGMOD_LDFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_LDFLAGS)
4522endif
4523TEMPLATE_VBOXGUESTR3XORGMOD_LIBS = \
4524 $(VBOX_LIB_VBGL_R3_SHARED) \
4525 $(VBOX_LIB_IPRT_GUEST_R3_MINI) \
4526 $(VBOX_LIB_VBGL_R3_SHARED) \
4527 $(VBOX_LIB_IPRT_GUEST_R3_MINI)
4528TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.freebsd += \
4529 iconv
4530
4531
4532#
4533# Template for building R0 drivers for the guest additions.
4534#
4535TEMPLATE_VBOXGUESTR0 = VBox Guest Driver
4536TEMPLATE_VBOXGUESTR0_EXTENDS = VBOXR0DRV
4537TEMPLATE_VBOXGUESTR0_INST = $(INST_ADDITIONS)
4538TEMPLATE_VBOXGUESTR0_SDKS.win.x86 = WIN32SDK $(VBOX_WINDDK)
4539TEMPLATE_VBOXGUESTR0_SDKS.win.amd64 = $(VBOX_WINDDK) WINPSDKINCS
4540TEMPLATE_VBOXGUESTR0_LIBS.win.x86 = \
4541 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/int64.lib
4542TEMPLATE_VBOXGUESTR0_DEFS = $(TEMPLATE_VBOXR0DRV_DEFS) IN_GUEST IN_GUEST_R0
4543ifeq ($(KBUILD_TARGET),solaris) # No VBI for the guest additions yet.
4544 TEMPLATE_VBOXGUESTR0_LDFLAGS = -r -dy
4545endif
4546ifn1of (darwin os2 win, $(KBUILD_TARGET))
4547 TEMPLATE_VBOXGUESTR0_CFLAGS = $(patsubst %/VBox/SUPDrvMangling.h,%/VBox/VBoxGuestMangling.h,$(TEMPLATE_VBOXR0DRV_CFLAGS))
4548 TEMPLATE_VBOXGUESTR0_CXXFLAGS = $(patsubst %/VBox/SUPDrvMangling.h,%/VBox/VBoxGuestMangling.h,$(TEMPLATE_VBOXR0DRV_CXXFLAGS))
4549endif
4550
4551#
4552# Template for building R0 libraries for the guest additions.
4553#
4554TEMPLATE_VBOXGUESTR0LIB = VBox Guest Driver Libraries
4555TEMPLATE_VBOXGUESTR0LIB_EXTENDS = VBOXGUESTR0
4556TEMPLATE_VBOXGUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
4557
4558#
4559# Template for building OpenGL host dlls.
4560#
4561TEMPLATE_VBOXCROGLR3HOSTDLL = VBox OpenGL Host DLLs
4562TEMPLATE_VBOXCROGLR3HOSTDLL_EXTENDS = VBOXR3NP
4563TEMPLATE_VBOXCROGLR3HOSTDLL_EXTENDS_BY = prepending
4564TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS = CHROMIUM_THREADSAFE VBOX_WITH_HGCM UNPACKS
4565TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.win = _WIN32_WINNT=0x0500 WINDOWS=1
4566TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.linux = Linux=1 _GNU_SOURCE
4567TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.solaris = SunOS=1 _GNU_SOURCE #GLEXT_64_TYPES_DEFINED
4568TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE
4569ifdef VBOX_WITH_COCOA_QT
4570 TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.darwin += VBOX_WITH_COCOA_QT
4571 TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.darwin = -framework AppKit
4572else
4573 TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.darwin = -framework Carbon
4574endif
4575TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.freebsd = FreeBSD=1 _GNU_SOURCE
4576TEMPLATE_VBOXCROGLR3HOSTDLL_INCS = $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES)
4577TEMPLATE_VBOXCROGLR3HOSTDLL_SDKS.darwin = DARWIN-OPENGL
4578TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.darwin += \
4579 -framework OpenGL \
4580 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
4581 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
4582TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.linux = -Wl,--no-as-needed
4583TEMPLATE_VBOXCROGLR3HOSTDLL_BLDDIRS = $(VBOX_PATH_CROGL_GENFILES)/
4584
4585#
4586# Template for building OpenGL host libraries.
4587#
4588TEMPLATE_VBOXCROGLR3HOSTLIB = VBox OpenGL Host Libraries
4589TEMPLATE_VBOXCROGLR3HOSTLIB_EXTENDS = VBOXCROGLR3HOSTDLL
4590TEMPLATE_VBOXCROGLR3HOSTLIB_INST = $(INST_LIB)
4591
4592#
4593# Template for building OpenGL guest dlls.
4594#
4595TEMPLATE_VBOXCROGLR3GUESTDLL = VBox OpenGL Guest DLLs
4596TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS = VBOXGUESTR3NPDLL
4597TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS_BY = prepending
4598TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS = CHROMIUM_THREADSAFE VBOX_WITH_HGCM
4599TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.win = WINDOWS=1
4600TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.linux = Linux=1 _GNU_SOURCE
4601TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.solaris = SunOS=1 _GNU_SOURCE #GLEXT_64_TYPES_DEFINED
4602TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE
4603ifdef VBOX_WITH_COCOA_QT
4604 TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.darwin += VBOX_WITH_COCOA_QT
4605 TEMPLATE_VBOXCROGLR3GUESTDLL_LDFLAGS.darwin = -framework AppKit
4606else
4607 TEMPLATE_VBOXCROGLR3GUESTDLL_LDFLAGS.darwin = -framework Carbon
4608endif
4609TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.freebsd = FreeBSD=1 _GNU_SOURCE
4610TEMPLATE_VBOXCROGLR3GUESTDLL_INCS = $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES)
4611TEMPLATE_VBOXCROGLR3GUESTDLL_SDKS.darwin = DARWIN-OPENGL
4612TEMPLATE_VBOXCROGLR3GUESTDLL_LDFLAGS.darwin += \
4613 -framework OpenGL \
4614 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
4615 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
4616TEMPLATE_VBOXCROGLR3GUESTDLL_BLDDIRS = $(VBOX_PATH_CROGL_GENFILES)/
4617
4618#
4619# Template for building OpenGL guest libraries.
4620#
4621TEMPLATE_VBOXCROGLR3GUESTLIB = VBox OpenGL Guest Libraries
4622TEMPLATE_VBOXCROGLR3GUESTLIB_EXTENDS = VBOXCROGLR3GUESTDLL
4623TEMPLATE_VBOXCROGLR3GUESTLIB_INST = $(INST_ADDITIONS_LIB)
4624
4625
4626#
4627# Template for building Mesa guest library, Linux-only so far.
4628#
4629TEMPLATE_VBOXMESAR3GUESTLIB = VBox Mesa Guest Library
4630TEMPLATE_VBOXMESAR3GUESTLIB_EXTENDS = VBOXCROGLR3GUESTDLL
4631TEMPLATE_VBOXMESAR3GUESTLIB_INST = $(INST_ADDITIONS_LIB)
4632TEMPLATE_VBOXMESAR3GUESTLIB_DEFS.linux = Linux=1
4633TEMPLATE_VBOXMESAR3GUESTLIB_DEFS.solaris = SunOS=1
4634TEMPLATE_VBOXMESAR3GUESTLIB_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY
4635ifeq ($(KBUILD_TARGET),linux)
4636 TEMPLATE_VBOXMESAR3GUESTLIB_ASTOOL = $(TEMPLATE_VBOXCROGLR3GUESTDLL_TOOL)
4637 TEMPLATE_VBOXMESAR3GUESTLIB_ASFLAGS = $(NO_SUCH_VARIABLE)
4638 TEMPLATE_VBOXMESAR3GUESTLIB_ASFLAGS.x86 = -m32
4639 TEMPLATE_VBOXMESAR3GUESTLIB_ASFLAGS.amd64 = -m64
4640 TEMPLATE_VBOXMESAR3GUESTLIB_ASDEFS = $(NO_SUCH_VARIABLE)
4641endif
4642
4643
4644#
4645# Guest additions libraries (all static).
4646# The _MINI and _SHARED are both compiled as PIC and intended for linking into a .so/.dll/.dylib.
4647#
4648VBOX_LIB_IPRT_GUEST_R3 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3$(VBOX_SUFF_LIB)
4649VBOX_LIB_IPRT_GUEST_R3_MINI = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3Mini$(VBOX_SUFF_LIB)
4650VBOX_LIB_IPRT_GUEST_R3_SHARED = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3Shared$(VBOX_SUFF_LIB)
4651VBOX_LIB_IPRT_GUEST_R0 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR0$(VBOX_SUFF_LIB)
4652ifeq ($(KBUILD_TARGET_ARCH),x86)
4653 VBOX_LIB_IPRT_GUEST_R0_NT4 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR0NT4$(VBOX_SUFF_LIB)
4654else
4655 VBOX_LIB_IPRT_GUEST_R0_NT4 = $(VBOX_LIB_IPRT_GUEST_R0)
4656endif
4657VBOX_LIB_VBGL_R3 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3Lib$(VBOX_SUFF_LIB)
4658VBOX_LIB_VBGL_R3_XFREE86 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibXFree86$(VBOX_SUFF_LIB)
4659VBOX_LIB_VBGL_R3_SHARED = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibShared$(VBOX_SUFF_LIB)
4660VBOX_LIB_VBGL_R0BASE = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0LibBase$(VBOX_SUFF_LIB)
4661VBOX_LIB_VBGL_R0 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0Lib$(VBOX_SUFF_LIB)
4662ifeq ($(KBUILD_TARGET),x86)
4663 VBOX_LIB_IPRT_GUEST_R3_X86 = $(VBOX_LIB_IPRT_GUEST_R3)
4664 VBOX_LIB_IPRT_GUEST_R3_SHARED_X86 = $(VBOX_LIB_IPRT_GUEST_R3_SHARED)
4665 VBOX_LIB_VBGL_R3_X86 = $(VBOX_LIB_VBGL_R3)
4666 VBOX_LIB_VBGL_R3_SHARED_X86 = $(VBOX_LIB_VBGL_R3_SHARED)
4667else
4668 VBOX_LIB_IPRT_GUEST_R3_X86 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3-x86$(VBOX_SUFF_LIB)
4669 VBOX_LIB_IPRT_GUEST_R3_SHARED_X86 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3Shared-x86$(VBOX_SUFF_LIB)
4670 VBOX_LIB_VBGL_R3_X86 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3Lib-x86$(VBOX_SUFF_LIB)
4671 VBOX_LIB_VBGL_R3_SHARED_X86 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibShared-x86$(VBOX_SUFF_LIB)
4672endif
4673
4674
4675
4676#
4677# Two targets to coordinate version number changes properly. Note that the
4678# only way to get a really consistent build is to run 'kmk' in the top-level
4679# directory. If you don't run it there, you get a consistent sub-tree only.
4680#
4681VBOX_BAD_CHAR_SET = ,;:/\$(SP)$(TAB)$(HASH)=![]@%&''()*""<>?^{}|~
4682VBOX_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),,_)
4683VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
4684VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
4685
4686$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
4687 $(call MSG_GENERATE,,$@)
4688 $(QUIET)$(MKDIR) -p $(@D)
4689 $(QUIET)$(RM) -f $(wildcard $(PATH_OUT)/version-stamp-*)
4690 $(QUIET)$(APPEND) $@ $(VBOX_VERSION_STRING)
4691
4692$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
4693 $(call MSG_GENERATE,,$@)
4694 $(QUIET)$(MKDIR) -p $(@D)
4695 $(QUIET)$(RM) -f $@ [email protected]
4696 $(QUIET)$(APPEND) [email protected] '#ifndef ___version_generated_h___'
4697 $(QUIET)$(APPEND) [email protected] '#define ___version_generated_h___'
4698 $(QUIET)$(APPEND) [email protected] ''
4699 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)'
4700 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)'
4701 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)'
4702 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_STRING_RAW "$(VBOX_VERSION_STRING_RAW)"'
4703 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_STRING "$(VBOX_VERSION_STRING)"'
4704 $(QUIET)$(APPEND) [email protected] '#define VBOX_API_VERSION_STRING "$(VBOX_API_VERSION)"'
4705 $(QUIET)$(APPEND) [email protected] ''
4706 $(QUIET)$(APPEND) [email protected] '#endif'
4707 $(QUIET)$(MV) -f [email protected] $@
4708
4709
4710VBOX_PACKAGE_HEADER = $(PATH_OUT)/package-generated.h
4711
4712$(VBOX_PACKAGE_HEADER):
4713 $(call MSG_GENERATE,,$@)
4714 $(QUIET)$(MKDIR) -p $(@D)
4715 $(QUIET)$(RM) -f $@ [email protected]
4716 $(QUIET)$(APPEND) [email protected] '#ifndef ___package_generated_h___'
4717 $(QUIET)$(APPEND) [email protected] '#define ___package_generated_h___'
4718 $(QUIET)$(APPEND) [email protected] ''
4719 $(QUIET)$(APPEND) [email protected] '#define VBOX_PACKAGE_STRING "$(VBOX_PACKAGE_STRING)"'
4720 $(QUIET)$(APPEND) [email protected] ''
4721 $(QUIET)$(APPEND) [email protected] '#endif'
4722 $(QUIET)$(MV) -f [email protected] $@
4723
4724VBOX_PRODUCT_HEADER = $(PATH_OUT)/product-generated.h
4725
4726$(VBOX_PRODUCT_HEADER): $(VBOX_VERSION_STAMP)
4727 $(call MSG_GENERATE,,$@)
4728 $(QUIET)$(MKDIR) -p $(@D)
4729 $(QUIET)$(RM) -f $@ [email protected]
4730 $(QUIET)$(APPEND) [email protected] '#ifndef ___product_generated_h___'
4731 $(QUIET)$(APPEND) [email protected] '#define ___product_generated_h___'
4732 $(QUIET)$(APPEND) [email protected] ''
4733 $(QUIET)$(APPEND) [email protected] '#define VBOX_VENDOR "$(VBOX_VENDOR)"'
4734 $(QUIET)$(APPEND) [email protected] '#define VBOX_VENDOR_SHORT "$(VBOX_VENDOR_SHORT)"'
4735 $(QUIET)$(APPEND) [email protected] '#define VBOX_PRODUCT "$(VBOX_PRODUCT)"'
4736 $(QUIET)$(APPEND) [email protected] '#define VBOX_C_YEAR "$(VBOX_C_YEAR)"'
4737 $(QUIET)$(APPEND) [email protected] ''
4738 $(QUIET)$(APPEND) [email protected] '#endif'
4739 $(QUIET)$(MV) -f [email protected] $@
4740
4741#
4742# Used for external makefiles which cannot include Config.kmk
4743#
4744$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
4745 $(call MSG_GENERATE,,$@)
4746 $(QUIET)$(RM) -f $@ [email protected]
4747 $(QUIET)$(MKDIR) -p $(@D)
4748 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)'
4749 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)'
4750 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)'
4751 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_STRING = $(VBOX_VERSION_STRING)'
4752 $(QUIET)$(APPEND) [email protected] 'VBOX_VENDOR = $(VBOX_VENDOR)'
4753 $(QUIET)$(APPEND) [email protected] 'VBOX_VENDOR_SHORT = $(VBOX_VENDOR_SHORT)'
4754 $(QUIET)$(APPEND) [email protected] 'VBOX_PRODUCT = $(VBOX_PRODUCT)'
4755 $(QUIET)$(APPEND) [email protected] 'VBOX_C_YEAR = $(VBOX_C_YEAR)'
4756 $(QUIET)$(MV) -f [email protected] $@
4757
4758if !defined(VBOX_OSE) && !defined(VBOX_NOINC_LICENSE_VER_KMK)
4759 if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris)
4760 # VBOX_LICENSE_VER is used in several Makefiles
4761 VBOX_LICENSE_VER_KMK = $(PATH_OUT)/license-version.kmk
4762$(VBOX_LICENSE_VER_KMK): $(VBOX_BRAND_LICENSE_HTML)
4763 $(call MSG_GENERATE,,$(VBOX_LICENSE_VER_KMK))
4764 $(QUIET)$(MKDIR) -p $(@D)
4765 ifdef VBOX_BRAND_LICENSE_VER
4766 $(QUIET)$(RM) -f '$@'
4767 $(APPEND) '$@' 'VBOX_LICENSE_VER=$(VBOX_BRAND_LICENSE_VER)'
4768 else
4769 $(QUIET)$(SED) -e "s/.*License version \([0-9.]*\) *[,&].*/VBOX_LICENSE_VER=\1/;t;d" --output $@ $(VBOX_BRAND_LICENSE_HTML)
4770 endif
4771 -include $(VBOX_LICENSE_VER_KMK)
4772 ifdef VBOX_LICENSE_VER
4773 VBOX_LICENSE_FILES = \
4774 License-$(VBOX_LICENSE_VER).html \
4775 $(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES),License-$(VBOX_LICENSE_VER)-$(f).html)
4776 VBOX_LICENSE_BINS = $(addprefix $(PATH_STAGE_BIN)/,$(VBOX_LICENSE_FILES))
4777 endif
4778 endif
4779endif
4780
4781
4782ifndef VBOX_NOINC_MISC
4783# Force building of the version header file as the first thing anywhere in
4784# the tree. This eliminates the need for manual dependencies on it.
4785## @todo there gotta be a better way of doing this.
4786Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK) $(VBOX_PRODUCT_HEADER) $(VBOX_PACKAGE_HEADER)
4787endif
4788
4789
4790#
4791# Subversion tree revision.
4792#
4793# The VBOX_SVN_REV contains our best guess. Use svn info on the root of the
4794# tree to determin this it if .svn/entries is found, otherwise fall back on
4795# the Config.kmk revision.
4796#
4797# Makefile rules using this information shall list $(VBOX_SVN_REV_KMK) as a
4798# prerequisite.
4799#
4800SVN ?= svn$(HOSTSUFF_EXE)
4801VBOX_SVN_REV_KMK = $(PATH_OUT)/revision.kmk
4802ifndef VBOX_SVN_REV
4803 VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 38184 $ )
4804 VBOX_SVN_DEP := $(wildcard $(PATH_ROOT)/.svn/entries)
4805 ifeq ($(which $(SVN)),)
4806 VBOX_SVN_DEP :=
4807 endif
4808
4809# Rule for generating a timestamp and updating the real thing on change.
4810$(VBOX_SVN_REV_KMK).ts +| $(VBOX_SVN_REV_KMK): $(if $(VBOX_SVN_DEP), $(VBOX_SVN_DEP), $(PATH_ROOT)/Config.kmk)
4811 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
4812 $(QUIET)$(RM) -f $@ [email protected]
4813 $(QUIET)$(MKDIR) -p $(@D)
4814 ifneq ($(VBOX_SVN_DEP),)
4815 $(REDIRECT) -E 'LC_ALL=C' -wo [email protected] -- $(SVN) info $(PATH_ROOT)
4816 ifeq ($(int-mod $(VBOX_VERSION_BUILD), 2),0)
4817 $(SED) -e '/^Last Changed Rev/!d' -e 's/Last Changed Rev\: */export VBOX_SVN_REV=/' --output $@ [email protected]
4818 else
4819 $(SED) -e '/^Revision/!d' -e 's/Revision\: */export VBOX_SVN_REV=/' --output $@ [email protected]
4820 endif
4821 $(QUIET)$(RM) -f [email protected]
4822 else
4823 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV_FALLBACK)'
4824 endif
4825 $(QUIET)$(CP) --changed -fv $@ $(VBOX_SVN_REV_KMK)
4826
4827 ifndef VBOX_NOINC_SVN_REV_KMK
4828 include $(VBOX_SVN_REV_KMK)
4829 endif
4830else
4831# allow to overwrite VBOX_SVN_REV externally (mainly for building .debs/.rpms)
4832$(VBOX_SVN_REV_KMK):
4833 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
4834 $(QUIET)$(RM) -f $@
4835 $(QUIET)$(MKDIR) -p $(@D)
4836 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV)'
4837 $(QUIET)echo '* $(VBOX_SVN_REV_KMK) was externally overwritten:'
4838 $(QUIET)$(CAT) $(VBOX_SVN_REV_KMK)
4839endif
4840
4841# only needed for VBoxGuest for Linux/FreeBSD guests
4842VBOX_SVN_REV_HEADER = $(PATH_OUT)/revision-generated.h
4843$(VBOX_SVN_REV_HEADER): $(VBOX_SVN_REV_KMK)
4844 $(call MSG_GENERATE,,$@)
4845 $(QUIET)$(RM) -f $@ [email protected]
4846 $(QUIET)$(MKDIR) -p $(@D)
4847 $(QUIET)$(APPEND) [email protected] '#define VBOX_SVN_REV $(VBOX_SVN_REV)'
4848 $(QUIET)$(MV) -f [email protected] $@
4849
4850#
4851# Shared definitions of the XIDL file to use as a source for
4852# generating various other files (VBoxSVC, webservice, docs, front-ends, ...)
4853#
4854
4855# Real XIDL source file; from this we strip the <desc> elements to generate
4856# a second XIDL file, from which the COM/XPCOM IDL files are then generated:
4857VBOX_XIDL_FILE_SRC = $(PATH_ROOT)/src/VBox/Main/idl/VirtualBox.xidl
4858# second XIDL file to use as source for COM/XPCOM IDL (with stripped docs):
4859VBOX_XIDL_FILE = $(PATH_OUT)/obj/VirtualBox_stripped.xidl
4860
4861# Java stuff.
4862ifeq ($(KBUILD_TARGET), darwin)
4863 VBOX_JAVA_COMMANDS = $(firstword $(wildcard \
4864 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands \
4865 /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands \
4866 $(if-expr $(VBOX_XCODE_VERSION_MAJOR) >= 4,/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands,) \
4867 ) /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands)
4868 VBOX_JAVAC = $(VBOX_JAVA_COMMANDS)/javac
4869 VBOX_JAVAH = $(VBOX_JAVA_COMMANDS)/javah
4870 VBOX_JAR = $(VBOX_JAVA_COMMANDS)/jar
4871 VBOX_WSIMPORT = $(VBOX_JAVA_COMMANDS)/wsimport
4872 if $(VBOX_XCODE_VERSION_MAJOR) >= 4 # Lion (4.1-preview 5) has a broken CurrentJDK link. Blindly applying it to 4.0.
4873 VBOX_JAVA_INC = $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers
4874 else
4875 VBOX_JAVA_INC = $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Headers
4876 endif
4877
4878else
4879
4880 ifeq ($(KBUILD_TARGET),linux)
4881 ifeq ($(origin VBOX_JAVA_HOME),undefined)
4882 # Add correct detection for you distro after the /usr/../java-6-sun line.
4883 VBOX_JAVA_HOME := $(firstword $(wildcard \
4884 $(PATH_DEVTOOLS)/linux.x86/jdk1.6.0_21 \
4885 /usr/lib/jvm/java-6-sun \
4886 /usr/lib/jvm/java-6-openjdk \
4887 \
4888 /usr/lib/jvm/sun-jdk-1.6 \
4889 ) /usr/lib/jvm/java-6-sun)
4890 endif
4891 endif
4892
4893 ifeq ($(KBUILD_TARGET),solaris)
4894 # VBOX_JAVA_HOME ?= /usr/jdk/jdk1.6.0
4895 VBOX_JAVA_HOME ?= /usr/java
4896 endif
4897
4898 ifeq ($(KBUILD_TARGET),win)
4899 VBOX_JAVA_HOME ?= c:/jdk
4900 endif
4901
4902 VBOX_JAVAC = $(VBOX_JAVA_HOME)/bin/javac
4903 VBOX_JAVAH = $(VBOX_JAVA_HOME)/bin/javah
4904 VBOX_JAR = $(VBOX_JAVA_HOME)/bin/jar
4905 VBOX_WSIMPORT = $(VBOX_JAVA_HOME)/bin/wsimport
4906 # correct for targets we care about
4907 VBOX_MD_OS = $(KBUILD_TARGET)
4908 VBOX_JAVA_INC = \
4909 $(VBOX_JAVA_HOME)/include \
4910 $(VBOX_JAVA_HOME)/include/$(VBOX_MD_OS)
4911endif
4912
4913ifeq ($(KBUILD_TARGET), win)
4914 VBOX_SEP=\;
4915else
4916 VBOX_SEP=:
4917endif
4918VBOX_JAVAC_OPTS = -source 1.5 -target 1.5 -Xlint:unchecked
4919
4920#
4921# Legacy.
4922#
4923## @todo try remove this.
4924ifneq ($(LOCALCFG),)
4925 include $(LOCALCFG)
4926endif
4927
4928
4929#
4930# Some extra goals.
4931#
4932.PHONY: up update st stat status
4933up update::
4934 $(SVN) up
4935
4936up2 update2::
4937 $(SVN) up --ignore-externals
4938
4939st stat status:
4940 $(SVN) status
4941
4942quick:
4943 $(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