VirtualBox

source: vbox/trunk/Config.kmk@ 35273

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

after Beta 4

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