VirtualBox

source: vbox/trunk/Config.kmk@ 17056

Last change on this file since 17056 was 17037, checked in by vboxsync, 16 years ago

Config.kmk: Disabled new liblzf, crash in RTZipCompFinish.

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