VirtualBox

source: vbox/trunk/Config.kmk@ 16247

Last change on this file since 16247 was 16240, checked in by vboxsync, 16 years ago

build crOpenGL with OSE as well

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