VirtualBox

source: vbox/trunk/Config.kmk@ 27909

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

remove VMI experiment (no longer supported by the other company)

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