VirtualBox

source: vbox/trunk/Config.kmk@ 34607

Last change on this file since 34607 was 34595, checked in by vboxsync, 14 years ago

Config.kmk: typo

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