VirtualBox

source: vbox/trunk/Config.kmk@ 11586

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

API/xpcom: disabled namespace cleanup completely for now, it causes trouble with testing.

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