VirtualBox

source: vbox/trunk/Config.kmk@ 22777

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

Config.kmk,Makefiles,liblzf-1.51: Removed src/lib/liblzf-1.51 and VBOX_WITH_NEW_LIBLZF.

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