VirtualBox

source: vbox/trunk/Config.kmk@ 35789

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

Main, Device: passthrough conditional

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette