VirtualBox

source: vbox/trunk/Config.kmk@ 28867

Last change on this file since 28867 was 28866, checked in by vboxsync, 15 years ago

update

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