VirtualBox

source: vbox/trunk/Config.kmk@ 29124

Last change on this file since 29124 was 29122, checked in by vboxsync, 15 years ago

FE/Qt, Devices: moved VDE plugin headers into include/VBox and enabled VDE in the GUI, but only if the plugin is found on the host (Linux and FreeBSD only)

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