VirtualBox

source: vbox/trunk/Config.kmk@ 12511

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

Windows Guest Additions Installer: Use branding bitmap.

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