VirtualBox

source: vbox/trunk/Config.kmk@ 30989

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

typo

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