VirtualBox

source: vbox/trunk/Config.kmk@ 24584

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

EFI: binary EFI firmware

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