VirtualBox

source: vbox/trunk/Config.kmk@ 2411

Last change on this file since 2411 was 2383, checked in by vboxsync, 18 years ago

NDEBUG for Main since we include xpcom headers

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