VirtualBox

source: vbox/trunk/Config.kmk@ 33973

Last change on this file since 33973 was 33935, checked in by vboxsync, 14 years ago

VMM: mask all Local APIC interrupt vectors which are set up to NMI mode during world switch (raw mode only)

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