VirtualBox

source: vbox/trunk/Config.kmk@ 28112

Last change on this file since 28112 was 28097, checked in by vboxsync, 15 years ago

Link Windows .r0/.gc modules with debug info.

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