VirtualBox

source: vbox/trunk/Config.kmk@ 25913

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

Config.kmk: another nice warning: -Wlogical-op

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