VirtualBox

source: vbox/trunk/Config.kmk@ 1314

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

find the right qt package darwin.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 79.1 KB
Line 
1# $Id: Config.kmk 1314 2007-03-07 21:09:03Z 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 ifndef VBOX_PATH_QT
921 VBOX_PATH_QT := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v3.*)))
922 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.8-r1
923 endif
924 LIB_QT ?= $(VBOX_PATH_QT)/lib/libqt-mt.3.dylib
925 LIB_QTMAIN ?= $(NO_SUCH_VARIABLE)
926 ifndef QTDIR
927 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
928 QTDIR := $(call lastword,$(QTDIR))
929 endif
930endif
931ifndef VBOX_PATH_QT
932 VBOX_PATH_QT ?= $(QTDIR)
933 LIB_QT ?= qt-mt
934endif
935ifeq ($(BUILD_PLATFORM),$(BUILD_TARGET))
936 VBOX_PATH_QT_HOST ?= $(VBOX_PATH_QT)
937else
938 VBOX_PATH_QT_HOST ?= $(QTDIR)
939endif
940VBOX_UIC ?= $(VBOX_PATH_QT_HOST)/bin/uic$(HOSTSUFF_EXE)
941VBOX_MOC ?= $(VBOX_PATH_QT_HOST)/bin/moc$(HOSTSUFF_EXE)
942VBOX_LUPDATE ?= $(VBOX_PATH_QT_HOST)/bin/lupdate$(HOSTSUFF_EXE)
943VBOX_LRELEASE ?= $(VBOX_PATH_QT_HOST)/bin/lrelease$(HOSTSUFF_EXE)
944
945#
946# The linux kernel headers(/sources).
947#
948ifneq ($(filter linux l4,$(BUILD_TARGET)),)
949 ifeq ($(origin VBOX_LINUX_SRC),undefined)
950 ifneq ($(wildcard /lib/modules/$(shell uname -r)/build/include/linux/autoconf.h),)
951 export VBOX_LINUX_SRC := /lib/modules/$(shell uname -r)/build
952 else
953 export VBOX_LINUX_SRC := /usr/src/linux
954 endif
955 endif
956 ifeq ($(origin VBOX_LINUX_INCS),undefined)
957 export VBOX_LINUX_INCS := $(VBOX_LINUX_SRC)/include
958 # support splitted Linux kernels (make O=<build directory>)
959 kernelsrc := $(shell sed -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(VBOX_LINUX_SRC)/Makefile)
960 ifneq ($(kernelsrc),)
961 kernelpath := $(realpath $(VBOX_LINUX_SRC)/$(kernelsrc))
962 VBOX_LINUX_INCS += $(VBOX_LINUX_SRC)/include2 $(kernelpath)/include
963 else
964 kernelpath := $(VBOX_LINUX_SRC)
965 endif
966 ifeq ($(BUILD_TARGET_ARCH),x86)
967 VBOX_LINUX_INCS += $(kernelpath)/include/asm-i386/mach-default
968 endif
969 endif
970endif
971
972
973#
974# Template for building GC things.
975#
976TEMPLATE_VBOXGC = VBox GC
977TEMPLATE_VBOXGC_ASTOOL = $(VBOX_ASTOOL)
978TEMPLATE_VBOXGC_ASFLAGS = $(VBOX_ASFLAGS32)
979TEMPLATE_VBOXGC_DEFS = IN_GC $(ARCH_BITS_DEFS)
980TEMPLATE_VBOXGC_SYSSUFF = .gc
981TEMPLATE_VBOXGC_BLD_TRG_ARCH = x86
982
983ifeq ($(VBOX_LDR_FMT32),pe)
984ifdef VBOX_USE_VCC80
985 TEMPLATE_VBOXGC_TOOL = VCC80X86
986 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)
987else
988 TEMPLATE_VBOXGC_TOOL = VCC70
989 TEMPLATE_VBOXGC_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP)
990endif
991TEMPLATE_VBOXGC_CFLAGS = $(TEMPLATE_VBOXGC_CXXFLAGS)
992TEMPLATE_VBOXGC_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Lines -MapInfo:Exports -NoD
993ifdef VBOX_USE_VCC80
994 include $(PATH_KBUILD)/sdks/W2K3DDKX86.kmk
995 TEMPLATE_VBOXGC_LIBS = \
996 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
997else
998 TEMPLATE_VBOXGC_LIBS = \
999 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1000endif
1001endif
1002
1003ifeq ($(VBOX_LDR_FMT32),elf)
1004TEMPLATE_VBOXGC_TOOL = $(VBOX_GCC32_TOOL)
1005TEMPLATE_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)
1006TEMPLATE_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)
1007TEMPLATE_VBOXGC_LDFLAGS = -nostdlib -Bsymbolic
1008# temporarily, must fix the loader.
1009TEMPLATE_VBOXGC_LDFLAGS += -S
1010TEMPLATE_VBOXGC_LDFLAGS.release = -S
1011TEMPLATE_VBOXGC_LIBS = \
1012 $(VBOX_GCC32_LIBGCC) # instricts
1013endif
1014
1015ifeq ($(VBOX_LDR_FMT32),macho)
1016TEMPLATE_VBOXGC_TOOL = GCC4MACHO
1017TEMPLATE_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
1018TEMPLATE_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
1019TEMPLATE_VBOXGC_LDFLAGS = -nostdlib
1020#TEMPLATE_VBOXGC_LDFLAGS.release = -Wl,-S ???
1021endif
1022
1023ifeq ($(VBOX_LDR_FMT32),lx)
1024TEMPLATE_VBOXGC_TOOL = GCC3OMF
1025TEMPLATE_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
1026TEMPLATE_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
1027TEMPLATE_VBOXGC_LDFLAGS = -Zdll -nostdlib
1028TEMPLATE_VBOXGC_LIBS = \
1029 $(VBOX_GCC32_LIBGCC) \
1030 $(OBJ_SYS0) \
1031 end
1032endif
1033
1034
1035#
1036# Template for building a GC ring-3 testcase (tstVMStructGC, tstDevStructGC).
1037#
1038TEMPLATE_VBOXGCEXE = VBox GC as ring-3 testcase
1039TEMPLATE_VBOXGCEXE_EXTENDS = VBOXGC
1040
1041ifeq ($(VBOX_LDR_FMT32),pe)
1042 TEMPLATE_VBOXGCEXE_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD -Debug
1043 TEMPLATE_VBOXGCEXE_SDKS = WIN32SDK
1044 ifdef VBOX_USE_VCC80
1045 TEMPLATE_VBOXGCEXE_LIBS = \
1046 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
1047 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib
1048 else
1049 TEMPLATE_VBOXGCEXE_LIBS = \
1050 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
1051 $(PATH_TOOL_VCC70_LIB)/oldnames.lib
1052 endif
1053endif
1054
1055ifeq ($(VBOX_LDR_FMT32),elf)
1056 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1057 TEMPLATE_VBOXGCEXE_LDFLAGS.release = -g
1058endif
1059
1060ifeq ($(VBOX_LDR_FMT32),macho)
1061 TEMPLATE_VBOXGCEXE_CFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CFLAGS))
1062 TEMPLATE_VBOXGCEXE_CXXFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CXXFLAGS))
1063 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1064endif
1065
1066ifeq ($(VBOX_LDR_FMT32),lx)
1067 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1068 TEMPLATE_VBOXGCEXE_LIBS = $(NO_SUCH_VARIABLE)
1069endif
1070
1071
1072#
1073# Template for building R0 things.
1074#
1075TEMPLATE_VBOXR0 = VBox Ring 0
1076TEMPLATE_VBOXR0_ASTOOL = $(VBOX_ASTOOL)
1077TEMPLATE_VBOXR0_ASFLAGS = $(VBOX_ASFLAGS)
1078TEMPLATE_VBOXR0_DEFS = IN_RING0 $(ARCH_BITS_DEFS)
1079
1080ifeq ($(VBOX_LDR_FMT),pe)
1081TEMPLATE_VBOXR0_TOOL = $(VBOX_VCC_TOOL)
1082ifdef VBOX_USE_VCC80
1083 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -W3 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1084else
1085 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1086endif
1087TEMPLATE_VBOXR0_CFLAGS = $(TEMPLATE_VBOXR0_CXXFLAGS)
1088TEMPLATE_VBOXR0_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD
1089ifdef VBOX_USE_VCC80
1090 TEMPLATE_VBOXR0_LIBS.x86 = \
1091 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1092else
1093 TEMPLATE_VBOXR0_LIBS.x86 = \
1094 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1095endif
1096endif # pe
1097
1098ifeq ($(VBOX_LDR_FMT),elf)
1099TEMPLATE_VBOXR0_TOOL = $(VBOX_GCC_TOOL)
1100TEMPLATE_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)
1101TEMPLATE_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)
1102TEMPLATE_VBOXR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding
1103TEMPLATE_VBOXR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables
1104TEMPLATE_VBOXR0_LDFLAGS = -nostdlib -Bsymbolic
1105# temporarily, must fix the loader.
1106TEMPLATE_VBOXR0_LDFLAGS += -S
1107TEMPLATE_VBOXR0_LDFLAGS.release = -S
1108TEMPLATE_VBOXR0_LIBS = \
1109 $(VBOX_GCC_LIBGCC) # instricts
1110endif
1111
1112ifeq ($(VBOX_LDR_FMT),macho)
1113TEMPLATE_VBOXR0_TOOL = GCC4MACHO
1114TEMPLATE_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
1115TEMPLATE_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
1116TEMPLATE_VBOXR0_LDFLAGS = -nostdlib
1117#TEMPLATE_VBOXR0_LDFLAGS.release = -Wl,-S ???
1118endif
1119
1120ifeq ($(VBOX_LDR_FMT),lx)
1121TEMPLATE_VBOXR0_TOOL = GCC3OMF
1122TEMPLATE_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
1123TEMPLATE_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
1124TEMPLATE_VBOXR0_LDFLAGS = -Zdll -nostdlib
1125TEMPLATE_VBOXR0_LIBS = \
1126 $(VBOX_GCC_LIBGCC) \
1127 $(OBJ_SYS0) \
1128 end
1129endif
1130
1131
1132#
1133# Template for building SUPDRV R0 things.
1134#
1135TEMPLATE_VBOXR0DRV = VBox SUPDRV Ring 0
1136TEMPLATE_VBOXR0DRV_ASTOOL = $(VBOX_ASTOOL)
1137TEMPLATE_VBOXR0DRV_ASFLAGS = $(VBOX_ASFLAGS)
1138TEMPLATE_VBOXR0DRV_DEFS = IN_RING0 IN_RT_R0 $(ARCH_BITS_DEFS)
1139
1140ifeq ($(BUILD_TARGET),win)
1141 TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_VCC_TOOL)
1142 TEMPLATE_VBOXR0DRV_RCDEFS = \
1143 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1144 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1145 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1146 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1147 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1148 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1149 TEMPLATE_VBOXR0DRV_DEFS.x86 = _X86_
1150 TEMPLATE_VBOXR0DRV_DEFS.amd64 = _AMD64_
1151 ifdef VBOX_USE_VCC80
1152 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -W3 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1153 else
1154 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -W3 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1155 endif
1156 TEMPLATE_VBOXR0DRV_CFLAGS = $(TEMPLATE_VBOXR0DRV_CXXFLAGS)
1157 TEMPLATE_VBOXR0DRV_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Debug
1158endif
1159
1160ifeq ($(BUILD_TARGET),linux)
1161TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1162TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0
1163TEMPLATE_VBOXR0DRV_INCS = $(VBOX_LINUX_INCS)
1164TEMPLATE_VBOXR0DRV_CFLAGS = -nostdinc -iwithprefix include \
1165 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1166 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1167TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mpreferred-stack-boundary=2 -msoft-float
1168TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1169 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1170 -Wno-sign-compare -Wdeclaration-after-statement
1171TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXR0DRV_CFLAGS)) -fno-exceptions -fno-rtti
1172 ifndef VBOX_LINUX_VERSION_2_4
1173# 2.6
1174TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1175TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1176TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1177 else
1178# 2.4
1179TEMPLATE_VBOXR0DRV_SYSSUFF = .o
1180TEMPLATE_VBOXR0DRV_LDFLAGS = -r -s
1181 endif
1182endif
1183
1184ifeq ($(BUILD_TARGET),os2)
1185TEMPLATE_VBOXR0DRV_TOOL = GCC3OMF
1186TEMPLATE_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
1187TEMPLATE_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
1188TEMPLATE_VBOXR0DRV_LIBS = $(VBOX_GCC_LIBGCC)
1189# wlink thinks physdevice doesn't need fixups and should have a stack - stupid!
1190TEMPLATE_VBOXR0DRV_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
1191endif
1192
1193ifeq ($(BUILD_TARGET),darwin)
1194TEMPLATE_VBOXR0DRV_TOOL = GCC4MACHO
1195TEMPLATE_VBOXR0DRV_DEFS += KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT
1196TEMPLATE_VBOXR0DRV_INCS += \
1197 /System/Library/Frameworks/Kernel.framework/PrivateHeaders \
1198 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Kernel.framework/Headers
1199TEMPLATE_VBOXR0DRV_CXXFLAGS = \
1200 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1201 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1202 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1203 -fapple-kext -fno-rtti -fcheck-new
1204TEMPLATE_VBOXR0DRV_CXXFLAGS.release = $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fasm-blocks
1205TEMPLATE_VBOXR0DRV_CXXFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1206TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1207TEMPLATE_VBOXR0DRV_CFLAGS = \
1208 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1209 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1210 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1211 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1212TEMPLATE_VBOXR0DRV_CFLAGS.release = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1213TEMPLATE_VBOXR0DRV_CFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.profile)
1214TEMPLATE_VBOXR0DRV_CFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile)
1215TEMPLATE_VBOXR0DRV_LDFLAGS = -static -nostdlib -r -Wl,-Y,1455 \
1216 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
1217TEMPLATE_VBOXR0DRV_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC)
1218endif
1219
1220ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),) # pure guess work just to avoid the warning below
1221TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1222TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ IN_RING0 IN_RT_R0
1223TEMPLATE_VBOXR0DRV_CFLAGS = \
1224 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1225 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1226TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -msoft-float
1227TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1228 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1229 -Wno-sign-compare -Wdeclaration-after-statement
1230TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXR0DRV_CFLAGS)) -fno-exceptions -fno-rtti
1231TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1232TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1233TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1234endif
1235
1236ifdef VBOX_WITH_VBOXDRV
1237 ifndef TEMPLATE_VBOXR0DRV_TOOL
1238 $(warning Warning: VBox Build: Target $(BUILD_PLATFORM) is not officially supported!)
1239 endif
1240endif
1241
1242
1243
1244#
1245# Template for building R3 executables and static libraries which are linked into executables.
1246#
1247TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
1248TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
1249TEMPLATE_VBOXR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
1250TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
1251TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
1252ifeq ($(BUILD_TARGET),win)
1253 TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
1254 TEMPLATE_VBOXR3EXE_RCDEFS = \
1255 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1256 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1257 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1258 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1259 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1260 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1261 TEMPLATE_VBOXR3EXE_SDKS = WINPSDK
1262 ifdef VBOX_USE_VCC80
1263 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MD -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1264 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
1265 else
1266 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MD -W3 -wd4065 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1267 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -GZ
1268 endif
1269 TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
1270 TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
1271 TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1272 TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1273 TEMPLATE_VBOXR3EXE_LDFLAGS = \
1274 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1275 /DISALLOWLIB:libc.lib \
1276 /DISALLOWLIB:libcd.lib \
1277 /DISALLOWLIB:libcmt.lib \
1278 /DISALLOWLIB:libcmtd.lib \
1279 /DISALLOWLIB:msvcrtd.lib
1280 TEMPLATE_VBOXR3EXE_LIBS = \
1281 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1282 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1283 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib
1284
1285else # the gcc guys
1286TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
1287TEMPLATE_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
1288# L4 currently can't handle exception handling.
1289TEMPLATE_VBOXR3EXE_CXXFLAGS.l4 = -fno-exceptions -nostdinc \
1290 $(addprefix -I,$(VBOX_L4_GCC3_INCS) $(L4_INCDIR) $(FILE_TOOL_GPP3_INCDIR)) \
1291 $(DEBUG_L4)
1292TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
1293TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1294TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1295TEMPLATE_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
1296TEMPLATE_VBOXR3EXE_CFLAGS.darwin = -fno-common
1297TEMPLATE_VBOXR3EXE_CFLAGS.l4 = -nostdinc \
1298 $(addprefix -I,$(VBOX_L4_GCC3_INCS) $(L4_INCDIR)) $(DEBUG_L4)
1299TEMPLATE_VBOXR3EXE_DEFS.l4 = L4_THREAD_SAFE
1300TEMPLATE_VBOXR3EXE_LDFLAGS.l4 = \
1301 $(L4_LIBDIR)/../crt0.o \
1302 -T$(L4_LIBDIR)/../main_dyn.ld -nostdlib \
1303 -Wl,--export-dynamic,--dynamic-linker=libld-l4.s.so \
1304 -Wl,--rpath-link,$(L4_LIBDIR)
1305 ifeq ($(BUILD_TARGET),linux)
1306TEMPLATE_VBOXR3EXE_LIBS = pthread m $(LIB_UUID) rt dl
1307 else ifeq ($(BUILD_TARGET),l4)
1308TEMPLATE_VBOXR3EXE_LIBS = \
1309 $(L4_LIBDIR)/libvboxserver.s.so \
1310 $(L4_LIBDIR)/libuc++.0.s.so \
1311 supc++ gcc_eh gcc \
1312 $(L4_LIBDIR)/libdl.s.so \
1313 $(L4_LIBDIR)/libuc.0.s.so
1314 else ifeq ($(BUILD_TARGET),os2)
1315TEMPLATE_VBOXR3EXE_TOOL = GCC3OMF
1316TEMPLATE_VBOXR3EXE_LIBS = socket iconv
1317 else ifeq ($(BUILD_TARGET),darwin)
1318TEMPLATE_VBOXR3EXE_TOOL = GCC4MACHO
1319TEMPLATE_VBOXR3EXE_LIBS =
1320TEMPLATE_VBOXR3EXE_LDFLAGS = -read_only_relocs suppress
1321 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1322TEMPLATE_VBOXR3EXE_TOOL = GCC3
1323TEMPLATE_VBOXR3EXE_LIBS = pthread
1324 else ifeq ($(BUILD_TARGET),solaris)
1325$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1326TEMPLATE_VBOXR3EXE_TOOL = GCC3PLAIN
1327TEMPLATE_VBOXR3EXE_LIBS = rt
1328 else
1329$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1330TEMPLATE_VBOXR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.release)
1331TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease)
1332 endif
1333endif
1334
1335#
1336# Template for building R3 shared objects / DLLs.
1337# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
1338#
1339TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
1340TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
1341TEMPLATE_VBOXR3_LDFLAGS.l4 = $(L4_LIBDIR)/../crt0.s.o -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
1342TEMPLATE_VBOXR3_DEFS.darwin = $(TEMPLATE_VBOXR3EXE_DEFS.darwin) PIC
1343ifeq ($(BUILD_TARGET_ARCH),amd64)
1344 ifneq ($(BUILD_TARGET),win)
1345 TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
1346 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
1347 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
1348 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
1349 endif
1350endif
1351
1352#
1353# Ring-3 testcase.
1354# This is the VBOXR3EXE template only with a different install dir.
1355#
1356TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
1357TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
1358TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
1359TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
1360
1361#
1362# Template for building bad C/C++ style R3 executables (no -pedantic).
1363#
1364TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
1365TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
1366ifneq ($(BUILD_TARGET),win)
1367 # (only gcc)
1368 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
1369 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
1370 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations ,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
1371endif
1372
1373#
1374# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
1375# This is mostly identical to the VBOXR3NPEXE template.
1376#
1377TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
1378TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3NPEXE
1379TEMPLATE_VBOXR3NP_LDFLAGS.l4 = \
1380 $(L4_LIBDIR)/../crt0.s.o \
1381 -T$(L4_LIBDIR)/../main_rel.ld \
1382 -nostdlib
1383ifeq ($(BUILD_TARGET_ARCH),amd64)
1384 ifneq ($(BUILD_TARGET),win)
1385 TEMPLATE_VBOXR3NP_DEFS = $(TEMPLATE_VBOXR3NPEXE_DEFS) PIC
1386 TEMPLATE_VBOXR3NP_CFLAGS = $(TEMPLATE_VBOXR3NPEXE_CFLAGS) -fPIC
1387 TEMPLATE_VBOXR3NP_CXXFLAGS = $(TEMPLATE_VBOXR3NPEXE_CXXFLAGS) -fPIC
1388 TEMPLATE_VBOXR3NP_LDFLAGS = $(TEMPLATE_VBOXR3NPEXE_LDFLAGS) -fPIC
1389 endif
1390endif
1391
1392
1393#
1394# Template for building libraries, shared libraries / modules
1395# which only depends on IPRT for crt.
1396#
1397TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
1398TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
1399TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
1400## @todo C++
1401TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno -Wall
1402TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -mcmodel=medium -fno-common
1403#TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O0 -fno-math-errno -fno-peephole2 -fno-strict-aliasing - for win64.
1404TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
1405TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1406TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1407TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -mdynamic-no-pic
1408TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
1409
1410ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.amd64)
1411 # cross compile to 64-bit ELF (linux).
1412 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
1413 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
1414 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
1415 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
1416 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1417
1418else ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1419 # Use the default GCC (MinGW) with the Microsoft linker.
1420 # (Drop all '-g' options as we're unable to strip the debug info.)
1421 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1422 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1423 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1424 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
1425 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
1426 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1427 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
1428
1429else
1430 # Use the default GCC.
1431 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
1432 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1433 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1434 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1435 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1436 ifneq ($(filter-out os2 darwin solaris,$(BUILD_TARGET)),)
1437 ifneq ($(BUILD_TARGET_ARCH),amd64)
1438 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
1439 endif
1440 endif
1441 ifneq ($(filter-out freebsd,$(BUILD_TARGET)),)
1442 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
1443 else
1444 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1445 endif
1446endif
1447
1448
1449#
1450# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
1451#
1452TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
1453TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
1454TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
1455ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1456 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
1457else
1458 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
1459endif
1460
1461
1462#
1463# Template for building executables that is part of the VBox MAIN component.
1464#
1465TEMPLATE_VBOXMAINEXE = VBox Main Executables
1466TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
1467TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
1468TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE
1469TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
1470
1471ifeq ($(BUILD_TARGET),win)
1472 TEMPLATE_VBOXMAINEXE_SDKS = WINPSDK W2K3DDK
1473 ifdef VBOX_USE_VCC80
1474 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
1475 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GF- -MD -EHsc -W3 -wd4065 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1476 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
1477 else
1478 TEMPLATE_VBOXMAINEXE_TOOL = VCC70
1479 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GX- -GF- -MD -EHsc -W3 -wd4065 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1480 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -GZ
1481 endif
1482 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
1483 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1484 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
1485 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1486 TEMPLATE_VBOXMAINEXE_INCS = \
1487 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1488 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
1489 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
1490 /DISALLOWLIB:libc.lib \
1491 /DISALLOWLIB:libcd.lib \
1492 /DISALLOWLIB:msvcrt.lib \
1493 /DISALLOWLIB:msvcrtd.lib \
1494 /DISALLOWLIB:libcmtd.lib \
1495 /DISALLOWLIB:libcmt.lib
1496 TEMPLATE_VBOXMAINEXE_LIBS = \
1497 $(LIB_RUNTIME) \
1498 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1499 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1500 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1501 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1502
1503else # the GCC guys:
1504
1505TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
1506TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
1507TEMPLATE_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
1508TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -fno-inline
1509TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
1510TEMPLATE_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
1511TEMPLATE_VBOXMAINEXE_CFLAGS.debug = -fno-inline
1512TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1513 ifeq ($(BUILD_TARGET),linux)
1514TEMPLATE_VBOXMAINEXE_LIBS = pthread m $(LIB_UUID) rt
1515 else ifeq ($(BUILD_TARGET),l4)
1516TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1517# no libs as yet in l4 target - must be added later
1518 else ifeq ($(BUILD_TARGET),os2)
1519TEMPLATE_VBOXMAINEXE_TOOL = GCC3OMF
1520TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1521 else ifeq ($(BUILD_TARGET),darwin)
1522TEMPLATE_VBOXMAINEXE_TOOL = GCC4MACHO
1523TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1524TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin = -bind_at_load -framework Carbon
1525 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1526TEMPLATE_VBOXMAINEXE_TOOL = GCC3
1527TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1528 else ifeq ($(BUILD_TARGET),solaris)
1529$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1530TEMPLATE_VBOXMAINEXE_TOOL = GCC3PLAIN
1531TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt
1532 else
1533$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1534TEMPLATE_VBOXMAINEXE_LIBS =
1535 endif
1536
1537endif # !win
1538
1539#
1540# Template for building the Main (+GUI) components
1541# This differ from VBOXMAINEXE only in PIC handling and similar DLL stuff.
1542#
1543TEMPLATE_VBOXMAIN = VBox MAIN
1544TEMPLATE_VBOXMAIN_EXTENDS = VBOXMAINEXE
1545ifeq ($(BUILD_TARGET_ARCH),amd64)
1546 ifneq ($(BUILD_TARGET),win)
1547 TEMPLATE_VBOXMAIN_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
1548 TEMPLATE_VBOXMAIN_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
1549 TEMPLATE_VBOXMAIN_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1550 TEMPLATE_VBOXMAIN_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
1551 endif
1552endif
1553TEMPLATE_VBOXMAIN_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin))
1554
1555#
1556# Template for building executables that is part of the VBox MAIN component.
1557# This is (pretty much) identical to VBOXMAIN except for PIC handling (which will be fixed later).
1558#
1559TEMPLATE_VBOXMAIN = VBox Main
1560TEMPLATE_VBOXMAIN_EXTENDS = VBOXMAINEXE
1561
1562
1563#
1564# Template for building executables that use the VBox MAIN component (COM stuff etc.)
1565#
1566TEMPLATE_VBOXMAINCLIENT = VBox MAIN Client
1567TEMPLATE_VBOXMAINCLIENT_EXTENDS = VBOXMAINEXE
1568TEMPLATE_VBOXMAINCLIENT_INCS = $(TEMPLATE_VBOXMAINEXE_INCS) \
1569 $(VBOX_PATH_SDK)/include
1570ifdef VBOX_WITH_XPCOM
1571TEMPLATE_VBOXMAINCLIENT_INCS += \
1572 $(VBOX_XPCOM_INCS)
1573endif
1574TEMPLATE_VBOXMAINCLIENT_LIBS = $(TEMPLATE_VBOXMAINEXE_LIBS) \
1575 $(LIB_RUNTIME)
1576ifeq ($(BUILD_TARGET),win)
1577 TEMPLATE_VBOXMAINCLIENT_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
1578 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
1579 $(PATH_SDK_WINPSDK_LIB)/User32.Lib \
1580 $(PATH_SDK_WINPSDK_LIB)/Shell32.Lib \
1581 $(PATH_SDK_WINPSDK_LIB)/ShLwApi.Lib \
1582 $(PATH_SDK_WINPSDK_LIB)/Ole32.Lib \
1583 $(PATH_SDK_WINPSDK_LIB)/OleAut32.Lib \
1584 $(PATH_SDK_WINPSDK_LIB)/Uuid.Lib
1585else
1586 TEMPLATE_VBOXMAINCLIENT_LIBS = $(TEMPLATE_VBOXMAINEXE_LIBS) \
1587 $(PATH_LIB)/VBoxXPCOM$(VBOX_SUFF_LIB) \
1588 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
1589 $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL) \
1590 $(LIB_RUNTIME)
1591
1592 TEMPLATE_VBOXMAINCLIENT_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
1593 NDEBUG TRIMMED
1594 ## Wonder why we compile main with defaults for these two and then drops it in the client executables...
1595 TEMPLATE_VBOXMAINCLIENT_CXXFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS) \
1596 -fno-rtti -fno-exceptions
1597 TEMPLATE_VBOXMAINCLIENT_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
1598 -pthread
1599 TEMPLATE_VBOXMAINCLIENT_LDFLAGS.darwin = $(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin) \
1600 -bind_at_load -framework Carbon
1601endif
1602
1603
1604#
1605# Template for building Qt GUI executables.
1606#
1607TEMPLATE_VBOXQTGUIEXE = VBox Qt GUI Executable
1608TEMPLATE_VBOXQTGUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS)
1609TEMPLATE_VBOXQTGUIEXE_INCS = \
1610 $(VBOX_PATH_SDK)/include \
1611 $(VBOX_PATH_QT)/include
1612
1613ifeq ($(BUILD_TARGET),win)
1614 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_VCC_TOOL)
1615 TEMPLATE_VBOXQTGUIEXE_DEFS += _WIN32_WINNT=0x0500 UNICODE QT_DLL _CRT_SECURE_NO_DEPRECATE
1616 ## @todo VCC70 flags?
1617 ifdef VBOX_USE_VCC80
1618 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1619 -nologo -Zm200 -W3 -MD -EHsc -Zc:wchar_t-
1620 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu
1621 else
1622 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1623 -nologo -Zm200 -W3 -MD -GX
1624 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -GZ
1625 endif
1626 TEMPLATE_VBOXQTGUIEXE_INCS += \
1627 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1628 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = \
1629 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
1630 /DELAYLOAD:oleaut32.dll
1631 TEMPLATE_VBOXQTGUIEXE_SDKS = WINPSDK
1632 TEMPLATE_VBOXQTGUIEXE_LIBS = \
1633 $(LIB_QT) \
1634 $(LIB_QTMAIN) \
1635 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
1636 $(LIB_RUNTIME) \
1637 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1638 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1639 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1640 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
1641 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1642
1643else # the gcc guys:
1644 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_GCC_TOOL)
1645 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM
1646 TEMPLATE_VBOXQTGUIEXE_DEFS.linux = _REENTRANT
1647
1648 TEMPLATE_VBOXQTGUIEXE_INCS += \
1649 $(LIB_SDL_INC) \
1650 $(VBOX_XPCOM_INCS)
1651 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1652 -pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
1653 -Wno-long-long -fshort-wchar -fno-strict-aliasing
1654 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -pthread
1655 ## @todo no $(LIB_QTMAIN) here?
1656 TEMPLATE_VBOXQTGUIEXE_LIBS = \
1657 $(LIB_QT) \
1658 $(LIB_SDL) \
1659 $(PATH_LIB)/VBoxXPCOM$(VBOX_SUFF_LIB) \
1660 $(LIB_RUNTIME) \
1661 $(LIB_REM) \
1662 $(LIB_VMM) \
1663 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
1664 $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
1665
1666 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
1667 $(VBOX_PATH_QT)/lib
1668
1669 ifeq ($(BUILD_TARGET),darwin)
1670 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -framework Carbon -bind_at_load
1671 TEMPLATE_VBOXQTGUIEXE_LIBS +=
1672 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
1673 else ifeq ($(BUILD_TARGET),os2)
1674 TEMPLATE_VBOXQTGUIEXE_LIBS +=
1675 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
1676 else
1677 TEMPLATE_VBOXQTGUIEXE_LIBS += \
1678 Xext \
1679 X11 \
1680 m \
1681 $(LIB_PTHREAD)
1682 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \
1683 $(VBOX_LIBPATH_X11)
1684 endif
1685
1686endif
1687
1688#
1689# Template for building Qt GUI components.
1690#
1691TEMPLATE_VBOXQTGUI = VBox Qt GUI Components
1692TEMPLATE_VBOXQTGUI_EXTENDS = VBOXQTGUIEXE
1693TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN) $(PATH_BIN)/VBoxXML$(VBOX_SUFF_DLL),$(TEMPLATE_VBOXQTGUIEXE_LIBS))
1694ifeq ($(BUILD_TARGET),darwin)
1695 TEMPLATE_VBOXQTGUI_LDFLAGS = $(filter-out -framework Carbon -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS))
1696endif
1697ifeq ($(BUILD_TARGET_ARCH),amd64)
1698 ifneq ($(BUILD_TARGET),win)
1699 TEMPLATE_VBOXQTGUI_DEFS = PIC $(TEMPLATE_VBOXQTGUIEXE_DEFS)
1700 TEMPLATE_VBOXQTGUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CFLAGS)
1701 TEMPLATE_VBOXQTGUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS)
1702 TEMPLATE_VBOXQTGUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_LDFLAGS)
1703 endif
1704endif
1705
1706
1707#
1708# Template for building build bldprogs.
1709#
1710TEMPLATE_VBOXBLDPROG = VBox Build Program
1711TEMPLATE_VBOXBLDPROG_DEFS = IN_RING3
1712ifeq ($(BUILD_PLATFORM),win)
1713 ifeq ($(BUILD_PLATFORM_ARCH),x86)
1714 ifdef VBOX_USE_VCC80
1715 TEMPLATE_VBOXBLDPROG_TOOL = VCC80X86
1716 else
1717 TEMPLATE_VBOXBLDPROG_TOOL = VCC70
1718 endif
1719 TEMPLATE_VBOXBLDPROG_SDKS = WIN32SDK
1720 else
1721 TEMPLATE_VBOXBLDPROG_TOOL = VCC80AMD64
1722 TEMPLATE_VBOXBLDPROG_SDKS = WIN64SDK
1723 endif
1724 ifneq ($(TEMPLATE_VBOXBLDPROG_TOOL),VCC70)
1725 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -W3 -wd4996 -Zc:wchar_t-
1726 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -RTCsu
1727 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -Oy- -GS-
1728 else
1729 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -W3
1730 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -GZ
1731 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -Ogitb2 -Oy-
1732 endif
1733 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1734 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1735 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
1736 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
1737 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1738 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
1739 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
1740 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
1741 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1742 /DISALLOWLIB:libcd.lib \
1743 /DISALLOWLIB:libcmtd.lib \
1744 /DISALLOWLIB:msvcrt.lib \
1745 /DISALLOWLIB:msvcrtd.lib \
1746 /DISALLOWLIB:msvcprt.lib \
1747 /DISALLOWLIB:msvcprtd.lib
1748 TEMPLATE_VBOXBLDPROG_LIBS = \
1749 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
1750 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt.lib \
1751 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt.lib
1752
1753else
1754# (gcc of some kind )
1755TEMPLATE_VBOXBLDPROG_TOOL = GCC3
1756TEMPLATE_VBOXBLDPROG_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1757TEMPLATE_VBOXBLDPROG_CFLAGS.debug = -fno-inline
1758TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
1759TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
1760TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
1761TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe
1762TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -fno-inline
1763TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
1764TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1765TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1766 ifeq ($(BUILD_PLATFORM),linux)
1767TEMPLATE_VBOXBLDPROG_LIBS = pthread m $(LIB_UUID) rt dl
1768 else ifeq ($(BUILD_PLATFORM),os2)
1769TEMPLATE_VBOXBLDPROG_TOOL = GCC3OMF
1770TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
1771 else ifeq ($(BUILD_PLATFORM),darwin)
1772TEMPLATE_VBOXBLDPROG_TOOL = GCC4MACHO
1773TEMPLATE_VBOXBLDPROG_LIBS =
1774 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_PLATFORM)),)
1775TEMPLATE_VBOXBLDPROG_TOOL = GCC3
1776TEMPLATE_VBOXBLDPROG_LIBS =
1777 else ifeq ($(BUILD_PLATFORM),solaris)
1778$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
1779TEMPLATE_VBOXBLDPROG_TOOL = GCC3PLAIN
1780TEMPLATE_VBOXBLDPROG_LIBS = rt
1781 else
1782$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
1783 endif
1784
1785endif # !win
1786
1787
1788
1789#
1790# Template for building R3 win32 guest additions.
1791#
1792TEMPLATE_VBOXW32GUESTR3 = VBox Win32 Guest Program
1793TEMPLATE_VBOXW32GUESTR3_INST = $(INST_ADDITIONS)
1794TEMPLATE_VBOXW32GUESTR3_BLD_TRG = win
1795TEMPLATE_VBOXW32GUESTR3_BLD_TRG_ARCH = x86
1796TEMPLATE_VBOXW32GUESTR3_BLD_TRG_CPU = i386
1797TEMPLATE_VBOXW32GUESTR3_DEFS = IN_GUEST IN_GUEST_R3 IN_RT_R3 IN_RING3 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
1798TEMPLATE_VBOXW32GUESTR3_RCDEFS = \
1799 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1800 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1801 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1802 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1803 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1804 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1805TEMPLATE_VBOXW32GUESTR3_ASTOOL = YASM
1806TEMPLATE_VBOXW32GUESTR3_ASFLAGS = -f win -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
1807TEMPLATE_VBOXW32GUESTR3_DLLSUFF = .dll
1808TEMPLATE_VBOXW32GUESTR3_EXESUFF = .exe
1809TEMPLATE_VBOXW32GUESTR3_LIBSUFF = .lib
1810TEMPLATE_VBOXW32GUESTR3_ARLIBSUFF = .lib
1811TEMPLATE_VBOXW32GUESTR3_SDKS = WIN32SDK W2K3DDKX86
1812ifdef VBOX_USE_VCC80
1813 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC80X86
1814 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
1815 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -RTCsu
1816 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -O2 -Oy- -GS-
1817else
1818 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC70
1819 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -U__LINUX__ -U__OS2__ -W3
1820 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -GZ
1821 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -Ogitb2 -Oy-
1822endif
1823TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
1824TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
1825TEMPLATE_VBOXW32GUESTR3_CFLAGS = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS)
1826TEMPLATE_VBOXW32GUESTR3_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug)
1827TEMPLATE_VBOXW32GUESTR3_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
1828TEMPLATE_VBOXW32GUESTR3_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile)
1829TEMPLATE_VBOXW32GUESTR3_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile)
1830TEMPLATE_VBOXW32GUESTR3_INCS = \
1831 $(VBOX_PATH_SDK)/include
1832TEMPLATE_VBOXW32GUESTR3_LDFLAGS = \
1833 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE \
1834 /DISALLOWLIB:libc.lib \
1835 /DISALLOWLIB:libcd.lib \
1836 /DISALLOWLIB:msvcrt.lib \
1837 /DISALLOWLIB:libcmtd.lib \
1838 /DISALLOWLIB:msvcrtd.lib
1839ifdef VBOX_USE_VCC80
1840 TEMPLATE_VBOXW32GUESTR3_LIBS = \
1841 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib \
1842 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
1843 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
1844else
1845 TEMPLATE_VBOXW32GUESTR3_LIBS = \
1846 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \
1847 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
1848 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
1849endif
1850
1851#
1852# R3 win32 guest libraries
1853#
1854TEMPLATE_VBOXW32GUESTR3LIB = VBox Win32 Guest User Libraries
1855TEMPLATE_VBOXW32GUESTR3LIB_EXTENDS = VBOXW32GUESTR3
1856TEMPLATE_VBOXW32GUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
1857
1858
1859#
1860# Template for building R0 win32 guest tools.
1861#
1862TEMPLATE_VBOXW32GUESTR0 = VBox Win32 Guest Driver
1863TEMPLATE_VBOXW32GUESTR0_INST = $(INST_ADDITIONS)
1864TEMPLATE_VBOXW32GUESTR0_BLD_TRG = win
1865TEMPLATE_VBOXW32GUESTR0_BLD_TRG_ARCH = x86
1866TEMPLATE_VBOXW32GUESTR0_BLD_TRG_CPU = i386
1867TEMPLATE_VBOXW32GUESTR0_DEFS = IN_RING0 _X86_ IN_GUEST_R0 IN_RT_R0 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
1868TEMPLATE_VBOXW32GUESTR0_RCDEFS = \
1869 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1870 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1871 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1872 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1873 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1874 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1875TEMPLATE_VBOXW32GUESTR0_ASTOOL = YASM
1876TEMPLATE_VBOXW32GUESTR0_ASFLAGS = -f win32 -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
1877TEMPLATE_VBOXW32GUESTR0_SYSSUFF = .sys
1878ifdef VBOX_USE_VCC80
1879 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC80X86
1880 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
1881 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -EHs-c- -Zl
1882 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -O2 -Oy-
1883else
1884 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC70
1885 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -U__LINUX__ -U__OS2__ -W3
1886 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -GX- -Zl
1887 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -Ogitb2 -Oy-
1888endif
1889TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
1890TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
1891TEMPLATE_VBOXW32GUESTR0_CFLAGS = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS)
1892TEMPLATE_VBOXW32GUESTR0_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug)
1893TEMPLATE_VBOXW32GUESTR0_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
1894TEMPLATE_VBOXW32GUESTR0_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile)
1895TEMPLATE_VBOXW32GUESTR0_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile)
1896TEMPLATE_VBOXW32GUESTR0_LDFLAGS = \
1897 -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Machine:X86 -Debug \
1898 /DISALLOWLIB:libcd.lib \
1899 /DISALLOWLIB:msvcrt.lib \
1900 /DISALLOWLIB:msvcrtd.lib \
1901 /DISALLOWLIB:libcmtd.lib
1902
1903#
1904# R0 win32 guest libraries
1905#
1906TEMPLATE_VBOXW32GUESTR0LIB = VBox Win32 Guest Driver
1907TEMPLATE_VBOXW32GUESTR0LIB_EXTENDS = VBOXW32GUESTR0
1908TEMPLATE_VBOXW32GUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
1909
1910
1911#
1912# Windows rc workaround for crosscompiling.
1913# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
1914#
1915ifneq ($(BUILD_PLATFORM),win)
1916 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
1917 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
1918 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
1919 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
1920else
1921 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
1922 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
1923 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
1924 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
1925 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
1926 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
1927 ) Sorry_Cannot_find_mc_in_the_PSDK)
1928endif
1929
1930
1931#
1932# Template for syntax checking the linux guest additions.
1933# Not properly realized yet.
1934#
1935TEMPLATE_VBOXLNX32GUESTR0 = Template for *syntax checking* linux guest additions kernel modules
1936TEMPLATE_VBOXLNX32GUESTR0_TOOL = $(VBOX_GCC_TOOL)
1937TEMPLATE_VBOXLNX32GUESTR0_BLD_TRG = linux
1938TEMPLATE_VBOXLNX32GUESTR0_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0 IN_GUEST_R0
1939TEMPLATE_VBOXLNX32GUESTR0_INCS = $(VBOX_LINUX_INCS)
1940TEMPLATE_VBOXLNX32GUESTR0_CFLAGS = -nostdinc -iwithprefix include \
1941 -O2 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1942 $(VBOX_GCC_fno-stack-protector) -fno-strict-aliasing -fno-common \
1943 -mpreferred-stack-boundary=2 -msoft-float
1944TEMPLATE_VBOXLNX32GUESTR0_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXLNX32GUESTR0_CFLAGS)) -fno-exceptions -fno-rtti
1945ifndef VBOX_LINUX_VERSION_2_4
1946# 2.6
1947TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .ko
1948TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -m elf_i386 -r
1949else
1950# 2.4
1951TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .o
1952TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -r -s
1953endif
1954
1955
1956#
1957# Tools and templates for building 32-bit linux guest additions.
1958#
1959TOOL_VBOXLNX32NOCPPLD = Linker tool replacing the VBOX_GCC32_TOOL linker (g++).
1960TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_OUTPUT = $(outbase).map
1961TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1962TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_DEPORD =
1963define TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_CMDS
1964 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_CC) $(flags) -o $(out) $(objs)\
1965 $(foreach p,$(libpath), -L$(p))\
1966 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
1967 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_MAP,$(outbase).map)
1968endef
1969TOOL_VBOXLNX32NOCPPLD_LINK_DLL_OUTPUT = $(outbase).map
1970TOOL_VBOXLNX32NOCPPLD_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1971TOOL_VBOXLNX32NOCPPLD_LINK_DLL_DEPORD =
1972# (no SONAME for now)
1973define TOOL_VBOXLNX32NOCPPLD_LINK_DLL_CMDS
1974 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_CC) $(TOOL_$(VBOX_GCC32_TOOL)_LDFLAGS.dll) $(flags) -o $(out)\
1975 $(objs)\
1976 $(foreach p,$(libpath), -L$(p))\
1977 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
1978 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_MAP,$(outbase).map)
1979endef
1980TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_OUTPUT = $(outbase).map
1981TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1982TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_DEPORD =
1983define TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_CMDS
1984 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_LD_SYSMOD) $(TOOL_VBOXLNX32NOCPPLD_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
1985 $(foreach p,$(libpath), -L$(p))\
1986 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
1987 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_SYSMOD_MAP,$(outbase).map)
1988endef
1989
1990TEMPLATE_VBOXLNX32GUESTR3EXE = Template for building 32-bit linux guest additions programs.
1991TEMPLATE_VBOXLNX32GUESTR3EXE_INST = $(INST_ADDITIONS)
1992TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG = linux
1993TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_ARCH = x86
1994TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_CPU = i386
1995TEMPLATE_VBOXLNX32GUESTR3EXE_TOOL = $(VBOX_GCC32_TOOL)
1996TEMPLATE_VBOXLNX32GUESTR3EXE_ASTOOL = YASM
1997TEMPLATE_VBOXLNX32GUESTR3EXE_ASFLAGS = -f elf32 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels
1998TEMPLATE_VBOXLNX32GUESTR3EXE_DEFS = IN_RING3 IN_GUEST_R3 HC_ARCH_BITS=32 GC_ARCH_BITS=32
1999TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe $(VBOX_GCC_fno-stack-protector)
2000TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug = -fno-inline
2001TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2002TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2003TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2004TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.release = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2005TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug)
2006TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile)
2007TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile)
2008TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_fno-stack-protector)
2009# No LDFLAGS nor LIBS!
2010
2011TEMPLATE_VBOXLNX32GUESTR3EXENOCPP = Template for building 32-bit linux guest additions programs without any C++.
2012TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2013TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_LDTOOL = VBOXLNX32NOCPPLD
2014# No LDFLAGS nor LIBS!
2015
2016TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP = Template for building 32-bit linux guest additions shared objects without any C++.
2017TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2018TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDTOOL = VBOXLNX32NOCPPLD
2019TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS)
2020TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS)
2021TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDFLAGS = -fPIC
2022
2023TEMPLATE_VBOXLNX32GUESTR3LIB = Template for building 32-bit linux guest additions libraries.
2024TEMPLATE_VBOXLNX32GUESTR3LIB_EXTENDS = VBOXLNX32GUESTR3EXE
2025TEMPLATE_VBOXLNX32GUESTR3LIB_INST = $(INST_ADDITION_LIB)
2026
2027
2028#
2029# Two targets to coordinate version number changes properly. Note that the
2030# only way to get a really consistent build is to run 'kmk' in the top-level
2031# directory. If you don't run it there, you get a consistent sub-tree only.
2032#
2033VBOX_VERSION_STAMP = $(PATH_OUT)/version-stamp-$(VBOX_VERSION_MAJOR)-$(VBOX_VERSION_MINOR)-$(VBOX_VERSION_BUILD)
2034VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
2035VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
2036
2037$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
2038 $(MKDIR) -p $(@D)
2039 $(RM) -f $(filter-out $@,$(wildcard $(PATH_OUT)/version-stamp-*))
2040 $(ECHO_EXT) > $@
2041
2042$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
2043 $(MKDIR) -p $(@D)
2044 $(RM) -f $@ [email protected]
2045 $(APPEND) [email protected] "#ifndef __version_generated_h__"
2046 $(APPEND) [email protected] "#define __version_generated_h__"
2047 $(APPEND) [email protected] ""
2048 $(APPEND) [email protected] "#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)"
2049 $(APPEND) [email protected] "#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)"
2050 $(APPEND) [email protected] "#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)"
2051 $(APPEND) [email protected] '#define VBOX_VERSION_STRING "$(VBOX_VERSION)"'
2052 $(APPEND) [email protected] ""
2053 $(APPEND) [email protected] "#endif"
2054 $(MV) -f [email protected] $@
2055
2056#
2057# Used for external makefiles which cannot include Config.kmk
2058#
2059$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
2060 $(MKDIR) -p $(@D)
2061 $(RM) -f $@ [email protected]
2062 $(APPEND) [email protected] "VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)"
2063 $(APPEND) [email protected] "VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)"
2064 $(APPEND) [email protected] "VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)"
2065 $(MV) -f [email protected] $@
2066
2067
2068# Force building of the version header file as the first thing anywhere in
2069# the tree. This eliminates the need for manual dependencies on it.
2070Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2071Makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2072makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2073
2074
2075#
2076# Legacy.
2077#
2078ifneq ($(LOCALCFG),)
2079 include $(LOCALCFG)
2080endif
2081
2082
2083#
2084# Some extra goals.
2085#
2086.PHONY: up update st stat status
2087up update::
2088 svn$(HOSTSUFF_EXE) up
2089
2090st stat status:
2091 svn$(HOSTSUFF_EXE) status
2092
2093quick:
2094 $(MAKE) VBOX_QUICK=1
2095
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