VirtualBox

source: vbox/trunk/Config.kmk@ 11225

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

Windows Guest Additions Installer: Fix for corrupted W2K installer icon. For 32-bit we now don't have a big (256x256) Vista icon anymore since the crappy NSIS uses the *same* icon for the application icon and the header icons in the installer. On 64-bit, the big icon is available.

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