VirtualBox

source: vbox/trunk/Config.kmk@ 13306

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

IPRT,++: some assert.h cleanup, making a suitable place to call panic() in ring-0.

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