VirtualBox

source: vbox/trunk/Config.kmk@ 16199

Last change on this file since 16199 was 16187, checked in by vboxsync, 16 years ago

Added VBOX_BOOST SDK.

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