VirtualBox

source: vbox/trunk/Config.kmk@ 25965

Last change on this file since 25965 was 25952, checked in by vboxsync, 15 years ago

forgotten SMC device

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