VirtualBox

source: vbox/trunk/Config.kmk@ 25611

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

fix for compiling against Linux 2.6.33+

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