VirtualBox

source: vbox/trunk/Config.kmk@ 28272

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

Config.kmk: LIB_RUNTIME_EF usage bug.

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