VirtualBox

source: vbox/trunk/Config.kmk@ 4399

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

Use 64 bits DIFx for 64 bits builds

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