VirtualBox

source: vbox/trunk/Config.kmk@ 12377

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

Config.kmk: Added VBOXR3OSX105.

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