VirtualBox

source: vbox/trunk/Config.kmk@ 26403

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

HPET: cleanup, OSE export, enable R0

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