VirtualBox

source: vbox/trunk/Config.kmk@ 35100

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

Config.kmk: typo

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