VirtualBox

source: vbox/trunk/Config.kmk@ 22707

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

enable VBOX_WITH_VIDEOHWACCEL for OSE

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