VirtualBox

source: vbox/trunk/Config.kmk@ 13791

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

documented the two other warnings we ignore.

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