VirtualBox

source: vbox/trunk/Config.kmk@ 4168

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

manual header update

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