VirtualBox

source: vbox/trunk/Config.kmk@ 34575

Last change on this file since 34575 was 34566, checked in by vboxsync, 14 years ago

Config.kmk: Added VBOX_EDIT_VERSION_RULE_FN and VBOX_EDIT_VERSION_CMD_FN for doing version string replacements in files.

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

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