VirtualBox

source: vbox/trunk/Config.kmk@ 37752

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

fix USB 2.0 for OSE builds

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