VirtualBox

source: vbox/trunk/Config.kmk@ 4395

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

Added VBOX_WITH_INTEL_PXE, currently disabled. Define it in LocalConfig.kmk to use the Intel PXE ROM.

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