VirtualBox

source: vbox/trunk/Config.kmk@ 26091

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

Config.kmk: drop the annoying version-generated.h stuff

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