VirtualBox

source: vbox/trunk/Config.kmk@ 46653

Last change on this file since 46653 was 46653, checked in by vboxsync, 11 years ago

Config.kmk: Moved a few C/C++ defines from DEFS to CDEFS (+CXXDEFS) to make MASM 5.10 work.

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