VirtualBox

source: vbox/trunk/Config.kmk@ 49116

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

*.kmk: Some template cleanup, adding VBoxR3Tool for dev tools (bin/tools/).

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