VirtualBox

source: vbox/trunk/Config.kmk@ 32766

Last change on this file since 32766 was 32622, checked in by vboxsync, 14 years ago

wddm: VBOXWDDM->VBOX_WITH_WDDM

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