VirtualBox

source: vbox/trunk/Config.kmk@ 11728

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

#3103: disabled on windows since it's not finished yet.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 125.5 KB
Line 
1# $Id: Config.kmk 11726 2008-08-27 22:22:34Z 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# Ring-3 testcase.
2279# This is the VBOXR3EXE template only with a different install dir.
2280#
2281TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
2282TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
2283TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
2284TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
2285ifdef VBOX_WITH_RUNPATH
2286 TEMPLATE_VBOXR3TSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' $(TEMPLATE_VBOXR3EXE_LDFLAGS)
2287else ifdef VBOX_WITH_ORIGIN
2288 TEMPLATE_VBOXR3TSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)/..' $(TEMPLATE_VBOXR3EXE_LDFLAGS)
2289endif
2290ifeq ($(KBUILD_TARGET),win)
2291 ifdef VBOX_SIGNING_MODE
2292 TEMPLATE_VBOXR3TSTEXE_POST_CMDS =
2293 endif
2294endif
2295
2296#
2297# Template for the CppUnit kind of testcases.
2298#
2299TEMPLATE_VBOXCPPUNITEXE = VBox CppUnit Testcase Exe
2300TEMPLATE_VBOXCPPUNITEXE_EXTENDS = VBOXR3TSTEXE
2301## @todo make a CPPUNIT SDK and add cppunit tools packages for windows, mac, solaris and OS/2.
2302#TEMPLATE_VBOXCPPUNITEXE_SDKS = CPPUNIT -
2303TEMPLATE_VBOXCPPUNITEXE_LIBS = \
2304 $(TEMPLATE_VBOXR3TSTEXE_LIBS) \
2305 cppunit
2306
2307#
2308# Template for building bad C/C++ style R3 executables (no -pedantic).
2309#
2310TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
2311TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
2312ifneq ($(KBUILD_TARGET),win) # (only gcc)
2313 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
2314 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
2315 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3EXE_CFLAGS))
2316endif
2317
2318
2319#
2320# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
2321# This is mostly identical to the VBOXR3NPEXE template.
2322#
2323TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
2324TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3NPEXE
2325TEMPLATE_VBOXR3NP_LDFLAGS.l4 = \
2326 $(L4_LIBDIR)/../crt0.s.o \
2327 -T$(L4_LIBDIR)/../main_rel.ld \
2328 -nostdlib
2329TEMPLATE_VBOXR3NP_DEFS.l4 = $(TEMPLATE_VBOXR3NPEXE_DEFS.l4) __PIC__
2330ifeq ($(filter-out solaris.x86 %.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),)
2331 ifneq ($(KBUILD_TARGET),win)
2332 TEMPLATE_VBOXR3NP_DEFS = $(TEMPLATE_VBOXR3NPEXE_DEFS) PIC
2333 TEMPLATE_VBOXR3NP_CFLAGS = $(TEMPLATE_VBOXR3NPEXE_CFLAGS) -fPIC
2334 TEMPLATE_VBOXR3NP_CXXFLAGS = $(TEMPLATE_VBOXR3NPEXE_CXXFLAGS) -fPIC
2335 TEMPLATE_VBOXR3NP_LDFLAGS = $(TEMPLATE_VBOXR3NPEXE_LDFLAGS) -fPIC
2336 endif
2337endif
2338
2339
2340#
2341# Template for building libraries, shared libraries / modules
2342# which only depends on IPRT for crt.
2343#
2344TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
2345TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
2346TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
2347TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno -Wall
2348TEMPLATE_VBOXNOCRTGCC_CFLAGS.x86 = -m32
2349TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -m64 -mcmodel=medium -fno-common
2350TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
2351TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
2352TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
2353ifdef VBOX_TARGET_MAC_OS_X_VERSION_10_5 ## @todo this probably works for 10.4 too, check.
2354 TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -static
2355else
2356 TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -mdynamic-no-pic
2357endif
2358TEMPLATE_VBOXNOCRTGCC_CXXFLAGS = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS)
2359TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(KBUILD_TARGET) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(KBUILD_TARGET))
2360TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(KBUILD_TARGET_ARCH) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(KBUILD_TARGET_ARCH))
2361TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
2362
2363ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
2364 # cross compile to 64-bit ELF (linux).
2365 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
2366 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
2367 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
2368 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
2369 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
2370
2371else ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
2372 # Use the default GCC (MinGW) with the Microsoft linker.
2373 # (Drop all '-g' options as we're unable to strip the debug info.)
2374 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
2375 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
2376 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
2377 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
2378 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
2379 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
2380 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
2381
2382else
2383 # Use the default GCC.
2384 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
2385 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
2386 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
2387 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
2388 TEMPLATE_VBOXNOCRTGCC_CFLAGS += $(VBOX_GCC_fno-stack-protector)
2389 TEMPLATE_VBOXNOCRTGCC_CXXFLAGS += $(VBOX_GCC_fno-stack-protector)
2390 ifeq ($(KBUILD_TARGET_ARCH),amd64)
2391 # in 64-bit mode we'll build a sys-module (VBoxREM2).
2392 if1of ($(KBUILD_TARGET),darwin solaris)
2393 TEMPLATE_VBOXNOCRTGCC_LDFLAGS.solaris= -64 -r
2394 else
2395 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
2396 endif
2397 else # x86:
2398 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
2399 ifn1of ($(KBUILD_TARGET), os2 darwin solaris)
2400 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
2401 endif
2402 endif # x86
2403 TEMPLATE_VBOXNOCRTGCC_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
2404 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
2405endif
2406
2407
2408#
2409# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
2410#
2411TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
2412TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
2413TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
2414ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
2415 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
2416else
2417 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
2418endif
2419TEMPLATE_VBOXNOCRTGAS_ASFLAGS.x86 = -m32
2420TEMPLATE_VBOXNOCRTGAS_ASFLAGS.amd64 = -m64
2421
2422
2423#
2424# Template for building executables that are part of the VBox Main component
2425# (COM/XPCOM interface to VirtualBox).
2426#
2427TEMPLATE_VBOXMAINEXE = VBox Main Executable
2428TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
2429TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
2430TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE NDEBUG=1
2431TEMPLATE_VBOXMAINEXE_DEFS.win = _UNICODE
2432TEMPLATE_VBOXMAINEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
2433TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
2434
2435ifeq ($(KBUILD_TARGET),win)
2436 TEMPLATE_VBOXMAINEXE_SDKS = WINPSDK W2K3DDK
2437 ifdef VBOX_USE_VCC80
2438 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
2439 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GF- -MD -EHsc -W3 -wd4065 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
2440 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
2441 else
2442 TEMPLATE_VBOXMAINEXE_TOOL = VCC70
2443 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GX- -GF- -MD -EHsc -W3 -wd4065 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
2444 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -GZ
2445 endif
2446 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
2447 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
2448 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
2449 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
2450 TEMPLATE_VBOXMAINEXE_INCS += \
2451 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
2452 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
2453 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
2454 /DISALLOWLIB:libc.lib \
2455 /DISALLOWLIB:libcd.lib \
2456 /DISALLOWLIB:msvcrt.lib \
2457 /DISALLOWLIB:msvcrtd.lib \
2458 /DISALLOWLIB:libcmtd.lib \
2459 /DISALLOWLIB:libcmt.lib
2460 TEMPLATE_VBOXMAINEXE_LIBS = \
2461 $(LIB_RUNTIME) \
2462 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
2463 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
2464 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
2465 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
2466 TEMPLATE_VBOXMAINEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2467
2468else # the GCC guys:
2469
2470TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
2471TEMPLATE_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)
2472TEMPLATE_VBOXMAINEXE_CXXFLAGS.x86 = -m32
2473TEMPLATE_VBOXMAINEXE_CXXFLAGS.amd64 = -m64
2474TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
2475TEMPLATE_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)
2476TEMPLATE_VBOXMAINEXE_CFLAGS.x86 = -m32
2477TEMPLATE_VBOXMAINEXE_CFLAGS.amd64 = -m64
2478TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
2479TEMPLATE_VBOXMAINEXE_LDFLAGS.x86 = -m32
2480TEMPLATE_VBOXMAINEXE_LDFLAGS.amd64 = -m64
2481 ifeq ($(KBUILD_TARGET),linux)
2482TEMPLATE_VBOXMAINEXE_LIBS = pthread m rt $(LIB_RUNTIME)
2483TEMPLATE_VBOXMAINEXE_LDFLAGS.linux = $(VBOX_LD_as_needed)
2484 else ifeq ($(KBUILD_TARGET),l4)
2485TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
2486# no libs as yet in l4 target - must be added later
2487 else ifeq ($(KBUILD_TARGET),os2)
2488TEMPLATE_VBOXMAINEXE_TOOL = GXX3OMF
2489TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
2490 else ifeq ($(KBUILD_TARGET),darwin)
2491TEMPLATE_VBOXMAINEXE_TOOL = GXX4MACHO
2492TEMPLATE_VBOXMAINEXE_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
2493TEMPLATE_VBOXMAINEXE_CFLAGS += $(VBOX_DARWIN_DEF_SDK_CFLAGS)
2494TEMPLATE_VBOXMAINEXE_CXXFLAGS += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
2495TEMPLATE_VBOXMAINEXE_OBJCFLAGS += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
2496TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin += -bind_at_load
2497TEMPLATE_VBOXMAINEXE_LDFLAGS += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -framework Carbon
2498TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
2499 else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd)
2500TEMPLATE_VBOXMAINEXE_TOOL = GXX3
2501TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
2502 else ifeq ($(KBUILD_TARGET),solaris)
2503TEMPLATE_VBOXMAINEXE_TOOL = GXX3PLAIN
2504TEMPLATE_VBOXMAINEXE_DEFS += _REENTRANT
2505TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt
2506 else
2507$(warning Warning: VBOX Build: Target $(KBUILD_TARGET) is not officially supported!)
2508TEMPLATE_VBOXMAINEXE_LIBS =
2509 endif
2510 ifdef VBOX_WITH_RUNPATH
2511TEMPLATE_VBOXMAINEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
2512 else ifdef VBOX_WITH_ORIGIN
2513TEMPLATE_VBOXMAINEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)'
2514TEMPLATE_VBOXMAINEXE_LDFLAGS.linux += -Wl,-z,origin
2515 endif
2516
2517endif # !win
2518
2519# Add COM/XPCOM stuff
2520TEMPLATE_VBOXMAINEXE_LIBS += \
2521 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
2522ifdef VBOX_WITH_XPCOM
2523 ## @todo may be worth creating the VBOX_XPCOM SDK def
2524 TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
2525 ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
2526 TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
2527 endif
2528 TEMPLATE_VBOXMAINEXE_INCS += \
2529 $(VBOX_XPCOM_INCS)
2530 TEMPLATE_VBOXMAINEXE_LIBS += \
2531 $(LIB_XPCOM)
2532 TEMPLATE_VBOXMAINEXE_INTERMEDIATES += \
2533 $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h
2534
2535else # COM
2536 TEMPLATE_VBOXMAINEXE_INCS += \
2537 $(VBOX_PATH_SDK)/bindings/mscom/include
2538 TEMPLATE_VBOXMAINEXE_INTERMEDIATES += \
2539 $(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h
2540endif # COM
2541
2542#
2543# Template for building the Main DLL modules (such as in-process COM/XPCOM
2544# components for Main).
2545#
2546# This differs from VBOXMAINEXE only in PIC handling and similar DLL stuff.
2547#
2548TEMPLATE_VBOXMAINDLL = VBox Main Component (shared library)
2549TEMPLATE_VBOXMAINDLL_EXTENDS = VBOXMAINEXE
2550ifeq ($(filter-out solaris.x86 %.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),)
2551 ifn1of ($(KBUILD_TARGET), darwin win)
2552 TEMPLATE_VBOXMAINDLL_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
2553 TEMPLATE_VBOXMAINDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
2554 TEMPLATE_VBOXMAINDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
2555 TEMPLATE_VBOXMAINDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
2556 endif
2557endif
2558TEMPLATE_VBOXMAINDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin)) \
2559 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
2560
2561#
2562# Template identical to VBOXMAINDLL except for where the stuff is
2563# installed when using XPCOM (components/).
2564#
2565# Note! In the hardened build this gets a bit ugly since $ORIGIN/..
2566# doesn't work. So, we use $ORIGIN there and let the installers
2567# handle the symlinking.
2568#
2569# (No difference when building against COM on Windows.)
2570#
2571TEMPLATE_VBOXMAINCOMP = VBox Main COM/XPCOM Component (shared library)
2572TEMPLATE_VBOXMAINCOMP_EXTENDS = VBOXMAINEXE
2573ifn1of ($(KBUILD_TARGET), win) ## WARNING! Linux used to be excluded too, so this may cause trouble.
2574 TEMPLATE_VBOXMAINCOMP_INST = $(INST_BIN)components/
2575endif
2576ifeq ($(filter-out solaris.x86 %.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),)
2577 ifneq ($(KBUILD_TARGET),win)
2578 TEMPLATE_VBOXMAINCOMP_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
2579 TEMPLATE_VBOXMAINCOMP_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
2580 TEMPLATE_VBOXMAINCOMP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
2581 ifdef VBOX_WITH_ORIGIN
2582 ifndef VBOX_WITH_HARDENING
2583 TEMPLATE_VBOXMAINCOMP_LDFLAGS = -fPIC $(filter-out '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)',$(TEMPLATE_VBOXMAINEXE_LDFLAGS)) '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)/..'
2584 endif
2585 endif
2586 ifndef TEMPLATE_VBOXMAINCOMP_LDFLAGS
2587 TEMPLATE_VBOXMAINCOMP_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
2588 endif
2589 endif
2590endif
2591ifdef VBOX_WITH_ORIGIN
2592 ifndef TEMPLATE_VBOXMAINCOMP_LDFLAGS
2593 ifndef VBOX_WITH_HARDENING
2594 TEMPLATE_VBOXMAINCOMP_LDFLAGS = $(filter-out '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)',$(TEMPLATE_VBOXMAINEXE_LDFLAGS)) '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)/..'
2595 endif
2596 endif
2597endif
2598TEMPLATE_VBOXMAINCOMP_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin)) \
2599 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
2600
2601#
2602# Template for building the Main static libraries.
2603#
2604# This differs from VBOXMAINDLL only that it zeroes out the _LIBS definition.
2605#
2606TEMPLATE_VBOXMAINLIB = VBox Main Component (static library)
2607TEMPLATE_VBOXMAINLIB_EXTENDS = VBOXMAINDLL
2608TEMPLATE_VBOXMAINLIB_LIBS =
2609
2610#
2611# Template for building executables that use the VBox Main component.
2612#
2613TEMPLATE_VBOXMAINCLIENTEXE = VBox Main Client (executable)
2614TEMPLATE_VBOXMAINCLIENTEXE_EXTENDS = VBOXMAINEXE
2615ifeq ($(KBUILD_TARGET),win)
2616 TEMPLATE_VBOXMAINCLIENTEXE_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
2617 $(PATH_SDK_WINPSDK_LIB)/User32.Lib \
2618 $(PATH_SDK_WINPSDK_LIB)/Shell32.Lib \
2619 $(PATH_SDK_WINPSDK_LIB)/ShLwApi.Lib \
2620 $(PATH_SDK_WINPSDK_LIB)/Ole32.Lib \
2621 $(PATH_SDK_WINPSDK_LIB)/OleAut32.Lib \
2622 $(PATH_SDK_WINPSDK_LIB)/Uuid.Lib
2623else
2624 TEMPLATE_VBOXMAINCLIENTEXE_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
2625 NDEBUG TRIMMED
2626 TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
2627 -pthread
2628endif
2629
2630#
2631# Template for building shared libraries / DLLs that use the VBox Main component.
2632#
2633# This differs from VBOXMAINCLIENTEXE only in PIC handling and similar DLL stuff.
2634#
2635TEMPLATE_VBOXMAINCLIENTDLL = VBox MAIN Client (shared library)
2636TEMPLATE_VBOXMAINCLIENTDLL_EXTENDS = VBOXMAINCLIENTEXE
2637ifeq ($(filter-out solaris.x86 %.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),)
2638 ifneq ($(KBUILD_TARGET),win)
2639 TEMPLATE_VBOXMAINCLIENTDLL_DEFS = PIC $(TEMPLATE_VBOXMAINCLIENTEXE_DEFS)
2640 TEMPLATE_VBOXMAINCLIENTDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CFLAGS)
2641 TEMPLATE_VBOXMAINCLIENTDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS)
2642 TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)
2643 endif
2644endif
2645TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin))
2646
2647
2648#
2649# Template for building Qt GUI executables.
2650#
2651TEMPLATE_VBOXQTGUIEXE = VBox Qt GUI Executable
2652TEMPLATE_VBOXQTGUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS)
2653TEMPLATE_VBOXQTGUIEXE_INCS = \
2654 $(VBOX_PATH_QT)/include
2655
2656ifeq ($(KBUILD_TARGET),win)
2657 # drag in library configuration (we need QMAKE_PRL_DEFINES)
2658 ifneq ($(LIB_QT_PRL),)
2659 include $(LIB_QT_PRL)
2660 endif
2661 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_VCC_TOOL)
2662 TEMPLATE_VBOXQTGUIEXE_DEFS += \
2663 _WIN32_WINNT=0x0500 UNICODE _UNICODE \
2664 QT_DLL _CRT_SECURE_NO_DEPRECATE \
2665 $(QMAKE_PRL_DEFINES)
2666 ## @todo VCC70 flags?
2667 ifdef VBOX_USE_VCC80
2668 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
2669 -nologo -Zm200 -W3 -MD -Zi -EHsc -Zc:wchar_t-
2670 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu
2671 else
2672 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
2673 -nologo -Zm200 -W3 -MD -Zi -GX
2674 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -GZ
2675 endif
2676 TEMPLATE_VBOXQTGUIEXE_INCS += \
2677 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
2678 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = \
2679 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
2680 /DELAYLOAD:oleaut32.dll
2681 TEMPLATE_VBOXQTGUIEXE_SDKS = WINPSDK
2682 TEMPLATE_VBOXQTGUIEXE_LIBS = \
2683 $(LIB_QT) \
2684 $(LIB_QTMAIN) \
2685 $(LIB_RUNTIME) \
2686 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
2687 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
2688 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
2689 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
2690 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
2691 TEMPLATE_VBOXQTGUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2692
2693else # the gcc guys:
2694 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_GCC_TOOL)
2695 TEMPLATE_VBOXQTGUIEXE_DEFS.linux = _REENTRANT
2696 TEMPLATE_VBOXQTGUIEXE_DEFS.solaris = _REENTRANT
2697
2698 TEMPLATE_VBOXQTGUIEXE_INCS += \
2699 $(LIB_SDL_INC)
2700 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
2701 -pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
2702 -Wno-long-long -fshort-wchar -fno-strict-aliasing \
2703 $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
2704 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.x86 = -m32
2705 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.amd64 = -m64
2706 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -pthread
2707 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.x86 = -m32
2708 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.amd64 = -m64
2709 TEMPLATE_VBOXQTGUIEXE_LIBS = \
2710 $(LIB_QT) \
2711 $(LIB_SDL) \
2712 $(LIB_RUNTIME) \
2713 $(LIB_REM) \
2714 $(LIB_VMM)
2715
2716 ifeq ($(KBUILD_TARGET_ARCH),amd64)
2717 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
2718 $(VBOX_PATH_QT)/lib64 $(VBOX_PATH_QT)/lib
2719 else
2720 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
2721 $(VBOX_PATH_QT)/lib
2722 endif
2723
2724 ifeq ($(KBUILD_TARGET),linux)
2725 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += $(VBOX_LD_as_needed)
2726 else ifeq ($(KBUILD_TARGET),darwin)
2727 TEMPLATE_VBOXQTGUIEXE_DEFS += $(VBOX_DARWIN_DEF_SDK_DEFS)
2728 TEMPLATE_VBOXQTGUIEXE_CFLAGS += $(VBOX_DARWIN_DEF_SDK_CFLAGS)
2729 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
2730 TEMPLATE_VBOXQTGUIEXE_OBJCFLAGS += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
2731 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.darwin += -bind_at_load
2732 TEMPLATE_VBOXQTGUIEXE_LIBS +=
2733 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
2734 else ifeq ($(KBUILD_TARGET),os2)
2735 # drag in library configuration (we need QMAKE_PRL_DEFINES)
2736 ifneq ($(LIB_QT_PRL),)
2737 include $(LIB_QT_PRL)
2738 endif
2739 TEMPLATE_VBOXQTGUIEXE_DEFS += $(QMAKE_PRL_DEFINES)
2740 TEMPLATE_VBOXQTGUIEXE_LIBS +=
2741 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
2742 else
2743 TEMPLATE_VBOXQTGUIEXE_INCS += \
2744 $(VBOX_XCURSOR_INCS)
2745 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2746 $(VBOX_XCURSOR_LIBS) \
2747 Xext \
2748 X11 \
2749 m \
2750 $(LIB_PTHREAD)
2751 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \
2752 $(VBOX_LIBPATH_X11)
2753 ifeq ($(KBUILD_TARGET),freebsd)
2754 TEMPLATE_VBOXQTGUIEXE_INCS += \
2755 /usr/include \
2756 /usr/X11R6/include \
2757 /usr/local/include
2758 endif
2759 ifeq ($(KBUILD_TARGET),solaris)
2760 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2761 rt socket nsl
2762 endif
2763 endif
2764 ifdef VBOX_WITH_RUNPATH
2765 ifeq ($(KBUILD_TARGET),solaris)
2766 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH):$(VBOX_WITH_RUNPATH)/qtgcc/lib'
2767 else
2768 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'
2769 endif
2770 else ifdef VBOX_WITH_ORIGIN
2771 ifeq ($(KBUILD_TARGET),solaris)
2772 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN):$$(VBOX_ORIGIN)/qtgcc/lib'
2773 else
2774 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)'
2775 endif
2776 endif
2777
2778endif # !win
2779
2780# Add COM/XPCOM stuff
2781TEMPLATE_VBOXQTGUIEXE_LIBS += \
2782 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
2783ifdef VBOX_WITH_XPCOM
2784 ## @todo may be worth creating the VBOX_XPCOM SDK def
2785 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM
2786 ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
2787 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
2788 endif
2789 TEMPLATE_VBOXQTGUIEXE_INCS += \
2790 $(VBOX_XPCOM_INCS)
2791 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2792 $(LIB_XPCOM)
2793 TEMPLATE_VBOXQTGUIEXE_INTERMEDIATES += \
2794 $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h
2795else
2796 TEMPLATE_VBOXQTGUIEXE_INCS += \
2797 $(VBOX_PATH_SDK)/bindings/mscom/include
2798 TEMPLATE_VBOXQTGUIEXE_INTERMEDIATES += \
2799 $(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h
2800endif
2801
2802#
2803# Template for building Qt GUI components.
2804#
2805TEMPLATE_VBOXQTGUI = VBox Qt GUI Components
2806TEMPLATE_VBOXQTGUI_EXTENDS = VBOXQTGUIEXE
2807TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN),$(TEMPLATE_VBOXQTGUIEXE_LIBS))
2808ifeq ($(KBUILD_TARGET),darwin)
2809 TEMPLATE_VBOXQTGUI_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS.darwin)) \
2810 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
2811endif
2812ifeq ($(filter-out solaris.x86 %.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),)
2813 ifneq ($(KBUILD_TARGET),win)
2814 TEMPLATE_VBOXQTGUI_DEFS = PIC $(TEMPLATE_VBOXQTGUIEXE_DEFS)
2815 TEMPLATE_VBOXQTGUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CFLAGS)
2816 TEMPLATE_VBOXQTGUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS)
2817 TEMPLATE_VBOXQTGUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_LDFLAGS)
2818 endif
2819endif
2820
2821
2822#
2823# Template for building build bldprogs.
2824#
2825TEMPLATE_VBOXBLDPROG = VBox Build Program
2826TEMPLATE_VBOXBLDPROG_DEFS = IN_RING3
2827ifeq ($(KBUILD_HOST),win)
2828 ifeq ($(KBUILD_HOST_ARCH),x86)
2829 ifdef VBOX_USE_VCC80
2830 TEMPLATE_VBOXBLDPROG_TOOL = VCC80X86
2831 else
2832 TEMPLATE_VBOXBLDPROG_TOOL = VCC70
2833 endif
2834 TEMPLATE_VBOXBLDPROG_SDKS = WIN32SDK
2835 else
2836 TEMPLATE_VBOXBLDPROG_TOOL = VCC80AMD64
2837 TEMPLATE_VBOXBLDPROG_SDKS = WIN64SDK
2838 endif
2839 ifneq ($(TEMPLATE_VBOXBLDPROG_TOOL),VCC70)
2840 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -W3 -wd4996 -Zc:wchar_t-
2841 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -RTCsu
2842 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -Oy- -GS-
2843 else
2844 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -W3
2845 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -GZ
2846 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -Ogitb2 -Oy-
2847 endif
2848 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2849 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2850 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
2851 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
2852 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2853 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
2854 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
2855 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
2856 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
2857 /DISALLOWLIB:libcd.lib \
2858 /DISALLOWLIB:libcmtd.lib \
2859 /DISALLOWLIB:msvcrt.lib \
2860 /DISALLOWLIB:msvcrtd.lib \
2861 /DISALLOWLIB:msvcprt.lib \
2862 /DISALLOWLIB:msvcprtd.lib
2863 TEMPLATE_VBOXBLDPROG_LIBS = \
2864 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
2865 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt.lib \
2866 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt.lib
2867
2868else
2869# (gcc of some kind )
2870TEMPLATE_VBOXBLDPROG_TOOL = GXX3
2871TEMPLATE_VBOXBLDPROG_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
2872TEMPLATE_VBOXBLDPROG_CFLAGS.x86 = -m32
2873TEMPLATE_VBOXBLDPROG_CFLAGS.amd64 = -m64
2874TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2875TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
2876TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
2877TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe
2878TEMPLATE_VBOXBLDPROG_CXXFLAGS.x86 = -m32
2879TEMPLATE_VBOXBLDPROG_CXXFLAGS.amd64 = -m64
2880TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2881TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2882TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2883TEMPLATE_VBOXBLDPROG_LDFLAGS.x86 = -m32
2884TEMPLATE_VBOXBLDPROG_LDFLAGS.amd64 = -m64
2885 ifeq ($(KBUILD_HOST),linux)
2886TEMPLATE_VBOXBLDPROG_LIBS = pthread m rt dl
2887 else ifeq ($(KBUILD_HOST),os2)
2888TEMPLATE_VBOXBLDPROG_TOOL = GXX3OMF
2889TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
2890 else ifeq ($(KBUILD_HOST),darwin)
2891TEMPLATE_VBOXBLDPROG_TOOL = GXX4MACHO
2892TEMPLATE_VBOXBLDPROG_CFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CFLAGS) -fno-common
2893TEMPLATE_VBOXBLDPROG_CXXFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_CXXFLAGS)
2894TEMPLATE_VBOXBLDPROG_OBJCFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS)
2895TEMPLATE_VBOXBLDPROG_LDFLAGS.darwin = $(VBOX_DARWIN_DEF_SDK_LDFLAGS)
2896TEMPLATE_VBOXBLDPROG_LIBS =
2897 else if1of ($(KBUILD_HOST), freebsd netbsd openbsd)
2898TEMPLATE_VBOXBLDPROG_TOOL = GXX3
2899TEMPLATE_VBOXBLDPROG_LIBS =
2900 else ifeq ($(KBUILD_HOST),solaris)
2901TEMPLATE_VBOXBLDPROG_TOOL = GXX3PLAIN
2902TEMPLATE_VBOXBLDPROG_LIBS = rt
2903 else
2904$(warning Warning: VBOX Build: Target $(KBUILD_HOST) is not officially supported!)
2905 endif
2906
2907endif # !win
2908
2909
2910#
2911# Windows rc workaround for crosscompiling.
2912# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
2913#
2914ifneq ($(KBUILD_HOST),win)
2915 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2916 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2917 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2918 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
2919else
2920 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
2921 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
2922 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
2923 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
2924 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
2925 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
2926 ) Sorry_Cannot_find_mc_in_the_PSDK)
2927endif
2928
2929
2930#
2931# Template for building Linux host tools (only for KBUILD_TARGET=l4).
2932#
2933TEMPLATE_VBOXLNXHOSTR3EXE = Template for building linux host programs when targeting L4.
2934TEMPLATE_VBOXLNXHOSTR3EXE_INST = $(INST_BIN)
2935TEMPLATE_VBOXLNXHOSTR3EXE_BLD_TRG = linux
2936TEMPLATE_VBOXLNXHOSTR3EXE_TOOL = $(VBOX_GCC_TOOL)
2937TEMPLATE_VBOXLNXHOSTR3EXE_ASTOOL = YASM
2938TEMPLATE_VBOXLNXHOSTR3EXE_DLLSUFF = .so
2939TEMPLATE_VBOXLNXHOSTR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
2940TEMPLATE_VBOXLNXHOSTR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
2941TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe $(VBOX_GCC_fno-stack-protector)
2942TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.debug = -fno-inline
2943TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2944TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release)
2945TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release)
2946TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.release = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.release)
2947TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.debug)
2948TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.profile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.profile)
2949TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXLNXHOSTR3EXE_CXXFLAGS.kprofile)
2950TEMPLATE_VBOXLNXHOSTR3EXE_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_fno-stack-protector)
2951TEMPLATE_VBOXLNXHOSTR3EXE_LIBS = pthread m rt dl
2952
2953TEMPLATE_VBOXLNXHOSTR3LIB = Template for linux host libraries.
2954TEMPLATE_VBOXLNXHOSTR3LIB_EXTENDS = VBOXLNXHOSTR3EXE
2955TEMPLATE_VBOXLNXHOSTR3LIB_INST = $(INST_LIB)
2956
2957
2958#
2959# Template for building R3 programs for the guest additions.
2960# Note: Make sure you don't break VBOXGUESTR3CPPEXE when changing this.
2961#
2962TEMPLATE_VBOXGUESTR3EXE = VBox Guest Program
2963ifeq ($(KBUILD_TARGET),win)
2964 TEMPLATE_VBOXGUESTR3EXE_EXTENDS = VBOXR3EXE
2965 TEMPLATE_VBOXGUESTR3EXE_CFLAGS = $(filter-out -MD, $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT
2966 TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS = $(filter-out -MD, $(TEMPLATE_VBOXR3EXE_CFLAGS)) -MT
2967 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS = $(filter-out /DISALLOWLIB:libcmt.lib, $(TEMPLATE_VBOXR3EXE_LDFLAGS)) \
2968 /DISALLOWLIB:msvcrt.lib \
2969 /DISALLOWLIB:msvcprt.lib
2970 TEMPLATE_VBOXGUESTR3EXE_LIBS = \
2971 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL)_LIB)/oldnames.lib \
2972 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL)_LIB)/libcmt.lib \
2973 $(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL)_LIB)/libcpmt.lib
2974else # the gcc guys
2975 TEMPLATE_VBOXGUESTR3EXE_EXTENDS = VBOXR3EXE
2976 TEMPLATE_VBOXGUESTR3EXE_TOOL := $(subst GXX,GCC,$(TEMPLATE_VBOXR3EXE_TOOL))
2977 TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fno-exceptions
2978endif
2979TEMPLATE_VBOXGUESTR3EXE_INST = $(INST_ADDITIONS)
2980TEMPLATE_VBOXGUESTR3EXE_DEFS := $(TEMPLATE_VBOXR3EXE_DEFS) IN_GUEST IN_GUEST_R3 IN_RT_R3
2981ifeq ($(KBUILD_TARGET),linux) # As few libs as possible on linux.
2982 TEMPLATE_VBOXGUESTR3EXE_LIBS = pthread rt m
2983endif
2984
2985#
2986# Template for building R3 (dynamic) libraries for the guest additions.
2987#
2988TEMPLATE_VBOXGUESTR3DLL = VBox Guest User Dynamic Libraries
2989TEMPLATE_VBOXGUESTR3DLL_EXTENDS = VBOXGUESTR3EXE
2990## @todo add a INSTFUN that separates dlls and libs.
2991ifn1of ($(KBUILD_TARGET), os2 win)
2992 TEMPLATE_VBOXGUESTR3DLL_DEFS = $(TEMPLATE_VBOXGUESTR3EXE_DEFS) PIC
2993 TEMPLATE_VBOXGUESTR3DLL_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fPIC
2994 TEMPLATE_VBOXGUESTR3DLL_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fPIC -fno-exceptions
2995 TEMPLATE_VBOXGUESTR3DLL_LDFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_LDFLAGS) -fPIC
2996endif
2997
2998#
2999# Template for building R3 (static) libraries for the guest additions.
3000#
3001TEMPLATE_VBOXGUESTR3LIB = VBox Guest User Libraries
3002TEMPLATE_VBOXGUESTR3LIB_EXTENDS = VBOXGUESTR3EXE
3003TEMPLATE_VBOXGUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
3004if1of ($(KBUILD_TARGET), solaris) ## @todo r=bird: Fix the *R3Mini template to VBOXGUESTR3DLL and remove this hack.
3005 TEMPLATE_VBOXGUESTR3LIB_DEFS = $(TEMPLATE_VBOXGUESTR3EXE_DEFS) PIC
3006 TEMPLATE_VBOXGUESTR3LIB_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fPIC
3007 TEMPLATE_VBOXGUESTR3LIB_CXXFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fPIC -fno-exceptions
3008endif
3009
3010
3011#
3012# Template for XFree86 guest modules (relocatable module, i.e. sysmod).
3013# This mostly about zapping the VBOXR3EXE linker flags and libraries.
3014#
3015TEMPLATE_VBOXGUESTR3XF86MOD = VBox Guest Program with C++ library dependencies
3016TEMPLATE_VBOXGUESTR3XF86MOD_EXTENDS = VBOXGUESTR3EXE
3017TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
3018TEMPLATE_VBOXGUESTR3XF86MOD_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
3019TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
3020TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
3021TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS = -r
3022if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd) # the gnu ld guys.
3023 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.release = -S
3024 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.x86 = -m elf_i386
3025 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.amd64 = -m elf_x86_64
3026endif
3027TEMPLATE_VBOXGUESTR3XF86MOD_CFLAGS = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fno-merge-constants -std=c99
3028TEMPLATE_VBOXGUESTR3XF86MOD_CXXFLAGS= $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS) -fno-merge-constants
3029TEMPLATE_VBOXGUESTR3XF86MOD_SYSSUFF = .o
3030TEMPLATE_VBOXGUESTR3XF86MOD_LIBS = \
3031 $(VBOX_LIB_VBGL_R3_XFREE86)
3032TEMPLATE_VBOXGUESTR3XF86MOD_DEFS = $(TEMPLATE_VBOXGUESTR3DLL_DEFS) LOG_TO_BACKDOOR
3033
3034
3035#
3036# Template for X.org guest modules (shared libs).
3037# This mostly about zapping unnecessary LIBS from VBOXGUESTR3DLL and adding some flags.
3038#
3039TEMPLATE_VBOXGUESTR3XORGMOD = VBox Guest Program with C++ library dependencies
3040TEMPLATE_VBOXGUESTR3XORGMOD_EXTENDS = VBOXGUESTR3DLL
3041TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.$(KBUILD_TYPE) = $(NO_SUCH_VARIABLE)
3042TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
3043TEMPLATE_VBOXGUESTR3XORGMOD_CFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_CFLAGS) -std=c99
3044TEMPLATE_VBOXGUESTR3XORGMOD_DEFS = $(TEMPLATE_VBOXGUESTR3DLL_DEFS) LOG_TO_BACKDOOR
3045ifeq ($(KBUILD_TARGET_ARCH),amd64)
3046 TEMPLATE_VBOXGUESTR3XORGMOD_DEFS += _XSERVER64
3047endif
3048if1of ($(KBUILD_TARGET), linux)
3049 TEMPLATE_VBOXGUESTR3XORGMOD_LDFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_LDFLAGS) -s
3050endif
3051TEMPLATE_VBOXGUESTR3XORGMOD_LIBS = \
3052 $(VBOX_LIB_VBGL_R3_SHARED) \
3053 $(VBOX_LIB_IPRT_GUEST_R3_MINI) \
3054 $(VBOX_LIB_VBGL_R3_SHARED)
3055
3056
3057#
3058# Template for guest stuff that makes use of the C++ library and features.
3059# (This is mostly about undoing what was done to C++ for VBOXGUESTR3EXE.)
3060#
3061TEMPLATE_VBOXGUESTR3CPPEXE = VBox Guest Program with C++ library dependencies
3062TEMPLATE_VBOXGUESTR3CPPEXE_EXTENDS = VBOXGUESTR3EXE
3063ifeq ($(KBUILD_TARGET),win)
3064 # later if necessary
3065else
3066 TEMPLATE_VBOXGUESTR3CPPEXE_TOOL = $(TEMPLATE_VBOXR3EXE_TOOL)
3067 TEMPLATE_VBOXGUESTR3CPPEXE_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
3068endif
3069
3070
3071#
3072# Template for building R0 drivers for the guest additions.
3073#
3074TEMPLATE_VBOXGUESTR0 = VBox Guest Driver
3075TEMPLATE_VBOXGUESTR0_EXTENDS = VBOXR0DRV
3076TEMPLATE_VBOXGUESTR0_INST = $(INST_ADDITIONS)
3077TEMPLATE_VBOXGUESTR0_SDKS.win.x86 = WIN32SDK W2K3DDK
3078TEMPLATE_VBOXGUESTR0_SDKS.win.amd64 = W2K3DDK WINPSDKINCS
3079TEMPLATE_VBOXGUESTR0_LIBS.win.x86 = \
3080 $(PATH_SDK_W2K3DDK_LIB)/int64.lib
3081TEMPLATE_VBOXGUESTR0_DEFS = $(TEMPLATE_VBOXR0DRV_DEFS) IN_GUEST IN_GUEST_R0
3082ifeq ($(KBUILD_TARGET),solaris) # No VBI for the guest additions yet.
3083 TEMPLATE_VBOXGUESTR0_LDFLAGS = -r -dy
3084endif
3085
3086#
3087# Template for building R0 libraries for the guest additions.
3088#
3089TEMPLATE_VBOXGUESTR0LIB = VBox Guest Driver Libraries
3090TEMPLATE_VBOXGUESTR0LIB_EXTENDS = VBOXGUESTR0
3091TEMPLATE_VBOXGUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
3092
3093
3094#
3095# Guest additions libraries (all static).
3096# The _MINI and _SHARED are both compiled as PIC and intended for linking into a .so/.dll/.dylib.
3097#
3098VBOX_LIB_IPRT_GUEST_R3 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3$(VBOX_SUFF_LIB)
3099VBOX_LIB_IPRT_GUEST_R3_MINI = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3Mini$(VBOX_SUFF_LIB)
3100VBOX_LIB_IPRT_GUEST_R0 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR0$(VBOX_SUFF_LIB)
3101ifeq ($(KBUILD_TARGET_ARCH),x86)
3102 VBOX_LIB_IPRT_GUEST_R0_NT4 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR0NT4$(VBOX_SUFF_LIB)
3103else
3104 VBOX_LIB_IPRT_GUEST_R0_NT4 = $(VBOX_LIB_IPRT_GUEST_R0)
3105endif
3106VBOX_LIB_VBGL_R3 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3Lib$(VBOX_SUFF_LIB)
3107VBOX_LIB_VBGL_R3_XFREE86 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibXFree86$(VBOX_SUFF_LIB)
3108VBOX_LIB_VBGL_R3_SHARED = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibShared$(VBOX_SUFF_LIB)
3109VBOX_LIB_VBGL_R0BASE = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0LibBase$(VBOX_SUFF_LIB)
3110VBOX_LIB_VBGL_R0 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0Lib$(VBOX_SUFF_LIB)
3111
3112
3113
3114#
3115# Two targets to coordinate version number changes properly. Note that the
3116# only way to get a really consistent build is to run 'kmk' in the top-level
3117# directory. If you don't run it there, you get a consistent sub-tree only.
3118#
3119VBOX_VERSION_STAMP = $(PATH_OUT)/version-stamp-$(VBOX_VERSION_STRING)
3120VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
3121VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
3122
3123$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
3124 $(call MSG_GENERATE,,$@)
3125 $(QUIET)$(MKDIR) -p $(@D)
3126 $(QUIET)$(RM) -f $(wildcard $(PATH_OUT)/version-stamp-*)
3127 $(QUIET)$(APPEND) $@ $(VBOX_VERSION_STRING)
3128
3129$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
3130 $(call MSG_GENERATE,,$@)
3131 $(QUIET)$(MKDIR) -p $(@D)
3132 $(QUIET)$(RM) -f $@ [email protected]
3133 $(QUIET)$(APPEND) [email protected] '#ifndef ___version_generated_h___'
3134 $(QUIET)$(APPEND) [email protected] '#define ___version_generated_h___'
3135 $(QUIET)$(APPEND) [email protected] ''
3136 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)'
3137 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)'
3138 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)'
3139 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_STRING "$(VBOX_VERSION_STRING)"'
3140 $(QUIET)$(APPEND) [email protected] ''
3141 $(QUIET)$(APPEND) [email protected] '#endif'
3142 $(QUIET)$(MV) -f [email protected] $@
3143
3144
3145VBOX_PACKAGE_HEADER = $(PATH_OUT)/package-generated.h
3146
3147$(VBOX_PACKAGE_HEADER):
3148 $(call MSG_GENERATE,,$@)
3149 $(QUIET)$(MKDIR) -p $(@D)
3150 $(QUIET)$(RM) -f $@ [email protected]
3151 $(QUIET)$(APPEND) [email protected] '#ifndef ___package_generated_h___'
3152 $(QUIET)$(APPEND) [email protected] '#define ___package_generated_h___'
3153 $(QUIET)$(APPEND) [email protected] ''
3154 $(QUIET)$(APPEND) [email protected] '#define VBOX_PACKAGE_STRING "$(VBOX_PACKAGE_STRING)"'
3155 $(QUIET)$(APPEND) [email protected] ''
3156 $(QUIET)$(APPEND) [email protected] '#endif'
3157 $(QUIET)$(MV) -f [email protected] $@
3158
3159#
3160# Used for external makefiles which cannot include Config.kmk
3161#
3162$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
3163 $(call MSG_GENERATE,,$@)
3164 $(QUIET)$(RM) -f $@ [email protected]
3165 $(QUIET)$(MKDIR) -p $(@D)
3166 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)'
3167 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)'
3168 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)'
3169 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_STRING = $(VBOX_VERSION_STRING)'
3170 $(QUIET)$(MV) -f [email protected] $@
3171
3172ifndef VBOX_OSE
3173if1of ($(KBUILD_TARGET),freebsd linux netbsd openbsd solaris)
3174# VBOX_LICENSE_VER is used in several Makefiles
3175VBOX_LICENSE_SRC := $(PATH_ROOT)/doc/License.html
3176VBOX_LICENSE_VER_KMK = $(PATH_OUT)/license-version.kmk
3177$(VBOX_LICENSE_VER_KMK): $(VBOX_LICENSE_SRC)
3178 $(call MSG_GENERATE,,$(VBOX_LICENSE_VER_KMK))
3179 $(QUIET)$(MKDIR) -p $(@D)
3180 $(QUIET)$(SED) -e "s/.*License version \([0-9.]*\),.*/VBOX_LICENSE_VER=\1/;t;d" --output $@ $(VBOX_LICENSE_SRC)
3181-include $(VBOX_LICENSE_VER_KMK)
3182VBOX_LICENSE_BIN = $(PATH_BIN)/License-$(VBOX_LICENSE_VER).html
3183endif
3184endif
3185
3186
3187# Force building of the version header file as the first thing anywhere in
3188# the tree. This eliminates the need for manual dependencies on it.
3189## @todo there gotta be a better way of doing this.
3190Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK) $(VBOX_PACKAGE_HEADER)
3191Makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK) $(VBOX_PACKAGE_HEADER)
3192makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK) $(VBOX_PACKAGE_HEADER)
3193
3194
3195#
3196# Subversion tree revision.
3197#
3198# The VBOX_SVN_REV contains our best guess. Use svn info on the
3199# root of the treeto determin this it if .svn/entries is found,
3200# otherwise fall back on the Config.kmk revision.
3201#
3202SVN ?= svn$(HOSTSUFF_EXE)
3203VBOX_SVN_REV_KMK = $(PATH_OUT)/revision.kmk
3204ifndef VBOX_SVN_REV
3205 VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 11726 $ )
3206 VBOX_SVN_DEP := $(wildcard $(PATH_ROOT)/.svn/entries)
3207 ifeq ($(which $(SVN)),)
3208 VBOX_SVN_DEP :=
3209 endif
3210
3211# Rule for generating a timestamp and updating the real thing on change.
3212$(VBOX_SVN_REV_KMK).ts +| $(VBOX_SVN_REV_KMK): $(if $(VBOX_SVN_DEP), $(VBOX_SVN_DEP), $(PATH_ROOT)/Config.kmk)
3213 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
3214 $(QUIET)$(RM) -f $@ [email protected]
3215 $(QUIET)$(MKDIR) -p $(@D)
3216 ifneq ($(VBOX_SVN_DEP),)
3217 $(REDIRECT) -E 'LC_ALL=C' -wo [email protected] -- $(SVN) info $(PATH_ROOT)
3218 ifeq ($(int-mod $(VBOX_VERSION_BUILD), 2),0)
3219 $(SED) -e '/^Last Changed Rev/!d' -e 's/Last Changed Rev\: */export VBOX_SVN_REV=/' --output $@ [email protected]
3220 else
3221 $(SED) -e '/^Revision/!d' -e 's/Revision\: */export VBOX_SVN_REV=/' --output $@ [email protected]
3222 endif
3223 $(QUIET)$(RM) -f [email protected]
3224 else
3225 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV_FALLBACK)'
3226 endif
3227 $(QUIET)$(CP) --changed -fv $@ $(VBOX_SVN_REV_KMK)
3228
3229 include $(VBOX_SVN_REV_KMK)
3230else
3231# allow to overwrite VBOX_SVN_REV externally (mainly for building .debs/.rpms)
3232$(VBOX_SVN_REV_KMK):
3233 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
3234 $(QUIET)$(RM) -f $@
3235 $(QUIET)$(MKDIR) -p $(@D)
3236 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV)'
3237 $(QUIET)echo '* $(VBOX_SVN_REV_KMK) was externally overwritten:'
3238 $(QUIET)$(CAT) $(VBOX_SVN_REV_KMK)
3239endif
3240
3241
3242#
3243# Legacy.
3244#
3245ifneq ($(LOCALCFG),)
3246 include $(LOCALCFG)
3247endif
3248
3249
3250#
3251# Some extra goals.
3252#
3253.PHONY: up update st stat status
3254up update::
3255 $(SVN) up
3256
3257up2 update2::
3258 $(SVN) up --ignore-externals
3259
3260st stat status:
3261 $(SVN) status
3262
3263quick:
3264 $(MAKE) VBOX_QUICK=1
3265
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