VirtualBox

source: vbox/trunk/Config.kmk@ 11749

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

Forgot one template. moved the LIBS.l4 prop into VBOXR3AUTOTST.

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