VirtualBox

source: vbox/trunk/Config.kmk@ 31903

Last change on this file since 31903 was 31902, checked in by vboxsync, 14 years ago

OSE compile fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 177.8 KB
Line 
1# $Id: Config.kmk 31902 2010-08-24 09:56:42Z 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-2010 Oracle Corporation
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 (GPL) as published by the Free Software
16# Foundation, in version 2 as it comes in the "COPYING" file of the
17# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18# hope that it will 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# Temporary hack for kBuild ticket #83.
57## @todo kBuild: remove after closing ticket #83.
58PROPS_ACCUMULATE_L_LNK += INTERMEDIATES
59PROPS_PROGRAMS_ACCUMULATE_L += INTERMEDIATES
60PROPS_LIBRARIES_ACCUMULATE_L += INTERMEDIATES
61PROPS_DLLS_ACCUMULATE_L += INTERMEDIATES
62PROPS_SYSMODS_ACCUMULATE_L += INTERMEDIATES
63PROPS_MISCBINS_ACCUMULATE_L += INTERMEDIATES
64
65# Install paths.
66PATH_INS = $(PATH_OUT)
67ifeq ($(KBUILD_TARGET),darwin)
68 INST_DIST = dist/
69 INST_SDK = $(INST_DIST)sdk/
70
71 # the bundles
72 INST_VIRTUALBOX = $(INST_DIST)VirtualBox.app/
73 INST_VBOXDRV = $(INST_DIST)VBoxDrv.kext/
74 INST_VBOXNETFLT = $(INST_DIST)VBoxNetFlt.kext/
75 INST_VBOXNETADP = $(INST_DIST)VBoxNetAdp.kext/
76 INST_VBOXUSB = $(INST_DIST)VBoxUSB.kext/
77
78 # put everything in the VirtualBox app bundle.
79 INST_BIN = $(INST_VIRTUALBOX)Contents/MacOS/
80 INST_DLL = $(INST_BIN)
81 INST_SYS = $(INST_BIN)
82 INST_TESTCASE = $(INST_BIN)testcase/
83 INST_ADDITIONS = $(INST_BIN)additions/
84 INST_ADDITIONS_ISO = $(INST_BIN)
85
86 # other paths
87 INST_TESTSUITE = testsuite/
88 INST_LIB = lib/
89 INST_ADDITIONS_LIB = $(INST_LIB)/additions/
90
91else
92
93 INST_BIN = bin/
94 INST_DIST = $(INST_BIN)
95 INST_DLL = $(INST_BIN)
96 INST_SDK = $(INST_BIN)sdk/
97 INST_DLL = $(INST_BIN)
98 INST_SYS = $(INST_BIN)
99 INST_TESTCASE = $(INST_BIN)testcase/
100 INST_ADDITIONS = $(INST_BIN)additions/
101 INST_ADDITIONS_ISO = $(INST_ADDITIONS)
102
103 INST_TESTSUITE = testsuite/
104 INST_LIB = lib/
105 INST_ADDITIONS_LIB = $(INST_LIB)additions/
106endif
107
108PATH_BIN = $(patsubst %/,%,$(PATH_INS)/$(INST_BIN))
109PATH_DLL = $(patsubst %/,%,$(PATH_INS)/$(INST_DLL))
110PATH_SYS = $(patsubst %/,%,$(PATH_INS)/$(INST_SYS))
111PATH_LIB = $(patsubst %/,%,$(PATH_INS)/$(INST_LIB))
112PATH_DOC = $(PATH_OUT)/doc
113VBOX_PATH_SDK = $(patsubst %/,%,$(PATH_INS)/$(INST_SDK))
114VBOX_PATH_DIST = $(patsubst %/,%,$(PATH_INS)/$(INST_DIST))
115VBOX_PATH_TESTSUITE = $(patsubst %/,%,$(PATH_INS)/$(INST_TESTSUITE))
116VBOX_PATH_ADDITIONS = $(patsubst %/,%,$(PATH_INS)/$(INST_ADDITIONS))
117VBOX_PATH_ADDITIONS_ISO = $(patsubst %/,%,$(PATH_INS)/$(INST_ADDITIONS_ISO))
118VBOX_PATH_ADDITIONS_LIB = $(patsubst %/,%,$(PATH_INS)/$(INST_ADDITIONS_LIB))
119
120
121# Delete targets on failure.
122.DELETE_ON_ERROR:
123
124# Notify about important kBuild updates.
125ifneq ($(call if-expr, $(KMK_REVISION) >= 2274 && $(KBUILD_KMK_REVISION) >= 2206,fine,old),fine)
126 $(error You must update kBuild! KMK_REVISION=$(KMK_REVISION) KBUILD_KMK_REVISION=$(KBUILD_KMK_REVISION) KBUILD_PATH=$(KBUILD_PATH))
127endif
128
129#
130# Define USERNAME early on.
131#
132ifndef USERNAME
133 ifdef USER
134 USERNAME = $(USER)
135 else
136 $(warning Warning: You must have USERNAME or USER in your environment.)
137 endif
138endif
139
140#
141# The VirtualBox version.
142#
143
144# Major version.
145VBOX_VERSION_MAJOR = 3
146# Minor version.
147VBOX_VERSION_MINOR = 2
148# This is the current build number. It should be increased every time we publish a
149# new build. The define is available in every source file. Only even build numbers
150# will be published, odd numbers are set during development.
151VBOX_VERSION_BUILD = 51
152# Full version string (may include more than just x.y.z, but no spaces or other problematic chars).
153VBOX_VERSION_STRING = $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
154# Force the additions.sh script to get an exact additions build when we're doing the release.
155
156ifeq ($(int-mod $(VBOX_VERSION_BUILD),2),0)
157 export VBOX_ADDITIONS_SH_MODE = release
158 export VBOX_DOCUMENTATION_SH_MODE = release
159 export VBOX_EFI_SH_MODE = release
160endif
161
162# Some info on the vendor
163VBOX_VENDOR = Oracle Corporation
164VBOX_VENDOR_SHORT = Oracle
165VBOX_PRODUCT = Oracle VM VirtualBox
166# Not all could be done automatically. Here is a list of known places which
167# have to be updated manually, please keep this up to date:
168# src/VBox/Devices/PC/PXE/client/uinit.asm
169# src/VBox/RDP/webclient/flash/com/sun/network/rdp/Version.as
170# src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
171# src/VBox/Frontends/VirtualBox/src/settings/global/VBoxGLSettingsLanguage.cpp
172# src/VBox/Frontends/VirtualBox/nls/*.ts
173# debian/control
174# src/VBox/Installer/linux/{debian,rpm}
175# src/VBox/Installer/linux/virtualbox.desktop
176# src/VBox/Additions/WINNT/Installer/ISO/ReadmeDrivers.txt
177
178# Maybe we want set this manually.
179VBOX_C_YEAR = $(date-utc %Y)
180
181#
182# The VirtualBox package type.
183#
184ifeq ($(KBUILD_TARGET),win)
185 VBOX_PACKAGE_OS = WINDOWS
186else ifeq ($(KBUILD_TARGET),linux)
187 VBOX_PACKAGE_OS = LINUX
188else ifeq ($(KBUILD_TARGET),darwin)
189 VBOX_PACKAGE_OS = DARWIN
190else ifeq ($(KBUILD_TARGET),solaris)
191 VBOX_PACKAGE_OS = SOLARIS
192else ifeq ($(KBUILD_TARGET),os2)
193 VBOX_PACKAGE_OS = OS2
194else if1of ($(KBUILD_TARGET), dragonfly freebsd netbsd openbsd)
195 VBOX_PACKAGE_OS = BSD
196else
197 $(error Cannot determine VBOX_PACKAGE_OS)
198endif
199ifeq ($(KBUILD_TARGET_ARCH),x86)
200 VBOX_PACKAGE_ARCH = 32BITS
201else
202 VBOX_PACKAGE_ARCH = 64BITS
203endif
204# distribution, mostly for Linux/Solaris where we support different distributions
205# this strip will be overridden by the Linux packaging scripts
206VBOX_PACKAGE_DIST ?= GENERIC
207# Full string
208VBOX_PACKAGE_STRING = $(VBOX_PACKAGE_OS)_$(VBOX_PACKAGE_ARCH)_$(VBOX_PACKAGE_DIST)
209
210
211#
212# The VirtualBox Configuration Defaults.
213#
214# We try to document all the build configuration options here, thing which
215# aren't enabled by default is left commented out just to show that they
216# exist and which value they should have (usually 1, but anyway).
217#
218
219# Virtual single makefile.
220# If undefined, the tranditional recursive make method will be used.
221VBOX_SINGLE_MAKEFILE = 1
222
223## @name Additions
224## @{
225# This indicates that additions (of some kind or another) is being _built_.
226# VBOX_WITHOUT_ADDITIONS overrides it.
227#if1of ($(KBUILD_TARGET), freebsd linux os2 solaris win)
228if1of ($(KBUILD_TARGET), freebsd linux solaris win)
229 VBOX_WITH_ADDITIONS = 1
230endif
231# Build the optional ring-0 part of the additions for syntax checking.
232# (Except when cross-building on linux since we're using /usr/src/...)
233ifn1of ($(KBUILD_TARGET).$(KBUILD_HOST_ARCH).$(KBUILD_TARGET_ARCH), linux.x86.amd64 linux.amd64.x86)
234 VBOX_WITH_ADDITION_DRIVERS = 1
235endif
236# Build X11 additions. Can be disabled separately.
237if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd solaris)
238 VBOX_WITH_X11_ADDITIONS = 1
239endif
240# Enable the building of shared folders in the windows additions.
241VBOX_WITH_WIN32_ADDITIONS_SHAREDFOLDERS = 1
242# Take the binaries of the OS/2 Additions.
243VBOX_WITH_OS2_ADDITIONS_BIN = 1
244# Use additions from the build server.
245#VBOX_WITH_ADDITIONS_FROM_BUILD_SERVER = 1
246# Include additions in the package
247VBOX_WITH_ADDITIONS_PACKING = 1
248# Only build the additions (for the additions build server).
249#VBOX_ONLY_ADDITIONS = 1
250ifdef VBOX_ADDITIONS_ONLY # typical mistake.
251 $(error It is VBOX_ONLY_ADDITIONS=1 not VBOX_ADDITIONS_ONLY!)
252endif
253# Don't bother with additions, overrides VBOX_WITH_ADDITIONS.
254# This is not used by makefiles, only Config.kmk, see below.
255ifdef VBOX_ONLY_SDK
256 VBOX_WITHOUT_ADDITIONS = 1
257endif
258# Don't create the additions ISO.
259# (Used by the additions build server, don't invert it.)
260#VBOX_WITHOUT_ADDITIONS_ISO = 1
261## @}
262
263## @name Documentation
264## @{
265# The documentation
266VBOX_WITH_DOCS = 1
267# Use documentation from the build server.
268#VBOX_WITH_DOCS_FROM_BUILD_SERVER = 1
269# Include documentation in the package
270VBOX_WITH_DOCS_PACKING = 1
271# Include CHM when building docs (unset in LocalConfig.kmk to suppress CHM)
272ifn1of ($(KBUILD_TARGET), linux)
273 VBOX_WITH_DOCS_CHM = 1
274endif
275# Don't bother with documentation, overrides VBOX_WITH_DOCS.
276# This is not used by makefiles, only Config.kmk, see below.
277#VBOX_WITHOUT_DOCS = 1
278# Only build the documentation (for the documentation build server).
279#VBOX_ONLY_DOCS = 1
280ifdef VBOX_DOCS_ONLY # typical mistake.
281 $(error It is VBOX_ONLY_DOCS=1 not VBOX_DOCS_ONLY!)
282endif
283## @}
284
285## @name VMM related settings.
286## @{
287# Enable the tradition raw-mode virtualization.
288VBOX_WITH_RAW_MODE = 1
289# Enable support for 64-bit guests.
290VBOX_WITH_64_BITS_GUESTS = 1
291# Enable multi-core VCPUs.
292VBOX_WITH_MULTI_CORE = 1
293# Activate this to force the VM to pre-allocate the guest RAM before startup
294VBOX_WITH_PREALLOC_RAM_BY_DEFAULT =
295# Enable the debugger.
296VBOX_WITH_DEBUGGER = 1
297# Enable the debugger GUI.
298VBOX_WITH_DEBUGGER_GUI = 1
299# Enable the PDM Lock and let I/O threads call into the PICs.
300# TODO: Eliminate VBOX_WITH_PDM_LOCK.
301VBOX_WITH_PDM_LOCK = 1
302## @}
303
304
305## @name Devices, Drivers,
306## @{
307# Build the Host Guest Communication Manager component.
308VBOX_WITH_HGCM = 1
309## Build the bugcheck detection code.
310#VBOX_WITH_GUEST_BUGCHECK_DETECTION =
311# Enable the USB feature. This includes VBOX_WITH_VUSB!
312VBOX_WITH_USB = 1
313# Enable the USB 1.1 controller plus virtual USB HID devices.
314VBOX_WITH_VUSB = 1
315# Enable the USB 2.0 controller.
316VBOX_WITH_EHCI = 1
317# Enable the ISCSI feature.
318VBOX_WITH_ISCSI = 1
319# Enable INIP support in the ISCSI feature.
320VBOX_WITH_INIP = 1
321# Enable the E1000 feature.
322VBOX_WITH_E1000 = 1
323# Enable the Virtio feature.
324VBOX_WITH_VIRTIO = 1
325# Enable ALSA support for Linux.
326VBOX_WITH_ALSA = 1
327# Enable Pulse support for Linux.
328VBOX_WITH_PULSE = 1
329# Enable statically linked dbus support
330if1of ($(KBUILD_TARGET), linux solaris)
331 VBOX_WITH_DBUS = 1
332endif
333# Enable building PAM modules
334if1of ($(KBUILD_TARGET), linux solaris)
335 VBOX_WITH_PAM = 1
336endif
337# Disable WINMM support for Windows (not implemented).
338VBOX_WITH_WINMM =
339# Enabled internal networking.
340VBOX_WITH_INTERNAL_NETWORKING = 1
341# Enable Host Guest Shared Memory Interface
342VBOX_WITH_HGSMI=1
343# Enable Video 2D Acceleration
344if1of ($(KBUILD_TARGET), darwin linux win)
345 VBOX_WITH_VIDEOHWACCEL = 1
346endif
347# Enable VBVA lock
348VBOX_WITH_OLD_VBVA_LOCK = 1
349# Enable the Intel PXE ROM (replaces Etherboot).
350VBOX_WITH_INTEL_PXE = 1
351# Enable EFI support
352VBOX_WITH_EFI = 1
353# Fetch EFI firmware image from the build server
354#VBOX_WITH_EFIFW_FROM_BUILD_SERVER = 1
355# Include the EFI firmware into the package
356VBOX_WITH_EFIFW_PACKING = 1
357# Use kStuff for MACH-O and LX binary loading.
358if1of ($(KBUILD_TARGET), darwin os2)
359 IPRT_WITH_KSTUFF = 1
360endif
361# Enable Crossbow support for Solaris TAP driver.
362VBOX_WITH_CROSSBOW = 1
363# Enable setuid wrapper for Solaris host DVD.
364#VBOX_WITH_SUID_WRAPPER = 1
365# Enable the virtual SATA/AHCI controller
366VBOX_WITH_AHCI = 1
367# Enable the new async completion manager
368VBOX_WITH_PDM_ASYNC_COMPLETION = 1
369# Temporary switch for enabling / disabling the new USB code on Darwin.
370VBOX_WITH_NEW_USB_CODE_ON_DARWIN=1
371# Enable USB code that relies on USBA driver election callback & our own USB client driver on Solaris.
372ifdef VBOX_WITH_USB
373 VBOX_WITH_NEW_USB_CODE_ON_SOLARIS=1
374endif
375ifdef VBOX_WITH_USB
376 VBOX_WITH_VUSB = 1
377endif
378# Enable the hal/sysfs USB code on Linux.
379ifeq ($(KBUILD_TARGET),linux)
380 VBOX_USB_WITH_SYSFS=1
381 # Disabled for now
382 # VBOX_USB_WITH_DBUS=1
383 VBOX_USB_WITH_INOTIFY=1
384endif
385# Use the new VBI module on Solaris.
386#VBOX_WITH_SOLARIS_VBI = 1
387# Enable performance API.
388VBOX_WITH_RESOURCE_USAGE_API = 1
389# Enable BusLogic SCSI host adapter
390VBOX_WITH_BUSLOGIC = 1
391# Enable LsiLogic SCSI host adapter
392VBOX_WITH_LSILOGIC = 1
393# Enable HPET device
394VBOX_WITH_HPET = 1
395# Enable LPC device
396VBOX_WITH_LPC = 1
397# Enable SMC device
398VBOX_WITH_SMC = 1
399# Enable SCSI drivers
400VBOX_WITH_SCSI = 1
401# Enable changing network attachments dynamically.
402VBOX_DYNAMIC_NET_ATTACH = 1
403# Enable this setting to force a fallback to default DMI data on configuration errors
404VBOX_BIOS_DMI_FALLBACK =
405# Enable host network interface API.
406if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
407 VBOX_WITH_HOSTNETIF_API = 1
408endif
409# Enable the new storage I/O path.
410if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
411 VBOX_WITH_NEW_IO_CODE = 1
412endif
413## @}
414
415
416## @name Other Component
417## @{
418# Build the installer.
419VBOX_WITH_INSTALLER = 1
420# The kernel driver/module and related runtime libraries.
421VBOX_WITH_VBOXDRV = 1
422# The main api.
423VBOX_WITH_MAIN = 1
424# Set this to prefix all C symbols in XPCOM, to avoid dynamic linking problems
425# caused by our XPCOM library polluting the symbol namespace for system libs.
426if1of ($(KBUILD_TARGET), linux solaris)
427 VBOX_WITH_XPCOM_NAMESPACE_CLEANUP = 1
428endif
429# Set this to not use COM or XPCOM in places where it can be avoided.
430#VBOX_WITHOUT_COM = 1
431# The webservices api.
432VBOX_WITH_WEBSERVICES = 1
433# The Qt 4 GUI.
434VBOX_WITH_QTGUI = 1
435# Indicates the Qt is Cocoa based on the Mac.
436ifeq ($(KBUILD_TARGET),darwin)
437 VBOX_WITH_COCOA_QT = 1
438endif
439# The SDL based GUI.
440VBOX_WITH_VBOXSDL = 1
441# Build VBoxSDL with secure label support.
442ifeq ($(filter win.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) # too much work with freetype and all that.
443VBOX_WITH_SECURELABEL = 1
444endif
445# The headless frontend.
446VBOX_WITH_HEADLESS = 1
447# Enable the VRDP server.
448VBOX_WITH_VRDP = 1
449# Enable support for video redirection VRDP channel.
450VBOX_WITH_VRDP_VIDEO_CHANNEL = 1
451# Build the VRDP authentication modules.
452VBOX_WITH_VRDP_AUTHMOD = 1
453# Build enhanced version of rdesktop.
454VBOX_WITH_VRDP_RDESKTOP = 1
455# The basic frontend (w/o Main).
456VBOX_WITH_VBOXBFE = 1
457## The Direct Framebuffer GUI.
458#VBOX_WITH_VBOXFB = 1
459# Enables the Python<->XPCOM and Python<->COM bindings.
460VBOX_WITH_PYTHON ?= 1
461if1of ($(KBUILD_TARGET), darwin linux solaris)
462 # Enable Java<->XPCOM bridge + glue code
463 VBOX_WITH_JXPCOM ?= 1
464endif
465if1of ($(KBUILD_TARGET), )
466 # Enable Java<->MSCOM glue, bridge is provided by an external lib (Jacob)
467 VBOX_WITH_JMSCOM ?= 1
468endif
469if1of ($(KBUILD_TARGET), darwin linux solaris)
470 # Enable Java<->JAX-WS bridge
471 VBOX_WITH_JWS ?= 1
472endif
473# Use XPIDL instead of XSLT stylesheet
474VBOX_WITH_JAVA_SUPPORT_IN_XPIDL ?=
475# Build against multiple Python versions present in the system
476VBOX_WITH_MULTIVERSION_PYTHON ?= 1
477# Enable the kchmviewer.
478VBOX_WITH_KCHMVIEWER = 1
479# Build the testsuite.
480VBOX_WITH_TESTSUITE = 1
481# Build the testcases.
482VBOX_WITH_TESTCASES = 1
483# Enables the ffmpeg module for recording test runs.
484# TODO: Enable this for normal build server builds?
485#if1of ($(KBUILD_TARGET), linux)
486# VBOX_WITH_FFMPEG = 1
487#endif
488# Enable shared folders
489VBOX_WITH_SHARED_FOLDERS = 1
490# Enable shared clipboard
491VBOX_WITH_SHARED_CLIPBOARD = 1
492# Enable the host/guest information service (aka guest properties).
493VBOX_WITH_GUEST_PROPS = 1
494# Enable this to prevent the guest from writing guest properties.
495VBOX_WITH_GUEST_PROPS_RDONLY_GUEST =
496# Enable the guest control service.
497if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
498 VBOX_WITH_GUEST_CONTROL = 1
499endif
500# Enable ballooning
501VBOX_WITH_MEMBALLOON = 1
502# Enable crOpenGL service
503if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
504 VBOX_WITH_CROGL = 1
505endif
506# Enable the VNC server in VBoxHeadless (GPL only).
507#VBOX_WITH_VNC = 1
508## @}
509
510
511## @name Misc
512## @{
513# Enable Seamless mode
514VBOX_X11_SEAMLESS_GUEST = 1
515# Enables all the doxgen bits.
516VBOX_WITH_ALL_DOXYGEN_TARGETS = 1
517# Set this to skip installing the redistributable compiler runtime.
518#VBOX_WITHOUT_COMPILER_REDIST = 1
519## @}
520
521
522## @name Compiler and linker config
523## @{
524# For treating compiler and linker warnings as errors where possible.
525if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.x86 darwin.amd64 linux.x86 linux.amd64 win.x86 win.amd64)
526 VBOX_WITH_WARNINGS_AS_ERRORS = 1
527endif
528## @}
529
530
531## @name Hardening
532## @{
533# Enables hardening.
534# Most developers will want to disable this in their LocalConfig.kmk.
535ifn1of ($(KBUILD_TARGET), win)
536 VBOX_WITH_HARDENING = 1
537endif
538# Where the application files are (going to be) installed.
539#VBOX_PATH_APP_PRIVATE = /usr/lib/virtualbox
540ifdef VBOX_WITH_HARDENING
541 if1of ($(KBUILD_TARGET), solaris)
542 VBOX_PATH_APP_PRIVATE = /opt/VirtualBox/$(if-expr $(KBUILD_TARGET_ARCH) == "amd64",amd64,i386)
543 else ifeq ($(KBUILD_TARGET),darwin)
544 VBOX_PATH_APP_PRIVATE = /Applications/VirtualBox.app/Contents/MacOS
545 else ifeq ($(KBUILD_TARGET),freebsd)
546 VBOX_PATH_APP_PRIVATE = /usr/local/lib/virtualbox
547 endif
548endif
549# Where the architecture specific application files are (going to be) installed.
550#VBOX_PATH_APP_PRIVATE_ARCH = /usr/lib/virtualbox
551ifdef VBOX_WITH_HARDENING
552 if1of ($(KBUILD_TARGET), darwin solaris)
553 VBOX_PATH_APP_PRIVATE_ARCH = $(VBOX_PATH_APP_PRIVATE)
554 endif
555endif
556# Where the shared libraries are (going to be) installed.
557#VBOX_PATH_SHARED_LIBS = /usr/lib
558ifdef VBOX_WITH_HARDENING
559 if1of ($(KBUILD_TARGET), darwin solaris)
560 VBOX_PATH_SHARED_LIBS = $(VBOX_PATH_APP_PRIVATE)
561 endif
562endif
563# Where the documentation is (going to be) installed.
564#VBOX_PATH_APP_DOCS = /usr/share/doc/virtualbox
565ifdef VBOX_WITH_HARDENING
566 if1of ($(KBUILD_TARGET), darwin solaris)
567 VBOX_PATH_APP_DOCS = $(VBOX_PATH_APP_PRIVATE)
568 endif
569endif
570# The DT_RPATH/DT_RUNPATH to embed into the binaries (ELF).
571# (This one is used for all binaries, there is no need to adjust this
572# depending on the location of the object.)
573#VBOX_WITH_RUNPATH = /usr/lib/virtualbox
574ifdef VBOX_WITH_HARDENING
575 if1of ($(KBUILD_TARGET), freebsd solaris)
576 VBOX_WITH_RUNPATH = $(VBOX_PATH_APP_PRIVATE)
577 endif
578endif
579# Enable use of the $ORIGIN DT_RPATH/DT_RUNPATH feature (ELF).
580# Because of the setuid usage on all ELF platforms when hardening the build
581# things gets a bit complicated since the $ORIGIN+setuid policy differs.
582#VBOX_WITH_ORIGIN=1
583ifdef VBOX_WITH_HARDENING
584 if1of ($(KBUILD_TARGET), linux)
585 VBOX_WITH_ORIGIN = 1
586 endif
587else if1of ($(KBUILD_TARGET), linux solaris)
588 VBOX_WITH_ORIGIN = 1
589endif
590# Enable the system wide support service/daemon.
591# Work in progress, but required for hardening on Windows.
592#VBOX_WITH_SUPSVC = 1
593ifdef VBOX_WITH_HARDENING
594 if1of ($(KBUILD_TARGET), win)
595 VBOX_WITH_SUPSVC = 1
596 endif
597endif
598# Use VBoxNetFlt for host interface networking.
599if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
600 VBOX_WITH_NETFLT = 1
601 ifeq ($(KBUILD_TARGET),solaris)
602# Disabled until some Nevada version ships the required headers.
603# VBOX_WITH_NETFLT_CROSSBOW = 1
604 endif
605 if1of ($(KBUILD_TARGET), darwin freebsd linux solaris)
606 VBOX_WITH_NETADP = 1
607 endif
608endif
609if1of ($(KBUILD_TARGET), freebsd linux)
610 VBOX_WITH_VDE = 1
611endif
612## @}
613
614# Strip binaries of release and profile builds before packing them into the installer
615# archive. When building .deb/.rpms, don't strip the symbols as they are required for
616# the debug packages containing symbols for gdb located in /usr/lib/debug.
617VBOX_DO_STRIP := $(if $(filter release profile,$(KBUILD_TYPE)),1,)
618# Strip R0/GC modules (current requirement for our loader)
619# TODO: This shouldn't be a requirement any longer. FIXME XXX
620VBOX_DO_STRIP_MODULES = 1
621
622
623#
624# Config items for enabling work in progress.
625#
626# It's good pratice to add stuff here even if it is currently disabled by
627# default.
628#
629# Note! Please, do *not* add stuff to the global DEFS unless it is *really*
630# necessary! The other guys will hate for it you when they have to
631# recompile everything when the feature is enabled or disabled. Put
632# the ifdefs in target or template definitions.
633#
634
635## For experimenting with disabling preemption instead of interrupts
636# when working VT-x/AMD-V in VMMR0.
637## @todo os2? Reconsider perhaps windows? (see defect) This should be made the default.
638if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
639 VBOX_WITH_VMMR0_DISABLE_PREEMPTION = 1
640endif
641## For testing deadlock detection and lock order validation.
642# If issues are found, create high priority defects and temporarily comment
643# the next line.
644VBOX_WITH_STRICT_LOCKS = 1
645
646
647#
648# Branding
649#
650VBOX_BRAND_BIOS_LOGO := $(PATH_ROOT)/src/VBox/Devices/Graphics/BIOS/puel_logo.bmp
651VBOX_BRAND_LICENSE_HTML := $(PATH_ROOT)/doc/License.html
652VBOX_BRAND_LICENSE_RTF := $(PATH_ROOT)/doc/License.rtf
653VBOX_BRAND_LICENSE_TXT := $(PATH_ROOT)/doc/License.txt
654VBOX_BRAND_LICENSE_VER :=
655VBOX_BRAND_GUI_ABOUT_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about.png
656VBOX_BRAND_GUI_ABOUT_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about_16px.png
657VBOX_BRAND_GUI_VBOX_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_16px.png
658VBOX_BRAND_GUI_VBOX_20PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_20px.png
659VBOX_BRAND_GUI_VBOX_32PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_32px.png
660VBOX_BRAND_GUI_VBOX_40PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_40px.png
661VBOX_BRAND_GUI_VBOX_48PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_48px.png
662VBOX_BRAND_GUI_VBOX_64PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_64px.png
663VBOX_BRAND_WIN_INST_DLGBMP := $(PATH_ROOT)/src/VBox/Installer/win/Binary/Dialog.bmp
664VBOX_BRAND_WIN_INST_EXT :=
665VBOX_BRAND_WIN_ADD_INST_DLGBMP := $(PATH_ROOT)/src/VBox/Additions/WINNT/Installer/welcome.bmp
666VBOX_BRAND_DARWIN_DISKIMAGE_DS_STORE := $(PATH_ROOT)/src/VBox/Installer/darwin/DiskImage/DS_Store
667VBOX_BRAND_DARWIN_DISKIMAGE_BG := $(PATH_ROOT)/src/VBox/Installer/darwin/DiskImage/vbox_folder.tiff
668VBOX_BRAND_DARWIN_INSTALLER_BG := $(PATH_ROOT)/src/VBox/Installer/darwin/VirtualBox_mpkg/background.tif
669
670#
671# Skip stuff.
672#
673
674# VBOX_QUICK can be used by core developers to speed to the build
675ifdef VBOX_QUICK
676 # undefine variables by assigning blank.
677 VBOX_WITH_TESTSUITE=
678 VBOX_WITH_TESTCASES=
679 VBOX_WITH_MAIN =
680 VBOX_WITH_VBOXSDL =
681 VBOX_WITH_VBOXBFE =
682 VBOX_WITH_QTGUI =
683 VBOX_WITH_DEBUGGER_GUI =
684 VBOX_WITH_DOCS =
685endif # VBOX_QUICK
686
687ifeq ($(KBUILD_TARGET),darwin)
688 # Don't bother with SDL ttf for now.
689 VBOX_WITH_SECURELABEL=
690 # We'll use the native html/help viewer.
691 VBOX_WITH_KCHMVIEWER=
692 VBOX_WITH_VRDP_RDESKTOP=
693 # Permanent (no working SDL).
694 VBOX_WITH_VBOXSDL=
695 VBOX_WITH_VBOXBFE=
696endif
697
698ifeq ($(KBUILD_TARGET),freebsd)
699 VBOX_WITH_DOCS=
700endif
701
702ifeq ($(KBUILD_TARGET),l4)
703 VBOX_WITH_VBOXDRV=
704 VBOX_WITH_ADDITION_DRIVERS=
705 VBOX_WITH_VRDP=
706 VBOX_WITH_HEADLESS=
707 VBOX_WITH_VBOXSDL=
708 VBOX_WITH_QTGUI=
709 VBOX_WITH_MAIN=
710 VBOX_WITH_DOCS=
711 VBOX_WITH_ISCSI=
712 VBOX_WITH_INIP=
713 VBOX_WITH_INTERNAL_NETWORKING=
714 VBOX_WITH_PDM_ASYNC_COMPLETION=
715 VBOX_WITH_KCHMVIEWER=
716 VBOX_WITH_HARDENING=
717endif
718
719ifeq ($(KBUILD_TARGET),os2)
720 VBOX_WITH_WEBSERVICES=
721 VBOX_WITH_INSTALLER=
722 VBOX_WITH_SECURELABEL=
723 VBOX_WITH_VRDP_AUTHMOD=
724 VBOX_WITH_VRDP_RDESKTOP=
725 VBOX_WITH_TESTSUITE=
726 VBOX_WITH_QTGUI=
727 VBOX_WITH_USB=
728 VBOX_WITH_EHCI=
729 VBOX_WITH_DOCS=
730 VBOX_WITH_PDM_ASYNC_COMPLETION=
731 VBOX_WITH_KCHMVIEWER=
732 VBOX_WITH_HARDENING=
733endif
734
735ifeq ($(KBUILD_TARGET),solaris)
736 VBOX_WITH_SECURELABEL=
737 VBOX_WITH_OGL=
738endif
739
740ifeq ($(KBUILD_TARGET),win)
741 VBOX_WITH_VRDP_RDESKTOP=
742 VBOX_WITH_KCHMVIEWER=
743endif
744
745ifn1of ($(KBUILD_TARGET_ARCH), x86 amd64)
746 VBOX_WITH_ADDITION_DRIVERS=
747 VBOX_WITH_CROGL=
748 VBOX_WITH_DEBUGGER=
749 VBOX_WITH_DOCS=
750 VBOX_WITH_EHCI=
751 VBOX_WITH_HARDENING=
752 VBOX_WITH_HEADLESS=
753 VBOX_WITH_HGCM=
754 VBOX_WITH_HGSMI=
755 VBOX_WITH_INIP=
756 VBOX_WITH_INSTALLER=
757 VBOX_WITH_INTERNAL_NETWORKING=
758 VBOX_WITH_ISCSI=
759 VBOX_WITH_KCHMVIEWER=
760 VBOX_WITH_MAIN=
761 VBOX_WITH_PDM_ASYNC_COMPLETION=
762 VBOX_WITH_QTGUI=
763 VBOX_WITH_RAW_MODE=
764 VBOX_WITH_SECURELABEL=
765 VBOX_WITH_TESTSUITE=
766 VBOX_WITH_USB=
767 VBOX_WITH_VBOXBFE=
768 VBOX_WITH_VBOXDRV=
769 VBOX_WITH_VBOXSDL=
770 VBOX_WITH_WEBSERVICES=
771 VBOX_WITH_XPCOM=
772 VBOX_WITHOUT_HARDENING=1
773 # remove later:
774 VBOX_WITH_VRDP=
775 VBOX_WITH_VRDP_AUTHMOD=
776 VBOX_WITH_VRDP_RDESKTOP=
777endif
778
779
780#
781# Include automatic and local config file to override the above settings
782# and to provide defaults for the settings below this point.
783#
784ifndef AUTOCFG
785 AUTOCFG := $(wildcard $(PATH_ROOT)/AutoConfig.kmk)
786endif
787ifneq ($(AUTOCFG),)
788 include $(AUTOCFG)
789endif
790
791ifndef LOCALCFG
792 LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
793 ifneq ($(LOCALCFG),)
794 include $(LOCALCFG)
795 endif
796else
797 # Ignore it if it doesn't exist.
798 if exists "$(LOCALCFG)"
799 include $(LOCALCFG)
800 else
801 $(warning LOCALCFG='$(LOCALCFG)' does not exist)
802 override LOCALCFG :=
803 endif
804endif
805
806#
807# Allow to overwrite the branding information from an external file
808#
809ifdef VBOX_BRANDING_CFG
810 include $(VBOX_BRANDING_CFG)
811endif
812
813#
814# Bitch about old settings.
815#
816ifdef VBOX_WITHOUT_LINUX_COMPILER_H
817 $(warning VBOX_WITHOUT_LINUX_COMPILER_H was renamed to VBOX_WITH_LINUX_COMPILER_H, the meaning is inverted.)
818endif
819
820#
821# For the docs build box.
822#
823ifdef VBOX_ONLY_DOCS
824 VBOX_WITH_DOCS_CHM = 1
825endif
826
827#
828# Disable components that are not open sourced.
829#
830ifdef VBOX_OSE
831 VBOX_WITH_VRDP=
832 VBOX_WITH_EHCI=
833 VBOX_WITH_OS2_ADDITIONS_BIN=
834 VBOX_WITH_SECURELABEL=
835 VBOX_WITH_KCHMVIEWER=
836 ifn1of ($(KBUILD_TARGET), linux)
837 VBOX_WITH_DOCS=
838 VBOX_WITH_DOCS_PACKING=
839 endif
840 VBOX_WITH_TESTSUITE=
841 VBOX_WITH_INTEL_PXE=
842 VBOX_WITH_FFMPEG=
843 ifn1of ($(KBUILD_TARGET), darwin linux solaris win)
844 VBOX_WITH_INSTALLER=
845 endif
846 if1of ($(KBUILD_TARGET), solaris)
847 VBOX_WITH_NEW_USB_CODE_ON_SOLARIS=
848 endif
849 # branding
850 VBOX_BRAND_LICENSE_HTML := $(PATH_ROOT)/doc/License-gpl-2.0.html
851 VBOX_BRAND_LICENSE_RTF := $(PATH_ROOT)/doc/License-gpl-2.0.rtf
852 VBOX_BRAND_LICENSE_TXT := $(PATH_ROOT)/doc/License-gpl-2.0.txt
853 VBOX_BRAND_BIOS_LOGO := $(PATH_ROOT)/src/VBox/Devices/Graphics/BIOS/ose_logo.bmp
854 VBOX_BRAND_GUI_ABOUT_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about.png
855 VBOX_BRAND_GUI_ABOUT_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about_16px.png
856 VBOX_BRAND_GUI_VBOX_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_16px.png
857 VBOX_BRAND_GUI_VBOX_20PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_20px.png
858 VBOX_BRAND_GUI_VBOX_32PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_32px.png
859 VBOX_BRAND_GUI_VBOX_40PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_40px.png
860 VBOX_BRAND_GUI_VBOX_48PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_48px.png
861 VBOX_BRAND_GUI_VBOX_64PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_64px.png
862 VBOX_BRAND_GUI_CUBE_42PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_cube_42px.png
863endif
864
865#
866# VBOX_WITHOUT_HARDENING is for developers (put in LocalConfig.kmk).
867# Note that this is a bit rough since hardening governs more than one
868# variable... Also note that we allow VBOX_WITH_HARDENING=1 on the
869# command line to overrule VBOX_WITHOUT_HARDENING (the check below).
870#
871ifdef VBOX_WITHOUT_HARDENING
872 VBOX_WITH_HARDENING=
873 ifeq ($(VBOX_WITH_HARDENING),)
874 VBOX_PATH_APP_PRIVATE=
875 VBOX_PATH_APP_PRIVATE_ARCH=
876 VBOX_PATH_SHARED_LIBS=
877 VBOX_PATH_APP_DOCS=
878 VBOX_WITH_RUNPATH=
879 if1of ($(KBUILD_TARGET), linux solaris)
880 VBOX_WITH_ORIGIN=1
881 endif
882 endif
883endif
884
885#
886# Sanitize the additions build config variables.
887#
888ifdef VBOX_WITH_ADDITIONS_FROM_BUILD_SERVER
889 VBOX_WITHOUT_ADDITIONS := 1
890 ifdef VBOX_ONLY_ADDITIONS
891 $(error VBOX_ONLY_ADDITIONS + VBOX_WITH_ADDITIONS_FROM_BUILD_SERVER does not add up!)
892 endif
893endif
894
895ifdef VBOX_ONLY_ADDITIONS
896 ifdef VBOX_WITHOUT_ADDITIONS
897 $(error VBOX_ONLY_ADDITIONS + VBOX_WITHOUT_ADDITIONS does not add up!)
898 endif
899endif
900
901ifdef VBOX_WITHOUT_ADDITIONS
902 # Zap anything that could be contradicting this.
903 VBOX_WITH_ADDITIONS :=
904endif
905
906#
907# Sanitize the documentation build config variables.
908#
909ifdef VBOX_WITH_DOCS_FROM_BUILD_SERVER
910 VBOX_WITHOUT_DOCS := 1
911 ifdef VBOX_ONLY_DOCS
912 $(error VBOX_ONLY_DOCS + VBOX_WITH_DOCS_FROM_BUILD_SERVER does not add up!)
913 endif
914endif
915
916ifdef VBOX_ONLY_DOCS
917 ifdef VBOX_WITHOUT_DOCS
918 $(error VBOX_ONLY_DOCS + VBOX_WITHOUT_DOCS does not add up!)
919 endif
920endif
921
922ifdef VBOX_WITHOUT_DOCS
923 # Zap anything that could be contradicting this.
924 VBOX_WITH_DOCS :=
925endif
926
927#
928# Disable components for headless
929#
930ifdef VBOX_HEADLESS
931 VBOX_WITH_QTGUI=
932 VBOX_WITH_VBOXSDL=
933 VBOX_WITH_VBOXBFE=
934 VBOX_WITH_OGL=
935 VBOX_WITH_KCHMVIEWER=
936 VBOX_WITH_VRDP_RDESKTOP=
937endif
938
939#
940# Undefined VBOX_WITH_MAIN implies exclusion of a few more items.
941#
942ifndef VBOX_WITH_MAIN
943 VBOX_WITH_VRDP=
944 VBOX_WITH_VBOXSDL=
945 VBOX_WITH_QTGUI=
946 VBOX_WITH_DEBUGGER_GUI=
947 VBOX_WITH_HEADLESS=
948 ifdef VBOX_ONLY_DOCS
949 $(error Oh, does VBOX_ONLY_DOCS actually end up here. sweet.)
950 endif
951 VBOX_WITH_DOCS=
952endif
953
954ifndef VBOX_WITH_QTGUI
955 VBOX_WITH_KCHMVIEWER=
956endif
957
958#
959# Mark OSE builds clearly, helps figuring out limitations more easily.
960#
961ifdef VBOX_OSE
962VBOX_VERSION_STRING = $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)_OSE
963endif
964
965# Keep in sync with G_virtualBoxPackage in glue-jaxws.xsl and glue-java.xsl
966# Changed with every new version, so beware!
967if $(VBOX_VERSION_BUILD) < 51
968 VBOX_API_SUFFIX = _$(VBOX_VERSION_MAJOR)_$(VBOX_VERSION_MINOR)
969else
970 VBOX_API_SUFFIX = _$(VBOX_VERSION_MAJOR)_$(expr $(VBOX_VERSION_MINOR) + 1)
971endif
972VBOX_JAVA_PACKAGE = org.virtualbox$(VBOX_API_SUFFIX)
973
974#
975# Derived / helper config indicators. Not configurable.
976#
977
978# Use the OpenGL module in qt when the video hardware acceleartion feature
979# is enabled.
980if defined(VBOX_WITH_VIDEOHWACCEL) && defined(VBOX_WITH_QTGUI)
981 VBOX_GUI_USE_QGL=1
982else
983 VBOX_GUI_USE_QGL=
984endif
985
986#
987# Image and object format config.
988#
989if1of ($(KBUILD_TARGET), freebsd linux l4 netbsd openbsd solaris)
990 VBOX_LDR_FMT = elf
991endif
992ifeq ($(KBUILD_TARGET),darwin)
993 VBOX_LDR_FMT = macho
994endif
995ifeq ($(KBUILD_TARGET),os2)
996 VBOX_LDR_FMT = lx
997 VBOX_LDR_FMT32 = lx
998 VBOX_LDR_FMT64 = elf
999 DONT_USE_YASM = 1 # yasm doesn't implement omf yet.
1000endif
1001ifeq ($(KBUILD_TARGET),win)
1002 VBOX_LDR_FMT = pe
1003endif
1004VBOX_LDR_FMT32 ?= $(VBOX_LDR_FMT)
1005VBOX_LDR_FMT64 ?= $(VBOX_LDR_FMT)
1006
1007#
1008# Assembler setup.
1009#
1010# This is a bit complicated since we have to support two different assmblers
1011# (yasm/nasm) and possibly two different formats (32-bit/64-bit).
1012#
1013ifeq ($(VBOX_LDR_FMT),elf)
1014 ifeq ($(KBUILD_TARGET_ARCH),x86)
1015VBOX_ASFLAGS_FMT = -f elf32 -DASM_FORMAT_ELF
1016 else
1017VBOX_ASFLAGS_FMT = -f elf64 -DASM_FORMAT_ELF
1018 endif
1019 VBOX_ASFLAGS_DBFINFO = -g dwarf2
1020endif
1021ifeq ($(VBOX_LDR_FMT),lx)
1022 VBOX_ASFLAGS_FMT = -f obj -DASM_FORMAT_OMF
1023 VBOX_ASFLAGS_DBFINFO = -g stabs
1024endif
1025ifeq ($(VBOX_LDR_FMT),macho)
1026 ifeq ($(KBUILD_TARGET_ARCH),x86)
1027 VBOX_ASFLAGS_FMT = -f macho32 -DASM_FORMAT_MACHO
1028 else
1029 VBOX_ASFLAGS_FMT = -f macho64 -DASM_FORMAT_MACHO
1030 endif
1031 VBOX_ASFLAGS_DBFINFO = -g dwarf2
1032endif
1033ifeq ($(VBOX_LDR_FMT),pe)
1034 ifeq ($(KBUILD_TARGET_ARCH),x86)
1035VBOX_ASFLAGS_FMT = -f win32 -DASM_FORMAT_PE
1036 else
1037VBOX_ASFLAGS_FMT = -f win64 -DASM_FORMAT_PE
1038 endif
1039VBOX_ASFLAGS_DBFINFO = -g cv8
1040endif
1041ifndef VBOX_ASFLAGS_FMT
1042 $(error VBOX_ASFLAGS_FMT is not defined. VBOX_LDR_FMT=$(VBOX_LDR_FMT))
1043endif
1044
1045ifeq ($(VBOX_LDR_FMT32),elf)
1046 VBOX_ASFLAGS_FMT32 = -f elf32 -DASM_FORMAT_ELF
1047 VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
1048endif
1049ifeq ($(VBOX_LDR_FMT32),lx)
1050 VBOX_ASFLAGS_FMT32 = -f obj -DASM_FORMAT_OMF
1051 VBOX_ASFLAGS_DBFINFO32 = -g stabs
1052endif
1053ifeq ($(VBOX_LDR_FMT32),macho)
1054 VBOX_ASFLAGS_FMT32 = -f macho32 -DASM_FORMAT_MACHO
1055 VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
1056endif
1057ifeq ($(VBOX_LDR_FMT32),pe)
1058 VBOX_ASFLAGS_FMT32 = -f win32 -DASM_FORMAT_PE
1059 VBOX_ASFLAGS_DBFINFO32 = -g cv8
1060endif
1061ifndef VBOX_ASFLAGS_FMT32
1062 $(error VBOX_ASFLAGS_FMT32 is not defined. VBOX_LDR_FMT32=$(VBOX_LDR_FMT32))
1063endif
1064
1065ifeq ($(VBOX_LDR_FMT64),elf)
1066 VBOX_ASFLAGS_FMT64 = -f elf64 -DASM_FORMAT_ELF
1067 VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
1068endif
1069ifeq ($(VBOX_LDR_FMT64),macho)
1070 VBOX_ASFLAGS_FMT64 = -f macho64 -DASM_FORMAT_MACHO
1071 VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
1072endif
1073ifeq ($(VBOX_LDR_FMT64),pe)
1074 VBOX_ASFLAGS_FMT64 = -f win64 -DASM_FORMAT_PE
1075 VBOX_ASFLAGS_DBFINFO64 = -g cv8
1076endif
1077ifndef VBOX_ASFLAGS_FMT64
1078 $(error VBOX_ASFLAGS_FMT64 is not defined. VBOX_LDR_FMT64=$(VBOX_LDR_FMT64))
1079endif
1080
1081ifndef DONT_USE_YASM
1082 VBOX_ASTOOL = YASM
1083 VBOX_LDR_FMT_2_YASM_DBGINFO.elf = -g dwarf2
1084 VBOX_LDR_FMT_2_YASM_DBGINFO.lx = -g stabs
1085 VBOX_LDR_FMT_2_YASM_DBGINFO.macho =
1086 VBOX_LDR_FMT_2_YASM_DBGINFO.pe = -g cv8
1087 VBOX_ASFLAGS = $(VBOX_ASFLAGS_FMT) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT))
1088 VBOX_ASFLAGS32 = $(VBOX_ASFLAGS_FMT32) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT32))
1089 VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT64))
1090else
1091 VBOX_ASTOOL = NASM
1092 VBOX_ASFLAGS = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT)) -D__NASM__ -w+orphan-labels -g
1093 VBOX_ASFLAGS32 = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT32)) -D__NASM__ -w+orphan-labels -g
1094 VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__NASM__ -w+orphan-labels -g
1095endif
1096
1097#
1098# Windows only has mingw handy. On *nix we have to deal with cross compiling
1099# 32-bit targets on 64-bit platforms, meaning we'll be using gcc32/g++32.
1100# In the latter case we'll also have to disable all the all the R0 driver related stuff.
1101#
1102ifndef VBOX_GCC_TOOL
1103 ifeq ($(KBUILD_TARGET),win)
1104 VBOX_GCC_TOOL := MINGW32
1105 TOOL_MINGW32_CFLAGS := $(UNDEFINED) # override -g
1106 else ifeq ($(KBUILD_TARGET),os2)
1107 VBOX_GCC_TOOL := GXX3OMF
1108 else ifeq ($(KBUILD_TARGET),darwin)
1109 VBOX_GCC_TOOL := GXX4MACHO
1110 else ifeq ($(KBUILD_TARGET),solaris)
1111 VBOX_GCC_TOOL := GXX3PLAIN
1112 VBOX_GCC32_TOOL := GXX3PLAIN
1113 TOOL_GXX3PLAIN_LD_SYSMOD ?= /usr/ccs/bin/ld
1114 else
1115 VBOX_GCC_TOOL := GXX3
1116 ifeq ($(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH),x86.amd64) ## @todo mixing target/host here!
1117 VBOX_GCC_TOOL := GXX32
1118 VBOX_WITH_VBOXDRV=
1119 else ifeq ($(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH),amd64.x86)
1120 VBOX_GCC_TOOL := GXX64
1121 VBOX_WITH_VBOXDRV=
1122 endif
1123 endif
1124endif
1125ifndef VBOX_GCC32_TOOL
1126 ifeq ($(KBUILD_TARGET_ARCH),x86)
1127 VBOX_GCC32_TOOL := $(VBOX_GCC_TOOL)
1128 else ifeq ($(KBUILD_TARGET),win)
1129 VBOX_GCC32_TOOL := MINGW32
1130 else
1131 VBOX_GCC32_TOOL := GXX32
1132 endif
1133endif
1134
1135#
1136# Decide which Visual C++ compiler version we're using by default.
1137#
1138ifndef VBOX_VCC_TOOL
1139 ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
1140 ifndef VBOX_USE_VCC100
1141 VBOX_USE_VCC80 ?= 1 # the default for win.amd64
1142 endif
1143 endif
1144 ifdef VBOX_USE_VCC100
1145 VBOX_VCC_TOOL_STEM = VCC100
1146 else ifdef VBOX_USE_VCC80
1147 VBOX_VCC_TOOL_STEM = VCC80
1148 else
1149 VBOX_VCC_TOOL := VCC70
1150 VBOX_VCC_TOOL_STEM := VCC70
1151 endif
1152 ifndef VBOX_VCC_TOOL
1153 VBOX_VCC_TOOL := $(VBOX_VCC_TOOL_STEM)$(toupper $(KBUILD_TARGET_ARCH))
1154 endif
1155else ifndef VBOX_VCC_TOOL_STEM
1156$(error VBOX_VCC_TOOL_STEM is not defined)
1157endif
1158# VCC70 is hopefully the most special case here...
1159if !defined(VBOX_USE_VCC100) && !defined(VBOX_USE_VCC90) && !defined(VBOX_USE_VCC80) && !defined(VBOX_USE_VCC70)
1160 VBOX_USE_VCC70 := 1
1161endif
1162
1163#
1164# The kBuild tools and SDKs are using PATH_DEVTOOLS, PATH_DEVTOOLS_BLD
1165# and PATH_DEVTOOLS_TRG to find things if we give them specific locations.
1166#
1167PATH_DEVTOOLS ?= $(PATH_ROOT)/tools
1168PATH_DEVTOOLS := $(abspath $(PATH_DEVTOOLS))
1169PATH_DEVTOOLS_BLD ?= $(PATH_DEVTOOLS)/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)
1170PATH_DEVTOOLS_TRG ?= $(PATH_DEVTOOLS)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
1171
1172## @todo Remove the default tool crap here!
1173TOOL = $(VBOX_GCC_TOOL)
1174ifdef VBOX_USE_VCC70
1175 TOOL.win = VCC70
1176else
1177 TOOL.win.x86 = $(VBOX_VCC_TOOL_STEM)X86
1178 TOOL.win.amd64 = $(VBOX_VCC_TOOL_STEM)AMD64
1179endif
1180ASTOOL = $(VBOX_ASTOOL)
1181
1182#
1183# L4-specific settings.
1184#
1185ifdef L4_DIR
1186 ifeq ($(KBUILD_TARGET),l4)
1187 L4_API ?= l4v2
1188 L4_ARCH ?= $(KBUILD_TARGET_ARCH)
1189 ifeq ($(L4_ARCH),x86)
1190 L4_CPU ?= 586
1191 L4LINUX26_INCDIR := $(L4LINUX26_DIR)/include \
1192 $(L4LINUX26_DIR)/include/asm-l4/i386-arch
1193 else ifeq ($(L4_ARCH),amd64)
1194 L4_CPU ?= k8
1195 L4LINUX26_INCDIR := $(L4LINUX26_DIR)/include
1196 # no red zone for L4 because of IPC bindings
1197 CFLAGS.l4 = -mno-red-zone
1198 CXXFLAGS.l4 = -mno-red-zone
1199 else
1200 $(error L4_ARCH=$(L4_ARCH))
1201 endif
1202 L4_OBJ := $(L4_DIR)/build-$(L4_ARCH)-$(L4_CPU)-$(L4_API)
1203 # support splitted Linux kernels (make O=<build directory>)
1204 kernelsrc := $(shell $(SED_EXT) -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(L4LINUX26_DIR)/Makefile)
1205 ifneq ($(kernelsrc),)
1206 kernelpath := $(realpath $(kernelsrc))
1207 L4LINUX26_INCDIR += $(L4LINUX26_DIR)/include2 $(kernelpath)/include
1208 endif
1209 L4_INCDIR := \
1210 $(L4_OBJ)/include/uclibc++ \
1211 $(L4_OBJ)/include/$(L4_ARCH)/uclibc \
1212 $(L4_OBJ)/include/uclibc \
1213 $(L4LINUX26_INCDIR) \
1214 $(L4_OBJ)/include/$(L4_ARCH)/$(L4_API) \
1215 $(L4_OBJ)/include/$(L4_API) \
1216 $(L4_OBJ)/include/$(L4_ARCH) \
1217 $(L4_OBJ)/include \
1218 $(L4_DIR)/tool/dice/include
1219 L4_LIBDIR := \
1220 $(L4_DIR)/build-$(L4_ARCH)-$(L4_CPU)-$(L4_API)/lib/$(L4_ARCH)_$(L4_CPU)/$(L4_API)
1221 endif # KBUILD_TARGET == l4
1222endif # L4_DIR
1223
1224# Produce debugging information that the Fiasco kernel debugger can read.
1225ifeq ($(KBUILD_TARGET).$(KBUILD_TYPE),l4.debug)
1226 DEBUG_L4 = -gstabs+
1227endif
1228
1229#
1230# Setup the global defines and includes.
1231#
1232# Note! The __SOMETHING__ #defines are deprecated as they violate the C/C++ specs.
1233#
1234INCS += $(PATH_ROOT)/include $(PATH_OUT)
1235DEFS += VBOX
1236DEFS.debug := DEBUG DEBUG_$(subst $(subst _, ,_),_,$(USERNAME)) DEBUG_USERNAME=$(subst $(subst _, ,_),_,$(USERNAME))
1237DEFS.dbgopt = $(DEFS.debug)
1238DEFS.profile = VBOX_WITH_STATISTICS
1239DEFS.strict = RT_STRICT VBOX_STRICT
1240DEFS.x86 = RT_ARCH_X86 __X86__
1241DEFS.amd64 = RT_ARCH_AMD64 __AMD64__
1242DEFS.darwin = RT_OS_DARWIN __DARWIN__
1243DEFS.freebsd = RT_OS_FREEBSD __FREEBSD__
1244DEFS.l4 = RT_OS_L4 __L4__ __L4ENV__ L4API_l4v2 ARCH_$(KBUILD_TARGET_ARCH) __NO_CTYPE _FILE_OFFSET_BITS=64
1245DEFS.linux = RT_OS_LINUX _FILE_OFFSET_BITS=64
1246DEFS.netbsd = RT_OS_NETBSD
1247DEFS.openbsd = RT_OS_OPENBSD
1248DEFS.os2 = RT_OS_OS2 __OS2__
1249DEFS.solaris = RT_OS_SOLARIS _FILE_OFFSET_BITS=64
1250DEFS.win = RT_OS_WINDOWS __WIN__
1251DEFS.win.x86 = __WIN32__
1252DEFS.win.amd64 = __WIN64__
1253# optional defines (use environment or make commandline)
1254ifdef VBOX_WITH_DEBUGGER
1255 DEFS += VBOX_WITH_DEBUGGER
1256endif
1257ifdef VBOX_WITH_STATISTICS
1258 DEFS += VBOX_WITH_STATISTICS
1259endif
1260ifdef VBOX_STRICT
1261 DEFS += VBOX_STRICT
1262endif
1263ifdef LOG_ENABLED
1264 DEFS += LOG_ENABLED
1265endif
1266ifdef VBOX_OSE
1267 DEFS += VBOX_OSE
1268endif
1269ifdef VBOX_WITH_64_BITS_GUESTS
1270 DEFS += VBOX_WITH_64_BITS_GUESTS
1271endif
1272ifdef VBOX_WITH_HARDENING
1273 DEFS += VBOX_WITH_HARDENING
1274endif
1275ifdef VBOX_PATH_APP_PRIVATE
1276 DEFS += RTPATH_APP_PRIVATE=\"$(VBOX_PATH_APP_PRIVATE)\"
1277endif
1278ifdef VBOX_PATH_APP_PRIVATE_ARCH
1279 DEFS += RTPATH_APP_PRIVATE_ARCH=\"$(VBOX_PATH_APP_PRIVATE_ARCH)\"
1280endif
1281ifdef VBOX_PATH_SHARED_LIBS
1282 DEFS += RTPATH_SHARED_LIBS=\"$(VBOX_PATH_SHARED_LIBS)\"
1283endif
1284ifdef VBOX_PATH_APP_DOCS
1285 DEFS += RTPATH_APP_DOCS=\"$(VBOX_PATH_APP_DOCS)\"
1286endif
1287if defined(VBOX_WITH_STRICT_LOCKS) && ($(KBUILD_TYPE) == "debug" || $(KBUILD_TYPE) == "strict")
1288 DEFS += RT_LOCK_STRICT RT_LOCK_STRICT_ORDER
1289endif
1290
1291#
1292# Compiler optimization flags.
1293#
1294VBOX_GCC_WARN ?= -Wall $(VBOX_GCC_Wextra) $(VBOX_GCC_Wno-missing-field-initializers) -Wno-unused -Wno-trigraphs $(VBOX_GCC_fdiagnostics-show-option)
1295VBOX_GCC_PEDANTIC_CXX ?= -pedantic -Wshadow $(VBOX_GCC_WARN) -Wno-long-long
1296VBOX_GCC_PEDANTIC_C ?= -pedantic -Wshadow $(VBOX_GCC_WARN) -Wno-long-long -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Werror-implicit-function-declaration
1297ifeq ($(KBUILD_TYPE),debug)
1298 VBOX_GCC_FP ?= -fno-omit-frame-pointer
1299 VBOX_GCC_OPT ?= -O0
1300 VBOX_VCC_FP ?= -Oy-
1301 VBOX_VCC_OPT ?=
1302 VBOX_GCC_R0_FP ?= -fno-omit-frame-pointer -fno-optimize-sibling-calls
1303 VBOX_GCC_R0_OPT ?= -O2
1304 VBOX_VCC_R0_FP ?= -Oy-
1305 VBOX_VCC_R0_OPT ?=
1306 VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer -fno-optimize-sibling-calls
1307 VBOX_GCC_GC_OPT ?= -O2
1308 VBOX_VCC_GC_FP ?= -Oy-
1309 VBOX_VCC_GC_OPT ?=
1310else
1311 # We should use -fomit-frame-pointer for GCC / -Oy for VCC.
1312 # -funwind-tables provides support for backtraces in gdb then.
1313 VBOX_GCC_FP ?= -fno-omit-frame-pointer
1314 VBOX_GCC_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
1315 VBOX_VCC_FP ?= -Oy-
1316 ifndef VBOX_USE_VCC70
1317 VBOX_VCC_OPT ?= -O2 -GS-
1318 else
1319 VBOX_VCC_OPT ?= -Ogitb2
1320 endif
1321 VBOX_GCC_R0_FP ?= -fno-omit-frame-pointer
1322 VBOX_GCC_R0_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
1323 VBOX_VCC_R0_FP ?= -Oy-
1324 ifndef VBOX_USE_VCC70
1325 VBOX_VCC_R0_OPT ?= -O2 -GS-
1326 else
1327 VBOX_VCC_R0_OPT ?= -Ogitb2
1328 endif
1329 VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer
1330 VBOX_GCC_GC_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
1331 VBOX_VCC_GC_FP ?= -Oy-
1332 ifndef VBOX_USE_VCC70
1333 VBOX_VCC_GC_OPT ?= -O2
1334 else
1335 VBOX_VCC_GC_OPT ?= -Ogitb2
1336 endif
1337endif
1338ifeq ($(KBUILD_TARGET_ARCH),x86)
1339 ifneq ($(KBUILD_TARGET),darwin)
1340 # (The '<=' operator is for prepending (kmk specific).)
1341 VBOX_GCC_OPT <= -march=i586
1342 endif
1343endif
1344
1345
1346#
1347# Select the CRT type we're using with Microsoft Visual C++.
1348#
1349ifdef VBOX_WITH_DEBUG_VCC_CRT
1350 VBOX_VCC_CRT_TYPE = d
1351 VBOX_VCC_CRT_TYPE_N =
1352else
1353 VBOX_VCC_CRT_TYPE =
1354 VBOX_VCC_CRT_TYPE_N = d
1355endif
1356
1357#
1358# Decide which windows DDK to use by default.
1359#
1360ifdef VBOX_USE_WINDDK
1361 VBOX_WINDDK ?= WINDDK
1362else
1363 VBOX_WINDDK ?= W2K3DDK
1364endif
1365
1366#
1367# ARCH_BITS_DEFS.
1368#
1369ifeq ($(KBUILD_TARGET_ARCH),amd64)
1370 ARCH_BITS_DEFS := HC_ARCH_BITS=64
1371else ifeq ($(KBUILD_TARGET_ARCH),x86)
1372 ARCH_BITS_DEFS := HC_ARCH_BITS=32
1373else
1374 error KBUILD_TARGET_ARCH=$(KBUILD_TARGET_ARCH)
1375endif
1376
1377ifdef VBOX_WITH_64_BITS_GUESTS
1378 VBOX_GC_ARCH_BITS_DEFS := GC_ARCH_BITS=64
1379else
1380 VBOX_GC_ARCH_BITS_DEFS := GC_ARCH_BITS=32
1381endif
1382ARCH_BITS_DEFS += $(VBOX_GC_ARCH_BITS_DEFS)
1383
1384#
1385# Add the output dir(s) to the dynamic loader search path.
1386#
1387if1of ($(KBUILD_HOST), freebsd linux l4 netbsd openbsd solaris)
1388 export LD_LIBRARY_PATH:=$(PATH_BIN):$(PATH_LIB):$(LD_LIBRARY_PATH)
1389endif
1390ifeq ($(KBUILD_HOST),os2)
1391 #fixme! export BEGINLIBPATH:=$(PATH_BIN);$(PATH_LIB);$(BEGINLIBPATH)
1392endif
1393ifeq ($(KBUILD_HOST),win)
1394 export PATH:=$(PATH_BIN);$(PATH_LIB);$(PATH)
1395endif
1396
1397#
1398# Common libraries and tools.
1399#
1400ifeq ($(KBUILD_TARGET),darwin)
1401 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.dylib
1402 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
1403 LIB_KPROFILE = $(PATH_BIN)/kPrf2.dylib
1404 LIB_VMM = $(PATH_BIN)/VBoxVMM.dylib
1405 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
1406 LIB_REM = $(PATH_LIB)/VBoxREM.dylib
1407 LIB_XPCOM = $(PATH_BIN)/VBoxXPCOM.dylib
1408 LIB_DDU = $(PATH_BIN)/VBoxDDU.dylib
1409endif
1410ifeq ($(KBUILD_TARGET),l4)
1411 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.s.so
1412 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
1413 LIB_KPROFILE = $(PATH_BIN)/kPrf2.s.so
1414 LIB_VMM = $(PATH_BIN)/VBoxVMM.s.so
1415 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
1416 LIB_REM = $(PATH_LIB)/VBoxREM.s.so
1417 LIB_XPCOM = $(PATH_BIN)/VBoxXPCOM.s.so
1418 LIB_DDU = $(PATH_BIN)/VBoxDDU.s.so
1419endif
1420if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris)
1421 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.so
1422 LIB_RUNTIME_EF = $(PATH_LIB)/RuntimeEFCPP.a
1423 LIB_KPROFILE = $(PATH_BIN)/kPrf2.so
1424 LIB_VMM = $(PATH_BIN)/VBoxVMM.so
1425 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
1426 LIB_REM = $(PATH_LIB)/VBoxREM.so
1427 LIB_XPCOM = $(PATH_BIN)/VBoxXPCOM.so
1428 LIB_DDU = $(PATH_BIN)/VBoxDDU.so
1429endif
1430ifeq ($(KBUILD_TARGET),os2)
1431 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.dll
1432 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
1433 LIB_KPROFILE = $(PATH_BIN)/kPrf2.dll
1434 LIB_VMM = $(PATH_BIN)/VBoxVMM.dll
1435 LIB_VMMGC = $(PATH_LIB)/VMMGCImp.lib
1436 LIB_REM = $(PATH_LIB)/VBoxREMImp.lib
1437 LIB_XPCOM = $(PATH_BIN)/VBoxXCOM.dll
1438 LIB_DDU = $(PATH_BIN)/VBoxDDU.dll
1439 VBOX_OBJ_SYS0 = $(PATH_OBJ)/RuntimeR0/os2/sys0.obj
1440endif
1441ifeq ($(KBUILD_TARGET),win)
1442 LIB_RUNTIME = $(PATH_LIB)/VBoxRT.lib
1443 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.lib
1444 LIB_KPROFILE = $(PATH_LIB)/kPrf2.lib
1445 LIB_VMM = $(PATH_LIB)/VBoxVMM.lib
1446 LIB_VMMGC = $(PATH_OBJ)/VMMGC/VMMGC.lib
1447 LIB_REM = $(PATH_LIB)/VBoxREMImp.lib
1448 LIB_XPCOM = $(PATH_BIN)/VBoxXPCOM.dll
1449 LIB_DDU = $(PATH_LIB)/VBoxDDU.lib
1450endif
1451VBOX_LIB_SUPHARDENED = $(PATH_LIB)/SUPR3HardenedStatic$(VBOX_SUFF_LIB)
1452VBOX_LIB_RUNTIME_STATIC = $(PATH_LIB)/RuntimeR3$(VBOX_SUFF_LIB)
1453
1454# Python
1455ifndef VBOX_BLD_PYTHON
1456 if1of ($(KBUILD_HOST), win)
1457 VBOX_BLD_PYTHON := $(firstword $(rsort $(wildcard $(PATH_DEVTOOLS)/win.x86/python/v*/python$(HOSTSUFF_EXE))) python-not-found.exe)
1458 else
1459 VBOX_BLD_PYTHON := python$(HOSTSUFF_EXE)
1460 endif
1461endif
1462
1463# Define the macro for win path conversion.
1464ifndef VBOX_ONLY_SDK
1465 VBOX_FN_MAKE_WIN_PATH = $(subst /,\\,$(1))
1466else
1467 # on Wine Z: is always FS root
1468 VBOX_FN_MAKE_WIN_PATH = $(subst /,\\,$(patsubst /%,Z:/%,$(1)))
1469endif #!VBOX_ONLY_SDK
1470
1471# The kprofile build automagically links with kProfile.
1472ifeq ($(KBUILD_TYPE),kprofile)
1473 LIB_RUNTIME += $(LIB_KPROFILE)
1474endif
1475
1476# Enable C++ electric fence heap. (Warning: will easily run out of virtual memory / kernel stuff on Linux/Windows.)
1477ifdef VBOX_WITH_CPP_EF
1478 LIB_RUNTIME <= $(LIB_RUNTIME_EF)
1479endif
1480
1481# Overridable libraries (unix).
1482LIB_PTHREAD ?= pthread
1483
1484# Xcursor (consider an SDK for this).
1485ifeq ($(VBOX_XCURSOR_LIBS),)
1486 ifeq ($(KBUILD_TARGET),solaris)
1487 VBOX_XCURSOR_LIBS := $(lastword $(wildcard $(PATH_DEVTOOLS_TRG)/libXcursor/*/lib/libXcursor.a))
1488 ifneq ($(VBOX_XCURSOR_LIBS),)
1489 VBOX_XCURSOR_INCS := $(patsubst %/lib/libXcursor.a,%/include, $(VBOX_XCURSOR_LIBS))
1490 VBOX_XCURSOR_LIBS += X11 Xrender Xfixes
1491 endif
1492 endif
1493 ifeq ($(VBOX_XCURSOR_LIBS),)
1494 VBOX_XCURSOR_LIBS := Xcursor
1495 endif
1496endif
1497
1498
1499# Intel ASL compiler for ACPI
1500VBOX_IASLCMD ?= $(firstword $(wildcard $(PATH_DEVTOOLS_BLD)/bin/iasl$(HOSTSUFF_EXE)) iasl$(HOSTSUFF_EXE))
1501
1502# Bruce's C compile is a C-compiler for BIOS-related 8086 code
1503ifndef VBOX_BCC
1504 if exists "$(PATH_DEVTOOLS_BLD)/bin/bcc$(HOSTSUFF_EXE)"
1505VBOX_BCC := $(PATH_DEVTOOLS_BLD)/bin/bcc$(HOSTSUFF_EXE) -B $(PATH_DEVTOOLS_BLD)/bin/
1506 else
1507VBOX_BCC := bcc$(HOSTSUFF_EXE)
1508 endif
1509endif
1510
1511# Assembler for BIOS-related 8086 code
1512ifndef VBOX_AS86
1513 if exists "$(PATH_DEVTOOLS_BLD)/bin/as86$(HOSTSUFF_EXE)"
1514VBOX_AS86 := $(PATH_DEVTOOLS_BLD)/bin/as86$(HOSTSUFF_EXE)
1515 else
1516VBOX_AS86 := as86$(HOSTSUFF_EXE)
1517 endif
1518endif
1519
1520# libxslt XSLT processor. (see PATH_TOOL_YASM for explanation why it's temporarily located in bin.)
1521ifeq ($(KBUILD_HOST),win)
1522# VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/win.x86/libxslt/10114/xsltproc.exe
1523 VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/win.x86/bin/xsltproc.exe
1524else ifeq ($(KBUILD_HOST),os2)
1525 VBOX_XSLTPROC ?= BEGINLIBPATH="$(PATH_DEVTOOLS_BLD)/bin;$$BEGINLIBPATH" $(PATH_DEVTOOLS_BLD)/bin/xsltproc.exe
1526else
1527 VBOX_XSLTPROC ?= xsltproc$(HOSTSUFF_EXE)
1528endif
1529
1530# bin2c (convert binary files into C arrays)
1531VBOX_BIN2C ?= $(PATH_OBJ)/bin2c/bin2c$(HOSTSUFF_EXE)
1532
1533# biossums (set BIOS checksums)
1534VBOX_BIOSSUMS ?= $(PATH_OBJ)/biossums/biossums$(HOSTSUFF_EXE)
1535
1536# filesplitter (splits java files)
1537VBOX_FILESPLIT ?= $(PATH_OBJ)/filesplitter/filesplitter$(HOSTSUFF_EXE)
1538
1539# mkisofs
1540ifeq ($(KBUILD_HOST),win)
1541 VBOX_MKISOFS ?= $(PATH_DEVTOOLS_BLD)/bin/mkisofs.exe
1542else
1543 VBOX_MKISOFS ?= mkisofs
1544endif
1545
1546# Makeself for the linux installers.
1547VBOX_MAKESELF ?= $(PATH_DEVTOOLS)/common/makeself/v2.1.5/makeself.sh
1548
1549# Microsoft HTML Help Workshop.
1550VBOX_PATH_HTML_HELP_WORKSHOP ?= $(PATH_DEVTOOLS)/win.x86/HTML_Help_Workshop/v1.3/
1551
1552# Path to the null soft installer.
1553VBOX_PATH_NSIS ?= $(PATH_DEVTOOLS)/win.x86/nsis/v2.33-log-nsscm-r1
1554
1555# Path to AutoIt3.
1556VBOX_PATH_AUTOIT3 ?= $(PATH_DEVTOOLS)/win.x86/autoit/v3.2.10.0
1557
1558# Windows install tools...
1559VBOX_PATH_WIX ?= $(PATH_DEVTOOLS)/win.x86/wix/v2.0.5805.0
1560VBOX_PATH_MSITRAN ?= $(PATH_DEVTOOLS)/win.x86/sdk/200504/Bin/MsiTran.Exe
1561VBOX_PATH_MSIDB ?= $(PATH_DEVTOOLS)/win.x86/sdk/200504/Bin/MsiDb.Exe
1562VBOX_PATH_WISUBSTG ?= $(PATH_DEVTOOLS)/win.x86/sdk/200504/Samples/SysMgmt/Msi/Scripts/WiSubStg.vbs
1563VBOX_PATH_WISUMINFO ?= $(PATH_DEVTOOLS)/win.x86/sdk/200504/Samples/SysMgmt/Msi/Scripts/WiSumInf.vbs
1564VBOX_PATH_DIFX ?= $(PATH_DEVTOOLS)/win.$(KBUILD_TARGET_ARCH)/DIFx/v2.1-r2
1565VBOX_PATH_CABSDK ?= $(PATH_DEVTOOLS)/win.x86/cabsdk/r1
1566VBOX_PATH_MAKECAB ?= $(VBOX_PATH_CABSDK)/BIN/MAKECAB.EXE
1567
1568# We need to export YASM for OSE, but since it was converted to .zip we need to
1569# allow for the location used by the zip to be properly cleaned up first.
1570if1of ($(KBUILD_HOST).$(KBUILD_HOST_ARCH), linux.x86 solaris.x86 win.x86)
1571 PATH_TOOL_YASM ?= $(PATH_DEVTOOLS_BLD)/bin
1572endif
1573
1574# XPCOM setup for all but win32.
1575ifneq ($(KBUILD_TARGET),win)
1576 VBOX_WITH_XPCOM = 1
1577 # if updating, also update xpidl_INST var in src/libs/xpcom18a4/Makefile.kmk
1578 VBOX_XPIDL ?= $(PATH_BIN)/xpidl$(HOSTSUFF_EXE)
1579 ifeq ($(KBUILD_TARGET),os2)
1580 VBOX_XPIDL_ENV = BEGINLIBPATH="$(dir $(VBOX_XPIDL));$$BEGINLIBPATH"$(SP)
1581 endif
1582 VBOX_PATH_XPCOM_IDL ?= $(VBOX_PATH_SDK)/bindings/xpcom/idl
1583 VBOX_XPCOM_INCS ?= \
1584 $(VBOX_PATH_SDK)/bindings/xpcom/include \
1585 $(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom \
1586 $(VBOX_PATH_SDK)/bindings/xpcom/include/string \
1587 $(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom \
1588 $(VBOX_PATH_SDK)/bindings/xpcom/include/nsprpub \
1589 $(VBOX_PATH_SDK)/bindings/xpcom/include/ipcd
1590 ifneq ($(KBUILD_TARGET),os2)
1591 # libIDL-config (for xpcom18a4)
1592 ifeq ($(origin VBOX_LIBIDL_CONFIG),undefined)
1593 export VBOX_LIBIDL_CONFIG := $(firstword $(shell which libIDL-config-2 libIDL-config 2> /dev/null))
1594 endif
1595 endif
1596endif
1597
1598# The X11 LIBPATH. (The amd64 hack is for RHEL4.)
1599ifeq ($(KBUILD_TARGET_ARCH),amd64)
1600 VBOX_LIBPATH_X11 ?= /usr/X11R6/lib64 /usr/X11R6/lib
1601else
1602 VBOX_LIBPATH_X11 ?= /usr/X11R6/lib
1603endif
1604
1605# 32bit X11 LIBPATH for building 32bit guest additions
1606VBOX_LIBPATH32_X11 ?= /usr/X11R6/lib32 /usr/X11R6/lib
1607
1608#
1609# Macros dealing with the darwin version we're targeting.
1610# The DEF in VBOX_DEF_MACOSX_VERSION_MIN mean default. The default min
1611# version is assumed to be the
1612#
1613ifeq ($(KBUILD_TARGET),darwin)
1614 ifeq ($(KBUILD_TARGET_ARCH),x86)
1615 ifdef VBOX_WITH_COCOA_QT
1616 VBOX_DEF_MACOSX_VERSION_MIN ?= 10.5
1617 VBOX_DARWIN_NO_COMPACT_LINKEDIT ?= $(VBOX_LD_no_compact_linkedit)
1618 else
1619 VBOX_DEF_MACOSX_VERSION_MIN ?= 10.4
1620 VBOX_DARWIN_NO_COMPACT_LINKEDIT ?=
1621 endif
1622 VBOX_MACOSX_GCC_INFIX ?= -4.0
1623 else
1624 VBOX_DEF_MACOSX_VERSION_MIN ?= 10.6
1625 VBOX_MACOSX_GCC_INFIX ?= -4.2
1626 VBOX_DARWIN_NO_COMPACT_LINKEDIT ?=
1627 endif
1628 TOOL_GCC4MACHO_CC = gcc$(VBOX_MACOSX_GCC_INFIX)$(HOSTSUFF_EXE)
1629 TOOL_GCC4MACHO_CXX = g++$(VBOX_MACOSX_GCC_INFIX)$(HOSTSUFF_EXE)
1630 TOOL_GCC4MACHO_AS = gcc$(VBOX_MACOSX_GCC_INFIX)$(HOSTSUFF_EXE)
1631 TOOL_GCC4MACHO_LD = gcc$(VBOX_MACOSX_GCC_INFIX)$(HOSTSUFF_EXE)
1632 TOOL_GCC4MACHO_LD_SYSMOD = gcc$(VBOX_MACOSX_GCC_INFIX)$(HOSTSUFF_EXE)
1633 TOOL_GXX4MACHO_CC = gcc$(VBOX_MACOSX_GCC_INFIX)$(HOSTSUFF_EXE)
1634 TOOL_GXX4MACHO_CXX = g++$(VBOX_MACOSX_GCC_INFIX)$(HOSTSUFF_EXE)
1635 TOOL_GXX4MACHO_OBJC= gcc$(VBOX_MACOSX_GCC_INFIX)$(HOSTSUFF_EXE) $(if-expr $(KBUILD_TARGET_ARCH) == "x86",-m32,-m64) -fvisibility=hidden
1636 TOOL_GXX4MACHO_OBJCXX = gcc$(VBOX_MACOSX_GCC_INFIX)$(HOSTSUFF_EXE) $(if-expr $(KBUILD_TARGET_ARCH) == "x86",-m32,-m64) -fvisibility=hidden -fvisibility-inlines-hidden
1637 TOOL_GXX4MACHO_AS = gcc$(VBOX_MACOSX_GCC_INFIX)$(HOSTSUFF_EXE)
1638 TOOL_GXX4MACHO_LD = g++$(VBOX_MACOSX_GCC_INFIX)$(HOSTSUFF_EXE)
1639 TOOL_GXX4MACHO_LD_SYSMOD = g++$(VBOX_MACOSX_GCC_INFIX)$(HOSTSUFF_EXE)
1640 ifeq ($(VBOX_DEF_MACOSX_VERSION_MIN),10.4)
1641 ifeq ($(origin VBOX_DARWIN_CLASSIC_LINKER),undefined)
1642 VBOX_DARWIN_CLASSIC_LINKER := $(shell ld -v 2>&1 )
1643 ifneq ($(filter ld64%, $(subst :, , $(VBOX_DARWIN_CLASSIC_LINKER))),)
1644 export VBOX_DARWIN_CLASSIC_LINKER := -Wl,-classic_linker
1645 else
1646 export VBOX_DARWIN_CLASSIC_LINKER :=
1647 endif
1648 endif
1649 VBOX_PATH_MACOSX_SDK ?= /Developer/SDKs/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN)u.sdk
1650 else
1651 VBOX_PATH_MACOSX_SDK ?= /Developer/SDKs/MacOSX$(VBOX_DEF_MACOSX_VERSION_MIN).sdk
1652 endif
1653 VBOX_DARWIN_DEF_SDK_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=$(subst .,,$(VBOX_DEF_MACOSX_VERSION_MIN))0 \
1654 MAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(VBOX_DEF_MACOSX_VERSION_MIN))0
1655 VBOX_DARWIN_DEF_SDK_CFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
1656 VBOX_DARWIN_DEF_SDK_CXXFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
1657 VBOX_DARWIN_DEF_SDK_OBJCFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
1658 VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -isysroot $(VBOX_PATH_MACOSX_SDK)
1659 VBOX_DARWIN_DEF_SDK_LDFLAGS = -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK) \
1660 -Wl,-headerpad_max_install_names $(VBOX_DARWIN_CLASSIC_LINKER) $(VBOX_DARWIN_NO_COMPACT_LINKEDIT)
1661
1662 # specific versions.
1663 ## @todo s/VBOX_DARWIN_DEF_SDK_10/VBOX_DARWIN_SDK_10/g
1664
1665 if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4) # classic linker detection is bust otherwise
1666 VBOX_PATH_MACOSX_SDK_10_4 ?= /Developer/SDKs/MacOSX10.4u.sdk
1667 VBOX_DARWIN_DEF_SDK_10_4_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=1040 MAC_OS_X_VERSION_MAX_ALLOWED=1040
1668 VBOX_DARWIN_DEF_SDK_10_4_CFLAGS := -mmacosx-version-min=10.4 -isysroot $(VBOX_PATH_MACOSX_SDK_10_4)
1669 VBOX_DARWIN_DEF_SDK_10_4_CXXFLAGS := -mmacosx-version-min=10.4 -isysroot $(VBOX_PATH_MACOSX_SDK_10_4)
1670 VBOX_DARWIN_DEF_SDK_10_4_OBJCFLAGS := -mmacosx-version-min=10.4 -isysroot $(VBOX_PATH_MACOSX_SDK_10_4)
1671 VBOX_DARWIN_DEF_SDK_10_4_OBJCXXFLAGS := -mmacosx-version-min=10.4 -isysroot $(VBOX_PATH_MACOSX_SDK_10_4)
1672 VBOX_DARWIN_DEF_SDK_10_4_LDFLAGS := -mmacosx-version-min=10.4 -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK_10_4) \
1673 -Wl,-headerpad_max_install_names $(VBOX_DARWIN_CLASSIC_LINKER)
1674 else
1675 VBOX_DARWIN_DEF_SDK_10_4_CXXFLAGS = $(error Using 10.4 SDK)
1676 VBOX_DARWIN_DEF_SDK_10_4_LDFLAGS = $(error Using 10.4 SDK)
1677 endif
1678
1679 if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4 10.5)
1680 VBOX_PATH_MACOSX_SDK_10_5 ?= /Developer/SDKs/MacOSX10.5.sdk
1681 VBOX_DARWIN_DEF_SDK_10_5_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=1050 MAC_OS_X_VERSION_MAX_ALLOWED=1050
1682 VBOX_DARWIN_DEF_SDK_10_5_CFLAGS := -mmacosx-version-min=10.5 -isysroot $(VBOX_PATH_MACOSX_SDK_10_5)
1683 VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS := -mmacosx-version-min=10.5 -isysroot $(VBOX_PATH_MACOSX_SDK_10_5)
1684 VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS := -mmacosx-version-min=10.5 -isysroot $(VBOX_PATH_MACOSX_SDK_10_5)
1685 VBOX_DARWIN_DEF_SDK_10_5_OBJCXXFLAGS := -mmacosx-version-min=10.5 -isysroot $(VBOX_PATH_MACOSX_SDK_10_5)
1686 VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS := -mmacosx-version-min=10.5 -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK_10_5) \
1687 -Wl,-headerpad_max_install_names $(VBOX_DARWIN_NO_COMPACT_LINKEDIT)
1688 else
1689 VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS = $(error Using 10.5 SDK)
1690 VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS = $(error Using 10.5 SDK)
1691 endif
1692
1693 if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4 10.5 10.6)
1694 VBOX_PATH_MACOSX_SDK_10_6 ?= /Developer/SDKs/MacOSX10.6.sdk
1695 VBOX_DARWIN_DEF_SDK_10_6_DEFS := MAC_OS_X_VERSION_MIN_REQUIRED=1060 MAC_OS_X_VERSION_MAX_ALLOWED=1060
1696 VBOX_DARWIN_DEF_SDK_10_6_CFLAGS := -mmacosx-version-min=10.6 -isysroot $(VBOX_PATH_MACOSX_SDK_10_6)
1697 VBOX_DARWIN_DEF_SDK_10_6_CXXFLAGS := -mmacosx-version-min=10.6 -isysroot $(VBOX_PATH_MACOSX_SDK_10_6)
1698 VBOX_DARWIN_DEF_SDK_10_6_OBJCFLAGS := -mmacosx-version-min=10.6 -isysroot $(VBOX_PATH_MACOSX_SDK_10_6)
1699 VBOX_DARWIN_DEF_SDK_10_6_OBJCXXFLAGS := -mmacosx-version-min=10.6 -isysroot $(VBOX_PATH_MACOSX_SDK_10_6)
1700 VBOX_DARWIN_DEF_SDK_10_6_LDFLAGS := -mmacosx-version-min=10.6 -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK_10_6) \
1701 -Wl,-headerpad_max_install_names
1702 else
1703 VBOX_DARWIN_DEF_SDK_10_6_CXXFLAGS = $(error Using 10.6 SDK)
1704 VBOX_DARWIN_DEF_SDK_10_6_LDFLAGS = $(error Using 10.6 SDK)
1705 endif
1706
1707
1708endif # target=darwin
1709
1710#
1711# Macro switching between @executable_path, @rpath and /Applications/VirtualBox.app
1712# depending on whether the build is hardened or not (dylib install_name).
1713#
1714ifeq ($(KBUILD_TARGET),darwin)
1715 ifndef VBOX_DYLD_EXECUTABLE_PATH
1716 ifdef VBOX_WITH_HARDENING
1717 VBOX_DYLD_EXECUTABLE_PATH = $(VBOX_PATH_APP_PRIVATE_ARCH)
1718 else if 0
1719 VBOX_DYLD_EXECUTABLE_PATH = @executable_path
1720 else
1721 VBOX_DYLD_EXECUTABLE_PATH = @rpath
1722 VBOX_WITH_RELATIVE_RUNPATH = @loader_path/
1723 endif
1724 endif
1725endif
1726
1727#
1728# Check for incompatible rpath combinations.
1729#
1730if defined(VBOX_WITH_RUNPATH) && defined(VBOX_WITH_ORIGIN)
1731 $(error VBOX_WITH_RUNPATH and VBOX_WITH_ORIGIN are mutually exclusive)
1732endif
1733if defined(VBOX_WITH_RELATIVE_RUNPATH) && defined(VBOX_WITH_ORIGIN)
1734 $(error VBOX_WITH_RELATIVE_RUNPATH and VBOX_WITH_ORIGIN are mutually exclusive)
1735endif
1736if defined(VBOX_WITH_RUNPATH) && defined(VBOX_WITH_RELATIVE_RUNPATH)
1737 $(error VBOX_WITH_RUNPATH and VBOX_WITH_RELATIVE_RUNPATH are mutually exclusive)
1738endif
1739if defined(VBOX_WITH_RELATIVE_RUNPATH) && defined(VBOX_WITH_HARDENING)
1740 $(error VBOX_WITH_RELATIVE_RUNPATH and VBOX_WITH_HARDENING are mutually exclusive)
1741endif
1742
1743#
1744# VBOX_WITH_ORIGIN translates into VBOX_WITH_RELATIVE_RUNPATH.
1745#
1746# We use two helper variables for the VBOX_WITH_ORIGIN stuff:
1747# VBOX_ORIGIN - Indirect expansion trick.
1748# VBOX_GCC_RPATH_OPT - Different GCC/LD combinations needs different options.
1749#
1750VBOX_ORIGIN = $$ORIGIN
1751ifeq ($(KBUILD_TARGET),solaris)
1752 VBOX_GCC_RPATH_OPT = -R
1753else
1754 VBOX_GCC_RPATH_OPT = -Wl,-rpath,
1755 VBOX_GCC_ORIGIN_OPT = -Wl,-z,origin
1756endif
1757ifdef VBOX_WITH_ORIGIN
1758 VBOX_WITH_RELATIVE_RUNPATH = $$(VBOX_ORIGIN)
1759endif
1760
1761#
1762# The X11 headers.
1763#
1764VBOX_PATH_X11_ROOT = $(PATH_ROOT)/src/VBox/Additions/x11/x11include
1765VBOX_PATH_X11_XFREE_4_3 = $(VBOX_PATH_X11_ROOT)/4.3
1766VBOX_PATH_X11_XORG_7_0 = $(VBOX_PATH_X11_ROOT)/7.0
1767VBOX_PATH_X11_XORG_7_1 = $(VBOX_PATH_X11_ROOT)/7.1
1768VBOX_PATH_X11_XORG_1_3 = $(VBOX_PATH_X11_ROOT)/1.3
1769VBOX_PATH_X11_XORG_1_4 = $(VBOX_PATH_X11_ROOT)/1.4
1770VBOX_PATH_X11_XORG_1_5 = $(VBOX_PATH_X11_ROOT)/1.5
1771VBOX_PATH_X11_XORG_1_6 = $(VBOX_PATH_X11_ROOT)/1.6
1772
1773#
1774# Various other variables.
1775#
1776
1777#
1778# crOpenGL related paths and variables.
1779#
1780ifdef VBOX_WITH_CROGL
1781 VBOX_PATH_CROGL_GLAPI = $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/glapi_parser
1782 VBOX_PATH_CROGL_GENFILES = $(PATH_OBJ)/VBoxOGLgen
1783 VBOX_PATH_CROGL_INCLUDE = $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/include
1784 VBOX_CROGL_API_FILES = $(VBOX_PATH_CROGL_GLAPI)/apiutil.py $(VBOX_PATH_CROGL_GLAPI)/APIspec.txt
1785 VBOX_CROGL_PYTHON_ENV = $(REDIRECT) $(if $1,-E 'PYTHONPATH=$1',) $(if $2,-o $2,) $(if $3,-i $3) --
1786
1787 if1of ($(KBUILD_HOST), os2 win)
1788 VBOX_PATH_CROGL_PYTHON_INCLUDE = $(VBOX_PATH_CROGL_GLAPI);$(PATH_ROOT)/src/VBox/GuestHost/OpenGL/packer;$(PATH_ROOT)/src/VBox/HostServices/SharedOpenGL/crserverlib
1789 else
1790 VBOX_PATH_CROGL_PYTHON_INCLUDE = $(VBOX_PATH_CROGL_GLAPI):$(PATH_ROOT)/src/VBox/GuestHost/OpenGL/packer:$(PATH_ROOT)/src/VBox/HostServices/SharedOpenGL/crserverlib
1791 endif
1792
1793 ifeq ($(KBUILD_TARGET),win)
1794 VBOX_LIB_OGL_CRUTIL = $(PATH_OBJ)/VBoxOGLcrutil/VBoxOGLcrutil$(VBOX_SUFF_LIB)
1795 VBOX_LIB_OGL_HOSTCRUTIL = $(PATH_OBJ)/VBoxOGLhostcrutil/VBoxOGLhostcrutil$(VBOX_SUFF_LIB)
1796 else
1797 VBOX_LIB_OGL_CRUTIL = $(VBOX_PATH_ADDITIONS)/VBoxOGLcrutil$(VBOX_SUFF_DLL)
1798 VBOX_LIB_OGL_HOSTCRUTIL = $(PATH_BIN)/VBoxOGLhostcrutil$(VBOX_SUFF_DLL)
1799 endif
1800
1801 if1of ($(KBUILD_TARGET), freebsd linux solaris)
1802 # VBOX_PATH_MESA_SOURCE = $(PATH_ROOT)/src/libs/mesa-7.2
1803 VBOX_PATH_MESA_SOURCE = $(VBOX_PATH_X11_ROOT)/mesa-7.2
1804 VBOX_MESA_INCS = \
1805 $(VBOX_PATH_MESA_SOURCE) \
1806 $(VBOX_PATH_MESA_SOURCE)/include \
1807 $(VBOX_PATH_MESA_SOURCE)/src/mesa/ \
1808 $(VBOX_PATH_MESA_SOURCE)/src/mesa/glapi \
1809 $(VBOX_PATH_MESA_SOURCE)/src/mesa/main \
1810 $(VBOX_PATH_MESA_SOURCE)/src/mesa/drivers/dri/common
1811 endif
1812
1813 VBOX_DARWIN_OPENGL_INST = obj/VBoxOGL/GL/
1814 VBOX_DARWIN_OPENGL_HEADERS = gl.h glu.h
1815 SDK_DARWIN-OPENGL = Workaround SDK for the darwin OpenGL include directorly layout layout.
1816 SDK_DARWIN-OPENGL_INCS = $(PATH_OUT)/obj/VBoxOGL
1817 SDK_DARWIN-OPENGL_ORDERDEPS = $(addprefix $(PATH_OUT)/obj/VBoxOGL/GL/./,$(VBOX_DARWIN_OPENGL_HEADERS))
1818 ## @todo kBuild: Using INTERMEDIATES doesn't work!
1819endif
1820
1821# The icons to use.
1822ifdef VBOX_OSE
1823 VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_win.ico
1824 VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_win.ico
1825 VBOX_NSIS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_win.ico
1826 VBOX_MACOSX_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox.icns
1827else
1828 ifeq ($(KBUILD_HOST),win)
1829 VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox-vista.ico
1830 VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBoxGA-vista.ico
1831 VBOX_NSIS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBoxGA-nsis.ico
1832 TOOL_VCC100X86_RC := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
1833 TOOL_VCC100AMD64_RC := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
1834 TOOL_VCC80X86_RC := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
1835 TOOL_VCC80AMD64_RC := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
1836 TOOL_VCC70_RC := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
1837 else
1838 VBOX_WINDOWS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox-winxp.ico
1839 VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBoxGA-winxp.ico
1840 VBOX_NSIS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox-nsis.ico
1841 endif
1842 VBOX_MACOSX_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox.icns
1843endif
1844
1845
1846ifndef VBOX_NOINC_GCC_CONFIG_KMK
1847#
1848# GCC stuff properties.
1849# Most of this is resolved on first kmk invocation and cached in PATH_OUT.
1850#
1851# Note! That a harmless warning is printed if the file doesn't exist.
1852# Note! Changes in GCC are not detected automatically (yet).
1853#
1854include $(KBUILD_PATH)/tools/$(VBOX_GCC_TOOL).kmk
1855ifneq ($(VBOX_GCC_TOOL),$(VBOX_GCC32_TOOL))
1856 include $(KBUILD_PATH)/tools/$(VBOX_GCC32_TOOL).kmk
1857endif
1858
1859# These tests never worked on Windows because of /dev/null, so, there
1860# can be no harm in just dropping them until cygwin is mp safe.
1861ifeq ($(KBUILD_HOST),win)
1862VBOX_GCC_CHECK_CC = $(2)
1863VBOX_GCC_CHECK_CXX = $(2)
1864VBOX_GCC_CHECK_LD = $(2)
1865VBOX_GCC32_CHECK_CXX = $(2)
1866else
1867VBOX_GCC_CHECK_CC = $(shell \
1868 if $(TOOL_$(VBOX_GCC_TOOL)_CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
1869 then echo "$(1)"; \
1870 else echo "$(2)"; fi; )
1871
1872VBOX_GCC_CHECK_CXX = $(shell \
1873 if $(TOOL_$(VBOX_GCC_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
1874 then echo "$(1)"; \
1875 else echo "$(2)"; fi; )
1876
1877VBOX_GCC_CHECK_LD = $(shell \
1878 if $(TOOL_$(VBOX_GCC_TOOL)_LD) -Wl,$(1) $(if $(eq $(KBUILD_HOST),darwin),-Wl$(COMMA)-u$(COMMA)start -Wl$(COMMA)-undefined$(COMMA)dynamic_lookup,) -nostdlib -o /dev/null -xc /dev/null > /dev/null 2>&1 ;\
1879 then echo "-Wl,$(1)"; \
1880 else echo "$(2)"; fi; )
1881
1882VBOX_GCC32_CHECK_CXX = $(shell \
1883 if $(TOOL_$(VBOX_GCC32_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
1884 then echo "$(1)"; \
1885 else echo "$(2)"; fi; )
1886endif
1887
1888ifeq ($(KBUILD_HOST),win)
1889# This isn't important (yet) on windows, so cook the result until
1890# cygwin is feeling better.
1891VBOX_GCC_VERSION := $(int-add $(int-mul 10000, 3), $(int-mul 100, 3), 3)
1892else
1893# This is kind of bad, the returned string needs to be re-evaluated before use.
1894# The reason for this hack is that the windows kmk_ash cannot deal with $((1+1)).
1895# Some versions of gcc (e.g. openSUSE11) return only major.minor on `gcc -dumpversion`.
1896VBOX_GCC_VERSION = $(shell \
1897 $(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))|' )
1898endif
1899
1900# No $(QUIET) here as it's interesting to see what goes into the file.
1901$(PATH_OUT)/GCCConfig.kmk: $(PATH_ROOT)/Config.kmk $(LOCALCFG) $(AUTOCFG)
1902 $(call MSG_GENERATE,,$@,)
1903 $(QUIET)$(RM) -f '$@'
1904 $(QUIET)$(MKDIR) -p $(@D)
1905
1906# HC compiler switch detection.
1907 $(APPEND) '$@' 'VBOX_GCC_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CC))'
1908 $(APPEND) '$@' 'VBOX_GCC_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CXX))'
1909 $(APPEND) '$@' 'VBOX_GCC_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)'
1910 $(APPEND) '$@' 'VBOX_GCC_Wno-pointer-sign ?= $(call VBOX_GCC_CHECK_CC,-Wno-pointer-sign,)'
1911 $(APPEND) '$@' 'VBOX_GCC_Wno-array_bounds ?= $$(if $$(int-ge $$(VBOX_GCC_VERSION_CXX),40300),-Wno-array-bounds,)'
1912# -Wextra produces additional useful warnings but includes -Wno-missing-field-initializers (too noisy)
1913 $(APPEND) '$@' 'VBOX_GCC_Wextra ?= $(call VBOX_GCC_CHECK_CC,-Wextra,)'
1914 $(APPEND) '$@' 'VBOX_GCC_Wlogical-op ?= $(call VBOX_GCC_CHECK_CC,-Wlogical-op,)'
1915 $(APPEND) '$@' 'VBOX_GCC_Wno-missing-field-initializers ?= $(call VBOX_GCC_CHECK_CC,-Wno-missing-field-initializers,)'
1916 $(APPEND) '$@' 'VBOX_GCC_Wno-pointer-to-int-cast ?= $(call VBOX_GCC_CHECK_CC,-Wno-pointer-to-int-cast,)'
1917 $(APPEND) '$@' 'VBOX_GCC_Wno-int-to-pointer-cast ?= $(call VBOX_GCC_CHECK_CC,-Wno-int-to-pointer-cast,)'
1918 $(APPEND) '$@' 'VBOX_GCC_Wno-variadic-macros ?= $(call VBOX_GCC_CHECK_CXX,-Wno-variadic-macros,)'
1919 $(APPEND) '$@' 'VBOX_GCC_Wno-invalid-offsetof ?= $(call VBOX_GCC_CHECK_CXX,-Wno-invalid-offsetof,)'
1920 $(APPEND) '$@' 'VBOX_GCC_fno-stack-protector ?= $(call VBOX_GCC_CHECK_CC,-fno-stack-protector,)'
1921 $(APPEND) '$@' 'VBOX_GCC_fdiagnostics-show-option ?= $(call VBOX_GCC_CHECK_CC,-fdiagnostics-show-option,)'
1922# Produce code optimized for the most common IA32/AMD64/EM64T processors. Introduced with gcc version 4.2.
1923 $(APPEND) '$@' 'VBOX_GCC_mtune-generic ?= $(call VBOX_GCC_CHECK_CC,-mtune=generic,)'
1924 $(APPEND) '$@' 'VBOX_LD_as_needed ?= $(call VBOX_GCC_CHECK_LD,--as-needed,)'
1925# gcc version < 3.4 has a bug in handling __attribute__((regparm(3))).
1926# See http://osdir.com/ml/gcc.prs/2002-08/msg00223.html and probably http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20004
1927 $(APPEND) '$@' 'VBOX_GCC_BUGGY_REGPARM ?= $$(int-lt $$(VBOX_GCC_VERSION_CC),30400)'
1928ifneq ($(KBUILD_TARGET),l4)
1929# Set default attribute for ELF and MACH-O symbols to ``hidden'' to reduce the number
1930# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
1931 $(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CC),)'
1932 $(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CC),40000),)'
1933 $(APPEND) '$@' ' VBOX_GCC_fvisibility-hidden ?= $(call VBOX_GCC_CHECK_CC,-fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN -DRT_USE_VISIBILITY_DEFAULT,)'
1934 $(APPEND) '$@' ' endif'
1935 $(APPEND) '$@' 'endif'
1936endif
1937ifneq ($(KBUILD_TARGET),l4)
1938# Set default attribute for inline functions to ``hidden'' to reduce the number
1939# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
1940 $(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CXX),)'
1941 $(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CXX),40000),)'
1942 $(APPEND) '$@' ' VBOX_GCC_fvisibility-inlines-hidden ?= $(call VBOX_GCC_CHECK_CXX,-fvisibility-inlines-hidden,)'
1943 $(APPEND) '$@' ' endif'
1944 $(APPEND) '$@' 'endif'
1945endif
1946# Find the compiler includes for IPRT no-crt.
1947# Note that `$(dir $(gcc -print-libgcc-file-name))/include does not work for a 64-bit cross build on a 32-bit build host.
1948ifeq ($(KBUILD_HOST),win)
1949# With the cygwin issues and gcc on windows returning a useless path, just skip this on windows.
1950 $(APPEND) '$@' 'VBOX_PATH_GCC_INCS ?= '
1951else
1952 $(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'
1953endif
1954# 32-bit (GC) compiler switch detection.
1955 $(APPEND) '$@' 'VBOX_GCC32_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CC))'
1956 $(APPEND) '$@' 'VBOX_GCC32_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CXX))'
1957 $(APPEND) '$@' 'VBOX_GCC32_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC32_TOOL)_CC) -print-libgcc-file-name)'
1958 $(APPEND) '$@' 'VBOX_GCC32_Wno-variadic-macros ?= $(call VBOX_GCC32_CHECK_CXX,-Wno-variadic-macros,)'
1959# darwin no_compact_linkedit starting at Xcode 3.2
1960ifeq ($(KBUILD_HOST),darwin)
1961 $(APPEND) '$@' 'VBOX_LD_no_compact_linkedit ?= $(call VBOX_GCC_CHECK_LD,-no_compact_linkedit,)'
1962endif
1963
1964include $(PATH_OUT)/GCCConfig.kmk
1965endif # !VBOX_NOINC_GCC_CONFIG_KMK
1966
1967#
1968# Warnings as errors.
1969#
1970# GCC: We disable warnings on non-X86 systems because of the variadic
1971# macro usage in the logger.
1972#
1973ifdef VBOX_WITH_WARNINGS_AS_ERRORS
1974 if defined(VBOX_WITH_WARNINGS_AS_ERRORS) \
1975 && $(VBOX_GCC_VERSION_CXX) < 40000 \
1976 && "$(KBUILD_TARGET_ARCH)" != "x86" \
1977 && "$(KBUILD_TARGET)" != "win"
1978 VBOX_WITH_WARNINGS_AS_ERRORS=
1979 else
1980 VBOX_GCC_WERR ?= -Werror
1981 VBOX_VCC_WERR ?= -WX
1982 VBOX_VCC_LD_WERR ?= ## @todo later also: -WX
1983 endif
1984endif
1985
1986#
1987# Code Signing.
1988#
1989ifdef VBOX_SIGNING_MODE
1990 ifeq ($(KBUILD_HOST),win)
1991 # VBOX_PATH_SELFSIGN points to the Vista WDK bin/SelfSign directory.
1992 ifndef VBOX_PATH_SELFSIGN
1993 VBOX_PATH_SELFSIGN := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS)/win.x86/selfsign/*)))
1994 ifeq ($(VBOX_PATH_SELFSIGN),)
1995 VBOX_PATH_SELFSIGN := $(PATH_DEVTOOLS)/win.x86/selfsign/r1
1996 endif
1997 endif
1998 VBOX_SIGNTOOL ?= $(PATH_DEVTOOLS)/bin/retry.cmd $(VBOX_PATH_SELFSIGN)/SignTool.exe
1999 VBOX_INF2CAT ?= $(VBOX_PATH_SELFSIGN)/Inf2Cat.exe
2000
2001 # There are three signing modes; 'test', 'development' and 'release'.
2002 ifeq ($(strip $(VBOX_SIGNING_MODE)),test)
2003 VBOX_CERTIFICATE_SUBJECT_NAME ?= MyTestCertificate
2004 VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
2005 else if1of ($(VBOX_SIGNING_MODE), release development)
2006 VBOX_CERTIFICATE_SUBJECT_NAME ?= Sun Microsystems, Inc.
2007 VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
2008 VBOX_CROSS_CERTIFICATE_FILE ?= $(VBOX_PATH_SELFSIGN)/MSCV-VSClass3.cer
2009 VBOX_CROSS_CERTIFICATE_FILE_ARGS ?= /ac "$(VBOX_CROSS_CERTIFICATE_FILE)"
2010 VBOX_TSA_URL ?= http://timestamp.verisign.com/scripts/timestamp.dll
2011 VBOX_TSA_URL_ARGS ?= /t "$(VBOX_TSA_URL)"
2012 else
2013 $(error Unknown VBOX_SIGNING_MODE: $(VBOX_SIGNING_MODE))
2014 endif
2015 VBOX_CERTIFICATE_STORE ?= my
2016 VBOX_CERTIFICATE_STORE_ARGS ?= /s "$(VBOX_CERTIFICATE_STORE)"
2017
2018 ## Commands for signing a driver image after link.
2019 VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_FILE_FN,$(out)))
2020 ## Sign a file.
2021 # @param 1 The file to sign.
2022 VBOX_SIGN_FILE_FN ?= $(VBOX_SIGNTOOL) sign \
2023 $(VBOX_CROSS_CERTIFICATE_FILE_ARGS) \
2024 $(VBOX_CERTIFICATE_STORE_ARGS) \
2025 $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
2026 $(VBOX_TSA_URL_ARGS) \
2027 $(1)
2028 ## Create a security catalog file.
2029 # @param 1 The directory containing the stuff to sign.
2030 # @param 2 The expected .cat name. (Inf2Cat lowercases it)
2031 # @param 3 The list of OSes, separated by ';'.
2032 VBOX_MAKE_CAT_HLP_FN ?= \
2033 $(RM) -f $(2)\
2034 $(NL)$(TAB)$(VBOX_INF2CAT) /driver:$(strip $(1)) /os:$(strip $(subst ;,$(COMMA),$(3))) /verbose \
2035 $(NL)$(TAB)$(MV) $(2) $(2) \
2036 $(NL)$(TAB)$(call VBOX_SIGN_FILE_FN,$(2))
2037 VBOX_MAKE_CAT64_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),XP_X64;Server2003_X64;Vista_X64)
2038 VBOX_MAKE_CAT32_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),2000;XP_X86;Server2003_X86;Vista_X86)
2039 ifeq ($(KBUILD_TARGET_ARCH),x86)
2040 VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT32_FN,$(1),$(2))
2041 else
2042 VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT64_FN,$(1),$(2))
2043 endif
2044
2045 # Go nuts, sign everything.
2046 ifeq ($(strip $(VBOX_SIGNING_MODE)),release)
2047 ## Commands for signing an executable or a dll image after link.
2048 VBOX_SIGN_IMAGE_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_FILE_FN,$(out)))
2049 endif
2050 ## Enable signing of the additions.
2051 VBOX_SIGN_ADDITIONS ?= 1
2052 else
2053 # Not windows build platform, ignore.
2054 VBOX_SIGNING_MODE :=
2055 endif
2056endif
2057
2058#
2059# Windows .inf editing.
2060#
2061ifeq ($(KBUILD_TARGET_ARCH),x86)
2062 VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF32_FN,$(1),$(2))
2063else
2064 VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF64_FN,$(1),$(2))
2065endif
2066## Edit an inf file an x86 target.
2067# @param 1 The inf file to edit.
2068# @param 2 The output file.
2069VBOX_EDIT_INF32_FN = $(SED) $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d') \
2070 -e 's/^;x86 *//' \
2071 -e '/^;amd64 /d' \
2072 -e 's/^;edit-DriverVer.*/DriverVer = $(date-utc %m\/%d\/%Y),$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)/' \
2073 --output $(2) \
2074 $(1)
2075## Edit an inf file an x86 target.
2076# @param 1 The inf file to edit.
2077# @param 2 The output file.
2078VBOX_EDIT_INF64_FN = $(SED) \
2079 $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d')\
2080 -e 's/^;amd64 *//' \
2081 -e '/^;x86 /d' \
2082 -e 's/^;edit-DriverVer.*/DriverVer = $(date-utc %m\/%d\/%Y),$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)/' \
2083 --output $(2) \
2084 $(1)
2085
2086#
2087# Default prefixes and suffixes.
2088#
2089VBOX_PREF_LIB =
2090if1of ($(KBUILD_TARGET), os2 win)
2091VBOX_SUFF_LIB = .lib
2092else
2093VBOX_SUFF_LIB = .a
2094endif
2095VBOX_SUFF_DLL = $(SUFF_DLL)
2096ifeq ($(KBUILD_TARGET),os2) # GXX3OMF produces out .o at the moment.
2097VBOX_SUFF_OBJ = .o
2098else
2099VBOX_SUFF_OBJ = $(SUFF_OBJ)
2100endif
2101VBOXW32GUEST_SUFF_LIB = .lib
2102VBOXLNX32GUEST_SUFF_LIB = .a
2103
2104#
2105# SDKs for external libraries.
2106#
2107SDK_VBOX_LIBXML2 = .
2108SDK_VBOX_LIBXML2_INCS ?= $(PATH_ROOT)/src/libs/libxml2-2.6.30/include
2109SDK_VBOX_LIBXML2_DEFS ?= _REENTRANT
2110SDK_VBOX_LIBXML2_DEFS.win += WIN32 _WINDOWS _MBCS
2111# note: no linking to LIB here, we do that explicitly in src/VBox/Runtime/Makefile.kmk to link
2112# libxml against VBoxRT
2113
2114SDK_VBOX_LIBXSLT = .
2115#if1of ($(KBUILD_TARGET), os2 solaris win)
2116 SDK_VBOX_LIBXSLT_INCS ?= $(PATH_ROOT)/src/libs/libxslt-1.1.22
2117 SDK_VBOX_LIBXSLT_LIBS ?= $(PATH_LIB)/VBox-libxslt$(VBOX_SUFF_LIB)
2118 SDK_VBOX_LIBXSLT_DEFS ?=
2119 SDK_VBOX_LIBXSLT_DEFS.win += WIN32 _WINDOWS _MBCS _REENTRANT
2120#else if1of ($(KBUILD_TARGET), linux)
2121# SDK_VBOX_LIBXSLT_INCS ?=
2122# SDK_VBOX_LIBXSLT_LIBS ?=
2123# SDK_VBOX_LIBXSLT_CFLAGS ?= $(shell pkg-config libxslt-1.0 --cflags)
2124# SDK_VBOX_LIBXSLT_CXXFLAGS ?= $(SDK_VBOX_LIBXSLT_CFLAGS)
2125# SDK_VBOX_LIBXSLT_LDFLAGS ?= $(shell pkg-config libxslt-1.0 --libs)
2126#else
2127# SDK_VBOX_LIBXSLT_INCS ?=
2128# SDK_VBOX_LIBXSLT_LIBS ?= xslt
2129#endif
2130
2131SDK_VBOX_LIBPNG = .
2132SDK_VBOX_LIBPNG_INCS ?= $(PATH_ROOT)/src/libs/libpng-1.2.8
2133SDK_VBOX_LIBPNG_LIBS ?= $(PATH_LIB)/VBox-libpng$(VBOX_SUFF_LIB)
2134
2135SDK_VBOX_ZLIB = .
2136if1of ($(KBUILD_TARGET), os2 win)
2137 SDK_VBOX_ZLIB_INCS ?= $(PATH_ROOT)/src/libs/zlib-1.2.1
2138 SDK_VBOX_ZLIB_LIBS ?= $(PATH_LIB)/VBox-zlib$(VBOX_SUFF_LIB)
2139else
2140 SDK_VBOX_ZLIB_INCS ?=
2141 SDK_VBOX_ZLIB_LIBS ?= z
2142 SDK_VBOX_ZLIB_DEFS.linux ?= _LARGEFILE64_SOURCE
2143endif
2144
2145SDK_VBOX_OPENSSL = .
2146SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS := $(PATH_OUT)/obj/crypto-headers/include
2147SDK_VBOX_OPENSSL_INCS ?= $(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)
2148SDK_VBOX_OPENSSL_ORDERDEPS ?= $(crypto-headers_1_TARGET)
2149SDK_VBOX_OPENSSL_LIBS ?= $(PATH_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB)
2150# Build entire openssl library, not just the minimal subset.
2151if1of ($(KBUILD_TARGET), linux solaris)
2152 VBOX_OPENSSL_ALL=1
2153endif
2154
2155VBOX_WITH_LIBCURL = 1
2156SDK_VBOX_LIBCURL = .
2157SDK_VBOX_LIBCURL_INCS ?= $(PATH_ROOT)/src/libs/curl-7.19.4/include
2158SDK_VBOX_LIBCURL_LIBS ?= $(PATH_LIB)/VBox-libcurl$(VBOX_SUFF_LIB)
2159SDK_VBOX_LIBCURL_DEFS ?= BUILDING_LIBCURL
2160
2161SDK_VBOX_FFMPEG = .
2162if1of ($(KBUILD_TARGET), darwin linux os2 solaris win)
2163 SDK_VBOX_FFMPEG_INCS ?= \
2164 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavutil \
2165 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavcodec \
2166 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavformat
2167 ifeq ($(KBUILD_TARGET),win)
2168 ## @todo Michael! Where is $(PATH_LIB)/VBoxFFmpegImp$(VBOX_SUFF_LIB) supposed to come from?
2169 #SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpeg.a
2170 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpegImp.lib
2171 else
2172 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_BIN)/VBoxFFmpeg$(SUFF_DLL)
2173 endif
2174else
2175 SDK_VBOX_FFMPEG_INCS ?= /usr/include/ffmpeg /usr/include/libpng
2176 SDK_VBOX_FFMPEG_LIBS ?= avutil avcodec avformat
2177endif
2178
2179SDK_VBOX_BOOST = .
2180SDK_VBOX_BOOST_DEFS ?= BOOST_DISABLE_ASSERTS
2181SDK_VBOX_BOOST_INCS ?= $(PATH_ROOT)/src/libs/boost-1.37.0
2182
2183#
2184# Special SDK for the problematic NTDLL.LIB.
2185#
2186SDK_VBOX_NTDLL = Requires $(VBOX_WINDDK)
2187SDK_VBOX_NTDLL_LIBS ?= $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntdll.lib
2188ifeq ($(KBUILD_TARGET),win)
2189 include $(KBUILD_PATH)/sdks/$(VBOX_WINDDK).kmk
2190endif
2191
2192#
2193# The linux kernel headers(/sources).
2194#
2195if1of ($(KBUILD_TARGET), linux)
2196 ifeq ($(origin VBOX_LINUX_SRC),undefined)
2197 ifneq ($(wildcard /lib/modules/$(shell uname -r)/build/include/linux/autoconf.h),)
2198 export VBOX_LINUX_SRC := /lib/modules/$(shell uname -r)/build
2199 else
2200 export VBOX_LINUX_SRC := /usr/src/linux
2201 endif
2202 endif
2203 ifneq ($(VBOX_LINUX_SRC),)
2204 ifeq ($(origin VBOX_LINUX_INCS),undefined)
2205 export VBOX_LINUX_INCS := $(VBOX_LINUX_SRC)/include
2206 # XXX hack alert! support splitted Linux kernels (make O=<build directory>)
2207 # XXX put this crap elsewhere
2208 kernelpath := $(shell $(SED_EXT) -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(VBOX_LINUX_SRC)/Makefile)
2209 ifeq ($(kernelpath),)
2210 # Linux >= 2.6.25
2211 kernelpath := $(shell $(SED_EXT) -ne 's+^MAKEARGS *:= *-C *\(\S*\).*+\1+p' $(VBOX_LINUX_SRC)/Makefile)
2212 endif
2213 ifneq ($(kernelpath),)
2214 # absolute path?
2215 ifneq ($(patsubst /%,,$(kernelpath)),)
2216 # no, relative path
2217 kernelpath := $(realpath $(VBOX_LINUX_SRC)/$(kernelpath))
2218 endif
2219 endif
2220 ifneq ($(kernelpath),)
2221 VBOX_LINUX_INCS += $(VBOX_LINUX_SRC)/include2 $(kernelpath)/include
2222 else
2223 kernelpath := $(VBOX_LINUX_SRC)
2224 endif
2225 VBOX_LINUX_INCS += $(kernelpath)/include/asm-i386/mach-default \
2226 $(kernelpath)/include/asm-x86/mach-default \
2227 $(kernelpath)/arch/x86/include \
2228 $(kernelpath)/arch/x86/include/asm/mach-default \
2229 $(kernelpath)/include
2230 endif
2231 endif
2232 # Since Linux 2.6.15, <linux/autoconf.h> is included like this. It cannot hurt to do the
2233 # same for older Linux kernels
2234 ifneq ($(wildcard $(VBOX_LINUX_SRC)/include/generated/autoconf.h),)
2235 # Linux >= 2.6.33
2236 export VBOX_LINUX_INCLUDE := -include $(VBOX_LINUX_SRC)/include/generated/autoconf.h
2237 else ifneq ($(wildcard $(VBOX_LINUX_SRC)/include/linux/autoconf.h),)
2238 # Linux < 2.6.33
2239 export VBOX_LINUX_INCLUDE := -include $(VBOX_LINUX_SRC)/include/linux/autoconf.h
2240 endif
2241endif
2242
2243#
2244# Determine Solaris version.
2245#
2246ifeq ($(KBUILD_TARGET),solaris)
2247 ifeq ($(origin VBOX_SOLARIS_VERSION),undefined)
2248 $(eval export VBOX_SOLARIS_VERSION := $(shell uname -r | $(SED_EXT) 's|\([0-9]*\)\.\([0-9]*\)|$$(int-add $$(int-mul 100, \1), \2)|' ))
2249 endif
2250 ifeq ($(VBOX_SOLARIS_VERSION),510)
2251 DEFS.solaris += RT_OS_SOLARIS_10
2252 # Solaris 10 does not include crossbow.
2253 VBOX_WITH_CROSSBOW =
2254 VBOX_SOLARIS_10 = 1
2255 # We cannot compile additions on Solaris 10, due kernel interface deps
2256 VBOX_WITHOUT_ADDITIONS := 1
2257 VBOX_WITH_ADDITIONS =
2258 else
2259 ## @todo r=bird: Why eval, and why export? Actually, since this isn't used anywhere, why not
2260 # VBOX_WITH_SOLARIS_OSS := $(if-expr $(shell uname -v | cut -f2 -d'_')) >= 115,1,)
2261 $(eval export VBOX_SOLARIS_SNV_VERSION := $(shell uname -v | cut -f2 -d'_'))
2262
2263 # OSS audio support for Solaris
2264 VBOX_WITH_SOLARIS_OSS := $(if-expr $(VBOX_SOLARIS_SNV_VERSION) >= 115,1,)
2265 endif
2266endif
2267
2268ifdef VBOX_WITH_RAW_MODE
2269 #
2270 # Template for building RC things.
2271 #
2272 TEMPLATE_VBoxRc = VBox Raw-Mode Context
2273 TEMPLATE_VBoxRc_ASTOOL = $(VBOX_ASTOOL)
2274 TEMPLATE_VBoxRc_ASFLAGS = $(VBOX_ASFLAGS32)
2275 TEMPLATE_VBoxRc_DEFS = IN_RC IPRT_NO_CRT RT_WITH_NOCRT_ALIASES $(ARCH_BITS_DEFS)
2276 TEMPLATE_VBoxRc_INCS = $(PATH_ROOT)/include/iprt/nocrt
2277 TEMPLATE_VBoxRc_SYSSUFF = .gc
2278 TEMPLATE_VBoxRc_BLD_TRG_ARCH = x86
2279
2280 ifeq ($(VBOX_LDR_FMT32),pe)
2281 ifndef VBOX_USE_VCC70
2282 TEMPLATE_VBoxRc_TOOL = $(VBOX_VCC_TOOL_STEM)X86
2283 TEMPLATE_VBoxRc_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -W3 -wd4244 -GS- -wd4996 -Zc:wchar_t- -Gs8192 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP) $(VBOX_VCC_WERR)
2284 else
2285 TEMPLATE_VBoxRc_TOOL = VCC70
2286 TEMPLATE_VBoxRc_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -W3 -wd4244 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP) $(VBOX_VCC_WERR)
2287 endif
2288 TEMPLATE_VBoxRc_CFLAGS = $(TEMPLATE_VBoxRc_CXXFLAGS)
2289 TEMPLATE_VBoxRc_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Exports -NoD $(VBOX_VCC_LD_WERR) -Debug
2290 ifdef VBOX_USE_WINDDK
2291 ifndef VBOX_NOINC_MISC
2292 include $(KBUILD_PATH)/sdks/$(VBOX_WINDDK).kmk
2293 endif
2294 TEMPLATE_VBoxRc_LIBS = \
2295 $(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/int64.lib
2296 else
2297 ifndef VBOX_NOINC_MISC
2298 include $(KBUILD_PATH)/sdks/W2K3DDKX86.kmk
2299 endif
2300 TEMPLATE_VBoxRc_LIBS = \
2301 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
2302 endif
2303 TEMPLATE_VBoxRc_LIBS += \
2304 $(PATH_LIB)/RuntimeRCStub$(VBOX_SUFF_LIB)
2305 TEMPLATE_VBoxRc_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2306 endif # pe
2307
2308 ifeq ($(VBOX_LDR_FMT32),elf)
2309 TEMPLATE_VBoxRc_TOOL = $(VBOX_GCC32_TOOL)
2310 TEMPLATE_VBoxRc_CXXFLAGS = -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC32_Wno-variadic-macros) -fno-exceptions $(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) -fno-rtti
2311 TEMPLATE_VBoxRc_CFLAGS = -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC32_Wno-variadic-macros) -fno-exceptions $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden)
2312 ifeq ($(KBUILD_TARGET),solaris)
2313 TEMPLATE_VBoxRc_LDFLAGS = -r
2314 else
2315 TEMPLATE_VBoxRc_LDFLAGS = -nostdlib -Bsymbolic
2316 # "temporarily", must fix the loader.
2317 TEMPLATE_VBoxRc_LDFLAGS += $(if $(VBOX_DO_STRIP_MODULES),-S,)
2318 TEMPLATE_VBoxRc_LDFLAGS.release = $(if $(VBOX_DO_STRIP_MODULES),-S,)
2319 endif
2320 ifn1of ($(KBUILD_TARGET), solaris freebsd)
2321 TEMPLATE_VBoxRc_LIBS = \
2322 $(VBOX_GCC32_LIBGCC) # instricts
2323 endif
2324 endif
2325
2326 ifeq ($(VBOX_LDR_FMT32),macho)
2327 TEMPLATE_VBoxRc_TOOL = GXX4MACHO
2328 TEMPLATE_VBoxRc_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
2329 TEMPLATE_VBoxRc_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) -m32 -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC32_Wno-variadic-macros) -fno-common -msoft-float -static $(VBOX_GCC_fno-stack-protector) -fno-exceptions $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing -fno-rtti
2330 TEMPLATE_VBoxRc_CFLAGS = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -m32 -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC32_Wno-variadic-macros) -fno-common -msoft-float -static $(VBOX_GCC_fno-stack-protector) -fno-exceptions $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing
2331 TEMPLATE_VBoxRc_LDFLAGS = $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -m32 -nostdlib
2332 #TEMPLATE_VBoxRc_LDFLAGS.release = -Wl,-S ???
2333 endif
2334
2335 ifeq ($(VBOX_LDR_FMT32),lx)
2336 TEMPLATE_VBoxRc_TOOL = GXX3OMF
2337 TEMPLATE_VBoxRc_CXXFLAGS = -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC32_Wno-variadic-macros) $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing -fno-exceptions -fno-rtti
2338 TEMPLATE_VBoxRc_CFLAGS = -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC32_Wno-variadic-macros) $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing -fno-exceptions
2339 TEMPLATE_VBoxRc_LDFLAGS = -Zdll -nostdlib
2340 TEMPLATE_VBoxRc_LIBS = \
2341 $(VBOX_GCC32_LIBGCC) \
2342 $(VBOX_OBJ_SYS0) \
2343 end
2344 endif
2345
2346
2347 #
2348 # Template for building a RC ring-3 testcase (tstVMStructGC, tstDevStructGC).
2349 #
2350 TEMPLATE_VBoxRcExe = VBox Raw-Mode as ring-3 testcase
2351 TEMPLATE_VBoxRcExe_EXTENDS = VBoxRc
2352 TEMPLATE_VBoxRcExe_DEFS = $(filter-out IPRT_NO_CRT RT_WITH_NOCRT_ALIASES,$(TEMPLATE_VBoxRc_DEFS))
2353 TEMPLATE_VBoxRcExe_INCS = $(NO_SUCH_VARIABLE)
2354
2355 ifeq ($(VBOX_LDR_FMT32),pe)
2356 TEMPLATE_VBoxRcExe_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD -Debug
2357 TEMPLATE_VBoxRcExe_SDKS = WIN32SDK
2358 ifndef VBOX_USE_VCC70
2359 TEMPLATE_VBoxRcExe_LIBS = \
2360 $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_LIB)/libcmt.lib \
2361 $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_LIB)/oldnames.lib
2362 else
2363 TEMPLATE_VBoxRcExe_LIBS = \
2364 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
2365 $(PATH_TOOL_VCC70_LIB)/oldnames.lib
2366 endif
2367 endif
2368
2369 ifeq ($(VBOX_LDR_FMT32),elf)
2370 TEMPLATE_VBoxRcExe_CFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CFLAGS))
2371 TEMPLATE_VBoxRcExe_CXXFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CXXFLAGS))
2372 TEMPLATE_VBoxRcExe_LDFLAGS = -g
2373 TEMPLATE_VBoxRcExe_LDFLAGS.dbgopt = -g
2374 TEMPLATE_VBoxRcExe_LDFLAGS.strict = -g
2375 TEMPLATE_VBoxRcExe_LDFLAGS.release = -g
2376 if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), freebsd.amd64)
2377 # The FreeBSD port of gcc isn't picking up -m32 where it should. the .o order below isn't
2378 # quite right (target source comes first), if it stops working we'll have to write a linker tool.
2379 TEMPLATE_VBoxRcExe_DEFS.$(KBUILD_TARGET) = $(TEMPLATE_VBoxRc_DEFS.$(KBUILD_TARGET)) IPRT_DONT_USE_SYSTEM_STDINT_H
2380 TEMPLATE_VBoxRcExe_LDFLAGS.$(KBUILD_TARGET) = $(TEMPLATE_VBoxRc_LDFLAGS.$(KBUILD_TARGET)) -nostdlib -v
2381 TEMPLATE_VBoxRcExe_SOURCES.$(KBUILD_TARGET) = /usr/lib32/crtend.o /usr/lib32/crtn.o
2382 TEMPLATE_VBoxRcExe_SOURCES = /usr/lib32/crt1.o /usr/lib32/crti.o /usr/lib32/crtbegin.o
2383 TEMPLATE_VBoxRcExe_LIBPATH.$(KBUILD_TARGET) = /usr/lib32
2384 TEMPLATE_VBoxRcExe_LIBS.$(KBUILD_TARGET) = /usr/lib32/libc.so
2385 endif
2386 endif
2387
2388 ifeq ($(VBOX_LDR_FMT32),macho)
2389 TEMPLATE_VBoxRcExe_CFLAGS = $(filter-out -static -nostdinc,$(TEMPLATE_VBoxRc_CFLAGS))
2390 TEMPLATE_VBoxRcExe_CXXFLAGS = $(filter-out -static -nostdinc,$(TEMPLATE_VBoxRc_CXXFLAGS))
2391 TEMPLATE_VBoxRcExe_LDFLAGS = -g -m32
2392 endif
2393
2394 ifeq ($(VBOX_LDR_FMT32),lx)
2395 TEMPLATE_VBoxRcExe_CFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CFLAGS))
2396 TEMPLATE_VBoxRcExe_CXXFLAGS = $(filter-out -nostdinc,$(TEMPLATE_VBoxRc_CXXFLAGS))
2397 TEMPLATE_VBoxRcExe_LDFLAGS = -g
2398 TEMPLATE_VBoxRcExe_LIBS = $(NO_SUCH_VARIABLE)
2399 endif
2400endif # VBOX_WITH_RAW_MODE
2401
2402
2403#
2404# Template for building R0 things.
2405#
2406TEMPLATE_VBoxR0 = VBox Ring 0
2407TEMPLATE_VBoxR0_ASTOOL = $(VBOX_ASTOOL)
2408TEMPLATE_VBoxR0_ASFLAGS = $(VBOX_ASFLAGS)
2409TEMPLATE_VBoxR0_DEFS = IN_RING0 IN_RING0_AGNOSTIC IPRT_NO_CRT RT_WITH_NOCRT_ALIASES $(ARCH_BITS_DEFS)
2410TEMPLATE_VBoxR0_INCS = $(PATH_ROOT)/include/iprt/nocrt
2411TEMPLATE_VBoxR0_SYSSUFF = .r0
2412
2413ifeq ($(VBOX_LDR_FMT),pe)
2414TEMPLATE_VBoxR0_TOOL = $(VBOX_VCC_TOOL)
2415 ifndef VBOX_USE_VCC70
2416TEMPLATE_VBoxR0_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -W3 -wd4244 -GS- -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP) $(VBOX_VCC_WERR)
2417 else
2418TEMPLATE_VBoxR0_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -W3 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP) $(VBOX_VCC_WERR)
2419 endif
2420TEMPLATE_VBoxR0_CFLAGS = $(TEMPLATE_VBoxR0_CXXFLAGS)
2421TEMPLATE_VBoxR0_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Exports -NoD $(VBOX_VCC_LD_WERR) -Debug
2422TEMPLATE_VBoxR0_LIBS = \
2423 $(PATH_LIB)/RuntimeR0Stub$(VBOX_SUFF_LIB)
2424 ifdef VBOX_USE_WINDDK
2425TEMPLATE_VBoxR0_LIBS.x86 = \
2426 $(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/int64.lib
2427 else
2428TEMPLATE_VBoxR0_LIBS.x86 = \
2429 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
2430 endif
2431TEMPLATE_VBoxR0_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
2432endif # pe
2433
2434ifeq ($(VBOX_LDR_FMT),elf)
2435TEMPLATE_VBoxR0_TOOL = $(VBOX_GCC_TOOL)
2436TEMPLATE_VBoxR0_CFLAGS = -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden) -std=gnu99
2437TEMPLATE_VBoxR0_CXXFLAGS = -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden) -fno-rtti
2438TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding
2439TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables
2440ifeq ($(KBUILD_TARGET),solaris)
2441 TEMPLATE_VBoxR0_LDFLAGS = -r
2442else
2443 TEMPLATE_VBoxR0_LDFLAGS = -nostdlib -Bsymbolic
2444 # temporarily, must fix the loader.
2445 TEMPLATE_VBoxR0_LDFLAGS += $(if $(VBOX_DO_STRIP_MODULES),-S,)
2446 TEMPLATE_VBoxR0_LDFLAGS.release = $(if $(VBOX_DO_STRIP_MODULES),-S,)
2447endif
2448ifn1of ($(KBUILD_TARGET),solaris freebsd)
2449 TEMPLATE_VBoxR0_LIBS = \
2450 $(VBOX_GCC_LIBGCC) # instricts
2451endif
2452endif
2453
2454ifeq ($(VBOX_LDR_FMT),macho)
2455TEMPLATE_VBoxR0_TOOL = GXX4MACHO
2456TEMPLATE_VBoxR0_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
2457TEMPLATE_VBoxR0_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) \
2458 -fno-common -msoft-float -static -fno-rtti -fno-exceptions $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing \
2459 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_fno-stack-protector)
2460TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mno-sse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -fno-unwind-tables
2461TEMPLATE_VBoxR0_CXXFLAGS.x86 = -m32
2462TEMPLATE_VBoxR0_CFLAGS = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) \
2463 -fno-common -msoft-float -static -fno-exceptions $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing \
2464 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(VBOX_GCC_fno-stack-protector)
2465TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -mno-red-zone -mno-sse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -fno-unwind-tables
2466TEMPLATE_VBoxR0_CFLAGS.x86 = -m32
2467TEMPLATE_VBoxR0_LDFLAGS = $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -nostdlib
2468#TEMPLATE_VBoxR0_LDFLAGS.release = -Wl,-S ???
2469TEMPLATE_VBoxR0_LDFLAGS.amd64 = -m64 -static
2470TEMPLATE_VBoxR0_LDFLAGS.x86 = -m32
2471endif
2472
2473ifeq ($(VBOX_LDR_FMT),lx)
2474TEMPLATE_VBoxR0_TOOL = GXX3OMF
2475TEMPLATE_VBoxR0_CFLAGS = -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions
2476TEMPLATE_VBoxR0_CXXFLAGS = -nostdinc -g -pipe $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions -fno-rtti
2477TEMPLATE_VBoxR0_LDFLAGS = -nostdlib -Zdll
2478TEMPLATE_VBoxR0_LIBS = \
2479 $(VBOX_GCC_LIBGCC) \
2480 $(VBOX_OBJ_SYS0) \
2481 end
2482endif
2483
2484
2485#
2486# Template for building SUPDRV R0 things.
2487#
2488TEMPLATE_VBOXR0DRV = VBox SUPDRV Ring 0
2489TEMPLATE_VBOXR0DRV_ASTOOL = $(VBOX_ASTOOL)
2490TEMPLATE_VBOXR0DRV_ASFLAGS = $(VBOX_ASFLAGS)
2491TEMPLATE_VBOXR0DRV_DEFS = IN_RING0 IN_RT_R0 $(ARCH_BITS_DEFS)
2492
2493ifeq ($(KBUILD_TARGET),win)
2494 TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_VCC_TOOL)
2495 TEMPLATE_VBOXR0DRV_RCDEFS = \
2496 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
2497 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
2498 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
2499 VBOX_SVN_REV=\"$(VBOX_SVN_REV)\" \
2500 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
2501 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
2502 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD) \
2503 VBOX_SVN_REV_NR=$(VBOX_SVN_REV)
2504 TEMPLATE_VBOXR0DRV_DEFS.x86 = _X86_
2505 TEMPLATE_VBOXR0DRV_DEFS.amd64 = _AMD64_
2506 ifndef VBOX_USE_VCC70
2507 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -Gz -W3 -GS- -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
2508 else
2509 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -Gz -W3 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
2510 endif
2511 TEMPLATE_VBOXR0DRV_CFLAGS = $(TEMPLATE_VBOXR0DRV_CXXFLAGS)
2512 TEMPLATE_VBOXR0DRV_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Exports -NoD -Debug
2513 TEMPLATE_VBOXR0DRV_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
2514 ifdef VBOX_USE_VCC100 # HACK ALERT!
2515 TEMPLATE_VBOXR0DRV_CINCS = $(TOOL_$(VBOX_VCC_TOOL)_CINCS)
2516 TEMPLATE_VBOXR0DRV_CXXINCS = $(TOOL_$(VBOX_VCC_TOOL)_CXXINCS)
2517 endif
2518endif
2519
2520ifeq ($(KBUILD_TARGET),linux)
2521TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
2522TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0
2523TEMPLATE_VBOXR0DRV_INCS = $(VBOX_LINUX_INCS)
2524TEMPLATE_VBOXR0DRV_CFLAGS = -nostdinc -iwithprefix include $(VBOX_LINUX_INCLUDE) \
2525 $(VBOX_GCC_WARN) -Wstrict-prototypes $(VBOX_GCC_Wno-pointer-sign) -Wno-sign-compare \
2526 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
2527TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mpreferred-stack-boundary=2 -msoft-float
2528TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
2529 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
2530 -Wno-sign-compare -Wdeclaration-after-statement
2531TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign -ffreestanding -Wdeclaration-after-statement -Werror-implicit-function-declaration,$(TEMPLATE_VBOXR0DRV_CFLAGS) $(TEMPLATE_VBOXR0DRV_CFLAGS.$(KBUILD_TARGET_ARCH))) -fno-exceptions -fno-rtti
2532 ifndef VBOX_LINUX_VERSION_2_4
2533# 2.6
2534TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
2535TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
2536TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
2537 else
2538# 2.4
2539TEMPLATE_VBOXR0DRV_SYSSUFF = .o
2540TEMPLATE_VBOXR0DRV_LDFLAGS = -r -s
2541 endif
2542endif
2543
2544ifeq ($(KBUILD_TARGET),os2)
2545TEMPLATE_VBOXR0DRV_TOOL = GXX3OMF
2546TEMPLATE_VBOXR0DRV_CXXFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions -fno-rtti
2547TEMPLATE_VBOXR0DRV_CFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions
2548TEMPLATE_VBOXR0DRV_LIBS = $(VBOX_GCC_LIBGCC)
2549# wlink thinks physdevice doesn't need fixups and should have a stack - stupid!
2550TEMPLATE_VBOXR0DRV_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
2551endif
2552
2553ifeq ($(KBUILD_TARGET),darwin)
2554TEMPLATE_VBOXR0DRV_TOOL = GXX4MACHO
2555TEMPLATE_VBOXR0DRV_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS) KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT RT_USE_VISIBILITY_HIDDEN
2556TEMPLATE_VBOXR0DRV_INCS += $(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/Kernel.framework/Headers
2557## @todo try use VBOX_GCC_PEDANTIC_CXX
2558TEMPLATE_VBOXR0DRV_CXXFLAGS = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) \
2559 -g -pipe $(VBOX_GCC_WARN) -Wno-long-long -fno-common -nostdinc -fno-builtin -finline \
2560 -fno-keep-inline-functions -fno-exceptions -msoft-float \
2561 -fapple-kext -fno-rtti -fcheck-new -force_cpusubtype_ALL \
2562 $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fasm-blocks
2563TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = -m64 -mkernel -mno-red-zone -gdwarf-2
2564TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = -m32 -static
2565TEMPLATE_VBOXR0DRV_CFLAGS = $(VBOX_DARWIN_DEF_SDK_CFLAGS) \
2566 -g -pipe $(VBOX_GCC_WARN) -Wno-long-long -fno-common -nostdinc -fno-builtin -finline \
2567 -fno-keep-inline-functions -fno-exceptions -msoft-float \
2568 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations \
2569 -Werror-implicit-function-declaration -force_cpusubtype_ALL \
2570 $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fasm-blocks
2571TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mkernel -mno-red-zone -gdwarf-2
2572TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -static
2573TEMPLATE_VBOXR0DRV_LDFLAGS = $(filter-out $(VBOX_DARWIN_NO_COMPACT_LINKEDIT),$(VBOX_DARWIN_DEF_SDK_LDFLAGS)) -static -nostdlib -r -Wl,-Y,1455 -keep_private_extern
2574TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m64 -Xlinker -kext
2575TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m32
2576TEMPLATE_VBOXR0DRV_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC)
2577endif
2578
2579ifeq ($(KBUILD_TARGET),solaris)
2580## The Solaris /usr/platform/i86pc/include and /usr/include directories.
2581VBOX_SOLARIS_SYS_INCS ?= /usr/platform/i86pc/include /usr/include
2582
2583TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
2584TEMPLATE_VBOXR0DRV_DEFS = _MACHDEP _KERNEL _STRICT_STDC IN_RING0 IN_RT_R0
2585TEMPLATE_VBOXR0DRV_INCS = $(VBOX_SOLARIS_SYS_INCS)
2586TEMPLATE_VBOXR0DRV_LDFLAGS = -r -dy
2587TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -64
2588# Exclude -Wall because of solaris headers' pragma ident warnings that gcc refuses to supress.
2589TEMPLATE_VBOXR0DRV_CFLAGS = -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
2590 -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \
2591 -Wshadow -Wuninitialized -Wunused-function -Wunused-label -Wunused-value -Wunused-variable \
2592 -Wformat -Wimplicit-int -Wimplicit-function-declaration -Werror-implicit-function-declaration -Wparentheses \
2593 -O2 -fno-omit-frame-pointer -ffreestanding -nodefaultlibs -fno-strict-aliasing -fno-common -std=c99
2594TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
2595TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow $(if $(VBOX_SOLARIS_10),,-msave-args) -mno-red-zone -mcmodel=kernel \
2596 -fno-reorder-blocks -fno-asynchronous-unwind-tables -funit-at-a-time
2597TEMPLATE_VBOXR0DRV_CXXFLAGS = -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
2598 -Wshadow -Wuninitialized -Wunused-function -Wunused-label -Wunused-value -Wunused-variable \
2599 -Wformat \
2600 -O2 -nodefaultlibs -fno-omit-frame-pointer -fno-strict-aliasing -fno-common -fno-exceptions -fno-rtti
2601TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86)
2602TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = $(TEMPLATE_VBOXR0DRV_CFLAGS.amd64)
2603endif # Solaris
2604
2605ifeq ($(KBUILD_TARGET),freebsd)
2606# x86 FreeBSD (6.2 or something):
2607# cc -O2 -fno-strict-aliasing -pipe -Werror -D_KERNEL -DKLD_MODULE \
2608# -nostdinc -I- -I. -I@ -I@/contrib/altq -I@/../include -I/usr/include \
2609# -finline-limit=8000 -fno-common -mno-align-long-strings -mpreferred-stack-boundary=2 \
2610# -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -ffreestanding -Wall -Wredundant-decls -Wnested-externs \
2611# -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions \
2612# -std=c99 -c ../my.c
2613# ld -d -warn-common -r -d -o my.kld my.o
2614# :> export_syms
2615# awk -f /usr/src/sys/modules/my/../../conf/kmod_syms.awk my.kld export_syms | xargs -J% objcopy % my.kld
2616# ld -Bsharable -d warn-commnon -o my.ko my.kld
2617#
2618# AMD64 FreeBSD (7.1):
2619# cc -O2 -fno-strict-aliasing -pipe -D_KERNEL -DKLD_MODULE -std=c99 -nostdinc -I. -I@ -I@/contrib/altq \
2620# -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common \
2621# -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx \
2622# -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -ffreestanding \
2623# -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign \
2624# -fformat-extensions -c /usr/src/sys/modules/my/../../dev/my/if_my.c
2625# ld -d -warn-common -r -d -o if_my.ko if_my.o
2626# :> export_syms
2627# awk -f /usr/src/sys/modules/my/../../conf/kmod_syms.awk if_my.ko export_syms | xargs -J% objcopy % if_my.ko
2628
2629# Note: @ -> /usr/src/sys and machine -> /usr/src/sys/i386/include
2630
2631## The location of the FreeBSD kernel source.
2632VBOX_FREEBSD_SRC ?= /usr/src/sys
2633## The FreeBSD /usr/include.
2634VBOX_FREEBSD_SYS_INCS ?= /usr/include
2635
2636TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
2637TEMPLATE_VBOXR0DRV_LDTOOL = FREEBSDKMODLD
2638TEMPLATE_VBOXR0DRV_DEFS = _KERNEL KLD_MODULE IN_RING0 IN_RT_R0
2639TEMPLATE_VBOXR0DRV_INCS = \
2640 $(VBOX_FREEBSD_SRC) \
2641 $(VBOX_FREEBSD_SRC)/contrib/altq \
2642 $(VBOX_FREEBSD_SRC)/../include \
2643 $(VBOX_FREEBSD_SYS_INCS)
2644# omitting: -Wcast-qual, -Wredundant-decls
2645TEMPLATE_VBOXR0DRV_CFLAGS = \
2646 $(VBOX_GCC_WARN) -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
2647 -Wstrict-prototypes -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \
2648 -Wimplicit-function-declaration -Werror-implicit-function-declaration \
2649 -O2 -fformat-extensions -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
2650 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
2651 -nostdinc -std=c99
2652TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2
2653TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 --param inline-unit-growth=100 --param large-function-growth=1000 \
2654 -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx \
2655 -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -Wundef
2656TEMPLATE_VBOXR0DRV_CXXFLAGS = -fno-exceptions -fno-rtti \
2657 $(VBOX_GCC_WARN) -Wpointer-arith -Winline \
2658 -O2 -fno-format-extensions -fno-strict-aliasing -fno-common -finline-limit=8000 \
2659 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
2660 -nostdinc
2661TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86)
2662TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = $(TEMPLATE_VBOXR0DRV_CFLAGS.amd64)
2663TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
2664TEMPLATE_VBOXR0DRV_LDFLAGS = -d --warn-common
2665TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386_fbsd
2666TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64_fbsd
2667
2668TOOL_FREEBSDKMODLD = FreeBSD kernel module linker.
2669# See kBuild/tools/GCC3.kmk for docs.
2670TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
2671TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
2672TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPORD =
2673 ifeq ($(KBUILD_TARGET_ARCH),amd64)
2674TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT =
2675define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
2676# Link intermediate .kld (a relocatable object).
2677 ld $(flags) -r -o $(out) $(objs) \
2678 $(foreach p,$(libpath), -L$(p))\
2679 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
2680# Strip non-exported symbols private and localize the exported ones.
2681 awk -f $(VBOX_FREEBSD_SRC)/conf/kmod_syms.awk $(out) $(if $(othersrc), $(othersrc),/dev/null) \
2682 | xargs -J% objcopy % $(out)
2683
2684## Strip debug info (comment out if debugging or something).
2685 objcopy --strip-debug $(out)
2686endef
2687 else # x86
2688TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT = $(outbase).kld
2689define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
2690# Link intermediate .kld (a relocatable object).
2691 ld $(flags) -r -o $(outbase).kld $(objs) \
2692 $(foreach p,$(libpath), -L$(p))\
2693 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
2694# Strip non-exported symbols private and localize the exported ones.
2695 awk -f $(VBOX_FREEBSD_SRC)/conf/kmod_syms.awk $(outbase).kld $(if $(othersrc), $(othersrc),/dev/null) \
2696 | xargs -J% objcopy % $(outbase).kld
2697
2698# Link the final .ko (a shared object).
2699 ld $(flags) -Bshareable -o $(out) $(outbase).kld
2700endef
2701 endif # x86
2702
2703endif # FreeBSD
2704
2705ifdef VBOX_WITH_VBOXDRV
2706 ifndef TEMPLATE_VBOXR0DRV_TOOL
2707 $(warning Warning: VBox Build: Target $(KBUILD_HOST) is not officially supported!)
2708 endif
2709endif
2710
2711
2712
2713#
2714# Template for building R3 executables and static libraries which are linked into executables.
2715# Note! This is the base template for a whole lot of other ones, so be careful when changing it.
2716#
2717TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
2718TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
2719TEMPLATE_VBOXR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
2720TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
2721TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
2722ifeq ($(KBUILD_TARGET),win)
2723 TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
2724 TEMPLATE_VBOXR3EXE_RCDEFS = \
2725 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
2726 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
2727 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
2728 VBOX_SVN_REV=\"$(VBOX_SVN_REV)\" \
2729 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
2730 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
2731 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD) \
2732 VBOX_SVN_REV_NR=$(VBOX_SVN_REV)
2733 TEMPLATE_VBOXR3EXE_SDKS = WINPSDK
2734 ifndef VBOX_USE_VCC70
2735 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHsc -GF -MD$(VBOX_VCC_CRT_TYPE) -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
2736 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
2737 else
2738 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHsc -GF -MD$(VBOX_VCC_CRT_TYPE) -W3 -wd4065 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
2739 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -GZ
2740 endif
2741 TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
2742 TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
2743 TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
2744 TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
2745 TEMPLATE_VBOXR3EXE_LDFLAGS = \
2746 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
2747 /DISALLOWLIB:libc.lib \
2748 /DISALLOWLIB:libcd.lib \
2749 /DISALLOWLIB:libcmt.lib \
2750 /DISALLOWLIB:libcmtd.lib \
2751 /DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE_N).lib \
2752 /DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE_N).lib
2753 TEMPLATE_VBOXR3EXE_LIBS = \
2754 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
2755 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
2756 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib
2757 TEMPLATE_VBOXR3EXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2758 ifdef VBOX_USE_VCC100 # HACK ALERT!
2759 TEMPLATE_VBOXR3EXE_CINCS.win = $(TOOL_$(VBOX_VCC_TOOL)_CINCS)
2760 TEMPLATE_VBOXR3EXE_CXXINCS.win = $(TOOL_$(VBOX_VCC_TOOL)_CXXINCS)
2761 endif
2762
2763else # the gcc guys
2764TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
2765TEMPLATE_VBOXR3EXE_CXXFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
2766TEMPLATE_VBOXR3EXE_CXXFLAGS.x86 = -m32
2767TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64 = -m64
2768TEMPLATE_VBOXR3EXE_CXXFLAGS.sparc32 = -m32
2769TEMPLATE_VBOXR3EXE_CXXFLAGS.sparc64 = -m64
2770# L4 currently can't handle exception handling.
2771TEMPLATE_VBOXR3EXE_CXXFLAGS.l4 = -fno-exceptions -nostdinc \
2772 $(addprefix -I,$(VBOX_PATH_GCC_INCS) $(L4_INCDIR) $(FILE_TOOL_GPP3_INCDIR)) \
2773 $(DEBUG_L4)
2774TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
2775TEMPLATE_VBOXR3EXE_CFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-hidden)
2776TEMPLATE_VBOXR3EXE_CFLAGS.x86 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.x86)
2777TEMPLATE_VBOXR3EXE_CFLAGS.amd64 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64)
2778TEMPLATE_VBOXR3EXE_CFLAGS.sparc32 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.sparc32)
2779TEMPLATE_VBOXR3EXE_CFLAGS.sparc64 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.sparc64)
2780TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
2781TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
2782TEMPLATE_VBOXR3EXE_CFLAGS.l4 = -nostdinc \
2783 $(addprefix -I,$(VBOX_PATH_GCC_INCS) $(L4_INCDIR)) $(DEBUG_L4)
2784TEMPLATE_VBOXR3EXE_OBJCFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS)
2785TEMPLATE_VBOXR3EXE_OBJCFLAGS.x86 = $(TEMPLATE_VBOXR3EXE_CFLAGS.x86)
2786TEMPLATE_VBOXR3EXE_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXR3EXE_CFLAGS.amd64)
2787TEMPLATE_VBOXR3EXE_OBJCFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CFLAGS.debug)
2788TEMPLATE_VBOXR3EXE_OBJCFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CFLAGS.kprofile)
2789TEMPLATE_VBOXR3EXE_OBJCXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
2790TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.x86)
2791TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64)
2792TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
2793TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.kprofile= $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
2794TEMPLATE_VBOXR3EXE_DEFS.l4 = L4_THREAD_SAFE
2795TEMPLATE_VBOXR3EXE_LDFLAGS.x86 = -m32
2796TEMPLATE_VBOXR3EXE_LDFLAGS.amd64 = -m64
2797TEMPLATE_VBOXR3EXE_LDFLAGS.sparc32 = -m32
2798TEMPLATE_VBOXR3EXE_LDFLAGS.sparc64 = -m64
2799TEMPLATE_VBOXR3EXE_LDFLAGS.l4 = \
2800 $(L4_LIBDIR)/../crt0.o \
2801 -T$(L4_LIBDIR)/../main_dyn.ld -nostdlib \
2802 -Wl,--export-dynamic,--dynamic-linker=libld-l4.s.so \
2803 -Wl,--rpath-link,$(L4_LIBDIR)
2804TEMPLATE_VBOXR3EXE_LDFLAGS.linux = -Wl,-z,noexecstack $(VBOX_LD_as_needed)
2805 ifeq ($(KBUILD_TARGET),linux)
2806TEMPLATE_VBOXR3EXE_LIBS = pthread m rt dl
2807 else ifeq ($(KBUILD_TARGET),l4)
2808TEMPLATE_VBOXR3EXE_LIBS = \
2809 $(L4_LIBDIR)/libvboxserver.s.so \
2810 $(L4_LIBDIR)/libuc++.0.s.so \
2811 supc++ gcc_eh gcc \
2812 $(L4_LIBDIR)/libdl.s.so \
2813 $(L4_LIBDIR)/libuc.0.s.so
2814 else ifeq ($(KBUILD_TARGET),os2)
2815TEMPLATE_VBOXR3EXE_TOOL = GXX3OMF
2816TEMPLATE_VBOXR3EXE_LIBS = socket iconv
2817 else ifeq ($(KBUILD_TARGET),darwin)
2818TEMPLATE_VBOXR3EXE_TOOL = GXX4MACHO
2819TEMPLATE_VBOXR3EXE_LIBS =
2820TEMPLATE_VBOXR3EXE_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_DEFS)
2821TEMPLATE_VBOXR3EXE_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -fno-common
2822TEMPLATE_VBOXR3EXE_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
2823TEMPLATE_VBOXR3EXE_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
2824TEMPLATE_VBOXR3EXE_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS)
2825TEMPLATE_VBOXR3EXE_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
2826TEMPLATE_VBOXR3EXE_LDFLAGS.darwin.x86 = -read_only_relocs suppress
2827 else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd)
2828TEMPLATE_VBOXR3EXE_TOOL = GXX3
2829TEMPLATE_VBOXR3EXE_LIBS = pthread
2830TEMPLATE_VBOXR3EXE_INCS += \
2831 /usr/include \
2832 /usr/X11R6/include \
2833 /usr/local/include
2834TEMPLATE_VBOXR3EXE_LIBPATH += \
2835 /usr/lib \
2836 /usr/X11R6/lib \
2837 /usr/local/lib
2838 else ifeq ($(KBUILD_TARGET),solaris)
2839TEMPLATE_VBOXR3EXE_TOOL = GXX3PLAIN
2840TEMPLATE_VBOXR3EXE_DEFS += LIBICONV_PLUG _REENTRANT # Avoid the GNU libiconv, for now at least.
2841TEMPLATE_VBOXR3EXE_LIBS = rt socket
2842 else
2843$(warning Warning: VBOX Build: Target $(KBUILD_TARGET) is not officially supported!)
2844TEMPLATE_VBOXR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.release)
2845TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease)
2846 endif
2847 ifdef VBOX_WITH_RUNPATH
2848 TEMPLATE_VBOXR3EXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
2849 else ifdef VBOX_WITH_RELATIVE_RUNPATH
2850 TEMPLATE_VBOXR3EXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
2851 endif
2852 ifdef VBOX_WITH_ORIGIN
2853 TEMPLATE_VBOXR3EXE_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT)
2854 endif
2855endif
2856
2857#
2858# Template for building R3 shared objects / DLLs.
2859# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
2860# -
2861TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
2862TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
2863TEMPLATE_VBOXR3_LDFLAGS.l4 = $(L4_LIBDIR)/../crt0.s.o -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
2864TEMPLATE_VBOXR3_DEFS.l4 = $(TEMPLATE_VBOXR3EXE_DEFS.l4) __PIC__
2865TEMPLATE_VBOXR3_DEFS.darwin = $(TEMPLATE_VBOXR3EXE_DEFS.darwin) PIC
2866TEMPLATE_VBOXR3_LDFLAGS.darwin = $(TEMPLATE_VBOXR3EXE_LDFLAGS.darwin) \
2867 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
2868 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
2869ifeq ($(filter-out solaris.x86 %.amd64 %.sparc32 %.sparc64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) ## TODO: cleanup!
2870 ifn1of ($(KBUILD_TARGET), darwin win)
2871 TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
2872 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
2873 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
2874 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
2875 endif
2876endif
2877
2878#
2879# Temporary: Renaming the template and warnings will be errors (soon).
2880#
2881TEMPLATE_VBoxR3Dll += VBox ring-3 SO/DLLs, no warnings
2882TEMPLATE_VBoxR3Dll_EXTENDS += VBOXR3
2883TEMPLATE_VBoxR3Dll_EXTENDS_BY += appending
2884ifeq ($(KBUILD_TARGET),win)
2885 TEMPLATE_VBoxR3Dll_CFLAGS += $(VBOX_VCC_WERR)
2886 TEMPLATE_VBoxR3Dll_CXXFLAGS += $(VBOX_VCC_WERR)
2887 TEMPLATE_VBoxR3Dll_LDFLAGS += $(VBOX_VCC_LD_WERR)
2888else
2889 TEMPLATE_VBoxR3Dll_CFLAGS += $(VBOX_GCC_WERR)
2890 TEMPLATE_VBoxR3Dll_CXXFLAGS += $(VBOX_GCC_WERR)
2891endif
2892
2893#
2894# Template for building static R3 executables and any static
2895# libraries they link with.
2896#
2897TEMPLATE_VBOXR3STATIC = VBox Static Ring 3 EXE
2898TEMPLATE_VBOXR3STATIC_EXTENDS = VBOXR3EXE
2899ifeq ($(KBUILD_TARGET),win)
2900 TEMPLATE_VBOXR3STATIC_CFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
2901 TEMPLATE_VBOXR3STATIC_CXXFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
2902 TEMPLATE_VBOXR3STATIC_LDFLAGS = $(filter-out /DISALLOWLIB:libcmt$(VBOX_VCC_CRT_TYPE).lib /DISALLOWLIB:libcpmt$(VBOX_VCC_CRT_TYPE).lib, $(TEMPLATE_VBOXR3EXE_LDFLAGS)) \
2903 /DISALLOWLIB:msvcrt.lib \
2904 /DISALLOWLIB:msvcrtd.lib \
2905 /DISALLOWLIB:msvcprt.lib \
2906 /DISALLOWLIB:msvcprtd.lib
2907 TEMPLATE_VBOXR3STATIC_LIBS = \
2908 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL)_LIB)/oldnames.lib \
2909 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
2910 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
2911else ifn1of ($(KBUILD_TARGET), darwin solaris)
2912 # The gcc guys sans darwin.
2913 TEMPLATE_VBOXR3STATIC_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -static
2914 TEMPLATE_VBOXR3STATIC_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -static
2915 TEMPLATE_VBOXR3STATIC_OBJCFLAGS = $(TEMPLATE_VBOXR3EXE_OBJCFLAGS) -static
2916 TEMPLATE_VBOXR3STATIC_OBJCXXFLAGS = $(TEMPLATE_VBOXR3EXE_OBJCXXFLAGS) -static
2917 TEMPLATE_VBOXR3STATIC_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -static
2918endif
2919
2920#
2921# Temporary: Renaming the template and warnings will be errors (soon).
2922#
2923TEMPLATE_VBoxR3Static = New name for VBOXR3STATIC
2924TEMPLATE_VBoxR3Static_EXTENDS = VBOXR3STATIC
2925TEMPLATE_VBoxR3Static_EXTENDS_BY = appending
2926ifeq ($(KBUILD_TARGET),win)
2927 TEMPLATE_VBoxR3Static_CFLAGS += $(VBOX_VCC_WERR)
2928 TEMPLATE_VBoxR3Static_CXXFLAGS += $(VBOX_VCC_WERR)
2929 TEMPLATE_VBoxR3Static_LDFLAGS += $(VBOX_VCC_LD_WERR)
2930else
2931 TEMPLATE_VBoxR3Static_CFLAGS += $(VBOX_GCC_WERR)
2932 TEMPLATE_VBoxR3Static_CXXFLAGS += $(VBOX_GCC_WERR)
2933endif
2934
2935#
2936# Same as VBOXR3EXE but without C++ exceptions.
2937#
2938# VBOXR3EXE does C++ exceptions and may assumes that extern "C" functions
2939# doesn't throw them. Use this template (and VBOXR3DLLNOXCPT) with care
2940# and only where the C++ overhead is really unwanted.
2941#
2942TEMPLATE_VBOXR3EXENOXCPT = VBox Ring 3 Exe without C++ exception
2943TEMPLATE_VBOXR3EXENOXCPT_EXTENDS = VBOXR3EXE
2944ifeq ($(KBUILD_TARGET),win)
2945 TEMPLATE_VBOXR3EXENOXCPT_CFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3EXE_CFLAGS) ) -EHs-
2946 TEMPLATE_VBOXR3EXENOXCPT_CXXFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3EXE_CXXFLAGS)) -EHs-
2947else
2948 TEMPLATE_VBOXR3EXENOXCPT_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fno-exceptions
2949endif
2950
2951#
2952# Same as VBOXR3 but without C++ exceptions.
2953#
2954TEMPLATE_VBOXR3DLLNOXCPT = VBox Ring 3 SO/DLLs without C++ exception
2955TEMPLATE_VBOXR3DLLNOXCPT_EXTENDS = VBOXR3
2956ifeq ($(KBUILD_TARGET),win)
2957 TEMPLATE_VBOXR3DLLNOXCPT_CFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3_CFLAGS) ) -EHs-
2958 TEMPLATE_VBOXR3DLLNOXCPT_CXXFLAGS = $(filter-out -EH%,$(TEMPLATE_VBOXR3_CXXFLAGS)) -EHs-
2959else
2960 TEMPLATE_VBOXR3DLLNOXCPT_CXXFLAGS = $(TEMPLATE_VBOXR3_CXXFLAGS) -fno-exceptions
2961endif
2962
2963#
2964# Template for building hardened Ring-3 executables.
2965# These shall have no extra runpaths, esp. not origin ones.
2966#
2967TEMPLATE_VBOXR3HARDENEDEXE = Hardened VBox Ring-3 EXE
2968TEMPLATE_VBOXR3HARDENEDEXE_EXTENDS = VBOXR3EXE
2969TEMPLATE_VBOXR3HARDENEDEXE_LIBS = $(VBOX_LIB_SUPHARDENED) $(TEMPLATE_VBOXR3EXE_LIBS)
2970TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.darwin = $(TEMPLATE_VBOXR3EXE_LDFLAGS.darwin) -framework IOKit
2971ifeq ($(KBUILD_TARGET),linux)
2972# not necessary except USE_LIB_PCAP is defined in SUPR3HardenedMain.cpp
2973# TEMPLATE_VBOXR3HARDENEDEXE_LIBS += cap
2974endif
2975ifn1of ($(KBUILD_TARGET), win os2)
2976 TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%,$(TEMPLATE_VBOXR3EXE_LDFLAGS))
2977 TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBOXR3EXE_LDFLAGS.linux))
2978endif
2979
2980#
2981# Template for building hardened Ring-3 libraries.
2982#
2983TEMPLATE_VBOXR3HARDENEDLIB = Hardened VBox Ring-3 LIB
2984TEMPLATE_VBOXR3HARDENEDLIB_EXTENDS = VBOXR3HARDENEDEXE
2985TEMPLATE_VBOXR3HARDENEDLIB_LIBS = $(NO_SUCH_VARIABLE)
2986
2987
2988#
2989# Template for building R3 shared objects / DLLs with the 10.5 Mac OS X SDK.
2990# Identical to VBOXR3EXE, except for the DYLIB, the classic_linker and SDK bits.
2991#
2992TEMPLATE_VBOXR3OSX105 = VBox Ring 3 SO/DLLs for OS X 10.5
2993TEMPLATE_VBOXR3OSX105_EXTENDS = VBOXR3EXE
2994TEMPLATE_VBOXR3OSX105_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_DEFS) PIC
2995TEMPLATE_VBOXR3OSX105_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CFLAGS) -fno-common
2996TEMPLATE_VBOXR3OSX105_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS)
2997TEMPLATE_VBOXR3OSX105_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS)
2998TEMPLATE_VBOXR3OSX105_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS)
2999TEMPLATE_VBOXR3OSX105_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS) \
3000 -read_only_relocs suppress \
3001 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
3002 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
3003
3004
3005#
3006# Ring-3 testcase, running automatically during the build.
3007# This is the VBOXR3EXE template only with a different install dir.
3008#
3009TEMPLATE_VBOXR3AUTOTST = VBox Ring 3 Testcase Exe
3010TEMPLATE_VBOXR3AUTOTST_EXTENDS = VBOXR3EXE
3011TEMPLATE_VBOXR3AUTOTST_INST = $(INST_TESTCASE)
3012TEMPLATE_VBOXR3AUTOTST_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS)
3013TEMPLATE_VBOXR3AUTOTST_LIBS.l4 = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS.l4)
3014ifeq ($(KBUILD_TARGET),win)
3015 ifdef VBOX_SIGNING_MODE
3016 TEMPLATE_VBOXR3AUTOTST_POST_CMDS =
3017 endif
3018endif
3019
3020#
3021# Ring-3 testcase.
3022# This is the VBOXR3EXE template only with a different install dir.
3023#
3024TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
3025TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
3026TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
3027TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
3028ifdef VBOX_WITH_RUNPATH
3029 TEMPLATE_VBOXR3TSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' $(TEMPLATE_VBOXR3EXE_LDFLAGS)
3030else ifdef VBOX_WITH_RELATIVE_RUNPATH
3031 TEMPLATE_VBOXR3TSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..' $(TEMPLATE_VBOXR3EXE_LDFLAGS)
3032endif
3033ifeq ($(KBUILD_TARGET),win)
3034 ifdef VBOX_SIGNING_MODE
3035 TEMPLATE_VBOXR3TSTEXE_POST_CMDS =
3036 endif
3037endif
3038
3039#
3040# Ring-3 testcase (no -pedantic)
3041#
3042TEMPLATE_VBOXR3TSTNPEXE = VBox Ring 3 Testcase Exe Non-pedantic
3043TEMPLATE_VBOXR3TSTNPEXE_EXTENDS = VBOXR3TSTEXE
3044ifneq ($(KBUILD_TARGET),win) # (only gcc)
3045 TEMPLATE_VBOXR3TSTNPEXE_TOOL = $(VBOX_GCC_TOOL)
3046 TEMPLATE_VBOXR3TSTNPEXE_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3TSTEXE_CXXFLAGS)) -Wno-sign-compare
3047 TEMPLATE_VBOXR3TSTNPEXE_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3TSTEXE_CFLAGS)) -Wno-sign-compare
3048endif
3049
3050
3051#
3052# Template for the CppUnit kind of testcases.
3053#
3054TEMPLATE_VBOXCPPUNITEXE = VBox CppUnit Testcase Exe
3055TEMPLATE_VBOXCPPUNITEXE_EXTENDS = VBOXR3TSTEXE
3056## @todo make a CPPUNIT SDK and add cppunit tools packages for windows, mac, solaris and OS/2.
3057#TEMPLATE_VBOXCPPUNITEXE_SDKS = CPPUNIT -
3058TEMPLATE_VBOXCPPUNITEXE_LIBS = \
3059 $(TEMPLATE_VBOXR3TSTEXE_LIBS) \
3060 cppunit
3061
3062#
3063# Template for building bad C/C++ style R3 executables (no -pedantic).
3064#
3065TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
3066TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
3067ifneq ($(KBUILD_TARGET),win) # (only gcc)
3068 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
3069 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3EXE_CXXFLAGS)) -Wno-sign-compare
3070 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3EXE_CFLAGS)) \
3071 -Wno-sign-compare -Werror-implicit-function-declaration
3072endif
3073
3074
3075#
3076# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
3077# (Same transformation as for VBOXR3NPEXE.)
3078#
3079TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
3080TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3
3081ifneq ($(KBUILD_TARGET),win) # (only gcc)
3082 TEMPLATE_VBOXR3NP_TOOL = $(VBOX_GCC_TOOL)
3083 TEMPLATE_VBOXR3NP_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3_CXXFLAGS)) -Wno-sign-compare
3084 TEMPLATE_VBOXR3NP_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3_CFLAGS)) \
3085 -Wno-sign-compare -Werror-implicit-function-declaration
3086endif
3087
3088
3089#
3090# Template for building libraries, shared libraries / modules
3091# which only depends on IPRT for crt.
3092#
3093TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
3094TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
3095TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
3096TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno $(VBOX_GCC_WARN) -Werror-implicit-function-declaration
3097TEMPLATE_VBOXNOCRTGCC_CFLAGS.x86 = -m32
3098TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -m64 -mcmodel=medium -fno-common
3099TEMPLATE_VBOXNOCRTGCC_CFLAGS.sparc32 = -m32
3100TEMPLATE_VBOXNOCRTGCC_CFLAGS.sparc64 = -m64
3101TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
3102TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
3103TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
3104TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -static
3105TEMPLATE_VBOXNOCRTGCC_CXXFLAGS = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS)
3106TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(KBUILD_TARGET) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(KBUILD_TARGET))
3107TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(KBUILD_TARGET_ARCH) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(KBUILD_TARGET_ARCH))
3108TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
3109
3110ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
3111 # cross compile to 64-bit ELF (linux).
3112 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
3113 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
3114 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
3115 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
3116 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
3117
3118else ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
3119 # Use the default GCC (MinGW) with the Microsoft linker.
3120 # (Drop all '-g' options as we're unable to strip the debug info.)
3121 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
3122 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
3123 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
3124 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
3125 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
3126 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
3127 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
3128
3129else
3130 # Use the default GCC.
3131 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
3132 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
3133 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
3134 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
3135 TEMPLATE_VBOXNOCRTGCC_CFLAGS += $(VBOX_GCC_fno-stack-protector)
3136 TEMPLATE_VBOXNOCRTGCC_CXXFLAGS += $(VBOX_GCC_fno-stack-protector)
3137 ifeq ($(KBUILD_TARGET_ARCH),amd64)
3138 # in 64-bit mode we'll build a sys-module (VBoxREM2).
3139 if1of ($(KBUILD_TARGET), darwin solaris)
3140 TEMPLATE_VBOXNOCRTGCC_LDFLAGS.solaris= -64 -r
3141 else
3142 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
3143 endif
3144 else # x86:
3145 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
3146 ifn1of ($(KBUILD_TARGET), os2 darwin solaris)
3147 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
3148 endif
3149 endif # x86
3150 TEMPLATE_VBOXNOCRTGCC_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
3151 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
3152endif
3153
3154
3155#
3156# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
3157#
3158TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
3159TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
3160TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
3161ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
3162 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
3163else
3164 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
3165endif
3166TEMPLATE_VBOXNOCRTGAS_ASFLAGS.x86 = -m32
3167TEMPLATE_VBOXNOCRTGAS_ASFLAGS.amd64 = -m64
3168
3169
3170#
3171# Template for building executables that are part of the VBox Main component
3172# (COM/XPCOM interface to VirtualBox).
3173#
3174TEMPLATE_VBOXMAINEXE = VBox Main Executable
3175TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
3176TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
3177TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE NDEBUG=1
3178TEMPLATE_VBOXMAINEXE_DEFS.win = _UNICODE
3179TEMPLATE_VBOXMAINEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
3180TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
3181
3182ifeq ($(KBUILD_TARGET),win)
3183 TEMPLATE_VBOXMAINEXE_SDKS = WINPSDK $(VBOX_WINDDK)
3184 # Note: C4250 is the dominance warning, see r32789.
3185 # C4065 is about default only switches.
3186 # C4996 is about deprected function (CRT only?).
3187 ifndef VBOX_USE_VCC70
3188 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
3189 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -EHsc -GF -MD$(VBOX_VCC_CRT_TYPE) -W3 -wd4065 -wd4996 -wd4250 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
3190 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
3191 else
3192 TEMPLATE_VBOXMAINEXE_TOOL = VCC70
3193 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -EHsc -GF -MD$(VBOX_VCC_CRT_TYPE) -W3 -wd4065 -wd4250 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
3194 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -GZ
3195 endif
3196 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
3197 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
3198 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
3199 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
3200 TEMPLATE_VBOXMAINEXE_INCS += \
3201 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
3202 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
3203 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
3204 /DISALLOWLIB:libc.lib \
3205 /DISALLOWLIB:libcd.lib \
3206 /DISALLOWLIB:libcmt.lib \
3207 /DISALLOWLIB:libcmtd.lib \
3208 /DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE_N).lib \
3209 /DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE_N).lib
3210 TEMPLATE_VBOXMAINEXE_LIBS = \
3211 $(LIB_RUNTIME) \
3212 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
3213 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
3214 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
3215 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls$(VBOX_VCC_CRT_TYPE).lib
3216 TEMPLATE_VBOXMAINEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
3217 ifdef VBOX_USE_VCC100 # HACK ALERT!
3218 TEMPLATE_VBOXMAINEXE_CINCS = $(TOOL_$(VBOX_VCC_TOOL)_CINCS)
3219 TEMPLATE_VBOXMAINEXE_CXXINCS = $(TOOL_$(VBOX_VCC_TOOL)_CXXINCS)
3220 endif
3221
3222else # the GCC guys:
3223
3224TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
3225TEMPLATE_VBOXMAINEXE_CXXFLAGS = -g -pipe \
3226 $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) -Wno-long-long -Wno-non-virtual-dtor -Wshadow \
3227 -fshort-wchar -fpermissive -fexceptions -frtti $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing \
3228 $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
3229TEMPLATE_VBOXMAINEXE_CXXFLAGS.x86 = -m32
3230TEMPLATE_VBOXMAINEXE_CXXFLAGS.amd64 = -m64
3231TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
3232TEMPLATE_VBOXMAINEXE_CFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros) \
3233 $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-hidden)
3234TEMPLATE_VBOXMAINEXE_CFLAGS.x86 = -m32
3235TEMPLATE_VBOXMAINEXE_CFLAGS.amd64 = -m64
3236TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
3237TEMPLATE_VBOXMAINEXE_OBJCFLAGS = $(TEMPLATE_VBOXMAINEXE_CFLAGS)
3238TEMPLATE_VBOXMAINEXE_OBJCFLAGS.x86 = $(TEMPLATE_VBOXMAINEXE_CFLAGS.x86)
3239TEMPLATE_VBOXMAINEXE_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXMAINEXE_CFLAGS.amd64)
3240TEMPLATE_VBOXMAINEXE_OBJCFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile)
3241TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
3242TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.x86)
3243TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.amd64)
3244TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS.kprofile= $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
3245TEMPLATE_VBOXMAINEXE_LDFLAGS.x86 = -m32
3246TEMPLATE_VBOXMAINEXE_LDFLAGS.amd64 = -m64
3247 ifeq ($(KBUILD_TARGET),linux)
3248TEMPLATE_VBOXMAINEXE_LIBS = pthread m rt $(LIB_RUNTIME) dl
3249TEMPLATE_VBOXMAINEXE_LDFLAGS.linux = $(VBOX_LD_as_needed)
3250 else ifeq ($(KBUILD_TARGET),l4)
3251TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
3252# no libs as yet in l4 target - must be added later
3253 else ifeq ($(KBUILD_TARGET),os2)
3254TEMPLATE_VBOXMAINEXE_TOOL = GXX3OMF
3255TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
3256 else ifeq ($(KBUILD_TARGET),darwin)
3257TEMPLATE_VBOXMAINEXE_TOOL = GXX4MACHO
3258TEMPLATE_VBOXMAINEXE_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
3259TEMPLATE_VBOXMAINEXE_CFLAGS += $(VBOX_DARWIN_DEF_SDK_CFLAGS)
3260TEMPLATE_VBOXMAINEXE_CXXFLAGS += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
3261TEMPLATE_VBOXMAINEXE_OBJCFLAGS += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
3262TEMPLATE_VBOXMAINEXE_OBJCXXFLAGS += $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS)
3263TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin += -bind_at_load
3264TEMPLATE_VBOXMAINEXE_LDFLAGS += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -framework Carbon
3265TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
3266 else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd)
3267TEMPLATE_VBOXMAINEXE_TOOL = GXX3
3268TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
3269TEMPLATE_VBOXMAINEXE_INCS += \
3270 /usr/include \
3271 /usr/X11R6/include \
3272 /usr/local/include
3273TEMPLATE_VBOXMAINEXE_LIBPATH += \
3274 /usr/lib \
3275 /usr/X11R6/lib \
3276 /usr/local/lib
3277else ifeq ($(KBUILD_TARGET),solaris)
3278TEMPLATE_VBOXMAINEXE_TOOL = GXX3PLAIN
3279TEMPLATE_VBOXMAINEXE_DEFS += _REENTRANT
3280TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt thread
3281 else
3282$(warning Warning: VBOX Build: Target $(KBUILD_TARGET) is not officially supported!)
3283TEMPLATE_VBOXMAINEXE_LIBS =
3284 endif
3285 ifdef VBOX_WITH_RUNPATH
3286TEMPLATE_VBOXMAINEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
3287 else ifdef VBOX_WITH_RELATIVE_RUNPATH
3288TEMPLATE_VBOXMAINEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
3289 endif
3290 ifdef VBOX_WITH_ORIGIN
3291TEMPLATE_VBOXMAINEXE_LDFLAGS.linux += $(VBOX_GCC_ORIGIN_OPT)
3292 endif
3293
3294endif # !win
3295
3296# Add COM/XPCOM stuff
3297TEMPLATE_VBOXMAINEXE_LIBS += \
3298 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
3299ifdef VBOX_WITH_XPCOM
3300 ## @todo may be worth creating the VBOX_XPCOM SDK def
3301 TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
3302 ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
3303 TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
3304 endif
3305 TEMPLATE_VBOXMAINEXE_INCS += \
3306 $(VBOX_XPCOM_INCS)
3307 TEMPLATE_VBOXMAINEXE_LIBS += \
3308 $(LIB_XPCOM)
3309 TEMPLATE_VBOXMAINEXE_INTERMEDIATES += \
3310 $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h
3311
3312else # COM
3313 TEMPLATE_VBOXMAINEXE_INCS += \
3314 $(VBOX_PATH_SDK)/bindings/mscom/include
3315 TEMPLATE_VBOXMAINEXE_INTERMEDIATES += \
3316 $(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h
3317endif # COM
3318
3319#
3320# Template for building the Main DLL modules (such as in-process COM/XPCOM
3321# components for Main).
3322#
3323# This differs from VBOXMAINEXE only in PIC handling and similar DLL stuff.
3324#
3325TEMPLATE_VBOXMAINDLL = VBox Main Component (shared library)
3326TEMPLATE_VBOXMAINDLL_EXTENDS = VBOXMAINEXE
3327
3328ifeq ($(filter-out solaris.x86 %.amd64 %.sparc32 %.sparc64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) ## TODO: cleanup!
3329 ifn1of ($(KBUILD_TARGET), darwin win)
3330 TEMPLATE_VBOXMAINDLL_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
3331 TEMPLATE_VBOXMAINDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
3332 TEMPLATE_VBOXMAINDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
3333 TEMPLATE_VBOXMAINDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
3334 endif
3335endif
3336TEMPLATE_VBOXMAINDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin)) \
3337 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
3338 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
3339
3340#
3341# Template identical to VBOXMAINDLL except for where the stuff is
3342# installed when using XPCOM (components/).
3343#
3344# Note! In the hardened build this gets a bit ugly since $ORIGIN/..
3345# doesn't work. So, we keep the $ORIGIN from VBOXMAINEXE and let
3346# the installers do the necessary .so symlinking.
3347#
3348# (No difference when building against COM on Windows.)
3349#
3350TEMPLATE_VBOXMAINCOMP = VBox Main COM/XPCOM Component (shared library)
3351TEMPLATE_VBOXMAINCOMP_EXTENDS = VBOXMAINEXE
3352ifn1of ($(KBUILD_TARGET), win)
3353 TEMPLATE_VBOXMAINCOMP_INST = $(INST_BIN)components/
3354endif
3355ifneq ($(KBUILD_TARGET),win)
3356 ifeq ($(filter-out solaris.x86 %.amd64 %.sparc32 %.sparc64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) ## TODO: cleanup!
3357 TEMPLATE_VBOXMAINCOMP_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
3358 TEMPLATE_VBOXMAINCOMP_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
3359 TEMPLATE_VBOXMAINCOMP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
3360 if defined(VBOX_WITH_RELATIVE_RUNPATH) && !defined(VBOX_WITH_HARDENING)
3361 TEMPLATE_VBOXMAINCOMP_LDFLAGS = -fPIC $(filter-out '$(VBOX_GCC_RPATH_OPT)%',$(TEMPLATE_VBOXMAINEXE_LDFLAGS)) '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..'
3362 else
3363 TEMPLATE_VBOXMAINCOMP_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
3364 endif
3365 else ifndef VBOX_WITH_HARDENING
3366 ifdef VBOX_WITH_RELATIVE_RUNPATH
3367 TEMPLATE_VBOXMAINCOMP_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%',$(TEMPLATE_VBOXMAINEXE_LDFLAGS)) '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..'
3368 endif
3369 endif
3370endif
3371TEMPLATE_VBOXMAINCOMP_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin)) \
3372 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
3373 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
3374
3375#
3376# Template for building the Main static libraries.
3377#
3378# This differs from VBOXMAINDLL only that it zeroes out the _LIBS definition.
3379#
3380TEMPLATE_VBOXMAINLIB = VBox Main Component (static library)
3381TEMPLATE_VBOXMAINLIB_EXTENDS = VBOXMAINDLL
3382TEMPLATE_VBOXMAINLIB_LIBS =
3383
3384#
3385# Template for building executables that use the VBox Main component.
3386#
3387TEMPLATE_VBOXMAINCLIENTEXE = VBox Main Client (executable)
3388TEMPLATE_VBOXMAINCLIENTEXE_EXTENDS = VBOXMAINEXE
3389ifeq ($(KBUILD_TARGET),win)
3390 TEMPLATE_VBOXMAINCLIENTEXE_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
3391 $(PATH_SDK_WINPSDK_LIB)/User32.Lib \
3392 $(PATH_SDK_WINPSDK_LIB)/Shell32.Lib \
3393 $(PATH_SDK_WINPSDK_LIB)/ShLwApi.Lib \
3394 $(PATH_SDK_WINPSDK_LIB)/Ole32.Lib \
3395 $(PATH_SDK_WINPSDK_LIB)/OleAut32.Lib \
3396 $(PATH_SDK_WINPSDK_LIB)/Uuid.Lib
3397else
3398 TEMPLATE_VBOXMAINCLIENTEXE_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
3399 NDEBUG TRIMMED
3400 TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
3401 -pthread
3402endif
3403
3404#
3405# Template for building shared libraries / DLLs that use the VBox Main component.
3406#
3407# This differs from VBOXMAINCLIENTEXE only in PIC handling and similar DLL stuff.
3408#
3409TEMPLATE_VBOXMAINCLIENTDLL = VBox MAIN Client (shared library)
3410TEMPLATE_VBOXMAINCLIENTDLL_EXTENDS = VBOXMAINCLIENTEXE
3411ifeq ($(filter-out solaris.x86 %.amd64 %.sparc32 %.sparc64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) ## TODO: cleanup!
3412 ifneq ($(KBUILD_TARGET),win)
3413 TEMPLATE_VBOXMAINCLIENTDLL_DEFS = PIC $(TEMPLATE_VBOXMAINCLIENTEXE_DEFS)
3414 TEMPLATE_VBOXMAINCLIENTDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CFLAGS)
3415 TEMPLATE_VBOXMAINCLIENTDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS)
3416 TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)
3417 endif
3418endif
3419TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin))
3420
3421
3422#
3423# Qt 4
3424# Qt 4
3425# Qt 4
3426#
3427ifdef VBOX_WITH_QTGUI
3428
3429 # Guess VBOX_WITH_QT4_SUN
3430 ifndef VBOX_WITH_QT4_SUN
3431 ifndef VBOX_OSE
3432 if1of ($(KBUILD_TARGET), darwin solaris win)
3433 VBOX_WITH_QT4_SUN := 1
3434 endif
3435 endif
3436 endif
3437
3438 #
3439 # Handmade configuration of qt4 - very annoying, this needs to
3440 # be cleaned up properly later some time (not important now).
3441 #
3442 ifeq ($(VBOX_PATH_QT4),)
3443 ifeq ($(KBUILD_TARGET),darwin)
3444 VBOX_PATH_QT4 := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
3445 ifeq ($(VBOX_PATH_QT4),)
3446 ifneq ($(wildcard /Library/Frameworks/QtCore.framework),)
3447 # Using the global installation (for OSE).
3448 VBOX_PATH_QT4 ?= /usr
3449 VBOX_PATH_QT4_FRAMEWORKS ?= /Library/Frameworks
3450 endif
3451 endif
3452 else if1of ($(KBUILD_TARGET), win)
3453 VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
3454 else if1of ($(KBUILD_TARGET), solaris)
3455 VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
3456 ifneq ($(VBOX_PATH_QT4),)
3457 VBOX_WITH_QT4_SUN = 1
3458 endif
3459 endif
3460 endif
3461 ifeq ($(VBOX_PATH_QT4),)
3462 if1of ($(USERNAME), bird)
3463 # gentoo (64-bit)
3464 VBOX_PATH_QT4 ?= /usr
3465 VBOX_PATH_QT4_LIB ?= /usr/lib/qt4
3466 endif
3467 endif
3468 VBOX_PATH_QT4 ?= /usr
3469 VBOX_PATH_QT4_LIB ?= $(VBOX_PATH_QT4)/lib
3470
3471 # Hack LD_LIBRARY_PATH for stuff in tools.
3472 ifdef VBOX_WITH_QT4_SUN
3473 if1of ($(KBUILD_TARGET), linux)
3474 export LD_LIBRARY_PATH := $(VBOX_PATH_QT4_LIB):$(LD_LIBRARY_PATH)
3475 endif
3476 endif
3477
3478
3479 #
3480 # Template for building Qt GUI executables.
3481 #
3482 TEMPLATE_VBOXQT4GUIEXE = VBox Qt GUI Executable
3483 TEMPLATE_VBOXQT4GUIEXE_USES = qt4
3484 TEMPLATE_VBOXQT4GUIEXE_QTTOOL = QT4
3485 TEMPLATE_VBOXQT4GUIEXE_MOCTOOL = QT4
3486 TEMPLATE_VBOXQT4GUIEXE_UICTOOL = QT4
3487 TEMPLATE_VBOXQT4GUIEXE_RCCTOOL = QT4
3488 TEMPLATE_VBOXQT4GUIEXE_LRCTOOL = QT4
3489 TEMPLATE_VBOXQT4GUIEXE_SDKS = QT4
3490 ifdef VBOX_WITH_QT4_SUN
3491 TEMPLATE_VBOXQT4GUIEXE_QT_INFIX = VBox
3492 endif
3493 TEMPLATE_VBOXQT4GUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT QT_SHARED HAVE_CONFIG_H $(ARCH_BITS_DEFS)
3494 TEMPLATE_VBOXQT4GUIEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
3495
3496 ifeq ($(KBUILD_TARGET),win)
3497 # Note! No use of VBOX_VCC_CRT_TYPE here yet as it requires a /MDd build of Qt as well.
3498 TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_VCC_TOOL)
3499 TEMPLATE_VBOXQT4GUIEXE_DEFS += \
3500 _WIN32_WINNT=0x0500 UNICODE _UNICODE \
3501 QT_DLL _CRT_SECURE_NO_DEPRECATE \
3502 $(QMAKE_PRL_DEFINES)
3503 ## @todo VCC70 flags?
3504 ifndef VBOX_USE_VCC70
3505 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
3506 -nologo -Zm200 -W3 -MD -Zi -EHsc -Zc:wchar_t-
3507 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.debug = -RTCsu
3508 else
3509 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
3510 -nologo -Zm200 -W3 -MD -Zi -GX
3511 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.debug = -GZ
3512 endif
3513 TEMPLATE_VBOXQT4GUIEXE_INCS += \
3514 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
3515 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS = \
3516 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
3517 /DELAYLOAD:oleaut32.dll
3518 TEMPLATE_VBOXQT4GUIEXE_SDKS += WINPSDK
3519 TEMPLATE_VBOXQT4GUIEXE_LIBS = \
3520 $(VBOX_LIBS_QT4) \
3521 $(LIB_RUNTIME) \
3522 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
3523 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
3524 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
3525 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
3526 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
3527 ifdef VBOX_WITH_DEBUG_VCC_CRT # VBoxCOM (static) is causing trouble of course.
3528 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
3529 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt$(VBOX_VCC_CRT_TYPE).lib \
3530 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib
3531 endif
3532 TEMPLATE_VBOXQT4GUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
3533 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.win.x86 += /LARGEADDRESSAWARE
3534
3535 ifdef VBOX_USE_VCC100 # HACK ALERT!
3536 TEMPLATE_VBOXQT4GUIEXE_CINCS = $(TOOL_$(VBOX_VCC_TOOL)_CINCS)
3537 TEMPLATE_VBOXQT4GUIEXE_CXXINCS = $(TOOL_$(VBOX_VCC_TOOL)_CXXINCS)
3538 endif
3539
3540 else # the gcc guys:
3541 TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_GCC_TOOL)
3542 TEMPLATE_VBOXQT4GUIEXE_DEFS.linux = _REENTRANT
3543
3544 TEMPLATE_VBOXQT4GUIEXE_DEFS.solaris = _REENTRANT
3545
3546 TEMPLATE_VBOXQT4GUIEXE_INCS += \
3547 $(LIB_SDL_INC)
3548 ## @todo Use VBOX_GCC_PEDANTIC_CXX?
3549 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
3550 -g -pipe $(filter-out -Wno-unused,$(VBOX_GCC_WARN)) -frtti -fno-exceptions -Wno-non-virtual-dtor \
3551 -Wno-long-long -fshort-wchar -fno-strict-aliasing \
3552 $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
3553 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.x86 = -m32
3554 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.amd64 = -m64
3555 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.linux = -pthread
3556 TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_C) -Wno-long-long -fno-exceptions
3557 TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS.x86 = $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.x86)
3558 TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.amd64)
3559 TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS = \
3560 -g -pipe $(VBOX_GCC_PEDANTIC_CXX) -Wno-non-virtual-dtor -Wno-long-long \
3561 -frtti -fno-exceptions $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
3562 TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.x86)
3563 TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.amd64)
3564 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.x86 = -m32
3565 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.amd64 = -m64
3566 TEMPLATE_VBOXQT4GUIEXE_LIBS = \
3567 $(VBOX_LIBS_QT4) \
3568 $(LIB_SDL) \
3569 $(LIB_RUNTIME) \
3570 $(LIB_REM) \
3571 $(LIB_VMM)
3572
3573 ifeq ($(KBUILD_TARGET),linux)
3574 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += $(VBOX_LD_as_needed)
3575 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
3576 $(VBOX_XCURSOR_LIBS) \
3577 Xext \
3578 X11
3579 TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
3580 $(VBOX_LIBPATH_X11)
3581 else ifeq ($(KBUILD_TARGET),darwin)
3582 TEMPLATE_VBOXQT4GUIEXE_DEFS.darwin += $(VBOX_DARWIN_DEF_SDK_DEFS)
3583 TEMPLATE_VBOXQT4GUIEXE_CFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CFLAGS)
3584 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
3585 TEMPLATE_VBOXQT4GUIEXE_OBJCFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
3586 TEMPLATE_VBOXQT4GUIEXE_OBJCXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS)
3587 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -bind_at_load
3588 TEMPLATE_VBOXQT4GUIEXE_LIBS +=
3589 TEMPLATE_VBOXQT4GUIEXE_LIBPATH +=
3590 else
3591 TEMPLATE_VBOXQT4GUIEXE_INCS += \
3592 $(VBOX_XCURSOR_INCS)
3593 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
3594 $(VBOX_XCURSOR_LIBS) \
3595 Xext \
3596 X11 \
3597 m \
3598 $(LIB_PTHREAD)
3599 TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
3600 $(VBOX_LIBPATH_X11)
3601 ifeq ($(KBUILD_TARGET),freebsd)
3602 TEMPLATE_VBOXQT4GUIEXE_INCS += \
3603 /usr/include \
3604 /usr/X11R6/include \
3605 /usr/local/include
3606 TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
3607 /usr/lib \
3608 /usr/X11R6/lib \
3609 /usr/local/lib
3610 endif
3611 ifeq ($(KBUILD_TARGET),solaris)
3612 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
3613 rt socket nsl
3614 endif
3615 endif
3616 # Assume the Qt shared objects are in the same directory as the executable, on Solaris too.
3617 ifdef VBOX_WITH_RUNPATH
3618 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
3619 else ifdef VBOX_WITH_RELATIVE_RUNPATH
3620 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'
3621 endif
3622
3623 endif
3624
3625 # Add COM/XPCOM stuff
3626 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
3627 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
3628 ifdef VBOX_WITH_XPCOM
3629 ## @todo may be worth creating the VBOX_XPCOM SDK def, or just a SDK_VBOXXPCOM.
3630 TEMPLATE_VBOXQT4GUIEXE_DEFS += VBOX_WITH_XPCOM
3631 ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
3632 TEMPLATE_VBOXQT4GUIEXE_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
3633 endif
3634 TEMPLATE_VBOXQT4GUIEXE_INCS += \
3635 $(VBOX_XPCOM_INCS)
3636 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
3637 $(LIB_XPCOM)
3638 TEMPLATE_VBOXQT4GUIEXE_INTERMEDIATES += \
3639 $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h
3640 else # COM
3641 TEMPLATE_VBOXQT4GUIEXE_INCS += \
3642 $(VBOX_PATH_SDK)/bindings/mscom/include
3643 TEMPLATE_VBOXQT4GUIEXE_INTERMEDIATES += \
3644 $(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h
3645 endif # COM
3646
3647
3648 #
3649 # Template for building Qt GUI components.
3650 #
3651 TEMPLATE_VBOXQT4GUI = VBox Qt GUI Components
3652 TEMPLATE_VBOXQT4GUI_EXTENDS = VBOXQT4GUIEXE
3653 TEMPLATE_VBOXQT4GUI_LIBS = $(filter-out $(QTMAIN),$(TEMPLATE_VBOXQT4GUIEXE_LIBS))
3654 ifeq ($(KBUILD_TARGET),darwin)
3655 TEMPLATE_VBOXQT4GUI_LDFLAGS.darwin += $(filter-out -bind_at_load,$(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.darwin)) \
3656 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
3657 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
3658 endif
3659 ifeq ($(filter-out solaris.x86 %.amd64 %.sparc32 %.sparc64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) ## TODO: cleanup!
3660 ifneq ($(KBUILD_TARGET),win)
3661 TEMPLATE_VBOXQT4GUI_DEFS = PIC $(TEMPLATE_VBOXQT4GUIEXE_DEFS)
3662 TEMPLATE_VBOXQT4GUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CFLAGS)
3663 TEMPLATE_VBOXQT4GUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS)
3664 TEMPLATE_VBOXQT4GUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS)
3665 endif
3666 endif
3667
3668endif # VBOX_WITH_QTGUI
3669
3670
3671#
3672# Template for building build bldprogs.
3673#
3674TEMPLATE_VBOXBLDPROG = VBox Build Program
3675TEMPLATE_VBOXBLDPROG_DEFS = IN_RING3
3676ifeq ($(KBUILD_HOST),win)
3677 ifndef VBOX_USE_VCC70
3678 TEMPLATE_VBOXBLDPROG_TOOL := $(VBOX_VCC_TOOL_STEM)$(toupper $(KBUILD_HOST_ARCH))
3679 TEMPLATE_VBOXBLDPROG_SDKS := $(if-expr "$(KBUILD_HOST_ARCH)" == "x86",WIN32SDK,WIN64SDK)
3680 else if1of ($(KBUILD_HOST_ARCH), x86)
3681 TEMPLATE_VBOXBLDPROG_TOOL := VCC70
3682 TEMPLATE_VBOXBLDPROG_SDKS := WIN32SDK
3683 else if1of ($(KBUILD_HOST_ARCH), amd64)
3684 TEMPLATE_VBOXBLDPROG_TOOL := VCC80AMD64
3685 TEMPLATE_VBOXBLDPROG_SDKS := WIN64SDK
3686 else
3687 $(error KBUILD_HOST_ARCH=$(KBUILD_HOST_ARCH))
3688 endif
3689 ifndef VBOX_USE_VCC70
3690 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -MT$(VBOX_VCC_CRT_TYPE) -W3 -wd4996 -Zc:wchar_t-
3691 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -RTCsu
3692 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -Oy- -GS-
3693 else
3694 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -MT$(VBOX_VCC_CRT_TYPE) -W3
3695 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -GZ
3696 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -Ogitb2 -Oy-
3697 endif
3698 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
3699 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
3700 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
3701 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
3702 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
3703 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
3704 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
3705 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
3706 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
3707 /DISALLOWLIB:libc$(VBOX_VCC_CRT_TYPE_N).lib \
3708 /DISALLOWLIB:libcmt$(VBOX_VCC_CRT_TYPE_N).lib \
3709 /DISALLOWLIB:msvcrt.lib \
3710 /DISALLOWLIB:msvcrtd.lib \
3711 /DISALLOWLIB:msvcprt.lib \
3712 /DISALLOWLIB:msvcprtd.lib
3713 TEMPLATE_VBOXBLDPROG_LIBS = \
3714 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
3715 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
3716 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
3717
3718else
3719# (gcc of some kind )
3720TEMPLATE_VBOXBLDPROG_TOOL = GXX3
3721TEMPLATE_VBOXBLDPROG_CFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_Wno-variadic-macros)
3722TEMPLATE_VBOXBLDPROG_CFLAGS.x86 = -m32
3723TEMPLATE_VBOXBLDPROG_CFLAGS.sparc32 = -m32
3724TEMPLATE_VBOXBLDPROG_CFLAGS.amd64 = -m64
3725TEMPLATE_VBOXBLDPROG_CFLAGS.sparc64 = -m64
3726TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
3727TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
3728TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
3729TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_CXX)
3730TEMPLATE_VBOXBLDPROG_CXXFLAGS.x86 = -m32
3731TEMPLATE_VBOXBLDPROG_CXXFLAGS.sparc32 = -m32
3732TEMPLATE_VBOXBLDPROG_CXXFLAGS.amd64 = -m64
3733TEMPLATE_VBOXBLDPROG_CXXFLAGS.sparc64 = -m64
3734TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
3735TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
3736TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
3737TEMPLATE_VBOXBLDPROG_OBJCFLAGS = $(TEMPLATE_VBOXBLDPROG_CFLAGS)
3738TEMPLATE_VBOXBLDPROG_OBJCFLAGS.x86 = $(TEMPLATE_VBOXBLDPROG_CFLAGS.x86)
3739TEMPLATE_VBOXBLDPROG_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXBLDPROG_CFLAGS.amd64)
3740TEMPLATE_VBOXBLDPROG_OBJCFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CFLAGS.release)
3741TEMPLATE_VBOXBLDPROG_OBJCFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CFLAGS.profile)
3742TEMPLATE_VBOXBLDPROG_OBJCFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile)
3743TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
3744TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.x86)
3745TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.amd64)
3746TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
3747TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
3748TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.kprofile= $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
3749TEMPLATE_VBOXBLDPROG_LDFLAGS.x86 = -m32
3750TEMPLATE_VBOXBLDPROG_LDFLAGS.sparc32 = -m32
3751TEMPLATE_VBOXBLDPROG_LDFLAGS.amd64 = -m64
3752TEMPLATE_VBOXBLDPROG_LDFLAGS.sparc64 = -m64
3753 ifeq ($(KBUILD_HOST),linux)
3754TEMPLATE_VBOXBLDPROG_LIBS = pthread m rt dl
3755 else ifeq ($(KBUILD_HOST),os2)
3756TEMPLATE_VBOXBLDPROG_TOOL = GXX3OMF
3757TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
3758 else ifeq ($(KBUILD_HOST),darwin)
3759TEMPLATE_VBOXBLDPROG_TOOL = GXX4MACHO
3760 ifeq ($(KBUILD_HOST_ARCH).$(KBUILD_TARGET_ARCH),amd64.x86) # MESS ALERT!
3761TEMPLATE_VBOXBLDPROG_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_DEFS)
3762TEMPLATE_VBOXBLDPROG_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_CFLAGS) -fno-common
3763TEMPLATE_VBOXBLDPROG_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_CXXFLAGS)
3764TEMPLATE_VBOXBLDPROG_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
3765TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
3766TEMPLATE_VBOXBLDPROG_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_6_LDFLAGS)
3767 else ifdef VBOX_MACOS_10_5_WORKAROUND # enable this if you have problems linking xpidl and is running 10.5 or later.
3768TEMPLATE_VBOXBLDPROG_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_DEFS)
3769TEMPLATE_VBOXBLDPROG_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CFLAGS) -fno-common
3770TEMPLATE_VBOXBLDPROG_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_CXXFLAGS)
3771TEMPLATE_VBOXBLDPROG_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
3772TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
3773TEMPLATE_VBOXBLDPROG_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_10_5_LDFLAGS)
3774 else
3775TEMPLATE_VBOXBLDPROG_DEFS.darwin = $(VBOX_DARWIN_DEF_SDK_DEFS)
3776TEMPLATE_VBOXBLDPROG_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -fno-common
3777TEMPLATE_VBOXBLDPROG_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
3778TEMPLATE_VBOXBLDPROG_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS) $(VBOX_GCC_PEDANTIC_C)
3779TEMPLATE_VBOXBLDPROG_OBJCXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS) $(VBOX_GCC_PEDANTIC_CXX)
3780TEMPLATE_VBOXBLDPROG_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
3781 endif
3782TEMPLATE_VBOXBLDPROG_LIBS =
3783 else if1of ($(KBUILD_HOST), freebsd netbsd openbsd)
3784TEMPLATE_VBOXBLDPROG_TOOL = GXX3
3785TEMPLATE_VBOXBLDPROG_LIBS =
3786TEMPLATE_VBOXBLDPROG_INCS += \
3787 /usr/include \
3788 /usr/X11R6/include \
3789 /usr/local/include
3790TEMPLATE_VBOXBLDPROG_LIBPATH += \
3791 /usr/lib \
3792 /usr/X11R6/lib \
3793 /usr/local/lib
3794 else ifeq ($(KBUILD_HOST),solaris)
3795TEMPLATE_VBOXBLDPROG_TOOL = GXX3PLAIN
3796TEMPLATE_VBOXBLDPROG_LIBS = rt
3797 else
3798$(warning Warning: VBOX Build: Target $(KBUILD_HOST) is not officially supported!)
3799 endif
3800
3801endif # !win
3802
3803
3804#
3805# Windows rc workaround for crosscompiling.
3806# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
3807#
3808ifneq ($(KBUILD_HOST),win)
3809 TOOL_VCC100X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
3810 TOOL_VCC100AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
3811 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
3812 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
3813 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
3814 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
3815else
3816 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
3817 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
3818 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
3819 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
3820 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
3821 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
3822 ) Sorry_Cannot_find_mc_in_the_PSDK)
3823endif
3824
3825
3826#
3827# Template for building Linux host tools (only for KBUILD_TARGET=l4).
3828#
3829TEMPLATE_VBOXLNXHOSTR3EXE = Template for building linux host programs when targeting L4.
3830TEMPLATE_VBOXLNXHOSTR3EXE_INST = $(INST_BIN)
3831TEMPLATE_VBOXLNXHOSTR3EXE_BLD_TRG = linux
3832TEMPLATE_VBOXLNXHOSTR3EXE_TOOL = $(VBOX_GCC_TOOL)
3833TEMPLATE_VBOXLNXHOSTR3EXE_ASTOOL = YASM
3834TEMPLATE_VBOXLNXHOSTR3EXE_DLLSUFF = .so
3835TEMPLATE_VBOXLNXHOSTR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
3836TEMPLATE_VBOXLNXHOSTR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
3837TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_fno-stack-protector)
3838TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.debug = -fno-inline
3839TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
3840TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release)
3841TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release)
3842TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.release = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release)
3843TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.debug)
3844TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.profile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.profile)
3845TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.kprofile)
3846TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS = -g -pipe $(VBOX_GCC_PEDANTIC_C) $(VBOX_GCC_fno-stack-protector)
3847TEMPLATE_VBOXLNXHOSTR3EXE_LIBS = pthread m rt dl
3848
3849TEMPLATE_VBOXLNXHOSTR3LIB = Template for linux host libraries.
3850TEMPLATE_VBOXLNXHOSTR3LIB_EXTENDS = VBOXLNXHOSTR3EXE
3851TEMPLATE_VBOXLNXHOSTR3LIB_INST = $(INST_LIB)
3852
3853
3854#
3855# Template for building R3 programs for the guest additions.
3856# Note: Make sure you don't break VBOXGUESTR3CPPEXE when changing this.
3857#
3858TEMPLATE_VBOXGUESTR3EXE = VBox Guest Program
3859ifeq ($(KBUILD_TARGET),win)
3860 TEMPLATE_VBOXGUESTR3EXE_EXTENDS = VBOXR3EXE
3861 TEMPLATE_VBOXGUESTR3EXE_SDKS = $(TEMPLATE_VBOXR3EXE_SDKS) VBOX_NTDLL
3862 TEMPLATE_VBOXGUESTR3EXE_CFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
3863 TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS = $(filter-out -MD$(VBOX_VCC_CRT_TYPE), $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT$(VBOX_VCC_CRT_TYPE)
3864 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS = $(filter-out /DISALLOWLIB:libcmt$(VBOX_VCC_CRT_TYPE).lib /DISALLOWLIB:libcpmt$(VBOX_VCC_CRT_TYPE).lib, $(TEMPLATE_VBOXR3EXE_LDFLAGS)) \
3865 /DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE).lib \
3866 /DISALLOWLIB:msvcprt$(VBOX_VCC_CRT_TYPE).lib
3867 TEMPLATE_VBOXGUESTR3EXE_LIBS = \
3868 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL)_LIB)/oldnames.lib \
3869 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
3870 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib
3871else # the gcc guys
3872 TEMPLATE_VBOXGUESTR3EXE_EXTENDS = VBOXR3EXE
3873 TEMPLATE_VBOXGUESTR3EXE_TOOL := $(subst GXX,GCC,$(TEMPLATE_VBOXR3EXE_TOOL))
3874 TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fno-exceptions
3875 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)%,$(TEMPLATE_VBOXR3EXE_LDFLAGS))
3876 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux = $(filter-out $(VBOX_GCC_ORIGIN_OPT),$(TEMPLATE_VBOXR3EXE_LDFLAGS.linux))
3877endif
3878TEMPLATE_VBOXGUESTR3EXE_INST = $(INST_ADDITIONS)
3879TEMPLATE_VBOXGUESTR3EXE_DEFS := $(TEMPLATE_VBOXR3EXE_DEFS) IN_GUEST IN_GUEST_R3 IN_RT_R3
3880TEMPLATE_VBOXGUESTR3EXE_DEFS.linux := $(TEMPLATE_VBOXR3EXE_DEFS.linux) LOG_USE_C99 RT_WITHOUT_EXEC_ALLOC
3881ifeq ($(KBUILD_TARGET),linux) # As few libs as possible on linux.
3882 TEMPLATE_VBOXGUESTR3EXE_LIBS = pthread rt m
3883endif
3884if1of ($(KBUILD_TARGET), freebsd netbsd openbsd)
3885 TEMPLATE_VBOXGUESTR3EXE_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS) iconv
3886endif
3887
3888
3889#
3890# Template for building R3 (dynamic) libraries for the guest additions.
3891#
3892TEMPLATE_VBOXGUESTR3DLL = VBox Guest User Dynamic Libraries
3893TEMPLATE_VBOXGUESTR3DLL_EXTENDS = VBOXGUESTR3EXE
3894## @todo add a INSTFUN that separates dlls and libs.
3895ifn1of ($(KBUILD_TARGET), os2 win)
3896 TEMPLATE_VBOXGUESTR3DLL_DEFS = $(TEMPLATE_VBOXGUESTR3EXE_DEFS) PIC
3897 TEMPLATE_VBOXGUESTR3DLL_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fPIC
3898 TEMPLATE_VBOXGUESTR3DLL_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fPIC -fno-exceptions
3899 TEMPLATE_VBOXGUESTR3DLL_LDFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_LDFLAGS) -fPIC
3900endif
3901
3902#
3903# Template for building R3 (static) libraries for the guest additions.
3904#
3905TEMPLATE_VBOXGUESTR3LIB = VBox Guest User Libraries
3906TEMPLATE_VBOXGUESTR3LIB_EXTENDS = VBOXGUESTR3EXE
3907TEMPLATE_VBOXGUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
3908if1of ($(KBUILD_TARGET), solaris) ## @todo r=bird: Fix the *R3Mini template to VBOXGUESTR3DLL and remove this hack.
3909 TEMPLATE_VBOXGUESTR3LIB_DEFS = $(TEMPLATE_VBOXGUESTR3EXE_DEFS) PIC
3910 TEMPLATE_VBOXGUESTR3LIB_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fPIC
3911 TEMPLATE_VBOXGUESTR3LIB_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fPIC -fno-exceptions
3912endif
3913
3914#
3915# Template for building R3 programs for the guest additions (no -pedantic)
3916#
3917TEMPLATE_VBOXGUESTR3NPEXE = VBox Guest Program Non-pedantic
3918TEMPLATE_VBOXGUESTR3NPEXE_EXTENDS = VBOXGUESTR3EXE
3919ifneq ($(KBUILD_TARGET),win) # gcc only
3920TEMPLATE_VBOXGUESTR3NPEXE_CXXFLAGS = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS)) -Wno-sign-compare
3921TEMPLATE_VBOXGUESTR3NPEXE_CFLAGS = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXGUESTR3EXE_CFLAGS)) -Wno-sign-compare
3922endif
3923
3924#
3925# Template for building R3 (dynamic) libraries for the guest additions (no -pedantic)
3926#
3927TEMPLATE_VBOXGUESTR3NPDLL = VBox Guest User Dynamic Libraries Non-pedantic
3928TEMPLATE_VBOXGUESTR3NPDLL_EXTENDS = VBOXGUESTR3NPEXE
3929## @todo add a INSTFUN that separates dlls and libs.
3930ifn1of ($(KBUILD_TARGET), os2 win)
3931 TEMPLATE_VBOXGUESTR3NPDLL_DEFS = $(TEMPLATE_VBOXGUESTR3NPEXE_DEFS) PIC
3932 TEMPLATE_VBOXGUESTR3NPDLL_CFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CFLAGS) -fPIC
3933 TEMPLATE_VBOXGUESTR3NPDLL_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CXXFLAGS) -fPIC -fno-exceptions
3934 TEMPLATE_VBOXGUESTR3NPDLL_LDFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_LDFLAGS) -fPIC
3935endif
3936
3937#
3938# Template for building R3 (static) libraries for the guest additions (no -pedantic)
3939#
3940TEMPLATE_VBOXGUESTR3NPLIB = VBox Guest User Libraries Non-pedantic
3941TEMPLATE_VBOXGUESTR3NPLIB_EXTENDS = VBOXGUESTR3NPEXE
3942TEMPLATE_VBOXGUESTR3NPLIB_INST = $(INST_ADDITIONS_LIB)
3943## @todo r=bird: Fix the *R3Mini template to VBOXGUESTR3DLL and remove this hack.
3944ifeq ($(filter-out solaris.x86 %.amd64 %.sparc32 %.sparc64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) ## TODO: cleanup!
3945 ifn1of ($(KBUILD_TARGET), darwin win)
3946 TEMPLATE_VBOXGUESTR3NPLIB_DEFS = $(TEMPLATE_VBOXGUESTR3NPEXE_DEFS) PIC
3947 TEMPLATE_VBOXGUESTR3NPLIB_CFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CFLAGS) -fPIC
3948 TEMPLATE_VBOXGUESTR3NPLIB_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3NPEXE_CXXFLAGS) -fPIC -fno-exceptions
3949 endif
3950endif
3951
3952
3953#
3954# Template for XFree86 guest modules (relocatable module, i.e. sysmod).
3955# This mostly about zapping the VBOXR3EXE linker flags and libraries.
3956#
3957TEMPLATE_VBOXGUESTR3XF86MOD = VBox XFree86 Guest Module
3958TEMPLATE_VBOXGUESTR3XF86MOD_EXTENDS = VBOXGUESTR3EXE
3959TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
3960TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
3961TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
3962TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
3963TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS = -r
3964if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd) # the gnu ld guys.
3965 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.release = -S
3966 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.x86 = -m elf_i386
3967 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.amd64 = -m elf_x86_64
3968endif
3969TEMPLATE_VBOXGUESTR3XF86MOD_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fno-merge-constants -std=c99 $(VBOX_GCC_fno-stack-protector) -ffreestanding
3970TEMPLATE_VBOXGUESTR3XF86MOD_CXXFLAGS= $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fno-merge-constants $(VBOX_GCC_fno-stack-protector) -ffreestanding
3971TEMPLATE_VBOXGUESTR3XF86MOD_SYSSUFF = .o
3972TEMPLATE_VBOXGUESTR3XF86MOD_LIBS = \
3973 $(VBOX_LIB_VBGL_R3_XFREE86)
3974TEMPLATE_VBOXGUESTR3XF86MOD_DEFS = $(TEMPLATE_VBOXGUESTR3DLL_DEFS) VBOX_GUESTR3XF86MOD RTMEM_NO_WRAP_TO_EF_APIS
3975
3976
3977#
3978# Template for XFree86 guest libraries.
3979#
3980TEMPLATE_VBOXGUESTR3XF86LIB = VBox XFree86 Guest Library
3981TEMPLATE_VBOXGUESTR3XF86LIB_EXTENDS = VBOXGUESTR3XF86MOD
3982TEMPLATE_VBOXGUESTR3XF86LIB_INST = $(INST_ADDITIONS_LIB)
3983
3984
3985#
3986# Template for X.org guest modules (shared libs).
3987# This mostly about zapping unnecessary LIBS from VBOXGUESTR3DLL and adding some flags.
3988#
3989TEMPLATE_VBOXGUESTR3XORGMOD = VBox X.org Guest Module
3990TEMPLATE_VBOXGUESTR3XORGMOD_EXTENDS = VBOXGUESTR3DLL
3991TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
3992TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
3993TEMPLATE_VBOXGUESTR3XORGMOD_CFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_CFLAGS) -std=c99
3994TEMPLATE_VBOXGUESTR3XORGMOD_DEFS = $(TEMPLATE_VBOXGUESTR3DLL_DEFS) LOG_TO_BACKDOOR VBOX_GUESTR3XORGMOD
3995ifeq ($(KBUILD_TARGET_ARCH),amd64)
3996 TEMPLATE_VBOXGUESTR3XORGMOD_DEFS += _XSERVER64
3997endif
3998if1of ($(KBUILD_TARGET), linux)
3999 TEMPLATE_VBOXGUESTR3XORGMOD_LDFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_LDFLAGS)
4000endif
4001TEMPLATE_VBOXGUESTR3XORGMOD_LIBS = \
4002 $(VBOX_LIB_VBGL_R3_SHARED) \
4003 $(VBOX_LIB_IPRT_GUEST_R3_MINI) \
4004 $(VBOX_LIB_VBGL_R3_SHARED) \
4005 $(VBOX_LIB_IPRT_GUEST_R3_MINI)
4006TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.freebsd += \
4007 iconv
4008
4009#
4010# Template for guest stuff that makes use of the C++ library and features.
4011# (This is mostly about undoing what was done to C++ for VBOXGUESTR3EXE.)
4012#
4013TEMPLATE_VBOXGUESTR3CPPEXE = VBox Guest Program with C++ library dependencies
4014TEMPLATE_VBOXGUESTR3CPPEXE_EXTENDS = VBOXGUESTR3EXE
4015ifeq ($(KBUILD_TARGET),win)
4016 # later if necessary
4017else
4018 TEMPLATE_VBOXGUESTR3CPPEXE_TOOL = $(TEMPLATE_VBOXR3EXE_TOOL)
4019 TEMPLATE_VBOXGUESTR3CPPEXE_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
4020endif
4021
4022
4023#
4024# Template for building R0 drivers for the guest additions.
4025#
4026TEMPLATE_VBOXGUESTR0 = VBox Guest Driver
4027TEMPLATE_VBOXGUESTR0_EXTENDS = VBOXR0DRV
4028TEMPLATE_VBOXGUESTR0_INST = $(INST_ADDITIONS)
4029TEMPLATE_VBOXGUESTR0_SDKS.win.x86 = WIN32SDK $(VBOX_WINDDK)
4030TEMPLATE_VBOXGUESTR0_SDKS.win.amd64 = $(VBOX_WINDDK) WINPSDKINCS
4031TEMPLATE_VBOXGUESTR0_LIBS.win.x86 = \
4032 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/int64.lib
4033TEMPLATE_VBOXGUESTR0_DEFS = $(TEMPLATE_VBOXR0DRV_DEFS) IN_GUEST IN_GUEST_R0
4034ifeq ($(KBUILD_TARGET),solaris) # No VBI for the guest additions yet.
4035 TEMPLATE_VBOXGUESTR0_LDFLAGS = -r -dy
4036endif
4037
4038#
4039# Template for building R0 libraries for the guest additions.
4040#
4041TEMPLATE_VBOXGUESTR0LIB = VBox Guest Driver Libraries
4042TEMPLATE_VBOXGUESTR0LIB_EXTENDS = VBOXGUESTR0
4043TEMPLATE_VBOXGUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
4044
4045#
4046# Template for building OpenGL host dlls.
4047#
4048TEMPLATE_VBOXCROGLR3HOSTDLL = VBox OpenGL Host DLLs
4049TEMPLATE_VBOXCROGLR3HOSTDLL_EXTENDS = VBOXR3NP
4050TEMPLATE_VBOXCROGLR3HOSTDLL_EXTENDS_BY = prepending
4051TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS = CHROMIUM_THREADSAFE VBOX_WITH_HGCM UNPACKS
4052TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.win = _WIN32_WINNT=0x0500 WINDOWS=1
4053TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.linux = Linux=1 _GNU_SOURCE
4054TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.solaris = SunOS=1 _GNU_SOURCE #GLEXT_64_TYPES_DEFINED
4055TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE
4056ifdef VBOX_WITH_COCOA_QT
4057 TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.darwin += VBOX_WITH_COCOA_QT
4058 TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.darwin = -framework AppKit
4059else
4060 TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.darwin = -framework Carbon
4061endif
4062TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.freebsd = FreeBSD=1 _GNU_SOURCE
4063TEMPLATE_VBOXCROGLR3HOSTDLL_INCS = $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES)
4064TEMPLATE_VBOXCROGLR3HOSTDLL_SDKS.darwin = DARWIN-OPENGL
4065TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.darwin += \
4066 -framework OpenGL \
4067 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
4068 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
4069TEMPLATE_VBOXCROGLR3HOSTDLL_LDFLAGS.linux = -Wl,--no-as-needed
4070TEMPLATE_VBOXCROGLR3HOSTDLL_BLDDIRS = $(VBOX_PATH_CROGL_GENFILES)/
4071
4072#
4073# Template for building OpenGL host libraries.
4074#
4075TEMPLATE_VBOXCROGLR3HOSTLIB = VBox OpenGL Host Libraries
4076TEMPLATE_VBOXCROGLR3HOSTLIB_EXTENDS = VBOXCROGLR3HOSTDLL
4077TEMPLATE_VBOXCROGLR3HOSTLIB_INST = $(INST_LIB)
4078
4079#
4080# Template for building OpenGL guest dlls.
4081#
4082TEMPLATE_VBOXCROGLR3GUESTDLL = VBox OpenGL Guest DLLs
4083TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS = VBOXGUESTR3NPDLL
4084TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS_BY = prepending
4085TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS = CHROMIUM_THREADSAFE VBOX_WITH_HGCM
4086TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.win = WINDOWS=1
4087TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.linux = Linux=1 _GNU_SOURCE
4088TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.solaris = SunOS=1 _GNU_SOURCE #GLEXT_64_TYPES_DEFINED
4089TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE
4090ifdef VBOX_WITH_COCOA_QT
4091 TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.darwin += VBOX_WITH_COCOA_QT
4092 TEMPLATE_VBOXCROGLR3GUESTDLL_LDFLAGS.darwin = -framework AppKit
4093else
4094 TEMPLATE_VBOXCROGLR3GUESTDLL_LDFLAGS.darwin = -framework Carbon
4095endif
4096TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.freebsd = FreeBSD=1 _GNU_SOURCE
4097TEMPLATE_VBOXCROGLR3GUESTDLL_INCS = $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES)
4098TEMPLATE_VBOXCROGLR3GUESTDLL_SDKS.darwin = DARWIN-OPENGL
4099TEMPLATE_VBOXCROGLR3GUESTDLL_LDFLAGS.darwin += \
4100 -framework OpenGL \
4101 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
4102 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
4103TEMPLATE_VBOXCROGLR3GUESTDLL_BLDDIRS = $(VBOX_PATH_CROGL_GENFILES)/
4104
4105#
4106# Template for building OpenGL guest libraries.
4107#
4108TEMPLATE_VBOXCROGLR3GUESTLIB = VBox OpenGL Guest Libraries
4109TEMPLATE_VBOXCROGLR3GUESTLIB_EXTENDS = VBOXCROGLR3GUESTDLL
4110TEMPLATE_VBOXCROGLR3GUESTLIB_INST = $(INST_ADDITIONS_LIB)
4111
4112
4113#
4114# Template for building Mesa guest library, Linux-only so far.
4115#
4116TEMPLATE_VBOXMESAR3GUESTLIB = VBox Mesa Guest Library
4117TEMPLATE_VBOXMESAR3GUESTLIB_EXTENDS = VBOXCROGLR3GUESTDLL
4118TEMPLATE_VBOXMESAR3GUESTLIB_INST = $(INST_ADDITIONS_LIB)
4119TEMPLATE_VBOXMESAR3GUESTLIB_DEFS.linux = Linux=1
4120TEMPLATE_VBOXMESAR3GUESTLIB_DEFS.solaris = SunOS=1
4121TEMPLATE_VBOXMESAR3GUESTLIB_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY
4122ifeq ($(KBUILD_TARGET),linux)
4123 TEMPLATE_VBOXMESAR3GUESTLIB_ASTOOL = $(TEMPLATE_VBOXCROGLR3GUESTDLL_TOOL)
4124 TEMPLATE_VBOXMESAR3GUESTLIB_ASFLAGS = $(NO_SUCH_VARIABLE)
4125 TEMPLATE_VBOXMESAR3GUESTLIB_ASFLAGS.x86 = -m32
4126 TEMPLATE_VBOXMESAR3GUESTLIB_ASFLAGS.amd64 = -m64
4127 TEMPLATE_VBOXMESAR3GUESTLIB_ASDEFS = $(NO_SUCH_VARIABLE)
4128endif
4129
4130
4131#
4132# Guest additions libraries (all static).
4133# The _MINI and _SHARED are both compiled as PIC and intended for linking into a .so/.dll/.dylib.
4134#
4135VBOX_LIB_IPRT_GUEST_R3 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3$(VBOX_SUFF_LIB)
4136VBOX_LIB_IPRT_GUEST_R3_MINI = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3Mini$(VBOX_SUFF_LIB)
4137VBOX_LIB_IPRT_GUEST_R3_SHARED = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3Shared$(VBOX_SUFF_LIB)
4138VBOX_LIB_IPRT_GUEST_R0 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR0$(VBOX_SUFF_LIB)
4139ifeq ($(KBUILD_TARGET_ARCH),x86)
4140 VBOX_LIB_IPRT_GUEST_R0_NT4 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR0NT4$(VBOX_SUFF_LIB)
4141else
4142 VBOX_LIB_IPRT_GUEST_R0_NT4 = $(VBOX_LIB_IPRT_GUEST_R0)
4143endif
4144VBOX_LIB_VBGL_R3 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3Lib$(VBOX_SUFF_LIB)
4145VBOX_LIB_VBGL_R3_XFREE86 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibXFree86$(VBOX_SUFF_LIB)
4146VBOX_LIB_VBGL_R3_SHARED = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibShared$(VBOX_SUFF_LIB)
4147VBOX_LIB_VBGL_R0BASE = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0LibBase$(VBOX_SUFF_LIB)
4148VBOX_LIB_VBGL_R0 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0Lib$(VBOX_SUFF_LIB)
4149
4150
4151
4152#
4153# Two targets to coordinate version number changes properly. Note that the
4154# only way to get a really consistent build is to run 'kmk' in the top-level
4155# directory. If you don't run it there, you get a consistent sub-tree only.
4156#
4157VBOX_BAD_CHAR_SET = ,;:/\$(SP)$(TAB)$(HASH)=![]@%&''()*""<>?^{}|~
4158VBOX_VERSION_STAMP = $(PATH_OUT)/version-stamp-$(translate $(VBOX_VERSION_STRING)-$(VBOX_C_YEAR)-$(VBOX_VENDOR)-$(VBOX_PRODUCT),$(VBOX_BAD_CHAR_SET),,_)
4159VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
4160VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
4161
4162$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
4163 $(call MSG_GENERATE,,$@)
4164 $(QUIET)$(MKDIR) -p $(@D)
4165 $(QUIET)$(RM) -f $(wildcard $(PATH_OUT)/version-stamp-*)
4166 $(QUIET)$(APPEND) $@ $(VBOX_VERSION_STRING)
4167
4168$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
4169 $(call MSG_GENERATE,,$@)
4170 $(QUIET)$(MKDIR) -p $(@D)
4171 $(QUIET)$(RM) -f $@ [email protected]
4172 $(QUIET)$(APPEND) [email protected] '#ifndef ___version_generated_h___'
4173 $(QUIET)$(APPEND) [email protected] '#define ___version_generated_h___'
4174 $(QUIET)$(APPEND) [email protected] ''
4175 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)'
4176 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)'
4177 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)'
4178 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_STRING "$(VBOX_VERSION_STRING)"'
4179 $(QUIET)$(APPEND) [email protected] ''
4180 $(QUIET)$(APPEND) [email protected] '#endif'
4181 $(QUIET)$(MV) -f [email protected] $@
4182
4183
4184VBOX_PACKAGE_HEADER = $(PATH_OUT)/package-generated.h
4185
4186$(VBOX_PACKAGE_HEADER):
4187 $(call MSG_GENERATE,,$@)
4188 $(QUIET)$(MKDIR) -p $(@D)
4189 $(QUIET)$(RM) -f $@ [email protected]
4190 $(QUIET)$(APPEND) [email protected] '#ifndef ___package_generated_h___'
4191 $(QUIET)$(APPEND) [email protected] '#define ___package_generated_h___'
4192 $(QUIET)$(APPEND) [email protected] ''
4193 $(QUIET)$(APPEND) [email protected] '#define VBOX_PACKAGE_STRING "$(VBOX_PACKAGE_STRING)"'
4194 $(QUIET)$(APPEND) [email protected] ''
4195 $(QUIET)$(APPEND) [email protected] '#endif'
4196 $(QUIET)$(MV) -f [email protected] $@
4197
4198VBOX_PRODUCT_HEADER = $(PATH_OUT)/product-generated.h
4199
4200$(VBOX_PRODUCT_HEADER): $(VBOX_VERSION_STAMP)
4201 $(call MSG_GENERATE,,$@)
4202 $(QUIET)$(MKDIR) -p $(@D)
4203 $(QUIET)$(RM) -f $@ [email protected]
4204 $(QUIET)$(APPEND) [email protected] '#ifndef ___product_generated_h___'
4205 $(QUIET)$(APPEND) [email protected] '#define ___product_generated_h___'
4206 $(QUIET)$(APPEND) [email protected] ''
4207 $(QUIET)$(APPEND) [email protected] '#define VBOX_VENDOR "$(VBOX_VENDOR)"'
4208 $(QUIET)$(APPEND) [email protected] '#define VBOX_VENDOR_SHORT "$(VBOX_VENDOR_SHORT)"'
4209 $(QUIET)$(APPEND) [email protected] '#define VBOX_PRODUCT "$(VBOX_PRODUCT)"'
4210 $(QUIET)$(APPEND) [email protected] '#define VBOX_C_YEAR "$(VBOX_C_YEAR)"'
4211 $(QUIET)$(APPEND) [email protected] ''
4212 $(QUIET)$(APPEND) [email protected] '#endif'
4213 $(QUIET)$(MV) -f [email protected] $@
4214
4215#
4216# Used for external makefiles which cannot include Config.kmk
4217#
4218$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
4219 $(call MSG_GENERATE,,$@)
4220 $(QUIET)$(RM) -f $@ [email protected]
4221 $(QUIET)$(MKDIR) -p $(@D)
4222 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)'
4223 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)'
4224 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)'
4225 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_STRING = $(VBOX_VERSION_STRING)'
4226 $(QUIET)$(APPEND) [email protected] 'VBOX_VENDOR = $(VBOX_VENDOR)'
4227 $(QUIET)$(APPEND) [email protected] 'VBOX_VENDOR_SHORT = $(VBOX_VENDOR_SHORT)'
4228 $(QUIET)$(APPEND) [email protected] 'VBOX_PRODUCT = $(VBOX_PRODUCT)'
4229 $(QUIET)$(APPEND) [email protected] 'VBOX_C_YEAR = $(VBOX_C_YEAR)'
4230 $(QUIET)$(MV) -f [email protected] $@
4231
4232if !defined(VBOX_OSE) && !defined(VBOX_NOINC_LICENSE_VER_KMK)
4233 if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris)
4234 # VBOX_LICENSE_VER is used in several Makefiles
4235 VBOX_LICENSE_VER_KMK = $(PATH_OUT)/license-version.kmk
4236$(VBOX_LICENSE_VER_KMK): $(VBOX_BRAND_LICENSE_HTML)
4237 $(call MSG_GENERATE,,$(VBOX_LICENSE_VER_KMK))
4238 $(QUIET)$(MKDIR) -p $(@D)
4239 ifdef VBOX_BRAND_LICENSE_VER
4240 $(QUIET)$(RM) -f '$@'
4241 $(APPEND) '$@' 'VBOX_LICENSE_VER=$(VBOX_BRAND_LICENSE_VER)'
4242 else
4243 $(QUIET)$(SED) -e "s/.*License version \([0-9.]*\) *[,&].*/VBOX_LICENSE_VER=\1/;t;d" --output $@ $(VBOX_BRAND_LICENSE_HTML)
4244 endif
4245 -include $(VBOX_LICENSE_VER_KMK)
4246 VBOX_LICENSE_FILES = \
4247 License-$(VBOX_LICENSE_VER).html \
4248 $(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES),License-$(VBOX_LICENSE_VER)-$(f).html)
4249 VBOX_LICENSE_BINS = $(addprefix $(PATH_BIN)/,$(VBOX_LICENSE_FILES))
4250 endif
4251endif
4252
4253
4254ifndef VBOX_NOINC_MISC
4255# Force building of the version header file as the first thing anywhere in
4256# the tree. This eliminates the need for manual dependencies on it.
4257## @todo there gotta be a better way of doing this.
4258Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK) $(VBOX_PRODUCT_HEADER) $(VBOX_PACKAGE_HEADER)
4259endif
4260
4261
4262#
4263# Subversion tree revision.
4264#
4265# The VBOX_SVN_REV contains our best guess. Use svn info on the
4266# root of the treeto determin this it if .svn/entries is found,
4267# otherwise fall back on the Config.kmk revision.
4268#
4269SVN ?= svn$(HOSTSUFF_EXE)
4270VBOX_SVN_REV_KMK = $(PATH_OUT)/revision.kmk
4271ifndef VBOX_SVN_REV
4272 VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 31902 $ )
4273 VBOX_SVN_DEP := $(wildcard $(PATH_ROOT)/.svn/entries)
4274 ifeq ($(which $(SVN)),)
4275 VBOX_SVN_DEP :=
4276 endif
4277
4278# Rule for generating a timestamp and updating the real thing on change.
4279$(VBOX_SVN_REV_KMK).ts +| $(VBOX_SVN_REV_KMK): $(if $(VBOX_SVN_DEP), $(VBOX_SVN_DEP), $(PATH_ROOT)/Config.kmk)
4280 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
4281 $(QUIET)$(RM) -f $@ [email protected]
4282 $(QUIET)$(MKDIR) -p $(@D)
4283 ifneq ($(VBOX_SVN_DEP),)
4284 $(REDIRECT) -E 'LC_ALL=C' -wo [email protected] -- $(SVN) info $(PATH_ROOT)
4285 ifeq ($(int-mod $(VBOX_VERSION_BUILD), 2),0)
4286 $(SED) -e '/^Last Changed Rev/!d' -e 's/Last Changed Rev\: */export VBOX_SVN_REV=/' --output $@ [email protected]
4287 else
4288 $(SED) -e '/^Revision/!d' -e 's/Revision\: */export VBOX_SVN_REV=/' --output $@ [email protected]
4289 endif
4290 $(QUIET)$(RM) -f [email protected]
4291 else
4292 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV_FALLBACK)'
4293 endif
4294 $(QUIET)$(CP) --changed -fv $@ $(VBOX_SVN_REV_KMK)
4295
4296 ifndef VBOX_NOINC_SVN_REV_KMK
4297 include $(VBOX_SVN_REV_KMK)
4298 endif
4299else
4300# allow to overwrite VBOX_SVN_REV externally (mainly for building .debs/.rpms)
4301$(VBOX_SVN_REV_KMK):
4302 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
4303 $(QUIET)$(RM) -f $@
4304 $(QUIET)$(MKDIR) -p $(@D)
4305 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV)'
4306 $(QUIET)echo '* $(VBOX_SVN_REV_KMK) was externally overwritten:'
4307 $(QUIET)$(CAT) $(VBOX_SVN_REV_KMK)
4308endif
4309
4310# only needed for VBoxGuest for Linux/FreeBSD guests
4311VBOX_SVN_REV_HEADER = $(PATH_OUT)/revision-generated.h
4312$(VBOX_SVN_REV_HEADER): $(VBOX_SVN_REV_KMK)
4313 $(call MSG_GENERATE,,$@)
4314 $(QUIET)$(RM) -f $@ [email protected]
4315 $(QUIET)$(MKDIR) -p $(@D)
4316 $(QUIET)$(APPEND) [email protected] '#define VBOX_SVN_REV $(VBOX_SVN_REV)'
4317 $(QUIET)$(MV) -f [email protected] $@
4318
4319#
4320# Shared definitions of the XIDL file to use as a source for
4321# generating various other files (VBoxSVC, webservice, docs, front-ends, ...)
4322#
4323
4324# Real XIDL source file; from this we strip the <desc> elements to generate
4325# a second XIDL file, from which the COM/XPCOM IDL files are then generated:
4326VBOX_XIDL_FILE_SRC = $(PATH_ROOT)/src/VBox/Main/idl/VirtualBox.xidl
4327# second XIDL file to use as source for COM/XPCOM IDL (with stripped docs):
4328VBOX_XIDL_FILE = $(PATH_OUT)/obj/VirtualBox_stripped.xidl
4329
4330# Java stuff.
4331ifeq ($(KBUILD_TARGET), darwin)
4332 VBOX_JAVA_HOME = /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0
4333 VBOX_JAVAC = $(VBOX_JAVA_HOME)/Commands/javac
4334 VBOX_JAVAH = $(VBOX_JAVA_HOME)/Commands/javah
4335 VBOX_JAR = $(VBOX_JAVA_HOME)/Commands/jar
4336 VBOX_WSIMPORT = $(VBOX_JAVA_HOME)/Commands/wsimport
4337 VBOX_JAVA_INC = $(VBOX_JAVA_HOME)/Headers
4338
4339else
4340
4341 ifeq ($(KBUILD_TARGET),linux)
4342 ifeq ($(origin VBOX_JAVA_HOME),undefined)
4343 # Add correct detection for you distro after the /usr/../java-6-sun line.
4344 VBOX_JAVA_HOME := $(firstword $(wildcard \
4345 $(PATH_DEVTOOLS)/linux.x86/jdk1.6.0_21 \
4346 /usr/lib/jvm/java-6-sun \
4347 /usr/lib/jvm/java-6-openjdk \
4348 \
4349 /usr/lib/jvm/sun-jdk-1.6 \
4350 ) /usr/lib/jvm/java-6-sun)
4351 endif
4352 endif
4353
4354 ifeq ($(KBUILD_TARGET),solaris)
4355 # VBOX_JAVA_HOME ?= /usr/jdk/jdk1.6.0
4356 VBOX_JAVA_HOME ?= /usr/java
4357 endif
4358
4359 ifeq ($(KBUILD_TARGET),win)
4360 VBOX_JAVA_HOME ?= c:/jdk
4361 endif
4362
4363 VBOX_JAVAC = $(VBOX_JAVA_HOME)/bin/javac
4364 VBOX_JAVAH = $(VBOX_JAVA_HOME)/bin/javah
4365 VBOX_JAR = $(VBOX_JAVA_HOME)/bin/jar
4366 VBOX_WSIMPORT = $(VBOX_JAVA_HOME)/bin/wsimport
4367 # correct for targets we care about
4368 VBOX_MD_OS = $(KBUILD_TARGET)
4369 VBOX_JAVA_INC = \
4370 $(VBOX_JAVA_HOME)/include \
4371 $(VBOX_JAVA_HOME)/include/$(VBOX_MD_OS)
4372endif
4373
4374ifeq ($(KBUILD_TARGET), win)
4375 VBOX_SEP=\;
4376else
4377 VBOX_SEP=:
4378endif
4379VBOX_JAVAC_OPTS = -source 1.5 -target 1.5 -Xlint:unchecked
4380
4381#
4382# Legacy.
4383#
4384## @todo try remove this.
4385ifneq ($(LOCALCFG),)
4386 include $(LOCALCFG)
4387endif
4388
4389
4390#
4391# Some extra goals.
4392#
4393.PHONY: up update st stat status
4394up update::
4395 $(SVN) up
4396
4397up2 update2::
4398 $(SVN) up --ignore-externals
4399
4400st stat status:
4401 $(SVN) status
4402
4403quick:
4404 $(MAKE) VBOX_QUICK=1
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