VirtualBox

source: vbox/trunk/Config.kmk@ 4663

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

Enabled the debugger gui and the vrdp server on OS/2.

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