VirtualBox

source: vbox/trunk/Config.kmk@ 29788

Last change on this file since 29788 was 29788, checked in by vboxsync, 15 years ago

Java bridge: MSCOM basics

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