VirtualBox

source: vbox/trunk/Config.kmk@ 34515

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

build fix

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