VirtualBox

source: vbox/trunk/Config.kmk@ 28317

Last change on this file since 28317 was 28303, checked in by vboxsync, 15 years ago

Misc: made it possible to do: DEFS += RTMEM_WRAP_TO_EF_APIS RTALLOC_USE_EFENCE

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