VirtualBox

source: vbox/trunk/Config.kmk@ 23194

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

OSX: fix burn

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