VirtualBox

source: vbox/trunk/Config.kmk@ 38241

Last change on this file since 38241 was 38234, checked in by vboxsync, 13 years ago

Config.kmk: enable translated manual builds in OSE

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