VirtualBox

source: vbox/trunk/Config.kmk@ 10196

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

Converted src/bldprogs to Sub-Makefile (bin2c).

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