VirtualBox

source: vbox/trunk/Config.kmk@ 11935

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

VBoxNetFlt for Darwin and Solaris to OSE

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