VirtualBox

source: vbox/trunk/Config.kmk@ 12227

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

Makefiles: Pushing openssl-0.9.8h up to root level in the sub-makefile sense.

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