VirtualBox

source: vbox/trunk/Config.kmk@ 12261

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

Config.kmk: Use the qt3 unit. (more to be clean up later if we bother with it)

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