VirtualBox

source: vbox/trunk/Config.kmk@ 41247

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

Config.kmk: VBOX_VBOXCPP and VBOX_INST_DTRACE_LIB.

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