VirtualBox

source: vbox/trunk/Config.kmk@ 14658

Last change on this file since 14658 was 14643, checked in by vboxsync, 16 years ago

enable new REM for all platforms

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