VirtualBox

source: vbox/trunk/Config.kmk@ 1283

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

Added support for the hybrid darwin setup where the kernel is 32-bit but the cpu *might* be running in 64-bit mode.

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