VirtualBox

source: vbox/trunk/Config.kmk@ 14833

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

Drop the global VBOX_WITH_NEW_RECOMPILER global.

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