VirtualBox

source: vbox/trunk/Config.kmk@ 26166

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

Config.kmk: Added short vendor name (for Windows registry paths etc).

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