VirtualBox

source: vbox/trunk/Config.kmk@ 23387

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

Config.kmk: Disabled Solaris new USB bits since testbox's nevada too old.

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