VirtualBox

source: vbox/trunk/Config.kmk@ 23858

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

Temporary disable the new I/O path.

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