VirtualBox

source: vbox/trunk/Config.kmk@ 5646

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

Introduced VBOX_WITH_PREALLOC_RAM_BY_DEFAULT which is disabled of course. A customer depends on this. Enabling this will not change PGM_DYNAMIC_RAM_ALLOC as we would execute other less-checked code pathes during execution.

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