VirtualBox

source: vbox/trunk/Config.kmk@ 15005

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

Config.kmk: disabled VBOX_WITH_DBUS again

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