VirtualBox

source: vbox/trunk/Config.kmk@ 12563

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

Branding: Added .MSI extension (AQ = Avanquest) for runtime serial number detection.

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