VirtualBox

source: vbox/trunk/Config.kmk@ 1347

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

Enabled the testsuite on darwin.

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