VirtualBox

source: vbox/trunk/Config.kmk@ 5348

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

Removed workaround for a solaris yasm bug.

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