VirtualBox

source: vbox/trunk/Config.kmk@ 14435

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

Disable opengl where not available

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