VirtualBox

source: vbox/trunk/Config.kmk@ 6083

Last change on this file since 6083 was 6083, checked in by vboxsync, 17 years ago

Just build libxml2 everywhere (hope this works better on the buildboxes).

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