VirtualBox

source: vbox/trunk/Config.kmk@ 37260

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

openssl compile fix

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