VirtualBox

source: vbox/trunk/Config.kmk@ 38066

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

4.1.1

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