VirtualBox

source: vbox/trunk/Config.kmk@ 14385

Last change on this file since 14385 was 14328, checked in by vboxsync, 16 years ago

Config.kmk: VBOXR0 set SYSSUFF to .r0 by default.

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