VirtualBox

source: vbox/trunk/Config.kmk@ 32087

Last change on this file since 32087 was 32012, checked in by vboxsync, 14 years ago

Installer: unify Qt4 module handling

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette