VirtualBox

source: vbox/trunk/Config.kmk@ 32501

Last change on this file since 32501 was 32471, checked in by vboxsync, 14 years ago

Devices: refactoring, further PCI work

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

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