VirtualBox

source: vbox/trunk/Config.kmk@ 28728

Last change on this file since 28728 was 28673, checked in by vboxsync, 15 years ago

Rebranding: readme in list

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