VirtualBox

source: vbox/trunk/Config.kmk@ 4041

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

Back out r23186.

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