VirtualBox

source: vbox/trunk/Config.kmk@ 29452

Last change on this file since 29452 was 29430, checked in by vboxsync, 15 years ago

after Beta 3

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