VirtualBox

source: vbox/trunk/Config.kmk@ 29615

Last change on this file since 29615 was 29517, checked in by vboxsync, 15 years ago

Fedora 13 build fix

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