VirtualBox

source: vbox/trunk/Config.kmk@ 41493

Last change on this file since 41493 was 41383, checked in by vboxsync, 13 years ago

Config.kmk: enable the emulated smart card reader

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