VirtualBox

source: vbox/trunk/Config.kmk@ 14199

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

crOpenGL amd64 fix

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