VirtualBox

source: vbox/trunk/Config.kmk@ 17973

Last change on this file since 17973 was 17912, checked in by vboxsync, 16 years ago

configure: check for OpenGL stuff

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