VirtualBox

source: vbox/trunk/Config.kmk@ 15410

Last change on this file since 15410 was 15373, checked in by vboxsync, 16 years ago

rem: fixed Mac builds and alignment problems

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