VirtualBox

source: vbox/trunk/Config.kmk@ 29235

Last change on this file since 29235 was 29235, checked in by vboxsync, 15 years ago

3.2.0 Beta 1 respin

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