VirtualBox

source: vbox/trunk/Config.kmk@ 33567

Last change on this file since 33567 was 33408, checked in by vboxsync, 14 years ago

Removed VBOX_DYNAMIC_NET_ATTACH, we don't need to keep this optional.

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