VirtualBox

source: vbox/trunk/Config.kmk@ 5546

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

PDMUsb changes.

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