VirtualBox

source: vbox/trunk/Config.kmk@ 33595

Last change on this file since 33595 was 33590, checked in by vboxsync, 14 years ago

VRDE: removed VBOX_WITH_VRDP from source code, also some obsolete code removed.

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