VirtualBox

source: vbox/trunk/Config.kmk@ 37198

Last change on this file since 37198 was 37186, checked in by vboxsync, 14 years ago

Config.kmk: Workaround lion java / SDK screw up.

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