VirtualBox

source: vbox/trunk/Config.kmk@ 5687

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

Trying to fix the double linking of the DBGC code (VBoxDBG and VBoxVMM), by making sure it gets into VBoxVMM when it is supposed to.

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