VirtualBox

source: vbox/trunk/Config.kmk@ 6079

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

Merged dmik/s2 branch (r25959:26751) to the trunk.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 108.4 KB
Line 
1# $Id: Config.kmk 6076 2007-12-14 19:23:03Z 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 = .
1153ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
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
1158else
1159ifeq ($(filter-out linux,$(BUILD_TARGET)),)
1160 SDK_VBOX_LIBXML2_INCS ?=
1161 SDK_VBOX_LIBXML2_LIBS ?=
1162 SDK_VBOX_LIBXML2_CFLAGS ?= $(shell pkg-config libxml-2.0 --cflags)
1163 SDK_VBOX_LIBXML2_CXXFLAGS ?= $(SDK_VBOX_LIBXML2_CFLAGS)
1164 SDK_VBOX_LIBXML2_LDFLAGS ?= $(shell pkg-config libxml-2.0 --libs)
1165else
1166 SDK_VBOX_LIBXML2_INCS ?=
1167 SDK_VBOX_LIBXML2_LIBS ?= xml2
1168endif
1169endif
1170
1171SDK_VBOX_LIBPNG = .
1172SDK_VBOX_LIBPNG_INCS ?= $(PATH_ROOT)/src/libs/libpng-1.2.8
1173SDK_VBOX_LIBPNG_LIBS ?= $(PATH_LIB)/VBox-libpng$(VBOX_SUFF_LIB)
1174
1175SDK_VBOX_ZLIB = .
1176ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
1177 SDK_VBOX_ZLIB_INCS ?= $(PATH_ROOT)/src/libs/zlib-1.2.1
1178 SDK_VBOX_ZLIB_LIBS ?= $(PATH_LIB)/VBox-zlib$(VBOX_SUFF_LIB)
1179else
1180 SDK_VBOX_ZLIB_INCS ?=
1181 SDK_VBOX_ZLIB_LIBS ?= z
1182endif
1183
1184SDK_VBOX_OPENSSL = .
1185SDK_VBOX_OPENSSL_INCS?= $(PATH_ROOT)/src/libs/openssl-0.9.7e/include
1186SDK_VBOX_OPENSSL_LIBS?= $(PATH_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB)
1187
1188SDK_VBOX_FFMPEG = .
1189ifeq ($(filter-out win os2 darwin,$(BUILD_TARGET)),)
1190 SDK_VBOX_FFMPEG_INCS ?= \
1191 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavutil \
1192 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavcodec \
1193 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavformat
1194 ifeq ($(BUILD_TARGET),win)
1195 ## @todo Michael! Where is $(PATH_LIB)/VBoxFFmpegImp$(VBOX_SUFF_LIB) supposed to come from?
1196 #SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpeg.a
1197 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpegImp.lib
1198 else
1199 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_BIN)/VBoxFFmpeg$(SUFF_DLL)
1200 endif
1201else
1202 SDK_VBOX_FFMPEG_INCS ?= /usr/include/ffmpeg /usr/include/libpng
1203 SDK_VBOX_FFMPEG_LIBS ?= avutil avcodec avformat
1204endif
1205
1206#
1207# Special SDK for the problematic NTDLL.LIB.
1208#
1209SDK_VBOX_NTDLL = Requires W2K3DDK
1210SDK_VBOX_NTDLL_LIBS ?= $(PATH_SDK_W2K3DDK_LIB)/ntdll.lib
1211
1212
1213#
1214# Qt build tools and libraries.
1215# For *NIX we require it to be present on the system.
1216#
1217## @todo convert this into SDK and integrate the Qt stuff into kBuild.
1218ifeq ($(BUILD_TARGET),win)
1219 ifeq ($(BUILD_TARGET_ARCH),x86)
1220 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.3
1221 LIB_QT ?= $(VBOX_PATH_QT)/lib/dynamic/qt-mt333.lib
1222 LIB_QTMAIN ?= $(VBOX_PATH_QT)/lib/dynamic/qtmain.lib
1223 else
1224 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.8
1225 LIB_QT ?= $(VBOX_PATH_QT)/lib/qt-mt338.lib
1226 LIB_QTMAIN ?= $(VBOX_PATH_QT)/lib/qtmain.lib
1227 endif
1228 ifndef QTDIR
1229 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
1230 QTDIR := $(call lastword,$(QTDIR))
1231 endif
1232else ifeq ($(BUILD_TARGET),os2)
1233 QTDIR ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.1
1234 VBOX_PATH_QT ?= $(QTDIR)
1235 LIB_QT ?= $(lastword $(sort $(wildcard $(VBOX_PATH_QT)/lib/*qt*.lib)))
1236 QTDIR := $(VBOX_PATH_QT)
1237else ifeq ($(BUILD_TARGET),darwin)
1238 ifndef VBOX_PATH_QT
1239 VBOX_PATH_QT := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v3.*)))
1240 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.8-r1
1241 endif
1242 VBOX_MUST_INSTALL_LIB_QT ?= 1
1243 LIB_QT ?= $(VBOX_PATH_QT)/lib/libqt-mt.3.dylib
1244 LIB_QTMAIN ?= $(NO_SUCH_VARIABLE)
1245 ifndef QTDIR
1246 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
1247 QTDIR := $(call lastword,$(QTDIR))
1248 endif
1249else
1250 ifndef QTDIR
1251 ifndef VBOX_PATH_QT
1252 # If QTDIR and VBOX_WITH_QTGUI aren't defined, we'll first
1253 # look in the tools tree and then on the system. If in the
1254 # tools, we'll have to install it.
1255 # Results are exported to avoid having to do this for every make file.
1256 VBOX_PATH_QT := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v3.*)))
1257 ifneq ($(VBOX_PATH_QT),)
1258 export VBOX_PATH_QT
1259 export VBOX_MUST_INSTALL_LIB_QT := 1
1260 export LIB_QT := $(VBOX_PATH_QT)/lib/libqt-mt.so.3
1261 export LD_LIBRARY_PATH := $(VBOX_PATH_QT)/lib:$(LD_LIBRARY_PATH)
1262 else
1263 QTDIR := $(wildcard /usr/share/qt3)
1264 ifeq ($(QTDIR),)
1265 QTDIR := $(patsubst %/bin/moc,%,$(firstword $(wildcard /usr/bin/moc /usr/local/bin/moc /usr/X11R6/bin/moc)))
1266 endif
1267 ifneq ($(QTDIR),)
1268 export QTDIR
1269 endif
1270 endif
1271 else
1272 QTDIR := $(VBOX_PATH_QT)
1273 export QTDIR
1274 endif
1275 endif
1276endif
1277ifndef VBOX_PATH_QT
1278 VBOX_PATH_QT ?= $(QTDIR)
1279 LIB_QT ?= qt-mt
1280endif
1281ifeq ($(BUILD_PLATFORM),$(BUILD_TARGET))
1282 VBOX_PATH_QT_HOST ?= $(VBOX_PATH_QT)
1283else
1284 VBOX_PATH_QT_HOST ?= $(QTDIR)
1285endif
1286VBOX_UIC ?= $(VBOX_PATH_QT_HOST)/bin/uic$(HOSTSUFF_EXE)
1287VBOX_MOC ?= $(VBOX_PATH_QT_HOST)/bin/moc$(HOSTSUFF_EXE)
1288VBOX_LUPDATE ?= $(VBOX_PATH_QT_HOST)/bin/lupdate$(HOSTSUFF_EXE)
1289VBOX_LRELEASE ?= $(VBOX_PATH_QT_HOST)/bin/lrelease$(HOSTSUFF_EXE)
1290
1291ifeq ($(BUILD_TARGET),os2)
1292 # search DLLs in the EXE directory first
1293 VBOX_UIC := BEGINLIBPATH="$(dir $(VBOX_UIC));$$BEGINLIBPATH" $(VBOX_UIC)
1294 VBOX_MOC := BEGINLIBPATH="$(dir $(VBOX_MOC));$$BEGINLIBPATH" $(VBOX_MOC)
1295 VBOX_LUPDATE := BEGINLIBPATH="$(dir $(VBOX_LUPDATE));$$BEGINLIBPATH" $(VBOX_LUPDATE)
1296 VBOX_LRELEASE := BEGINLIBPATH="$(dir $(VBOX_LRELEASE));$$BEGINLIBPATH" $(VBOX_LRELEASE)
1297endif
1298
1299#
1300# The linux kernel headers(/sources).
1301#
1302ifneq ($(filter linux,$(BUILD_TARGET)),)
1303 ifeq ($(origin VBOX_LINUX_SRC),undefined)
1304 ifneq ($(wildcard /lib/modules/$(shell uname -r)/build/include/linux/autoconf.h),)
1305 export VBOX_LINUX_SRC := /lib/modules/$(shell uname -r)/build
1306 else
1307 export VBOX_LINUX_SRC := /usr/src/linux
1308 endif
1309 endif
1310 ifeq ($(origin VBOX_LINUX_INCS),undefined)
1311 export VBOX_LINUX_INCS := $(VBOX_LINUX_SRC)/include
1312 # support splitted Linux kernels (make O=<build directory>)
1313 kernelsrc := $(shell $(SED_EXT) -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(VBOX_LINUX_SRC)/Makefile)
1314 ifneq ($(kernelsrc),)
1315 kernelpath := $(realpath $(VBOX_LINUX_SRC)/$(kernelsrc))
1316 VBOX_LINUX_INCS += $(VBOX_LINUX_SRC)/include2 $(kernelpath)/include
1317 else
1318 kernelpath := $(VBOX_LINUX_SRC)
1319 endif
1320 ifeq ($(BUILD_TARGET_ARCH),x86)
1321 VBOX_LINUX_INCS += $(kernelpath)/include/asm-i386/mach-default \
1322 $(kernelpath)/include/asm-x86/mach-default
1323 endif
1324 endif
1325endif
1326
1327
1328#
1329# Template for building GC things.
1330#
1331TEMPLATE_VBOXGC = VBox GC
1332TEMPLATE_VBOXGC_ASTOOL = $(VBOX_ASTOOL)
1333TEMPLATE_VBOXGC_ASFLAGS = $(VBOX_ASFLAGS32)
1334TEMPLATE_VBOXGC_DEFS = IN_GC $(ARCH_BITS_DEFS)
1335TEMPLATE_VBOXGC_SYSSUFF = .gc
1336TEMPLATE_VBOXGC_BLD_TRG_ARCH = x86
1337
1338ifeq ($(VBOX_LDR_FMT32),pe)
1339ifdef VBOX_USE_VCC80
1340 TEMPLATE_VBOXGC_TOOL = VCC80X86
1341 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)
1342else
1343 TEMPLATE_VBOXGC_TOOL = VCC70
1344 TEMPLATE_VBOXGC_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP)
1345endif
1346TEMPLATE_VBOXGC_CFLAGS = $(TEMPLATE_VBOXGC_CXXFLAGS)
1347TEMPLATE_VBOXGC_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Lines -MapInfo:Exports -NoD
1348ifdef VBOX_USE_VCC80
1349 include $(PATH_KBUILD)/sdks/W2K3DDKX86.kmk
1350 TEMPLATE_VBOXGC_LIBS = \
1351 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1352else
1353 TEMPLATE_VBOXGC_LIBS = \
1354 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1355endif
1356endif
1357
1358ifeq ($(VBOX_LDR_FMT32),elf)
1359TEMPLATE_VBOXGC_TOOL = $(VBOX_GCC32_TOOL)
1360TEMPLATE_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)
1361TEMPLATE_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)
1362ifeq ($(BUILD_TARGET),solaris)
1363 TEMPLATE_VBOXGC_LDFLAGS = -r
1364else
1365 TEMPLATE_VBOXGC_LDFLAGS = -nostdlib -Bsymbolic
1366 # temporarily, must fix the loader.
1367 TEMPLATE_VBOXGC_LDFLAGS += $(if $(VBOX_DO_STRIP_MODULES),-S,)
1368 TEMPLATE_VBOXGC_LDFLAGS.release = $(if $(VBOX_DO_STRIP_MODULES),-S,)
1369endif
1370ifneq ($(filter-out solaris freebsd,$(BUILD_TARGET)),)
1371TEMPLATE_VBOXGC_LIBS = \
1372 $(VBOX_GCC32_LIBGCC) # instricts
1373endif
1374endif
1375
1376ifeq ($(VBOX_LDR_FMT32),macho)
1377TEMPLATE_VBOXGC_TOOL = GXX4MACHO
1378TEMPLATE_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
1379TEMPLATE_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
1380TEMPLATE_VBOXGC_LDFLAGS = -nostdlib
1381#TEMPLATE_VBOXGC_LDFLAGS.release = -Wl,-S ???
1382endif
1383
1384ifeq ($(VBOX_LDR_FMT32),lx)
1385TEMPLATE_VBOXGC_TOOL = GXX3OMF
1386TEMPLATE_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
1387TEMPLATE_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
1388TEMPLATE_VBOXGC_LDFLAGS = -Zdll -nostdlib
1389TEMPLATE_VBOXGC_LIBS = \
1390 $(VBOX_GCC32_LIBGCC) \
1391 $(OBJ_SYS0) \
1392 end
1393endif
1394
1395
1396#
1397# Template for building a GC ring-3 testcase (tstVMStructGC, tstDevStructGC).
1398#
1399TEMPLATE_VBOXGCEXE = VBox GC as ring-3 testcase
1400TEMPLATE_VBOXGCEXE_EXTENDS = VBOXGC
1401
1402ifeq ($(VBOX_LDR_FMT32),pe)
1403 TEMPLATE_VBOXGCEXE_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD -Debug
1404 TEMPLATE_VBOXGCEXE_SDKS = WIN32SDK
1405 ifdef VBOX_USE_VCC80
1406 TEMPLATE_VBOXGCEXE_LIBS = \
1407 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
1408 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib
1409 else
1410 TEMPLATE_VBOXGCEXE_LIBS = \
1411 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
1412 $(PATH_TOOL_VCC70_LIB)/oldnames.lib
1413 endif
1414endif
1415
1416ifeq ($(VBOX_LDR_FMT32),elf)
1417 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1418 TEMPLATE_VBOXGCEXE_LDFLAGS.release = -g
1419endif
1420
1421ifeq ($(VBOX_LDR_FMT32),macho)
1422 TEMPLATE_VBOXGCEXE_CFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CFLAGS))
1423 TEMPLATE_VBOXGCEXE_CXXFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CXXFLAGS))
1424 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1425endif
1426
1427ifeq ($(VBOX_LDR_FMT32),lx)
1428 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1429 TEMPLATE_VBOXGCEXE_LIBS = $(NO_SUCH_VARIABLE)
1430endif
1431
1432
1433#
1434# Template for building R0 things.
1435#
1436TEMPLATE_VBOXR0 = VBox Ring 0
1437TEMPLATE_VBOXR0_ASTOOL = $(VBOX_ASTOOL)
1438TEMPLATE_VBOXR0_ASFLAGS = $(VBOX_ASFLAGS)
1439TEMPLATE_VBOXR0_DEFS = IN_RING0 $(ARCH_BITS_DEFS)
1440
1441ifeq ($(VBOX_LDR_FMT),pe)
1442TEMPLATE_VBOXR0_TOOL = $(VBOX_VCC_TOOL)
1443ifdef VBOX_USE_VCC80
1444 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -W3 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1445else
1446 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1447endif
1448TEMPLATE_VBOXR0_CFLAGS = $(TEMPLATE_VBOXR0_CXXFLAGS)
1449TEMPLATE_VBOXR0_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD
1450ifdef VBOX_USE_VCC80
1451 TEMPLATE_VBOXR0_LIBS.x86 = \
1452 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1453else
1454 TEMPLATE_VBOXR0_LIBS.x86 = \
1455 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1456endif
1457endif # pe
1458
1459ifeq ($(VBOX_LDR_FMT),elf)
1460TEMPLATE_VBOXR0_TOOL = $(VBOX_GCC_TOOL)
1461TEMPLATE_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)
1462TEMPLATE_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)
1463TEMPLATE_VBOXR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding
1464TEMPLATE_VBOXR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables
1465ifeq ($(BUILD_TARGET),solaris)
1466 TEMPLATE_VBOXR0_LDFLAGS = -r
1467else
1468 TEMPLATE_VBOXR0_LDFLAGS = -nostdlib -Bsymbolic
1469 # temporarily, must fix the loader.
1470 TEMPLATE_VBOXR0_LDFLAGS += $(if $(VBOX_DO_STRIP_MODULES),-S,)
1471 TEMPLATE_VBOXR0_LDFLAGS.release = $(if $(VBOX_DO_STRIP_MODULES),-S,)
1472endif
1473
1474ifneq ($(filter-out solaris freebsd,$(BUILD_TARGET)),)
1475 TEMPLATE_VBOXR0_LIBS = \
1476 $(VBOX_GCC_LIBGCC) # instricts
1477endif
1478endif
1479
1480ifeq ($(VBOX_LDR_FMT),macho)
1481TEMPLATE_VBOXR0_TOOL = GXX4MACHO
1482TEMPLATE_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
1483TEMPLATE_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
1484TEMPLATE_VBOXR0_LDFLAGS = -nostdlib
1485#TEMPLATE_VBOXR0_LDFLAGS.release = -Wl,-S ???
1486endif
1487
1488ifeq ($(VBOX_LDR_FMT),lx)
1489TEMPLATE_VBOXR0_TOOL = GXX3OMF
1490TEMPLATE_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
1491TEMPLATE_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
1492TEMPLATE_VBOXR0_LDFLAGS = -Zdll -nostdlib
1493TEMPLATE_VBOXR0_LIBS = \
1494 $(VBOX_GCC_LIBGCC) \
1495 $(OBJ_SYS0) \
1496 end
1497endif
1498
1499
1500#
1501# Template for building SUPDRV R0 things.
1502#
1503TEMPLATE_VBOXR0DRV = VBox SUPDRV Ring 0
1504TEMPLATE_VBOXR0DRV_ASTOOL = $(VBOX_ASTOOL)
1505TEMPLATE_VBOXR0DRV_ASFLAGS = $(VBOX_ASFLAGS)
1506TEMPLATE_VBOXR0DRV_DEFS = IN_RING0 IN_RT_R0 $(ARCH_BITS_DEFS)
1507
1508ifeq ($(BUILD_TARGET),win)
1509 TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_VCC_TOOL)
1510 TEMPLATE_VBOXR0DRV_RCDEFS = \
1511 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1512 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1513 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1514 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1515 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1516 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1517 TEMPLATE_VBOXR0DRV_DEFS.x86 = _X86_
1518 TEMPLATE_VBOXR0DRV_DEFS.amd64 = _AMD64_
1519 ifdef VBOX_USE_VCC80
1520 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -W3 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1521 else
1522 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -W3 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1523 endif
1524 TEMPLATE_VBOXR0DRV_CFLAGS = $(TEMPLATE_VBOXR0DRV_CXXFLAGS)
1525 TEMPLATE_VBOXR0DRV_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Debug
1526 TEMPLATE_VBOXR0DRV_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
1527endif
1528
1529ifeq ($(BUILD_TARGET),linux)
1530TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1531TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0
1532TEMPLATE_VBOXR0DRV_INCS = $(VBOX_LINUX_INCS)
1533TEMPLATE_VBOXR0DRV_CFLAGS = -nostdinc -iwithprefix include \
1534 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1535 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1536TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mpreferred-stack-boundary=2 -msoft-float
1537TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1538 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1539 -Wno-sign-compare -Wdeclaration-after-statement
1540TEMPLATE_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
1541 ifndef VBOX_LINUX_VERSION_2_4
1542# 2.6
1543TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1544TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1545TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1546 else
1547# 2.4
1548TEMPLATE_VBOXR0DRV_SYSSUFF = .o
1549TEMPLATE_VBOXR0DRV_LDFLAGS = -r -s
1550 endif
1551endif
1552
1553ifeq ($(BUILD_TARGET),os2)
1554TEMPLATE_VBOXR0DRV_TOOL = GXX3OMF
1555TEMPLATE_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
1556TEMPLATE_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
1557TEMPLATE_VBOXR0DRV_LIBS = $(VBOX_GCC_LIBGCC)
1558# wlink thinks physdevice doesn't need fixups and should have a stack - stupid!
1559TEMPLATE_VBOXR0DRV_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
1560endif
1561
1562ifeq ($(BUILD_TARGET),darwin)
1563TEMPLATE_VBOXR0DRV_TOOL = GXX4MACHO
1564TEMPLATE_VBOXR0DRV_DEFS += KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT
1565TEMPLATE_VBOXR0DRV_INCS += \
1566 /System/Library/Frameworks/Kernel.framework/PrivateHeaders \
1567 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Kernel.framework/Headers
1568TEMPLATE_VBOXR0DRV_CXXFLAGS = \
1569 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1570 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1571 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1572 -fapple-kext -fno-rtti -fcheck-new
1573TEMPLATE_VBOXR0DRV_CXXFLAGS.release = $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fasm-blocks
1574TEMPLATE_VBOXR0DRV_CXXFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1575TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1576TEMPLATE_VBOXR0DRV_CFLAGS = \
1577 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1578 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1579 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1580 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1581TEMPLATE_VBOXR0DRV_CFLAGS.release = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1582TEMPLATE_VBOXR0DRV_CFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.profile)
1583TEMPLATE_VBOXR0DRV_CFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile)
1584TEMPLATE_VBOXR0DRV_LDFLAGS = -static -nostdlib -r -Wl,-Y,1455 \
1585 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
1586TEMPLATE_VBOXR0DRV_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC)
1587endif
1588
1589ifeq ($(BUILD_TARGET),solaris)
1590## The Solaris /usr/include.
1591VBOX_SOLARIS_SYS_INCS ?= /usr/include
1592
1593TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1594TEMPLATE_VBOXR0DRV_DEFS = _KERNEL _STRICT_STDC IN_RING0 IN_RT_R0
1595TEMPLATE_VBOXR0DRV_SYSSUFF = .o
1596TEMPLATE_VBOXR0DRV_LDFLAGS = -r
1597TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -64
1598# Exclude -Wall because of solaris headers' pragma ident warnings that gcc refuses to supress.
1599TEMPLATE_VBOXR0DRV_CFLAGS = -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1600 -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \
1601 -O2 -ffreestanding -nodefaultlibs -fno-strict-aliasing -fno-common -std=c99
1602TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
1603TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-red-zone -mcmodel=kernel \
1604 -fno-reorder-blocks -fno-asynchronous-unwind-tables -funit-at-a-time
1605TEMPLATE_VBOXR0DRV_CXXFLAGS = -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1606 -O2 -nodefaultlibs -fno-strict-aliasing -fno-common
1607TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86)
1608TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = $(TEMPLATE_VBOXR0DRV_CFLAGS.amd64)
1609endif # Solaris
1610
1611ifeq ($(BUILD_TARGET),freebsd)
1612# x86 FreeBSD:
1613# cc -O2 -fno-strict-aliasing -pipe -Werror -D_KERNEL -DKLD_MODULE \
1614# -nostdinc -I- -I. -I@ -I@/contrib/altq -I@/../include -I/usr/include \
1615# -finline-limit=8000 -fno-common -mno-align-long-strings -mpreferred-stack-boundary=2 \
1616# -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -ffreestanding -Wall -Wredundant-decls -Wnested-externs \
1617# -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions \
1618# -std=c99 -c ../my.c
1619# ld -d -warn-common -r -d -o my.kld my.o
1620# :> export_syms
1621# awk -f /usr/src/sys/modules/my/../../conf/kmod_syms.awk my.kld export_syms | xargs -J% objcopy % my.kld
1622# ld -Bsharable -d warn-commnon -o my.ko my.kld
1623#
1624# Note: @ -> /usr/src/sys and machine -> /usr/src/sys/i386/include
1625
1626## The location of the FreeBSD kernel source.
1627VBOX_FREEBSD_SRC ?= /usr/src/sys
1628## The FreeBSD /usr/include.
1629VBOX_FREEBSD_SYS_INCS ?= /usr/include
1630
1631TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1632TEMPLATE_VBOXR0DRV_LDTOOL = FREEBSDKMODLD
1633TEMPLATE_VBOXR0DRV_DEFS = _KERNEL KLD_MODULE IN_RING0 IN_RT_R0
1634TEMPLATE_VBOXR0DRV_INCS = \
1635 $(VBOX_FREEBSD_SRC) \
1636 $(VBOX_FREEBSD_SRC)/contrib/altq \
1637 $(VBOX_FREEBSD_SRC)/../include \
1638 $(VBOX_FREEBSD_SYS_INCS)
1639# omitting: -Wcast-qual, -Wredundant-decls
1640TEMPLATE_VBOXR0DRV_CFLAGS = \
1641 -Wall -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1642 -Wstrict-prototypes -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \
1643 -O2 -fformat-extensions -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
1644 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) \
1645 -nostdinc -std=c99
1646TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2
1647TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 "Port me to amd64 FreeBSD"
1648TEMPLATE_VBOXR0DRV_CXXFLAGS = -fno-exceptions -fno-rtti \
1649 -Wall -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1650 -O2 -fno-format-extensions -fno-strict-aliasing -fno-common -finline-limit=8000 \
1651 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) \
1652 -nostdinc
1653TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1654TEMPLATE_VBOXR0DRV_LDFLAGS = -d --warn-common
1655TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386_fbsd
1656TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 "Port me to amd64 FreeBSD"
1657
1658TOOL_FREEBSDKMODLD = FreeBSD kernel module linker.
1659# See kBuild/tools/GCC3.kmk for docs.
1660TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT = $(outbase).kld
1661TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
1662TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1663TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPORD =
1664define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
1665 @# Link intermediate .kld (a relocatable object).
1666 ld $(flags) -r -o $(outbase).kld $(objs) \
1667 $(foreach p,$(libpath), -L$(p))\
1668 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
1669 @# Strip non-exported symbols private and localize the exported ones.
1670 awk -f $(VBOX_FREEBSD_SRC)/conf/kmod_syms.awk $(outbase).kld $(if $(othersrc), $(othersrc),/dev/null) \
1671 | xargs -J% objcopy % $(outbase).kld
1672 @# Link the final .ko (a shared object).
1673 ld $(flags) -Bshareable -o $(out) $(outbase).kld
1674endef
1675
1676endif # FreeBSD
1677
1678ifdef VBOX_WITH_VBOXDRV
1679 ifndef TEMPLATE_VBOXR0DRV_TOOL
1680 $(warning Warning: VBox Build: Target $(BUILD_PLATFORM) is not officially supported!)
1681 endif
1682endif
1683
1684
1685
1686#
1687# Template for building R3 executables and static libraries which are linked into executables.
1688#
1689TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
1690TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
1691TEMPLATE_VBOXR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
1692TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
1693TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
1694ifeq ($(BUILD_TARGET),win)
1695 TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
1696 TEMPLATE_VBOXR3EXE_RCDEFS = \
1697 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1698 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1699 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1700 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1701 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1702 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1703 TEMPLATE_VBOXR3EXE_SDKS = WINPSDK
1704 ifdef VBOX_USE_VCC80
1705 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MD -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1706 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
1707 else
1708 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MD -W3 -wd4065 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1709 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -GZ
1710 endif
1711 TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
1712 TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
1713 TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1714 TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1715 TEMPLATE_VBOXR3EXE_LDFLAGS = \
1716 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1717 /DISALLOWLIB:libc.lib \
1718 /DISALLOWLIB:libcd.lib \
1719 /DISALLOWLIB:libcmt.lib \
1720 /DISALLOWLIB:libcmtd.lib \
1721 /DISALLOWLIB:msvcrtd.lib
1722 TEMPLATE_VBOXR3EXE_LIBS = \
1723 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1724 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1725 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib
1726 TEMPLATE_VBOXR3EXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1727
1728else # the gcc guys
1729TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
1730TEMPLATE_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)
1731TEMPLATE_VBOXR3EXE_CXXFLAGS.x86 = -m32
1732TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64 = -m64
1733# L4 currently can't handle exception handling.
1734TEMPLATE_VBOXR3EXE_CXXFLAGS.l4 = -fno-exceptions -nostdinc \
1735 $(addprefix -I,$(VBOX_PATH_GCC_INCS) $(L4_INCDIR) $(FILE_TOOL_GPP3_INCDIR)) \
1736 $(DEBUG_L4)
1737TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
1738TEMPLATE_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)
1739TEMPLATE_VBOXR3EXE_CFLAGS.x86 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.x86)
1740TEMPLATE_VBOXR3EXE_CFLAGS.amd64 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64)
1741TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1742TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1743TEMPLATE_VBOXR3EXE_CFLAGS.darwin = -fno-common
1744TEMPLATE_VBOXR3EXE_CFLAGS.l4 = -nostdinc \
1745 $(addprefix -I,$(VBOX_PATH_GCC_INCS) $(L4_INCDIR)) $(DEBUG_L4)
1746TEMPLATE_VBOXR3EXE_DEFS.l4 = L4_THREAD_SAFE
1747TEMPLATE_VBOXR3EXE_LDFLAGS.x86 = -m32
1748TEMPLATE_VBOXR3EXE_LDFLAGS.amd64 = -m64
1749TEMPLATE_VBOXR3EXE_LDFLAGS.l4 = \
1750 $(L4_LIBDIR)/../crt0.o \
1751 -T$(L4_LIBDIR)/../main_dyn.ld -nostdlib \
1752 -Wl,--export-dynamic,--dynamic-linker=libld-l4.s.so \
1753 -Wl,--rpath-link,$(L4_LIBDIR)
1754TEMPLATE_VBOXR3EXE_LDFLAGS.linux = -Wl,-z,noexecstack $(VBOX_LD_as_needed)
1755 ifeq ($(BUILD_TARGET),linux)
1756TEMPLATE_VBOXR3EXE_LIBS = pthread m rt dl
1757 else ifeq ($(BUILD_TARGET),l4)
1758TEMPLATE_VBOXR3EXE_LIBS = \
1759 $(L4_LIBDIR)/libvboxserver.s.so \
1760 $(L4_LIBDIR)/libuc++.0.s.so \
1761 supc++ gcc_eh gcc \
1762 $(L4_LIBDIR)/libdl.s.so \
1763 $(L4_LIBDIR)/libuc.0.s.so
1764 else ifeq ($(BUILD_TARGET),os2)
1765TEMPLATE_VBOXR3EXE_TOOL = GXX3OMF
1766TEMPLATE_VBOXR3EXE_LIBS = socket iconv
1767 else ifeq ($(BUILD_TARGET),darwin)
1768TEMPLATE_VBOXR3EXE_TOOL = GXX4MACHO
1769TEMPLATE_VBOXR3EXE_LIBS =
1770TEMPLATE_VBOXR3EXE_LDFLAGS = -read_only_relocs suppress
1771TEMPLATE_VBOXR3EXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1772 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1773TEMPLATE_VBOXR3EXE_TOOL = GXX3
1774TEMPLATE_VBOXR3EXE_LIBS = pthread
1775TEMPLATE_VBOXR3EXE_INCS += \
1776 /usr/include \
1777 /usr/X11R6/include \
1778 /usr/local/include
1779 else ifeq ($(BUILD_TARGET),solaris)
1780TEMPLATE_VBOXR3EXE_TOOL = GXX3PLAIN
1781TEMPLATE_VBOXR3EXE_DEFS += LIBICONV_PLUG _REENTRANT # Avoid the GNU libiconv, for now at least.
1782TEMPLATE_VBOXR3EXE_LIBS = rt socket
1783 else
1784$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1785TEMPLATE_VBOXR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.release)
1786TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease)
1787 endif
1788endif
1789
1790#
1791# Template for building R3 shared objects / DLLs.
1792# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
1793#
1794TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
1795TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
1796TEMPLATE_VBOXR3_LDFLAGS.l4 = $(L4_LIBDIR)/../crt0.s.o -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
1797TEMPLATE_VBOXR3_DEFS.l4 = $(TEMPLATE_VBOXR3EXE_DEFS.l4) __PIC__
1798TEMPLATE_VBOXR3_DEFS.darwin = $(TEMPLATE_VBOXR3EXE_DEFS.darwin) PIC
1799ifeq ($(filter-out solaris.x86 %.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
1800 ifneq ($(BUILD_TARGET),win)
1801 TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
1802 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
1803 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
1804 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
1805 endif
1806endif
1807
1808#
1809# Ring-3 testcase.
1810# This is the VBOXR3EXE template only with a different install dir.
1811#
1812TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
1813TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
1814TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
1815TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
1816ifeq ($(BUILD_TARGET),win)
1817 ifdef VBOX_SIGNING_MODE
1818 TEMPLATE_VBOXR3TSTEXE_POST_CMDS =
1819 endif
1820endif
1821
1822#
1823# Template for the CppUnit kind of testcases.
1824#
1825TEMPLATE_VBOXCPPUNITEXE = VBox CppUnit Testcase Exe
1826TEMPLATE_VBOXCPPUNITEXE_EXTENDS = VBOXR3TSTEXE
1827## @todo make a CPPUNIT SDK and add cppunit tools packages for windows, mac, solaris and OS/2.
1828#TEMPLATE_VBOXCPPUNITEXE_SDKS = CPPUNIT -
1829TEMPLATE_VBOXCPPUNITEXE_LIBS = \
1830 $(TEMPLATE_VBOXR3TSTEXE_LIBS) \
1831 cppunit
1832
1833#
1834# Template for building bad C/C++ style R3 executables (no -pedantic).
1835#
1836TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
1837TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
1838ifneq ($(BUILD_TARGET),win)
1839 # (only gcc)
1840 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
1841 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
1842 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3EXE_CFLAGS))
1843endif
1844
1845#
1846# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
1847# This is mostly identical to the VBOXR3NPEXE template.
1848#
1849TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
1850TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3NPEXE
1851TEMPLATE_VBOXR3NP_LDFLAGS.l4 = \
1852 $(L4_LIBDIR)/../crt0.s.o \
1853 -T$(L4_LIBDIR)/../main_rel.ld \
1854 -nostdlib
1855TEMPLATE_VBOXR3NP_DEFS.l4 = $(TEMPLATE_VBOXR3NPEXE_DEFS.l4) __PIC__
1856ifeq ($(filter-out solaris.x86 %.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
1857 ifneq ($(BUILD_TARGET),win)
1858 TEMPLATE_VBOXR3NP_DEFS = $(TEMPLATE_VBOXR3NPEXE_DEFS) PIC
1859 TEMPLATE_VBOXR3NP_CFLAGS = $(TEMPLATE_VBOXR3NPEXE_CFLAGS) -fPIC
1860 TEMPLATE_VBOXR3NP_CXXFLAGS = $(TEMPLATE_VBOXR3NPEXE_CXXFLAGS) -fPIC
1861 TEMPLATE_VBOXR3NP_LDFLAGS = $(TEMPLATE_VBOXR3NPEXE_LDFLAGS) -fPIC
1862 endif
1863endif
1864
1865
1866#
1867# Template for building libraries, shared libraries / modules
1868# which only depends on IPRT for crt.
1869#
1870TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
1871TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
1872TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
1873TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno -Wall
1874TEMPLATE_VBOXNOCRTGCC_CFLAGS.x86 = -m32
1875TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -m64 -mcmodel=medium -fno-common
1876TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
1877TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1878TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1879ifdef VBOX_TARGET_MAC_OS_X_VERSION_10_5 ## @todo this probably works for 10.4 too, check.
1880 TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -static
1881else
1882 TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -mdynamic-no-pic
1883endif
1884TEMPLATE_VBOXNOCRTGCC_CXXFLAGS = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS)
1885TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(BUILD_TARGET) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(BUILD_TARGET))
1886TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(BUILD_TARGET_ARCH) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(BUILD_TARGET_ARCH))
1887TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
1888
1889ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.amd64)
1890 # cross compile to 64-bit ELF (linux).
1891 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
1892 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
1893 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
1894 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
1895 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1896
1897else ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1898 # Use the default GCC (MinGW) with the Microsoft linker.
1899 # (Drop all '-g' options as we're unable to strip the debug info.)
1900 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1901 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1902 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1903 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
1904 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
1905 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1906 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
1907
1908else
1909 # Use the default GCC.
1910 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
1911 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1912 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1913 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1914 TEMPLATE_VBOXNOCRTGCC_CFLAGS += $(VBOX_GCC_fno-stack-protector)
1915 TEMPLATE_VBOXNOCRTGCC_CXXFLAGS += $(VBOX_GCC_fno-stack-protector)
1916 ifeq ($(BUILD_TARGET_ARCH),amd64)
1917 # in 64-bit mode we'll build a sys-module (VBoxREM2).
1918 if1of ($(BUILD_TARGET),darwin solaris)
1919 TEMPLATE_VBOXNOCRTGCC_LDFLAGS.solaris= -64 -r
1920 else
1921 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1922 endif
1923 else # x86:
1924 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1925 ifneq ($(filter-out os2 darwin solaris,$(BUILD_TARGET)),)
1926 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
1927 endif
1928 endif # x86
1929 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
1930endif
1931
1932
1933#
1934# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
1935#
1936TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
1937TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
1938TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
1939ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1940 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
1941else
1942 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
1943endif
1944TEMPLATE_VBOXNOCRTGAS_ASFLAGS.x86 = -m32
1945TEMPLATE_VBOXNOCRTGAS_ASFLAGS.amd64 = -m64
1946
1947
1948#
1949# Template for building executables that are part of the VBox Main component
1950# (COM/XPCOM interface to VirtualBox).
1951#
1952
1953TEMPLATE_VBOXMAINEXE = VBox Main Executable
1954TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
1955TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
1956TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE NDEBUG=1
1957TEMPLATE_VBOXMAINEXE_DEFS.win = _UNICODE
1958TEMPLATE_VBOXMAINEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
1959TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
1960TEMPLATE_VBOXMAINEXE_INCS = \
1961 $(VBOX_PATH_SDK)/include
1962
1963ifeq ($(BUILD_TARGET),win)
1964 TEMPLATE_VBOXMAINEXE_SDKS = WINPSDK W2K3DDK
1965 ifdef VBOX_USE_VCC80
1966 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
1967 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GF- -MD -EHsc -W3 -wd4065 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1968 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
1969 else
1970 TEMPLATE_VBOXMAINEXE_TOOL = VCC70
1971 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GX- -GF- -MD -EHsc -W3 -wd4065 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1972 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -GZ
1973 endif
1974 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
1975 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1976 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
1977 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1978 TEMPLATE_VBOXMAINEXE_INCS += \
1979 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1980 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
1981 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
1982 /DISALLOWLIB:libc.lib \
1983 /DISALLOWLIB:libcd.lib \
1984 /DISALLOWLIB:msvcrt.lib \
1985 /DISALLOWLIB:msvcrtd.lib \
1986 /DISALLOWLIB:libcmtd.lib \
1987 /DISALLOWLIB:libcmt.lib
1988 TEMPLATE_VBOXMAINEXE_LIBS = \
1989 $(LIB_RUNTIME) \
1990 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1991 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1992 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1993 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1994 TEMPLATE_VBOXMAINEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1995
1996else # the GCC guys:
1997
1998TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
1999TEMPLATE_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)
2000TEMPLATE_VBOXMAINEXE_CXXFLAGS.x86 = -m32
2001TEMPLATE_VBOXMAINEXE_CXXFLAGS.amd64 = -m64
2002TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
2003TEMPLATE_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)
2004TEMPLATE_VBOXMAINEXE_CFLAGS.x86 = -m32
2005TEMPLATE_VBOXMAINEXE_CFLAGS.amd64 = -m64
2006TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
2007TEMPLATE_VBOXMAINEXE_LDFLAGS.x86 = -m32
2008TEMPLATE_VBOXMAINEXE_LDFLAGS.amd64 = -m64
2009 ifeq ($(BUILD_TARGET),linux)
2010TEMPLATE_VBOXMAINEXE_LIBS = pthread m rt $(LIB_RUNTIME)
2011TEMPLATE_VBOXMAINEXE_LDFLAGS.linux = $(VBOX_LD_as_needed)
2012 else ifeq ($(BUILD_TARGET),l4)
2013TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
2014# no libs as yet in l4 target - must be added later
2015 else ifeq ($(BUILD_TARGET),os2)
2016TEMPLATE_VBOXMAINEXE_TOOL = GXX3OMF
2017TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
2018 else ifeq ($(BUILD_TARGET),darwin)
2019TEMPLATE_VBOXMAINEXE_TOOL = GXX4MACHO
2020TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
2021TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin = -bind_at_load -framework Carbon
2022 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
2023TEMPLATE_VBOXMAINEXE_TOOL = GXX3
2024TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
2025TEMPLATE_VBOXMAINEXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
2026 else ifeq ($(BUILD_TARGET),solaris)
2027TEMPLATE_VBOXMAINEXE_TOOL = GXX3PLAIN
2028TEMPLATE_VBOXMAINEXE_DEFS += _REENTRANT
2029TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt
2030 else
2031$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
2032TEMPLATE_VBOXMAINEXE_LIBS =
2033 endif
2034
2035endif # !win
2036
2037# Add COM/XPCOM stuff
2038TEMPLATE_VBOXMAINEXE_LIBS += \
2039 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
2040ifdef VBOX_WITH_XPCOM
2041 ## @todo may be worth creating the VBOX_XPCOM SDK def
2042 TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
2043 TEMPLATE_VBOXMAINEXE_INCS += \
2044 $(VBOX_XPCOM_INCS)
2045 TEMPLATE_VBOXMAINEXE_LIBS += \
2046 $(LIB_XPCOM)
2047endif
2048
2049#
2050# Template for building the Main DLL modules (such as in-process COM/XPCOM
2051# components for Main).
2052#
2053# This differs from VBOXMAINEXE only in PIC handling and similar DLL stuff.
2054#
2055
2056TEMPLATE_VBOXMAINDLL = VBox Main Component (shared library)
2057TEMPLATE_VBOXMAINDLL_EXTENDS = VBOXMAINEXE
2058ifeq ($(filter-out solaris.x86 %.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
2059 ifneq ($(BUILD_TARGET),win)
2060 TEMPLATE_VBOXMAINDLL_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
2061 TEMPLATE_VBOXMAINDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
2062 TEMPLATE_VBOXMAINDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
2063 TEMPLATE_VBOXMAINDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
2064 endif
2065endif
2066TEMPLATE_VBOXMAINDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin))
2067
2068#
2069# Template for building the Main static libraries.
2070#
2071# This differs from VBOXMAINDLL only that it zeroes out the _LIBS definition.
2072#
2073
2074TEMPLATE_VBOXMAINLIB = VBox Main Component (static library)
2075TEMPLATE_VBOXMAINLIB_EXTENDS = VBOXMAINDLL
2076TEMPLATE_VBOXMAINLIB_LIBS =
2077
2078#
2079# Template for building executables that use the VBox Main component.
2080#
2081
2082TEMPLATE_VBOXMAINCLIENTEXE = VBox Main Client (executable)
2083TEMPLATE_VBOXMAINCLIENTEXE_EXTENDS = VBOXMAINEXE
2084ifeq ($(BUILD_TARGET),win)
2085 TEMPLATE_VBOXMAINCLIENTEXE_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
2086 $(PATH_SDK_WINPSDK_LIB)/User32.Lib \
2087 $(PATH_SDK_WINPSDK_LIB)/Shell32.Lib \
2088 $(PATH_SDK_WINPSDK_LIB)/ShLwApi.Lib \
2089 $(PATH_SDK_WINPSDK_LIB)/Ole32.Lib \
2090 $(PATH_SDK_WINPSDK_LIB)/OleAut32.Lib \
2091 $(PATH_SDK_WINPSDK_LIB)/Uuid.Lib
2092else
2093 TEMPLATE_VBOXMAINCLIENTEXE_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
2094 NDEBUG TRIMMED
2095 TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
2096 -pthread
2097 TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin = $(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin) \
2098 -bind_at_load -framework Carbon
2099endif
2100
2101#
2102# Template for building shared libraries / DLLs that use the VBox Main component.
2103#
2104# This differs from VBOXMAINCLIENTEXE only in PIC handling and similar DLL stuff.
2105#
2106
2107TEMPLATE_VBOXMAINCLIENTDLL = VBox MAIN Client (shared library)
2108TEMPLATE_VBOXMAINCLIENTDLL_EXTENDS = VBOXMAINCLIENTEXE
2109ifeq ($(filter-out solaris.x86 %.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
2110 ifneq ($(BUILD_TARGET),win)
2111 TEMPLATE_VBOXMAINCLIENTDLL_DEFS = PIC $(TEMPLATE_VBOXMAINCLIENTEXE_DEFS)
2112 TEMPLATE_VBOXMAINCLIENTDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CFLAGS)
2113 TEMPLATE_VBOXMAINCLIENTDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS)
2114 TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)
2115 endif
2116endif
2117TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin))
2118
2119
2120#
2121# Template for building Qt GUI executables.
2122#
2123
2124TEMPLATE_VBOXQTGUIEXE = VBox Qt GUI Executable
2125TEMPLATE_VBOXQTGUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS)
2126TEMPLATE_VBOXQTGUIEXE_INCS = \
2127 $(VBOX_PATH_SDK)/include \
2128 $(VBOX_PATH_QT)/include
2129
2130ifeq ($(BUILD_TARGET),win)
2131 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_VCC_TOOL)
2132 TEMPLATE_VBOXQTGUIEXE_DEFS += \
2133 _WIN32_WINNT=0x0500 UNICODE _UNICODE \
2134 QT_DLL _CRT_SECURE_NO_DEPRECATE
2135 ## @todo VCC70 flags?
2136 ifdef VBOX_USE_VCC80
2137 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
2138 -nologo -Zm200 -W3 -MD -Zi -EHsc -Zc:wchar_t-
2139 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu
2140 else
2141 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
2142 -nologo -Zm200 -W3 -MD -Zi -GX
2143 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -GZ
2144 endif
2145 TEMPLATE_VBOXQTGUIEXE_INCS += \
2146 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
2147 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = \
2148 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
2149 /DELAYLOAD:oleaut32.dll
2150 TEMPLATE_VBOXQTGUIEXE_SDKS = WINPSDK
2151 TEMPLATE_VBOXQTGUIEXE_LIBS = \
2152 $(LIB_QT) \
2153 $(LIB_QTMAIN) \
2154 $(LIB_RUNTIME) \
2155 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
2156 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
2157 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
2158 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
2159 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
2160 TEMPLATE_VBOXQTGUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2161
2162else # the gcc guys:
2163 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_GCC_TOOL)
2164 TEMPLATE_VBOXQTGUIEXE_DEFS.linux = _REENTRANT
2165 TEMPLATE_VBOXQTGUIEXE_DEFS.solaris = _REENTRANT
2166
2167 TEMPLATE_VBOXQTGUIEXE_INCS += \
2168 $(LIB_SDL_INC)
2169 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
2170 -pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
2171 -Wno-long-long -fshort-wchar -fno-strict-aliasing \
2172 $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
2173 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.x86 = -m32
2174 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.amd64 = -m64
2175 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -pthread
2176 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.x86 = -m32
2177 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.amd64 = -m64
2178 ## @todo no $(LIB_QTMAIN) here?
2179 TEMPLATE_VBOXQTGUIEXE_LIBS = \
2180 $(LIB_QT) \
2181 $(LIB_SDL) \
2182 $(LIB_RUNTIME) \
2183 $(LIB_REM) \
2184 $(LIB_VMM)
2185
2186 ifeq ($(BUILD_TARGET_ARCH),amd64)
2187 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
2188 $(VBOX_PATH_QT)/lib64 $(VBOX_PATH_QT)/lib
2189 else
2190 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
2191 $(VBOX_PATH_QT)/lib
2192 endif
2193
2194 ifeq ($(BUILD_TARGET),linux)
2195 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += $(VBOX_LD_as_needed)
2196 else ifeq ($(BUILD_TARGET),darwin)
2197 TEMPLATE_VBOXQTGUIEXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
2198 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -framework Carbon -framework QuickTime -bind_at_load
2199 TEMPLATE_VBOXQTGUIEXE_LIBS +=
2200 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
2201 else ifeq ($(BUILD_TARGET),os2)
2202 TEMPLATE_VBOXQTGUIEXE_LIBS +=
2203 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
2204 else
2205 TEMPLATE_VBOXQTGUIEXE_INCS += \
2206 $(VBOX_XCURSOR_INCS)
2207 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2208 $(VBOX_XCURSOR_LIBS) \
2209 Xext \
2210 X11 \
2211 m \
2212 $(LIB_PTHREAD)
2213 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \
2214 $(VBOX_LIBPATH_X11)
2215 ifeq ($(BUILD_TARGET),freebsd)
2216 TEMPLATE_VBOXQTGUIEXE_INCS += \
2217 /usr/include \
2218 /usr/X11R6/include \
2219 /usr/local/include
2220 endif
2221 ifeq ($(BUILD_TARGET),solaris)
2222 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2223 rt socket nsl
2224 endif
2225 endif
2226
2227endif
2228
2229# Add COM/XPCOM stuff
2230TEMPLATE_VBOXQTGUIEXE_LIBS += \
2231 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
2232ifdef VBOX_WITH_XPCOM
2233 ## @todo may be worth creating the VBOX_XPCOM SDK def
2234 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM
2235 TEMPLATE_VBOXQTGUIEXE_INCS += \
2236 $(VBOX_XPCOM_INCS)
2237 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2238 $(LIB_XPCOM)
2239endif
2240
2241#
2242# Template for building Qt GUI components.
2243#
2244TEMPLATE_VBOXQTGUI = VBox Qt GUI Components
2245TEMPLATE_VBOXQTGUI_EXTENDS = VBOXQTGUIEXE
2246TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN) $(PATH_BIN)/VBoxXML$(VBOX_SUFF_DLL),$(TEMPLATE_VBOXQTGUIEXE_LIBS))
2247ifeq ($(BUILD_TARGET),darwin)
2248 TEMPLATE_VBOXQTGUI_LDFLAGS = $(filter-out -framework Carbon -framework QuickTime -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS))
2249endif
2250ifeq ($(filter-out solaris.x86 %.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
2251 ifneq ($(BUILD_TARGET),win)
2252 TEMPLATE_VBOXQTGUI_DEFS = PIC $(TEMPLATE_VBOXQTGUIEXE_DEFS)
2253 TEMPLATE_VBOXQTGUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CFLAGS)
2254 TEMPLATE_VBOXQTGUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS)
2255 TEMPLATE_VBOXQTGUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_LDFLAGS)
2256 endif
2257endif
2258
2259
2260#
2261# Template for building build bldprogs.
2262#
2263TEMPLATE_VBOXBLDPROG = VBox Build Program
2264TEMPLATE_VBOXBLDPROG_DEFS = IN_RING3
2265ifeq ($(BUILD_PLATFORM),win)
2266 ifeq ($(BUILD_PLATFORM_ARCH),x86)
2267 ifdef VBOX_USE_VCC80
2268 TEMPLATE_VBOXBLDPROG_TOOL = VCC80X86
2269 else
2270 TEMPLATE_VBOXBLDPROG_TOOL = VCC70
2271 endif
2272 TEMPLATE_VBOXBLDPROG_SDKS = WIN32SDK
2273 else
2274 TEMPLATE_VBOXBLDPROG_TOOL = VCC80AMD64
2275 TEMPLATE_VBOXBLDPROG_SDKS = WIN64SDK
2276 endif
2277 ifneq ($(TEMPLATE_VBOXBLDPROG_TOOL),VCC70)
2278 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -W3 -wd4996 -Zc:wchar_t-
2279 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -RTCsu
2280 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -Oy- -GS-
2281 else
2282 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -W3
2283 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -GZ
2284 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -Ogitb2 -Oy-
2285 endif
2286 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2287 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2288 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
2289 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
2290 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2291 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
2292 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
2293 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
2294 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
2295 /DISALLOWLIB:libcd.lib \
2296 /DISALLOWLIB:libcmtd.lib \
2297 /DISALLOWLIB:msvcrt.lib \
2298 /DISALLOWLIB:msvcrtd.lib \
2299 /DISALLOWLIB:msvcprt.lib \
2300 /DISALLOWLIB:msvcprtd.lib
2301 TEMPLATE_VBOXBLDPROG_LIBS = \
2302 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
2303 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt.lib \
2304 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt.lib
2305
2306else
2307# (gcc of some kind )
2308TEMPLATE_VBOXBLDPROG_TOOL = GXX3
2309TEMPLATE_VBOXBLDPROG_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
2310TEMPLATE_VBOXBLDPROG_CFLAGS.x86 = -m32
2311TEMPLATE_VBOXBLDPROG_CFLAGS.amd64 = -m64
2312TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2313TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
2314TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
2315TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe
2316TEMPLATE_VBOXBLDPROG_CXXFLAGS.x86 = -m32
2317TEMPLATE_VBOXBLDPROG_CXXFLAGS.amd64 = -m64
2318TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2319TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2320TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2321TEMPLATE_VBOXBLDPROG_LDFLAGS.x86 = -m32
2322TEMPLATE_VBOXBLDPROG_LDFLAGS.amd64 = -m64
2323 ifeq ($(BUILD_PLATFORM),linux)
2324TEMPLATE_VBOXBLDPROG_LIBS = pthread m rt dl
2325 else ifeq ($(BUILD_PLATFORM),os2)
2326TEMPLATE_VBOXBLDPROG_TOOL = GXX3OMF
2327TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
2328 else ifeq ($(BUILD_PLATFORM),darwin)
2329TEMPLATE_VBOXBLDPROG_TOOL = GXX4MACHO
2330TEMPLATE_VBOXBLDPROG_LIBS =
2331TEMPLATE_VBOXBLDPROG_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
2332 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_PLATFORM)),)
2333TEMPLATE_VBOXBLDPROG_TOOL = GXX3
2334TEMPLATE_VBOXBLDPROG_LIBS =
2335 else ifeq ($(BUILD_PLATFORM),solaris)
2336TEMPLATE_VBOXBLDPROG_TOOL = GXX3PLAIN
2337TEMPLATE_VBOXBLDPROG_LIBS = rt
2338 else
2339$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
2340 endif
2341
2342endif # !win
2343
2344
2345
2346#
2347# Template for building R3 win32 guest additions.
2348#
2349TEMPLATE_VBOXW32GUESTR3 = VBox Win32 Guest Program
2350TEMPLATE_VBOXW32GUESTR3_INST = $(INST_ADDITIONS)
2351TEMPLATE_VBOXW32GUESTR3_BLD_TRG = win
2352TEMPLATE_VBOXW32GUESTR3_BLD_TRG_ARCH = x86
2353TEMPLATE_VBOXW32GUESTR3_BLD_TRG_CPU = i386
2354TEMPLATE_VBOXW32GUESTR3_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 IN_RT_R3 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
2355TEMPLATE_VBOXW32GUESTR3_RCDEFS = \
2356 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
2357 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
2358 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
2359 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
2360 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
2361 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
2362TEMPLATE_VBOXW32GUESTR3_ASTOOL = YASM
2363TEMPLATE_VBOXW32GUESTR3_ASFLAGS = -f win32 -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
2364TEMPLATE_VBOXW32GUESTR3_DLLSUFF = .dll
2365TEMPLATE_VBOXW32GUESTR3_EXESUFF = .exe
2366TEMPLATE_VBOXW32GUESTR3_LIBSUFF = .lib
2367TEMPLATE_VBOXW32GUESTR3_ARLIBSUFF = .lib
2368TEMPLATE_VBOXW32GUESTR3_SDKS = WIN32SDK W2K3DDKX86
2369ifdef VBOX_USE_VCC80
2370 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC80X86
2371 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
2372 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -RTCsu
2373 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -O2 -Oy- -GS-
2374else
2375 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC70
2376 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -U__LINUX__ -U__OS2__ -W3
2377 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -GZ
2378 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -Ogitb2 -Oy-
2379endif
2380TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2381TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2382TEMPLATE_VBOXW32GUESTR3_CFLAGS = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS)
2383TEMPLATE_VBOXW32GUESTR3_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug)
2384TEMPLATE_VBOXW32GUESTR3_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2385TEMPLATE_VBOXW32GUESTR3_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile)
2386TEMPLATE_VBOXW32GUESTR3_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile)
2387TEMPLATE_VBOXW32GUESTR3_INCS = \
2388 $(VBOX_PATH_SDK)/include
2389TEMPLATE_VBOXW32GUESTR3_LDFLAGS = \
2390 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE \
2391 /DISALLOWLIB:libc.lib \
2392 /DISALLOWLIB:libcd.lib \
2393 /DISALLOWLIB:msvcrt.lib \
2394 /DISALLOWLIB:libcmtd.lib \
2395 /DISALLOWLIB:msvcrtd.lib
2396ifdef VBOX_USE_VCC80
2397 TEMPLATE_VBOXW32GUESTR3_LIBS = \
2398 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib \
2399 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
2400 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
2401else
2402 TEMPLATE_VBOXW32GUESTR3_LIBS = \
2403 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \
2404 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
2405 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
2406endif
2407TEMPLATE_VBOXW32GUESTR3_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2408
2409#
2410# R3 win32 guest libraries
2411#
2412TEMPLATE_VBOXW32GUESTR3LIB = VBox Win32 Guest User Libraries
2413TEMPLATE_VBOXW32GUESTR3LIB_EXTENDS = VBOXW32GUESTR3
2414TEMPLATE_VBOXW32GUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
2415
2416
2417#
2418# Template for building R0 win32 guest tools.
2419#
2420TEMPLATE_VBOXW32GUESTR0 = VBox Win32 Guest Driver
2421TEMPLATE_VBOXW32GUESTR0_INST = $(INST_ADDITIONS)
2422TEMPLATE_VBOXW32GUESTR0_BLD_TRG = win
2423TEMPLATE_VBOXW32GUESTR0_BLD_TRG_ARCH = x86
2424TEMPLATE_VBOXW32GUESTR0_BLD_TRG_CPU = i386
2425TEMPLATE_VBOXW32GUESTR0_DEFS = _X86_ IN_GUEST IN_GUEST_R0 IN_RING0 IN_RT_R0 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
2426TEMPLATE_VBOXW32GUESTR0_RCDEFS = \
2427 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
2428 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
2429 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
2430 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
2431 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
2432 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
2433TEMPLATE_VBOXW32GUESTR0_ASTOOL = YASM
2434TEMPLATE_VBOXW32GUESTR0_ASFLAGS = -f win32 -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
2435TEMPLATE_VBOXW32GUESTR0_SYSSUFF = .sys
2436ifdef VBOX_USE_VCC80
2437 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC80X86
2438 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -U__LINUX__ -W3 -wd4996 -Zc:wchar_t-
2439 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -EHs-c- -Zl
2440 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -O2 -Oy-
2441else
2442 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC70
2443 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -U__LINUX__ -W3
2444 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -GX- -Zl
2445 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -Ogitb2 -Oy-
2446endif
2447TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2448TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2449TEMPLATE_VBOXW32GUESTR0_CFLAGS = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS)
2450TEMPLATE_VBOXW32GUESTR0_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug)
2451TEMPLATE_VBOXW32GUESTR0_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2452TEMPLATE_VBOXW32GUESTR0_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile)
2453TEMPLATE_VBOXW32GUESTR0_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile)
2454TEMPLATE_VBOXW32GUESTR0_LDFLAGS = \
2455 -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Machine:X86 -Debug \
2456 /DISALLOWLIB:libcd.lib \
2457 /DISALLOWLIB:msvcrt.lib \
2458 /DISALLOWLIB:msvcrtd.lib \
2459 /DISALLOWLIB:libcmtd.lib
2460TEMPLATE_VBOXW32GUESTR0_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
2461
2462#
2463# R0 win32 guest libraries
2464#
2465TEMPLATE_VBOXW32GUESTR0LIB = VBox Win32 Guest Driver
2466TEMPLATE_VBOXW32GUESTR0LIB_EXTENDS = VBOXW32GUESTR0
2467TEMPLATE_VBOXW32GUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
2468
2469
2470#
2471# Windows rc workaround for crosscompiling.
2472# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
2473#
2474ifneq ($(BUILD_PLATFORM),win)
2475 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2476 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2477 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2478 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
2479else
2480 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
2481 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
2482 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
2483 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
2484 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
2485 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
2486 ) Sorry_Cannot_find_mc_in_the_PSDK)
2487endif
2488
2489
2490#
2491# Template for syntax checking the linux guest additions.
2492# Not properly realized yet.
2493#
2494TEMPLATE_VBOXLNX32GUESTR0 = Template for *syntax checking* linux guest additions kernel modules
2495TEMPLATE_VBOXLNX32GUESTR0_TOOL = $(VBOX_GCC_TOOL)
2496TEMPLATE_VBOXLNX32GUESTR0_BLD_TRG = linux
2497TEMPLATE_VBOXLNX32GUESTR0_DEFS = __KERNEL__ MODULE IN_GUEST IN_GUEST_R0 IN_RING0 IN_RT_R0
2498TEMPLATE_VBOXLNX32GUESTR0_INCS = $(VBOX_LINUX_INCS)
2499TEMPLATE_VBOXLNX32GUESTR0_CFLAGS = -nostdinc -iwithprefix include \
2500 -O2 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
2501 $(VBOX_GCC_fno-stack-protector) -fno-strict-aliasing -fno-common \
2502 -mpreferred-stack-boundary=2 -msoft-float
2503TEMPLATE_VBOXLNX32GUESTR0_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXLNX32GUESTR0_CFLAGS)) -fno-exceptions -fno-rtti
2504ifndef VBOX_LINUX_VERSION_2_4
2505# 2.6
2506TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .ko
2507TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -m elf_i386 -r
2508else
2509# 2.4
2510TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .o
2511TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -r -s
2512endif
2513
2514
2515#
2516# Templates for building 32-bit linux guest additions.
2517#
2518
2519TEMPLATE_VBOXLNX32GUESTR3EXE = Template for building 32-bit linux guest additions programs.
2520TEMPLATE_VBOXLNX32GUESTR3EXE_INST = $(INST_ADDITIONS)
2521TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG = linux
2522TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_ARCH = x86
2523TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_CPU = i386
2524TEMPLATE_VBOXLNX32GUESTR3EXE_TOOL = $(VBOX_GCC32_TOOL)
2525TEMPLATE_VBOXLNX32GUESTR3EXE_ASTOOL = YASM
2526TEMPLATE_VBOXLNX32GUESTR3EXE_ASFLAGS = -f elf32 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels
2527TEMPLATE_VBOXLNX32GUESTR3EXE_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 HC_ARCH_BITS=32 GC_ARCH_BITS=32
2528TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe $(VBOX_GCC_fno-stack-protector)
2529TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2530TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2531TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2532TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.release = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2533TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug)
2534TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile)
2535TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile)
2536TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_fno-stack-protector)
2537# No LDFLAGS nor LIBS!
2538
2539TEMPLATE_VBOXLNX32GUESTR3EXENOCPP = Template for building 32-bit linux guest additions programs without any C++.
2540TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2541TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_TOOL := $(subst GXX,GCC,$(VBOX_GCC32_TOOL))
2542# No LDFLAGS nor LIBS!
2543
2544TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP = Template for building 32-bit linux guest additions shared objects without any C++.
2545TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2546TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_TOOL = $(TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_TOOL)
2547TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS)
2548TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS)
2549TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDFLAGS = -fPIC
2550
2551TEMPLATE_VBOXLNX32GUESTR3LIB = Template for building 32-bit linux guest additions libraries.
2552TEMPLATE_VBOXLNX32GUESTR3LIB_EXTENDS = VBOXLNX32GUESTR3EXE
2553TEMPLATE_VBOXLNX32GUESTR3LIB_INST = $(INST_ADDITION_LIB)
2554
2555
2556
2557
2558ifdef VBOX_WITH_OS2_ADDITIONS
2559
2560#
2561# Template for building R3 OS/2 guest additions.
2562#
2563TEMPLATE_VBOXOS2GUESTR3 = VBox OS/2 Guest Programs and DLLs
2564TEMPLATE_VBOXOS2GUESTR3_INST = $(INST_ADDITIONS)os2/
2565TEMPLATE_VBOXOS2GUESTR3_BLD_TRG = os2
2566TEMPLATE_VBOXOS2GUESTR3_BLD_TRG_ARCH = x86
2567TEMPLATE_VBOXOS2GUESTR3_BLD_TRG_CPU = blend
2568TEMPLATE_VBOXOS2GUESTR3_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 IN_RT_R3 HC_ARCH_BITS=32 GC_ARCH_BITS=32
2569TEMPLATE_VBOXOS2GUESTR3_ASTOOL = NASM
2570TEMPLATE_VBOXOS2GUESTR3_ASFLAGS = -f obj -DASM_FORMAT_OMF -D__NASM__ -w+orphan-labels -g
2571TEMPLATE_VBOXOS2GUESTR3_DLLSUFF = .dll
2572TEMPLATE_VBOXOS2GUESTR3_EXESUFF = .exe
2573TEMPLATE_VBOXOS2GUESTR3_LIBSUFF = .lib
2574TEMPLATE_VBOXOS2GUESTR3_ARLIBSUFF = .lib
2575TEMPLATE_VBOXOS2GUESTR3_TOOL = GXX3OMF
2576TEMPLATE_VBOXOS2GUESTR3_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -fno-strict-aliasing -fno-rtti -fno-exceptions
2577TEMPLATE_VBOXOS2GUESTR3_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -fno-strict-aliasing
2578ifneq ($(BUILD_TYPE),debug)
2579 TEMPLATE_VBOXOS2GUESTR3_CFLAGS += -O2 -fno-omit-frame-pointer
2580 TEMPLATE_VBOXOS2GUESTR3_CXXFLAGS += -O2 -fno-omit-frame-pointer
2581endif
2582TEMPLATE_VBOXOS2GUESTR3_INCS = \
2583 $(VBOX_PATH_SDK)/include
2584
2585#
2586# Template for building OS/2 guest R3 libraries.
2587#
2588TEMPLATE_VBOXOS2GUESTR3LIB = VBox OS/2 Guest Usermode Libraries
2589TEMPLATE_VBOXOS2GUESTR3LIB_EXTENDS = VBOXOS2GUESTR3
2590TEMPLATE_VBOXOS2GUESTR3LIB_INST = $(INST_ADDITIONS_LIB)os2/
2591
2592#
2593# Template for building OS/2 Guest R0 images.
2594#
2595TEMPLATE_VBOXOS2GUESTR0 = VBox OS/2 Guest Driver
2596TEMPLATE_VBOXOS2GUESTR0_INST = $(INST_ADDITIONS)os2/
2597TEMPLATE_VBOXOS2GUESTR0_BLD_TRG = os2
2598TEMPLATE_VBOXOS2GUESTR0_BLD_TRG_ARCH = x86
2599TEMPLATE_VBOXOS2GUESTR0_BLD_TRG_CPU = blend
2600TEMPLATE_VBOXOS2GUESTR0_DEFS = IN_RING0 IN_GUEST IN_GUEST_R0 IN_RT_R0 HC_ARCH_BITS=32 GC_ARCH_BITS=32 LOG_TO_BACKDOOR
2601TEMPLATE_VBOXOS2GUESTR0_SYSSUFF = .sys
2602TEMPLATE_VBOXOS2GUESTR0_ASTOOL = NASM
2603TEMPLATE_VBOXOS2GUESTR0_ASFLAGS = -f obj -DASM_FORMAT_OMF -D__NASM__ -w+orphan-labels -g
2604TEMPLATE_VBOXOS2GUESTR0_TOOL = GXX3OMF
2605TEMPLATE_VBOXOS2GUESTR0_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -fno-strict-aliasing -fno-rtti -fno-exceptions
2606TEMPLATE_VBOXOS2GUESTR0_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -fno-strict-aliasing
2607ifneq ($(BUILD_TYPE),debug)
2608 TEMPLATE_VBOXOS2GUESTR0_CFLAGS += -O2 -fno-omit-frame-pointer
2609 TEMPLATE_VBOXOS2GUESTR0_CXXFLAGS += -O2 -fno-omit-frame-pointer
2610endif
2611TEMPLATE_VBOXOS2GUESTR0_LIBS = $(VBOX_GCC_LIBGCC) ## @todo this isn't nice.
2612TEMPLATE_VBOXOS2GUESTR0_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
2613
2614#
2615# Template for building OS/2 Guest R0 libraries.
2616#
2617TEMPLATE_VBOXOS2GUESTR0LIB = VBox OS/2 Guest Driver Library
2618TEMPLATE_VBOXOS2GUESTR0LIB_EXTENDS = VBOXOS2GUESTR0
2619TEMPLATE_VBOXOS2GUESTR0LIB_INST = $(INST_ADDITIONS_LIB)os2/
2620
2621#
2622# OS/2 Guest Libraries.
2623#
2624VBOX_LIB_IPRT_OS2_GUEST_R0 = $(PATH_LIB)/additions/os2/RuntimeOS2GuestR0.lib
2625VBOX_LIB_IPRT_OS2_GUEST_R3 = $(PATH_LIB)/additions/os2/RuntimeOS2GuestR3.lib
2626VBOX_LIB_VBGL_OS2_R3 = $(PATH_LIB)/additions/os2/VBoxGuestR3LibOS2.lib
2627VBOX_LIB_VBGL_OS2_R0BASE = $(PATH_LIB)/additions/os2/VBoxGuestR0LibBaseOS2.lib
2628VBOX_LIB_VBGL_OS2_R0 = $(PATH_LIB)/additions/os2/VBoxGuestR0LibOS2.lib
2629
2630endif # VBOX_WITH_OS2_ADDITIONS
2631
2632
2633#
2634# Template for building R3 programs for the guest additions.
2635#
2636TEMPLATE_VBOXGUESTR3EXE = VBox Guest Program
2637TEMPLATE_VBOXGUESTR3EXE_EXTENDS = VBOXR3EXE
2638TEMPLATE_VBOXGUESTR3EXE_INST = $(INST_ADDITIONS)
2639TEMPLATE_VBOXGUESTR3EXE_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) IN_GUEST IN_GUEST_R3 IN_RT_R3
2640if1of ($(BUILD_TARGET),win)
2641 ## @todo make static TEMPLATE_VBOXGUESTR3EXE_LDFLAGS =
2642else
2643 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -static
2644endif
2645
2646#
2647# Template for building R3 (static) libraries for the guest additions.
2648#
2649TEMPLATE_VBOXGUESTR3LIB = VBox Guest User Libraries
2650TEMPLATE_VBOXGUESTR3LIB_EXTENDS = VBOXGUESTR3EXE
2651TEMPLATE_VBOXGUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
2652
2653#
2654# Template for building R0 drivers for the guest additions.
2655#
2656TEMPLATE_VBOXGUESTR0 = VBox Guest Driver
2657TEMPLATE_VBOXGUESTR0_EXTENDS = VBOXR0DRV
2658TEMPLATE_VBOXGUESTR0_SDKS.win.x86 = WIN32SDK W2K3DDKX86
2659TEMPLATE_VBOXGUESTR0_SDKS.win.amd64 = W2K3DDK WINPSDKINCS
2660TEMPLATE_VBOXGUESTR0_INST = $(INST_ADDITIONS)
2661TEMPLATE_VBOXGUESTR0_DEFS = $(TEMPLATE_VBOXR0DRV_DEFS) IN_GUEST IN_GUEST_R0
2662
2663#
2664# Template for building R0 libraries for the guest additions.
2665#
2666TEMPLATE_VBOXGUESTR0LIB = VBox Guest Driver Libraries
2667TEMPLATE_VBOXGUESTR0LIB_EXTENDS = VBOXGUESTR0
2668TEMPLATE_VBOXGUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
2669
2670## @todo X11?
2671
2672#
2673# Guest additions libraries.
2674#
2675VBOX_LIB_IPRT_GUEST_R3 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR3$(VBOX_SUFF_LIB)
2676VBOX_LIB_IPRT_GUEST_R0 = $(VBOX_PATH_ADDITIONS_LIB)/RuntimeGuestR0$(VBOX_SUFF_LIB)
2677VBOX_LIB_VBGL_R3 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3Lib$(VBOX_SUFF_LIB)
2678VBOX_LIB_VBGL_R0BASE = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0LibBase$(VBOX_SUFF_LIB)
2679VBOX_LIB_VBGL_R0 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR0Lib$(VBOX_SUFF_LIB)
2680
2681
2682
2683#
2684# Two targets to coordinate version number changes properly. Note that the
2685# only way to get a really consistent build is to run 'kmk' in the top-level
2686# directory. If you don't run it there, you get a consistent sub-tree only.
2687#
2688VBOX_VERSION_STAMP = $(PATH_OUT)/version-stamp-$(VBOX_VERSION_STRING)
2689VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
2690VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
2691
2692$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
2693 $(call MSG_GENERATE,,$@)
2694 $(QUIET)$(MKDIR) -p $(@D)
2695 $(QUIET)$(RM) -f $(wildcard $(PATH_OUT)/version-stamp-*)
2696 $(QUIET)$(APPEND) $@ $(VBOX_VERSION_STRING)
2697
2698$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
2699 $(call MSG_GENERATE,,$@)
2700 $(QUIET)$(MKDIR) -p $(@D)
2701 $(QUIET)$(RM) -f $@ $@.tmp
2702 $(QUIET)$(APPEND) $@.tmp '#ifndef ___version_generated_h___'
2703 $(QUIET)$(APPEND) $@.tmp '#define ___version_generated_h___'
2704 $(QUIET)$(APPEND) $@.tmp ''
2705 $(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)'
2706 $(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)'
2707 $(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)'
2708 $(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_STRING "$(VBOX_VERSION_STRING)"'
2709 $(QUIET)$(APPEND) $@.tmp ''
2710 $(QUIET)$(APPEND) $@.tmp '#endif'
2711 $(QUIET)$(MV) -f $@.tmp $@
2712
2713#
2714# Used for external makefiles which cannot include Config.kmk
2715#
2716$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
2717 $(call MSG_GENERATE,,$@)
2718 $(QUIET)$(RM) -f $@ $@.tmp
2719 $(QUIET)$(MKDIR) -p $(@D)
2720 $(QUIET)$(APPEND) $@.tmp 'VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)'
2721 $(QUIET)$(APPEND) $@.tmp 'VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)'
2722 $(QUIET)$(APPEND) $@.tmp 'VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)'
2723 $(QUIET)$(APPEND) $@.tmp 'VBOX_VERSION_STRING = $(VBOX_VERSION_STRING)'
2724 $(QUIET)$(MV) -f $@.tmp $@
2725
2726ifndef VBOX_OSE
2727ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # linux only, yea, right.
2728VBOX_LICENSE_SRC := $(PATH_ROOT)/doc/License.html
2729## @todo this can be done by sed alone. Why do we have to do this $(shell ) stuff in *all* make
2730# files btw? If this is really necessary, then just do it once for <insert deity of choice>'s sake.
2731VBOX_LICENSE_VER := $(shell grep Version $(VBOX_LICENSE_SRC)|sed -e 's/.*Version \([0-9.]*\),.*/\1/g')
2732VBOX_LICENSE_BIN := $(PATH_BIN)/License-$(VBOX_LICENSE_VER).html
2733
2734$(VBOX_LICENSE_BIN): $(VBOX_LICENSE_SRC)
2735 $(call MSG_GENERATE,,$@)
2736 $(QUIET)$(CP) $< $@
2737endif
2738endif
2739
2740
2741# Force building of the version header file as the first thing anywhere in
2742# the tree. This eliminates the need for manual dependencies on it.
2743## @todo there gotta be a better way of doing this.
2744Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2745Makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2746makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2747
2748
2749#
2750# Subversion tree revision.
2751#
2752# The VBOX_SVN_REV contains our best guess. Use svn info on the
2753# root of the treeto determin this it if .svn/entries is found,
2754# otherwise fall back on the Config.kmk revision.
2755#
2756SVN ?= svn$(HOSTSUFF_EXE)
2757VBOX_SVN_REV_KMK = $(PATH_OUT)/revision.kmk
2758ifndef VBOX_SVN_REV
2759 VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 6076 $ )
2760 VBOX_SVN_DEP := $(wildcard $(PATH_ROOT)/.svn/entries)
2761 ifeq ($(which $(SVN)),)
2762 VBOX_SVN_DEP :=
2763 endif
2764
2765# Rule for generating a timestamp and updating the real thing on change.
2766$(VBOX_SVN_REV_KMK).ts +| $(VBOX_SVN_REV_KMK): $(if $(VBOX_SVN_DEP), $(VBOX_SVN_DEP), $(PATH_ROOT)/Config.kmk)
2767 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
2768 $(QUIET)$(RM) -f $@ $@.tmp
2769 $(QUIET)$(MKDIR) -p $(@D)
2770 ifneq ($(VBOX_SVN_DEP),)
2771 $(REDIRECT) -E 'LC_ALL=C' -wo $@.tmp -- $(SVN) info $(PATH_ROOT)
2772 $(SED) -e '/^Revision/!d' -e 's/Revision\: */export VBOX_SVN_REV=/' --output $@ $@.tmp
2773 $(QUIET)$(RM) -f $@.tmp
2774 else
2775 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV_FALLBACK)'
2776 endif
2777 $(QUIET)$(CP) --changed -fv $@ $(VBOX_SVN_REV_KMK)
2778
2779 include $(VBOX_SVN_REV_KMK)
2780else
2781# allow to overwrite VBOX_SVN_REV externally (mainly for building .debs/.rpms)
2782$(VBOX_SVN_REV_KMK):
2783 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
2784 $(QUIET)$(RM) -f $@
2785 $(QUIET)$(MKDIR) -p $(@D)
2786 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV)'
2787 $(QUIET)echo '* $(VBOX_SVN_REV_KMK) was externally overwritten:'
2788 $(QUIET)$(CAT) $(VBOX_SVN_REV_KMK)
2789endif
2790
2791
2792#
2793# Legacy.
2794#
2795ifneq ($(LOCALCFG),)
2796 include $(LOCALCFG)
2797endif
2798
2799
2800#
2801# Some extra goals.
2802#
2803.PHONY: up update st stat status
2804up update::
2805 $(SVN) up
2806
2807up2 update2::
2808 $(SVN) up --ignore-externals
2809
2810st stat status:
2811 $(SVN) status
2812
2813quick:
2814 $(MAKE) VBOX_QUICK=1
2815
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