VirtualBox

source: vbox/trunk/Config.kmk@ 26219

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

Config.kmk: VBOX_WITH_WARNINGS_AS_ERRORS=1 on darwin.

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