VirtualBox

source: vbox/trunk/Config.kmk@ 34655

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

Use GPLv2 license instead of PUEL.

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