VirtualBox

source: vbox/trunk/Config.kmk@ 11809

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

Linux 2.6.26 / AMD64 vboxdrv compile fix (VBox build time)

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