VirtualBox

source: vbox/trunk/Config.kmk@ 19449

Last change on this file since 19449 was 19408, checked in by vboxsync, 16 years ago

Config.kmk: enable curl on win.amd64.

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