VirtualBox

source: vbox/trunk/Config.kmk@ 1492

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

VBOX_WITH_INSTALLER for darwin.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 80.1 KB
Line 
1# $Id: Config.kmk 1492 2007-03-14 20:35:45Z 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# Full version string (may include more than just x.y.z, but no spaces or other problematic chars).
130VBOX_VERSION_STRING = $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
131# Same as VBOX_VERSION_STRING, deprecated.
132VBOX_VERSION = $(VBOX_VERSION_STRING)
133
134
135#
136# The VirtualBox Configuration Defaults.
137#
138
139# Build linux / win32 additions.
140ifeq ($(BUILD_TARGET),linux)
141 VBOX_WITH_LINUX_ADDITIONS = 1
142 VBOX_WITH_WIN32_ADDITIONS = 1
143endif
144ifeq ($(BUILD_TARGET),l4)
145 VBOX_WITH_LINUX_ADDITIONS = 1
146 VBOX_WITH_WIN32_ADDITIONS = 1
147endif
148ifeq ($(BUILD_TARGET),win)
149 VBOX_WITH_WIN32_ADDITIONS = 1
150endif
151ifdef VBOX_WITH_LINUX_ADDITIONS
152 ifeq ($(BUILD_TARGET).$(BUILD_PLATFORM_ARCH),linux.x86)
153 VBOX_WITH_LINUX_ADDITIONS_32BIT_R0 = 1
154 endif
155endif
156# Enable the building of shared folders in the windows additions.
157VBOX_WITH_WIN32_ADDITIONS_SHAREDFOLDERS = 1
158
159# build the installer
160VBOX_WITH_INSTALLER = 1
161# enable VRDP server
162VBOX_WITH_VRDP = 1
163# build VRDP authentication modules
164VBOX_WITH_VRDP_AUTHMOD = 1
165# build enhanced version of rdesktop
166VBOX_WITH_VRDP_RDESKTOP = 1
167ifeq ($(filter-out darwin os2,$(BUILD_TARGET)),)
168# build the support driver & library without IDT patching.
169## @todo invert this!
170VBOX_WITHOUT_IDT_PATCHING = 1
171endif
172# The kernel driver/module and related runtime libraries.
173VBOX_WITH_VBOXDRV = 1
174# build with secure label support
175ifeq ($(filter win.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),) # too much work with freetype and all that.
176VBOX_WITH_SECURELABEL = 1
177endif
178
179# the main api
180VBOX_WITH_MAIN = 1
181# the SDL based GUI
182VBOX_WITH_VBOXSDL = 1
183# the basic frontend (w/o Main)
184VBOX_WITH_VBOXBFE = 1
185# the Qt GUI
186VBOX_WITH_QTGUI = 1
187## the Direct Framebuffer GUI
188#VBOX_WITH_VBOXFB = 1
189# the gui debugger
190ifneq ($(BUILD_TYPE),release)
191VBOX_WITH_DEBUGGER_GUI = 1
192endif
193# the documentation
194VBOX_WITH_DOCS = 1
195# build the Host Guest Communication Manager component
196VBOX_WITH_HGCM = 1
197# Enable the USB feature.
198VBOX_WITH_USB = 1
199# Enable the ISCSI feature.
200VBOX_WITH_ISCSI = 1
201# Enable ALSA support for Linux
202VBOX_WITH_ALSA = 1
203# Disable WINMM support for Windows (not implemented)
204VBOX_WITH_WINMM =
205# Enable the kchmviewer
206VBOX_WITH_KCHMVIEWER = 1
207# Build the testsuite.
208VBOX_WITH_TESTSUITE = 1
209# Build the testcases.
210VBOX_WITH_TESTCASES = 1
211# Set this to not use COM or XPCOM in places where it can be avoided.
212#VBOX_WITHOUT_COM = 1
213# Set this to skip installing the redistributable compiler runtime.
214#VBOX_WITHOUT_COMPILER_REDIST = 1
215# Enabled internal networking.
216VBOX_WITH_INTERNAL_NETWORKING = 1
217
218#
219# Skip stuff.
220#
221
222# VBOX_QUICK can be used by core developers to speed to the build
223ifdef VBOX_QUICK
224 # undefine variables by assigning blank.
225 VBOX_WITH_TESTSUITE=
226 VBOX_WITH_TESTCASES=
227 VBOX_WITH_MAIN =
228 VBOX_WITH_VBOXSDL =
229 VBOX_WITH_VBOXBFE =
230 VBOX_WITH_QTGUI =
231 VBOX_WITH_DEBUGGER_GUI =
232 VBOX_WITH_DOCS =
233endif # VBOX_QUICK
234
235# l4 have to skip a few things.
236ifeq ($(BUILD_TARGET),l4)
237 VBOX_WITH_VBOXDRV=
238 VBOX_WITH_VRDP=
239 VBOX_WITH_VBOXSDL=
240 VBOX_WITH_QTGUI=
241 VBOX_WITH_MAIN=
242 VBOX_WITH_DOCS=
243 VBOX_WITH_ISCSI=
244 VBOX_WITH_INTERNAL_NETWORKING=
245endif
246
247# Darwin have to skip a few things at present.
248ifeq ($(BUILD_TARGET),darwin)
249 # Internal networking requires testing and possibly proper ring-3/ring0 separation.
250 VBOX_WITH_INTERNAL_NETWORKING=
251 # Don't bother with SDL ttf for now.
252 VBOX_WITH_SECURELABEL=
253 ifdef VBOX_OSE
254 # Qt/Mac v3.3.x requires patching to work for us.
255 VBOX_WITH_QTGUI=
256 endif
257 # Later:
258 VBOX_WITH_USB=
259 VBOX_WITH_DOCS=
260 VBOX_WITH_VRDP_AUTHMOD=
261 VBOX_WITH_VRDP_RDESKTOP=
262endif
263
264# Most stuff doesn't build yet on the new targets.
265ifeq ($(filter-out os2 freebsd solaris,$(BUILD_TARGET)),)
266 #VBOX_WITH_VBOXBFE=
267 VBOX_WITH_MAIN=
268 VBOX_WITH_VBOXSDL=
269 VBOX_WITH_QTGUI=
270 VBOX_WITH_DEBUGGER_GUI=
271 VBOX_WITH_INSTALLER=
272 VBOX_WITH_SECURELABEL=
273 VBOX_WITH_VRDP=
274 VBOX_WITH_VRDP_AUTHMOD=
275 VBOX_WITH_VRDP_RDESKTOP=
276 VBOX_WITH_TESTSUITE=
277 VBOX_WITH_USB=
278 VBOX_WITH_DOCS=
279endif
280
281
282#
283# Include automatic and local config file to override the above settings
284# and to provide defaults for the settings below this point.
285#
286AUTOCFG := $(wildcard $(PATH_ROOT)/AutoConfig.kmk)
287ifeq ($(AUTOCFG),)
288 # deprecated name. to be removed.
289 AUTOCFG := $(wildcard $(PATH_ROOT)/Config.kmkconf)
290 ifneq ($(AUTOCFG),)
291 $(warning Config.kmkconf has been renamed. Please re-run configure.)
292 endif
293endif
294ifneq ($(AUTOCFG),)
295 include $(AUTOCFG)
296endif
297
298LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
299ifeq ($(LOCALCFG),)
300 # deprecated name. to be removed.
301 LOCALCFG := $(wildcard $(PATH_ROOT)/Config.kmklocal)
302 ifneq ($(LOCALCFG),)
303 $(warning Please rename your Config.kmklocal to LocalConfig.kmk.)
304 endif
305endif
306ifneq ($(LOCALCFG),)
307 include $(LOCALCFG)
308endif
309
310
311#
312# Disable components that are not open sourced.
313#
314ifdef VBOX_OSE
315 VBOX_WITH_VRDP=
316 VBOX_WITH_USB=
317 VBOX_WITH_ISCSI=
318 VBOX_WITH_DEBUGGER_GUI=
319 VBOX_WITH_WIN32_ADDITIONS_SHAREDFOLDERS=
320 VBOX_WITH_SECURELABEL=
321 VBOX_WITH_INSTALLER=
322 VBOX_WITH_KCHMVIEWER=
323 VBOX_WITH_DOCS=
324 VBOX_WITH_TESTSUITE=
325 PASSES := $(filter-out PACKING,$(PASSES))
326endif
327
328##
329## HACK ALERT!
330## OVerride anyone attempting to build Linux/GNU additions when targeting AMD64.
331##
332#ifdef VBOX_WITH_LINUX_ADDITIONS
333# ifeq ($(BUILD_TARGET_ARCH),amd64)
334# VBOX_WITH_LINUX_ADDITIONS :=
335# endif
336#endif
337
338#
339# Image and object format config.
340#
341ifeq ($(filter-out linux l4 freebsd netbsd openbsd solaris,$(BUILD_TARGET)),)
342 VBOX_LDR_FMT = elf
343endif
344ifeq ($(BUILD_TARGET),darwin)
345 VBOX_LDR_FMT = macho
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 macho64 -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 =
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# Mac OS X SDK paths.
783#
784VBOX_PATH_MACOSX_SDK ?= /Developer/SDKs/MacOSX10.4u.sdk
785VBOX_PATH_MACOSX_SDK_INCS ?= $(VBOX_PATH_MACOSX_SDK)/Developer/Headers
786
787
788#
789# GCC stuff properties.
790#
791# These will be resolved on the first kmk invocation and passed on to recursive
792# instances in the environment.
793#q
794# Note. If we add much more to here, we should seriously consider moving this to a
795# gcc configure script which we invoke automatically.
796#
797include $(PATH_KBUILD)/tools/$(VBOX_GCC_TOOL).kmk
798
799ifndef VBOX_GCC_LIBGCC
800 export VBOX_GCC_LIBGCC := $(shell $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)
801endif
802
803# HC compiler switch detction.
804VBOX_GCC_CHECK_CC = $(shell \
805 if $(TOOL_$(VBOX_GCC_TOOL)_CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
806 then echo "$(1)"; \
807 else echo "$(2)"; fi; )
808VBOX_GCC_CHECK_CXX = $(shell \
809 if $(TOOL_$(VBOX_GCC_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
810 then echo "$(1)"; \
811 else echo "$(2)"; fi; )
812ifeq ($(origin VBOX_GCC_Wno-pointer-sign),undefined)
813 export VBOX_GCC_Wno-pointer-sign := $(call VBOX_GCC_CHECK_CC,-Wno-pointer-sign,)
814endif
815ifeq ($(origin VBOX_GCC_Wno-variadic-macros),undefined)
816 export VBOX_GCC_Wno-variadic-macros := $(call VBOX_GCC_CHECK_CXX,-Wno-variadic-macros,)
817endif
818ifeq ($(origin VBOX_GCC_Wno-invalid-offsetof),undefined)
819 export VBOX_GCC_Wno-invalid-offsetof := $(call VBOX_GCC_CHECK_CXX,-Wno-invalid-offsetof,)
820endif
821ifeq ($(origin VBOX_GCC_fno-stack-protector),undefined)
822 export VBOX_GCC_fno-stack-protector := $(call VBOX_GCC_CHECK_CC,-fno-stack-protector,)
823endif
824
825# 32-bit (GC) compiler switch detection.
826VBOX_GCC32_CHECK_CXX = $(shell \
827 if $(TOOL_$(VBOX_GCC32_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
828 then echo "$(1)"; \
829 else echo "$(2)"; fi; )
830ifneq ($(VBOX_GCC_TOOL),$(VBOX_GCC32_TOOL))
831 include $(PATH_KBUILD)/tools/$(VBOX_GCC32_TOOL).kmk
832 ifeq ($(origin VBOX_GCC32_Wno-variadic-macros),undefined)
833 export VBOX_GCC32_Wno-variadic-macros := $(call VBOX_GCC32_CHECK_CXX,-Wno-variadic-macros,)
834 endif
835 ifndef VBOX_GCC32_LIBGCC
836 export VBOX_GCC32_LIBGCC := $(shell $(TOOL_$(VBOX_GCC32_TOOL)_CC) -print-libgcc-file-name)
837 endif
838else
839 VBOX_GCC32_Wno-variadic-macros ?= $(VBOX_GCC_Wno-variadic-macros)
840 VBOX_GCC32_LIBGCC ?= $(VBOX_GCC_LIBGCC)
841endif
842
843# Find the compiler defines (for IPRT no-crt).
844ifndef VBOX_PATH_GCC_INCS
845 export VBOX_PATH_GCC_INCS := $(abspath $(dir $(shell LC_ALL=C $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)))/include
846endif
847
848# L4
849ifeq ($(BUILD_TARGET),l4)
850 ifndef VBOX_PATH_L4_GCC3_INSTALL
851 export VBOX_PATH_L4_GCC3_INSTALL := $(shell LANG=C $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-search-dirs|sed -ne 's+^install: \(.*[^/][^/]*\)/\?+\1+p')
852 endif
853 VBOX_L4_GCC3_INCS := $(VBOX_PATH_L4_GCC3_INSTALL)/include
854 # L4_GPP3_INCS := \
855 # $(VBOX_PATH_L4_GCC3_INSTALL)/include/g++-v3/ \
856 # $(VBOX_PATH_L4_GCC3_INSTALL)/include/g++-v3/i386-pc-linux-gnu/
857endif
858
859#
860# Default prefixes and suffixes.
861#
862VBOX_PREF_LIB =
863ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
864VBOX_SUFF_LIB = .lib
865else
866VBOX_SUFF_LIB = .a
867endif
868VBOX_SUFF_DLL = $(SUFF_DLL)
869VBOXW32GUEST_SUFF_LIB = .lib
870VBOXLNX32GUEST_SUFF_LIB = .a
871
872#
873# SDKs for external libraries.
874#
875SDK_VBOX_XERCES = .
876SDK_VBOX_XERCES_INCS ?= $(PATH_ROOT)/src/libs/xerces-2.6.0/src
877SDK_VBOX_XERCES_LIBS ?= $(PATH_LIB)/VBox-xerces$(VBOX_SUFF_LIB)
878
879SDK_VBOX_XALAN = .
880SDK_VBOX_XALAN_INCS ?= $(PATH_ROOT)/src/libs/xalan-1.10.0
881SDK_VBOX_XALAN_LIBS ?= $(PATH_LIB)/VBox-xalan$(VBOX_SUFF_LIB)
882
883SDK_VBOX_LIBPNG = .
884SDK_VBOX_LIBPNG_INCS ?= $(PATH_ROOT)/src/libs/libpng-1.2.8
885SDK_VBOX_LIBPNG_LIBS ?= $(PATH_LIB)/VBox-libpng$(VBOX_SUFF_LIB)
886
887SDK_VBOX_ZLIB = .
888ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
889 SDK_VBOX_ZLIB_INCS ?= $(PATH_ROOT)/src/libs/zlib-1.2.1
890 SDK_VBOX_ZLIB_LIBS ?= $(PATH_LIB)/VBox-zlib$(VBOX_SUFF_LIB)
891else
892 SDK_VBOX_ZLIB_INCS ?=
893 SDK_VBOX_ZLIB_LIBS ?= z
894endif
895
896SDK_VBOX_OPENSSL = .
897SDK_VBOX_OPENSSL_INCS?= $(PATH_ROOT)/src/libs/openssl-0.9.7e/include
898SDK_VBOX_OPENSSL_LIBS?= $(PATH_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB)
899
900SDK_VBOX_FFMPEG = .
901ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
902 SDK_VBOX_FFMPEG_INCS ?= \
903 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavutil \
904 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavcodec \
905 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavformat
906 ifeq ($(BUILD_TARGET),win)
907 ## Michael! Where is $(PATH_LIB)/VBoxFFmpegImp$(VBOX_SUFF_LIB) supposed to come from?
908 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpeg.a
909 else
910 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_BIN)/VBoxFFmpeg$(SUFF_DLL)
911 endif
912else
913 SDK_VBOX_FFMPEG_INCS ?=
914 SDK_VBOX_FFMPEG_LIBS ?= avutil avcodec avformat
915endif
916
917#
918# Special SDK for the problematic NTDLL.LIB.
919#
920SDK_VBOX_NTDLL = Requires W2K3DDK
921SDK_VBOX_NTDLL_LIBS ?= $(PATH_SDK_W2K3DDK_LIB)/ntdll.lib
922
923
924#
925# Qt build tools and libraries.
926# For *NIX we require it to be present on the system.
927#
928## @todo convert this into SDK and integrate the Qt stuff into kBuild.
929ifeq ($(BUILD_TARGET),win)
930 ifeq ($(BUILD_TARGET_ARCH),x86)
931 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.3
932 LIB_QT ?= $(VBOX_PATH_QT)/lib/dynamic/qt-mt333.lib
933 else
934 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.6
935 LIB_QT ?= $(VBOX_PATH_QT)/lib/dynamic/qt-mt336.lib
936 endif
937 LIB_QTMAIN ?= $(VBOX_PATH_QT)/lib/dynamic/qtmain.lib
938 ifndef QTDIR
939 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
940 QTDIR := $(call lastword,$(QTDIR))
941 endif
942
943else ifeq ($(BUILD_TARGET),darwin)
944 ifndef VBOX_PATH_QT
945 VBOX_PATH_QT := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v3.*)))
946 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.8-r1
947 endif
948 LIB_QT ?= $(VBOX_PATH_QT)/lib/libqt-mt.3.dylib
949 LIB_QTMAIN ?= $(NO_SUCH_VARIABLE)
950 ifndef QTDIR
951 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
952 QTDIR := $(call lastword,$(QTDIR))
953 endif
954endif
955ifndef VBOX_PATH_QT
956 VBOX_PATH_QT ?= $(QTDIR)
957 LIB_QT ?= qt-mt
958endif
959ifeq ($(BUILD_PLATFORM),$(BUILD_TARGET))
960 VBOX_PATH_QT_HOST ?= $(VBOX_PATH_QT)
961else
962 VBOX_PATH_QT_HOST ?= $(QTDIR)
963endif
964VBOX_UIC ?= $(VBOX_PATH_QT_HOST)/bin/uic$(HOSTSUFF_EXE)
965VBOX_MOC ?= $(VBOX_PATH_QT_HOST)/bin/moc$(HOSTSUFF_EXE)
966VBOX_LUPDATE ?= $(VBOX_PATH_QT_HOST)/bin/lupdate$(HOSTSUFF_EXE)
967VBOX_LRELEASE ?= $(VBOX_PATH_QT_HOST)/bin/lrelease$(HOSTSUFF_EXE)
968
969#
970# The linux kernel headers(/sources).
971#
972ifneq ($(filter linux l4,$(BUILD_TARGET)),)
973 ifeq ($(origin VBOX_LINUX_SRC),undefined)
974 ifneq ($(wildcard /lib/modules/$(shell uname -r)/build/include/linux/autoconf.h),)
975 export VBOX_LINUX_SRC := /lib/modules/$(shell uname -r)/build
976 else
977 export VBOX_LINUX_SRC := /usr/src/linux
978 endif
979 endif
980 ifeq ($(origin VBOX_LINUX_INCS),undefined)
981 export VBOX_LINUX_INCS := $(VBOX_LINUX_SRC)/include
982 # support splitted Linux kernels (make O=<build directory>)
983 kernelsrc := $(shell sed -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(VBOX_LINUX_SRC)/Makefile)
984 ifneq ($(kernelsrc),)
985 kernelpath := $(realpath $(VBOX_LINUX_SRC)/$(kernelsrc))
986 VBOX_LINUX_INCS += $(VBOX_LINUX_SRC)/include2 $(kernelpath)/include
987 else
988 kernelpath := $(VBOX_LINUX_SRC)
989 endif
990 ifeq ($(BUILD_TARGET_ARCH),x86)
991 VBOX_LINUX_INCS += $(kernelpath)/include/asm-i386/mach-default
992 endif
993 endif
994endif
995
996
997#
998# Template for building GC things.
999#
1000TEMPLATE_VBOXGC = VBox GC
1001TEMPLATE_VBOXGC_ASTOOL = $(VBOX_ASTOOL)
1002TEMPLATE_VBOXGC_ASFLAGS = $(VBOX_ASFLAGS32)
1003TEMPLATE_VBOXGC_DEFS = IN_GC $(ARCH_BITS_DEFS)
1004TEMPLATE_VBOXGC_SYSSUFF = .gc
1005TEMPLATE_VBOXGC_BLD_TRG_ARCH = x86
1006
1007ifeq ($(VBOX_LDR_FMT32),pe)
1008ifdef VBOX_USE_VCC80
1009 TEMPLATE_VBOXGC_TOOL = VCC80X86
1010 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)
1011else
1012 TEMPLATE_VBOXGC_TOOL = VCC70
1013 TEMPLATE_VBOXGC_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP)
1014endif
1015TEMPLATE_VBOXGC_CFLAGS = $(TEMPLATE_VBOXGC_CXXFLAGS)
1016TEMPLATE_VBOXGC_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Lines -MapInfo:Exports -NoD
1017ifdef VBOX_USE_VCC80
1018 include $(PATH_KBUILD)/sdks/W2K3DDKX86.kmk
1019 TEMPLATE_VBOXGC_LIBS = \
1020 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1021else
1022 TEMPLATE_VBOXGC_LIBS = \
1023 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1024endif
1025endif
1026
1027ifeq ($(VBOX_LDR_FMT32),elf)
1028TEMPLATE_VBOXGC_TOOL = $(VBOX_GCC32_TOOL)
1029TEMPLATE_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)
1030TEMPLATE_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)
1031TEMPLATE_VBOXGC_LDFLAGS = -nostdlib -Bsymbolic
1032# temporarily, must fix the loader.
1033TEMPLATE_VBOXGC_LDFLAGS += -S
1034TEMPLATE_VBOXGC_LDFLAGS.release = -S
1035TEMPLATE_VBOXGC_LIBS = \
1036 $(VBOX_GCC32_LIBGCC) # instricts
1037endif
1038
1039ifeq ($(VBOX_LDR_FMT32),macho)
1040TEMPLATE_VBOXGC_TOOL = GCC4MACHO
1041TEMPLATE_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
1042TEMPLATE_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
1043TEMPLATE_VBOXGC_LDFLAGS = -nostdlib
1044#TEMPLATE_VBOXGC_LDFLAGS.release = -Wl,-S ???
1045endif
1046
1047ifeq ($(VBOX_LDR_FMT32),lx)
1048TEMPLATE_VBOXGC_TOOL = GCC3OMF
1049TEMPLATE_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
1050TEMPLATE_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
1051TEMPLATE_VBOXGC_LDFLAGS = -Zdll -nostdlib
1052TEMPLATE_VBOXGC_LIBS = \
1053 $(VBOX_GCC32_LIBGCC) \
1054 $(OBJ_SYS0) \
1055 end
1056endif
1057
1058
1059#
1060# Template for building a GC ring-3 testcase (tstVMStructGC, tstDevStructGC).
1061#
1062TEMPLATE_VBOXGCEXE = VBox GC as ring-3 testcase
1063TEMPLATE_VBOXGCEXE_EXTENDS = VBOXGC
1064
1065ifeq ($(VBOX_LDR_FMT32),pe)
1066 TEMPLATE_VBOXGCEXE_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD -Debug
1067 TEMPLATE_VBOXGCEXE_SDKS = WIN32SDK
1068 ifdef VBOX_USE_VCC80
1069 TEMPLATE_VBOXGCEXE_LIBS = \
1070 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
1071 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib
1072 else
1073 TEMPLATE_VBOXGCEXE_LIBS = \
1074 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
1075 $(PATH_TOOL_VCC70_LIB)/oldnames.lib
1076 endif
1077endif
1078
1079ifeq ($(VBOX_LDR_FMT32),elf)
1080 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1081 TEMPLATE_VBOXGCEXE_LDFLAGS.release = -g
1082endif
1083
1084ifeq ($(VBOX_LDR_FMT32),macho)
1085 TEMPLATE_VBOXGCEXE_CFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CFLAGS))
1086 TEMPLATE_VBOXGCEXE_CXXFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CXXFLAGS))
1087 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1088endif
1089
1090ifeq ($(VBOX_LDR_FMT32),lx)
1091 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1092 TEMPLATE_VBOXGCEXE_LIBS = $(NO_SUCH_VARIABLE)
1093endif
1094
1095
1096#
1097# Template for building R0 things.
1098#
1099TEMPLATE_VBOXR0 = VBox Ring 0
1100TEMPLATE_VBOXR0_ASTOOL = $(VBOX_ASTOOL)
1101TEMPLATE_VBOXR0_ASFLAGS = $(VBOX_ASFLAGS)
1102TEMPLATE_VBOXR0_DEFS = IN_RING0 $(ARCH_BITS_DEFS)
1103
1104ifeq ($(VBOX_LDR_FMT),pe)
1105TEMPLATE_VBOXR0_TOOL = $(VBOX_VCC_TOOL)
1106ifdef VBOX_USE_VCC80
1107 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -W3 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1108else
1109 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1110endif
1111TEMPLATE_VBOXR0_CFLAGS = $(TEMPLATE_VBOXR0_CXXFLAGS)
1112TEMPLATE_VBOXR0_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD
1113ifdef VBOX_USE_VCC80
1114 TEMPLATE_VBOXR0_LIBS.x86 = \
1115 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1116else
1117 TEMPLATE_VBOXR0_LIBS.x86 = \
1118 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1119endif
1120endif # pe
1121
1122ifeq ($(VBOX_LDR_FMT),elf)
1123TEMPLATE_VBOXR0_TOOL = $(VBOX_GCC_TOOL)
1124TEMPLATE_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)
1125TEMPLATE_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)
1126TEMPLATE_VBOXR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding
1127TEMPLATE_VBOXR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables
1128TEMPLATE_VBOXR0_LDFLAGS = -nostdlib -Bsymbolic
1129# temporarily, must fix the loader.
1130TEMPLATE_VBOXR0_LDFLAGS += -S
1131TEMPLATE_VBOXR0_LDFLAGS.release = -S
1132TEMPLATE_VBOXR0_LIBS = \
1133 $(VBOX_GCC_LIBGCC) # instricts
1134endif
1135
1136ifeq ($(VBOX_LDR_FMT),macho)
1137TEMPLATE_VBOXR0_TOOL = GCC4MACHO
1138TEMPLATE_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
1139TEMPLATE_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
1140TEMPLATE_VBOXR0_LDFLAGS = -nostdlib
1141#TEMPLATE_VBOXR0_LDFLAGS.release = -Wl,-S ???
1142endif
1143
1144ifeq ($(VBOX_LDR_FMT),lx)
1145TEMPLATE_VBOXR0_TOOL = GCC3OMF
1146TEMPLATE_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
1147TEMPLATE_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
1148TEMPLATE_VBOXR0_LDFLAGS = -Zdll -nostdlib
1149TEMPLATE_VBOXR0_LIBS = \
1150 $(VBOX_GCC_LIBGCC) \
1151 $(OBJ_SYS0) \
1152 end
1153endif
1154
1155
1156#
1157# Template for building SUPDRV R0 things.
1158#
1159TEMPLATE_VBOXR0DRV = VBox SUPDRV Ring 0
1160TEMPLATE_VBOXR0DRV_ASTOOL = $(VBOX_ASTOOL)
1161TEMPLATE_VBOXR0DRV_ASFLAGS = $(VBOX_ASFLAGS)
1162TEMPLATE_VBOXR0DRV_DEFS = IN_RING0 IN_RT_R0 $(ARCH_BITS_DEFS)
1163
1164ifeq ($(BUILD_TARGET),win)
1165 TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_VCC_TOOL)
1166 TEMPLATE_VBOXR0DRV_RCDEFS = \
1167 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1168 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1169 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1170 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1171 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1172 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1173 TEMPLATE_VBOXR0DRV_DEFS.x86 = _X86_
1174 TEMPLATE_VBOXR0DRV_DEFS.amd64 = _AMD64_
1175 ifdef VBOX_USE_VCC80
1176 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -W3 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1177 else
1178 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -W3 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1179 endif
1180 TEMPLATE_VBOXR0DRV_CFLAGS = $(TEMPLATE_VBOXR0DRV_CXXFLAGS)
1181 TEMPLATE_VBOXR0DRV_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Debug
1182endif
1183
1184ifeq ($(BUILD_TARGET),linux)
1185TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1186TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0
1187TEMPLATE_VBOXR0DRV_INCS = $(VBOX_LINUX_INCS)
1188TEMPLATE_VBOXR0DRV_CFLAGS = -nostdinc -iwithprefix include \
1189 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1190 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1191TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mpreferred-stack-boundary=2 -msoft-float
1192TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1193 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1194 -Wno-sign-compare -Wdeclaration-after-statement
1195TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXR0DRV_CFLAGS)) -fno-exceptions -fno-rtti
1196 ifndef VBOX_LINUX_VERSION_2_4
1197# 2.6
1198TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1199TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1200TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1201 else
1202# 2.4
1203TEMPLATE_VBOXR0DRV_SYSSUFF = .o
1204TEMPLATE_VBOXR0DRV_LDFLAGS = -r -s
1205 endif
1206endif
1207
1208ifeq ($(BUILD_TARGET),os2)
1209TEMPLATE_VBOXR0DRV_TOOL = GCC3OMF
1210TEMPLATE_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
1211TEMPLATE_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
1212TEMPLATE_VBOXR0DRV_LIBS = $(VBOX_GCC_LIBGCC)
1213# wlink thinks physdevice doesn't need fixups and should have a stack - stupid!
1214TEMPLATE_VBOXR0DRV_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
1215endif
1216
1217ifeq ($(BUILD_TARGET),darwin)
1218TEMPLATE_VBOXR0DRV_TOOL = GCC4MACHO
1219TEMPLATE_VBOXR0DRV_DEFS += KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT
1220TEMPLATE_VBOXR0DRV_INCS += \
1221 /System/Library/Frameworks/Kernel.framework/PrivateHeaders \
1222 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Kernel.framework/Headers
1223TEMPLATE_VBOXR0DRV_CXXFLAGS = \
1224 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1225 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1226 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1227 -fapple-kext -fno-rtti -fcheck-new
1228TEMPLATE_VBOXR0DRV_CXXFLAGS.release = $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fasm-blocks
1229TEMPLATE_VBOXR0DRV_CXXFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1230TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1231TEMPLATE_VBOXR0DRV_CFLAGS = \
1232 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1233 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1234 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1235 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1236TEMPLATE_VBOXR0DRV_CFLAGS.release = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1237TEMPLATE_VBOXR0DRV_CFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.profile)
1238TEMPLATE_VBOXR0DRV_CFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile)
1239TEMPLATE_VBOXR0DRV_LDFLAGS = -static -nostdlib -r -Wl,-Y,1455 \
1240 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
1241TEMPLATE_VBOXR0DRV_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC)
1242endif
1243
1244ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),) # pure guess work just to avoid the warning below
1245TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1246TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ IN_RING0 IN_RT_R0
1247TEMPLATE_VBOXR0DRV_CFLAGS = \
1248 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1249 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1250TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -msoft-float
1251TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1252 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1253 -Wno-sign-compare -Wdeclaration-after-statement
1254TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXR0DRV_CFLAGS)) -fno-exceptions -fno-rtti
1255TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1256TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1257TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1258endif
1259
1260ifdef VBOX_WITH_VBOXDRV
1261 ifndef TEMPLATE_VBOXR0DRV_TOOL
1262 $(warning Warning: VBox Build: Target $(BUILD_PLATFORM) is not officially supported!)
1263 endif
1264endif
1265
1266
1267
1268#
1269# Template for building R3 executables and static libraries which are linked into executables.
1270#
1271TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
1272TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
1273TEMPLATE_VBOXR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
1274TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
1275TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
1276ifeq ($(BUILD_TARGET),win)
1277 TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
1278 TEMPLATE_VBOXR3EXE_RCDEFS = \
1279 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1280 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1281 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1282 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1283 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1284 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1285 TEMPLATE_VBOXR3EXE_SDKS = WINPSDK
1286 ifdef VBOX_USE_VCC80
1287 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MD -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1288 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
1289 else
1290 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MD -W3 -wd4065 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1291 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -GZ
1292 endif
1293 TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
1294 TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
1295 TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1296 TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1297 TEMPLATE_VBOXR3EXE_LDFLAGS = \
1298 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1299 /DISALLOWLIB:libc.lib \
1300 /DISALLOWLIB:libcd.lib \
1301 /DISALLOWLIB:libcmt.lib \
1302 /DISALLOWLIB:libcmtd.lib \
1303 /DISALLOWLIB:msvcrtd.lib
1304 TEMPLATE_VBOXR3EXE_LIBS = \
1305 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1306 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1307 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib
1308
1309else # the gcc guys
1310TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
1311TEMPLATE_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
1312# L4 currently can't handle exception handling.
1313TEMPLATE_VBOXR3EXE_CXXFLAGS.l4 = -fno-exceptions -nostdinc \
1314 $(addprefix -I,$(VBOX_L4_GCC3_INCS) $(L4_INCDIR) $(FILE_TOOL_GPP3_INCDIR)) \
1315 $(DEBUG_L4)
1316TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
1317TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1318TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1319TEMPLATE_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
1320TEMPLATE_VBOXR3EXE_CFLAGS.darwin = -fno-common
1321TEMPLATE_VBOXR3EXE_CFLAGS.l4 = -nostdinc \
1322 $(addprefix -I,$(VBOX_L4_GCC3_INCS) $(L4_INCDIR)) $(DEBUG_L4)
1323TEMPLATE_VBOXR3EXE_DEFS.l4 = L4_THREAD_SAFE
1324TEMPLATE_VBOXR3EXE_LDFLAGS.l4 = \
1325 $(L4_LIBDIR)/../crt0.o \
1326 -T$(L4_LIBDIR)/../main_dyn.ld -nostdlib \
1327 -Wl,--export-dynamic,--dynamic-linker=libld-l4.s.so \
1328 -Wl,--rpath-link,$(L4_LIBDIR)
1329 ifeq ($(BUILD_TARGET),linux)
1330TEMPLATE_VBOXR3EXE_LIBS = pthread m $(LIB_UUID) rt dl
1331 else ifeq ($(BUILD_TARGET),l4)
1332TEMPLATE_VBOXR3EXE_LIBS = \
1333 $(L4_LIBDIR)/libvboxserver.s.so \
1334 $(L4_LIBDIR)/libuc++.0.s.so \
1335 supc++ gcc_eh gcc \
1336 $(L4_LIBDIR)/libdl.s.so \
1337 $(L4_LIBDIR)/libuc.0.s.so
1338 else ifeq ($(BUILD_TARGET),os2)
1339TEMPLATE_VBOXR3EXE_TOOL = GCC3OMF
1340TEMPLATE_VBOXR3EXE_LIBS = socket iconv
1341 else ifeq ($(BUILD_TARGET),darwin)
1342TEMPLATE_VBOXR3EXE_TOOL = GCC4MACHO
1343TEMPLATE_VBOXR3EXE_LIBS =
1344TEMPLATE_VBOXR3EXE_LDFLAGS = -read_only_relocs suppress
1345TEMPLATE_VBOXR3EXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1346 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1347TEMPLATE_VBOXR3EXE_TOOL = GCC3
1348TEMPLATE_VBOXR3EXE_LIBS = pthread
1349 else ifeq ($(BUILD_TARGET),solaris)
1350$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1351TEMPLATE_VBOXR3EXE_TOOL = GCC3PLAIN
1352TEMPLATE_VBOXR3EXE_LIBS = rt
1353 else
1354$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1355TEMPLATE_VBOXR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.release)
1356TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease)
1357 endif
1358endif
1359
1360#
1361# Template for building R3 shared objects / DLLs.
1362# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
1363#
1364TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
1365TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
1366TEMPLATE_VBOXR3_LDFLAGS.l4 = $(L4_LIBDIR)/../crt0.s.o -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
1367TEMPLATE_VBOXR3_DEFS.darwin = $(TEMPLATE_VBOXR3EXE_DEFS.darwin) PIC
1368ifeq ($(BUILD_TARGET_ARCH),amd64)
1369 ifneq ($(BUILD_TARGET),win)
1370 TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
1371 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
1372 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
1373 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
1374 endif
1375endif
1376
1377#
1378# Ring-3 testcase.
1379# This is the VBOXR3EXE template only with a different install dir.
1380#
1381TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
1382TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
1383TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
1384TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
1385
1386#
1387# Template for building bad C/C++ style R3 executables (no -pedantic).
1388#
1389TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
1390TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
1391ifneq ($(BUILD_TARGET),win)
1392 # (only gcc)
1393 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
1394 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
1395 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations ,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
1396endif
1397
1398#
1399# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
1400# This is mostly identical to the VBOXR3NPEXE template.
1401#
1402TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
1403TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3NPEXE
1404TEMPLATE_VBOXR3NP_LDFLAGS.l4 = \
1405 $(L4_LIBDIR)/../crt0.s.o \
1406 -T$(L4_LIBDIR)/../main_rel.ld \
1407 -nostdlib
1408ifeq ($(BUILD_TARGET_ARCH),amd64)
1409 ifneq ($(BUILD_TARGET),win)
1410 TEMPLATE_VBOXR3NP_DEFS = $(TEMPLATE_VBOXR3NPEXE_DEFS) PIC
1411 TEMPLATE_VBOXR3NP_CFLAGS = $(TEMPLATE_VBOXR3NPEXE_CFLAGS) -fPIC
1412 TEMPLATE_VBOXR3NP_CXXFLAGS = $(TEMPLATE_VBOXR3NPEXE_CXXFLAGS) -fPIC
1413 TEMPLATE_VBOXR3NP_LDFLAGS = $(TEMPLATE_VBOXR3NPEXE_LDFLAGS) -fPIC
1414 endif
1415endif
1416
1417
1418#
1419# Template for building libraries, shared libraries / modules
1420# which only depends on IPRT for crt.
1421#
1422TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
1423TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
1424TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
1425## @todo C++
1426TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno -Wall
1427TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -mcmodel=medium -fno-common
1428#TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O0 -fno-math-errno -fno-peephole2 -fno-strict-aliasing - for win64.
1429TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
1430TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1431TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1432TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -mdynamic-no-pic
1433TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
1434
1435ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.amd64)
1436 # cross compile to 64-bit ELF (linux).
1437 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
1438 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
1439 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
1440 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
1441 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1442
1443else ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1444 # Use the default GCC (MinGW) with the Microsoft linker.
1445 # (Drop all '-g' options as we're unable to strip the debug info.)
1446 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1447 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1448 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1449 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
1450 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
1451 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1452 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
1453
1454else
1455 # Use the default GCC.
1456 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
1457 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1458 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1459 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1460 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1461 ifneq ($(filter-out os2 darwin solaris,$(BUILD_TARGET)),)
1462 ifneq ($(BUILD_TARGET_ARCH),amd64)
1463 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
1464 endif
1465 endif
1466 ifneq ($(filter-out freebsd,$(BUILD_TARGET)),)
1467 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
1468 else
1469 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1470 endif
1471endif
1472
1473
1474#
1475# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
1476#
1477TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
1478TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
1479TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
1480ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1481 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
1482else
1483 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
1484endif
1485
1486
1487#
1488# Template for building executables that is part of the VBox MAIN component.
1489#
1490TEMPLATE_VBOXMAINEXE = VBox Main Executables
1491TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
1492TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
1493TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE
1494TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
1495TEMPLATE_VBOXMAINEXE_INCS = \
1496 $(VBOX_PATH_SDK)/include
1497ifdef VBOX_WITH_XPCOM
1498 TEMPLATE_VBOXMAINEXE_INCS += \
1499 $(VBOX_XPCOM_INCS)
1500endif
1501
1502ifeq ($(BUILD_TARGET),win)
1503 TEMPLATE_VBOXMAINEXE_SDKS = WINPSDK W2K3DDK
1504 ifdef VBOX_USE_VCC80
1505 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
1506 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GF- -MD -EHsc -W3 -wd4065 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1507 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
1508 else
1509 TEMPLATE_VBOXMAINEXE_TOOL = VCC70
1510 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GX- -GF- -MD -EHsc -W3 -wd4065 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1511 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -GZ
1512 endif
1513 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
1514 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1515 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
1516 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1517 TEMPLATE_VBOXMAINEXE_INCS += \
1518 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1519 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
1520 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
1521 /DISALLOWLIB:libc.lib \
1522 /DISALLOWLIB:libcd.lib \
1523 /DISALLOWLIB:msvcrt.lib \
1524 /DISALLOWLIB:msvcrtd.lib \
1525 /DISALLOWLIB:libcmtd.lib \
1526 /DISALLOWLIB:libcmt.lib
1527 TEMPLATE_VBOXMAINEXE_LIBS = \
1528 $(LIB_RUNTIME) \
1529 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1530 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1531 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1532 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1533
1534else # the GCC guys:
1535
1536TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
1537TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
1538TEMPLATE_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
1539TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -fno-inline
1540TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
1541TEMPLATE_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
1542TEMPLATE_VBOXMAINEXE_CFLAGS.debug = -fno-inline
1543TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1544TEMPLATE_VBOXMAINEXE_INCS += $(VBOX_XPCOM_INCS)
1545 ifeq ($(BUILD_TARGET),linux)
1546TEMPLATE_VBOXMAINEXE_LIBS = pthread m $(LIB_UUID) rt
1547 else ifeq ($(BUILD_TARGET),l4)
1548TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1549# no libs as yet in l4 target - must be added later
1550 else ifeq ($(BUILD_TARGET),os2)
1551TEMPLATE_VBOXMAINEXE_TOOL = GCC3OMF
1552TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1553 else ifeq ($(BUILD_TARGET),darwin)
1554TEMPLATE_VBOXMAINEXE_TOOL = GCC4MACHO
1555TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1556TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin = -bind_at_load -framework Carbon
1557 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1558TEMPLATE_VBOXMAINEXE_TOOL = GCC3
1559TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1560TEMPLATE_VBOXMAINEXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1561 else ifeq ($(BUILD_TARGET),solaris)
1562$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1563TEMPLATE_VBOXMAINEXE_TOOL = GCC3PLAIN
1564TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt
1565 else
1566$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1567TEMPLATE_VBOXMAINEXE_LIBS =
1568 endif
1569
1570endif # !win
1571
1572#
1573# Template for building the Main (+GUI) components
1574# This differ from VBOXMAINEXE only in PIC handling and similar DLL stuff.
1575#
1576TEMPLATE_VBOXMAIN = VBox MAIN
1577TEMPLATE_VBOXMAIN_EXTENDS = VBOXMAINEXE
1578ifeq ($(BUILD_TARGET_ARCH),amd64)
1579 ifneq ($(BUILD_TARGET),win)
1580 TEMPLATE_VBOXMAIN_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
1581 TEMPLATE_VBOXMAIN_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
1582 TEMPLATE_VBOXMAIN_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1583 TEMPLATE_VBOXMAIN_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
1584 endif
1585endif
1586TEMPLATE_VBOXMAIN_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin))
1587
1588#
1589# Template for building executables that is part of the VBox MAIN component.
1590# This is (pretty much) identical to VBOXMAIN except for PIC handling (which will be fixed later).
1591#
1592TEMPLATE_VBOXMAIN = VBox Main
1593TEMPLATE_VBOXMAIN_EXTENDS = VBOXMAINEXE
1594
1595
1596#
1597# Template for building executables that use the VBox MAIN component (COM stuff etc.)
1598#
1599TEMPLATE_VBOXMAINCLIENT = VBox MAIN Client
1600TEMPLATE_VBOXMAINCLIENT_EXTENDS = VBOXMAINEXE
1601ifeq ($(BUILD_TARGET),win)
1602 TEMPLATE_VBOXMAINCLIENT_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
1603 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
1604 $(PATH_SDK_WINPSDK_LIB)/User32.Lib \
1605 $(PATH_SDK_WINPSDK_LIB)/Shell32.Lib \
1606 $(PATH_SDK_WINPSDK_LIB)/ShLwApi.Lib \
1607 $(PATH_SDK_WINPSDK_LIB)/Ole32.Lib \
1608 $(PATH_SDK_WINPSDK_LIB)/OleAut32.Lib \
1609 $(PATH_SDK_WINPSDK_LIB)/Uuid.Lib
1610else
1611 TEMPLATE_VBOXMAINCLIENT_LIBS = $(TEMPLATE_VBOXMAINEXE_LIBS) \
1612 $(PATH_LIB)/VBoxXPCOM$(VBOX_SUFF_LIB) \
1613 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
1614 $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL) \
1615 $(LIB_RUNTIME)
1616
1617 TEMPLATE_VBOXMAINCLIENT_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
1618 NDEBUG TRIMMED
1619 ## Wonder why we compile main with defaults for these two and then drops it in the client executables...
1620 TEMPLATE_VBOXMAINCLIENT_CXXFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS) \
1621 -fno-rtti -fno-exceptions
1622 TEMPLATE_VBOXMAINCLIENT_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
1623 -pthread
1624 TEMPLATE_VBOXMAINCLIENT_LDFLAGS.darwin = $(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin) \
1625 -bind_at_load -framework Carbon
1626endif
1627
1628
1629#
1630# Template for building Qt GUI executables.
1631#
1632TEMPLATE_VBOXQTGUIEXE = VBox Qt GUI Executable
1633TEMPLATE_VBOXQTGUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS)
1634TEMPLATE_VBOXQTGUIEXE_INCS = \
1635 $(VBOX_PATH_SDK)/include \
1636 $(VBOX_PATH_QT)/include
1637
1638ifeq ($(BUILD_TARGET),win)
1639 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_VCC_TOOL)
1640 TEMPLATE_VBOXQTGUIEXE_DEFS += _WIN32_WINNT=0x0500 UNICODE QT_DLL _CRT_SECURE_NO_DEPRECATE
1641 ## @todo VCC70 flags?
1642 ifdef VBOX_USE_VCC80
1643 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1644 -nologo -Zm200 -W3 -MD -EHsc -Zc:wchar_t-
1645 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu
1646 else
1647 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1648 -nologo -Zm200 -W3 -MD -GX
1649 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -GZ
1650 endif
1651 TEMPLATE_VBOXQTGUIEXE_INCS += \
1652 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1653 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = \
1654 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
1655 /DELAYLOAD:oleaut32.dll
1656 TEMPLATE_VBOXQTGUIEXE_SDKS = WINPSDK
1657 TEMPLATE_VBOXQTGUIEXE_LIBS = \
1658 $(LIB_QT) \
1659 $(LIB_QTMAIN) \
1660 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
1661 $(LIB_RUNTIME) \
1662 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1663 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1664 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1665 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
1666 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1667
1668else # the gcc guys:
1669 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_GCC_TOOL)
1670 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM
1671 TEMPLATE_VBOXQTGUIEXE_DEFS.linux = _REENTRANT
1672
1673 TEMPLATE_VBOXQTGUIEXE_INCS += \
1674 $(LIB_SDL_INC) \
1675 $(VBOX_XPCOM_INCS)
1676 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1677 -pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
1678 -Wno-long-long -fshort-wchar -fno-strict-aliasing
1679 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -pthread
1680 ## @todo no $(LIB_QTMAIN) here?
1681 TEMPLATE_VBOXQTGUIEXE_LIBS = \
1682 $(LIB_QT) \
1683 $(LIB_SDL) \
1684 $(PATH_LIB)/VBoxXPCOM$(VBOX_SUFF_LIB) \
1685 $(LIB_RUNTIME) \
1686 $(LIB_REM) \
1687 $(LIB_VMM) \
1688 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
1689 $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
1690
1691 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
1692 $(VBOX_PATH_QT)/lib
1693
1694 ifeq ($(BUILD_TARGET),darwin)
1695 TEMPLATE_VBOXQTGUIEXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1696 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -framework Carbon -framework QuickTime -bind_at_load
1697 TEMPLATE_VBOXQTGUIEXE_LIBS +=
1698 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
1699 else ifeq ($(BUILD_TARGET),os2)
1700 TEMPLATE_VBOXQTGUIEXE_LIBS +=
1701 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
1702 else
1703 TEMPLATE_VBOXQTGUIEXE_LIBS += \
1704 Xext \
1705 X11 \
1706 m \
1707 $(LIB_PTHREAD)
1708 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \
1709 $(VBOX_LIBPATH_X11)
1710 endif
1711
1712endif
1713
1714#
1715# Template for building Qt GUI components.
1716#
1717TEMPLATE_VBOXQTGUI = VBox Qt GUI Components
1718TEMPLATE_VBOXQTGUI_EXTENDS = VBOXQTGUIEXE
1719TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN) $(PATH_BIN)/VBoxXML$(VBOX_SUFF_DLL),$(TEMPLATE_VBOXQTGUIEXE_LIBS))
1720ifeq ($(BUILD_TARGET),darwin)
1721 TEMPLATE_VBOXQTGUI_LDFLAGS = $(filter-out -framework Carbon -framework QuickTime -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS))
1722endif
1723ifeq ($(BUILD_TARGET_ARCH),amd64)
1724 ifneq ($(BUILD_TARGET),win)
1725 TEMPLATE_VBOXQTGUI_DEFS = PIC $(TEMPLATE_VBOXQTGUIEXE_DEFS)
1726 TEMPLATE_VBOXQTGUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CFLAGS)
1727 TEMPLATE_VBOXQTGUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS)
1728 TEMPLATE_VBOXQTGUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_LDFLAGS)
1729 endif
1730endif
1731
1732
1733#
1734# Template for building build bldprogs.
1735#
1736TEMPLATE_VBOXBLDPROG = VBox Build Program
1737TEMPLATE_VBOXBLDPROG_DEFS = IN_RING3
1738ifeq ($(BUILD_PLATFORM),win)
1739 ifeq ($(BUILD_PLATFORM_ARCH),x86)
1740 ifdef VBOX_USE_VCC80
1741 TEMPLATE_VBOXBLDPROG_TOOL = VCC80X86
1742 else
1743 TEMPLATE_VBOXBLDPROG_TOOL = VCC70
1744 endif
1745 TEMPLATE_VBOXBLDPROG_SDKS = WIN32SDK
1746 else
1747 TEMPLATE_VBOXBLDPROG_TOOL = VCC80AMD64
1748 TEMPLATE_VBOXBLDPROG_SDKS = WIN64SDK
1749 endif
1750 ifneq ($(TEMPLATE_VBOXBLDPROG_TOOL),VCC70)
1751 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -W3 -wd4996 -Zc:wchar_t-
1752 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -RTCsu
1753 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -Oy- -GS-
1754 else
1755 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -W3
1756 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -GZ
1757 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -Ogitb2 -Oy-
1758 endif
1759 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1760 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1761 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
1762 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
1763 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1764 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
1765 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
1766 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
1767 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1768 /DISALLOWLIB:libcd.lib \
1769 /DISALLOWLIB:libcmtd.lib \
1770 /DISALLOWLIB:msvcrt.lib \
1771 /DISALLOWLIB:msvcrtd.lib \
1772 /DISALLOWLIB:msvcprt.lib \
1773 /DISALLOWLIB:msvcprtd.lib
1774 TEMPLATE_VBOXBLDPROG_LIBS = \
1775 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
1776 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt.lib \
1777 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt.lib
1778
1779else
1780# (gcc of some kind )
1781TEMPLATE_VBOXBLDPROG_TOOL = GCC3
1782TEMPLATE_VBOXBLDPROG_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1783TEMPLATE_VBOXBLDPROG_CFLAGS.debug = -fno-inline
1784TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
1785TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
1786TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
1787TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe
1788TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -fno-inline
1789TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
1790TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1791TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1792 ifeq ($(BUILD_PLATFORM),linux)
1793TEMPLATE_VBOXBLDPROG_LIBS = pthread m $(LIB_UUID) rt dl
1794 else ifeq ($(BUILD_PLATFORM),os2)
1795TEMPLATE_VBOXBLDPROG_TOOL = GCC3OMF
1796TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
1797 else ifeq ($(BUILD_PLATFORM),darwin)
1798TEMPLATE_VBOXBLDPROG_TOOL = GCC4MACHO
1799TEMPLATE_VBOXBLDPROG_LIBS =
1800TEMPLATE_VBOXBLDPROG_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1801 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_PLATFORM)),)
1802TEMPLATE_VBOXBLDPROG_TOOL = GCC3
1803TEMPLATE_VBOXBLDPROG_LIBS =
1804 else ifeq ($(BUILD_PLATFORM),solaris)
1805$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
1806TEMPLATE_VBOXBLDPROG_TOOL = GCC3PLAIN
1807TEMPLATE_VBOXBLDPROG_LIBS = rt
1808 else
1809$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
1810 endif
1811
1812endif # !win
1813
1814
1815
1816#
1817# Template for building R3 win32 guest additions.
1818#
1819TEMPLATE_VBOXW32GUESTR3 = VBox Win32 Guest Program
1820TEMPLATE_VBOXW32GUESTR3_INST = $(INST_ADDITIONS)
1821TEMPLATE_VBOXW32GUESTR3_BLD_TRG = win
1822TEMPLATE_VBOXW32GUESTR3_BLD_TRG_ARCH = x86
1823TEMPLATE_VBOXW32GUESTR3_BLD_TRG_CPU = i386
1824TEMPLATE_VBOXW32GUESTR3_DEFS = IN_GUEST IN_GUEST_R3 IN_RT_R3 IN_RING3 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
1825TEMPLATE_VBOXW32GUESTR3_RCDEFS = \
1826 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1827 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1828 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1829 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1830 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1831 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1832TEMPLATE_VBOXW32GUESTR3_ASTOOL = YASM
1833TEMPLATE_VBOXW32GUESTR3_ASFLAGS = -f win -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
1834TEMPLATE_VBOXW32GUESTR3_DLLSUFF = .dll
1835TEMPLATE_VBOXW32GUESTR3_EXESUFF = .exe
1836TEMPLATE_VBOXW32GUESTR3_LIBSUFF = .lib
1837TEMPLATE_VBOXW32GUESTR3_ARLIBSUFF = .lib
1838TEMPLATE_VBOXW32GUESTR3_SDKS = WIN32SDK W2K3DDKX86
1839ifdef VBOX_USE_VCC80
1840 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC80X86
1841 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
1842 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -RTCsu
1843 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -O2 -Oy- -GS-
1844else
1845 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC70
1846 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -U__LINUX__ -U__OS2__ -W3
1847 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -GZ
1848 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -Ogitb2 -Oy-
1849endif
1850TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
1851TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
1852TEMPLATE_VBOXW32GUESTR3_CFLAGS = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS)
1853TEMPLATE_VBOXW32GUESTR3_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug)
1854TEMPLATE_VBOXW32GUESTR3_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
1855TEMPLATE_VBOXW32GUESTR3_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile)
1856TEMPLATE_VBOXW32GUESTR3_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile)
1857TEMPLATE_VBOXW32GUESTR3_INCS = \
1858 $(VBOX_PATH_SDK)/include
1859TEMPLATE_VBOXW32GUESTR3_LDFLAGS = \
1860 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE \
1861 /DISALLOWLIB:libc.lib \
1862 /DISALLOWLIB:libcd.lib \
1863 /DISALLOWLIB:msvcrt.lib \
1864 /DISALLOWLIB:libcmtd.lib \
1865 /DISALLOWLIB:msvcrtd.lib
1866ifdef VBOX_USE_VCC80
1867 TEMPLATE_VBOXW32GUESTR3_LIBS = \
1868 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib \
1869 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
1870 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
1871else
1872 TEMPLATE_VBOXW32GUESTR3_LIBS = \
1873 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \
1874 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
1875 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
1876endif
1877
1878#
1879# R3 win32 guest libraries
1880#
1881TEMPLATE_VBOXW32GUESTR3LIB = VBox Win32 Guest User Libraries
1882TEMPLATE_VBOXW32GUESTR3LIB_EXTENDS = VBOXW32GUESTR3
1883TEMPLATE_VBOXW32GUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
1884
1885
1886#
1887# Template for building R0 win32 guest tools.
1888#
1889TEMPLATE_VBOXW32GUESTR0 = VBox Win32 Guest Driver
1890TEMPLATE_VBOXW32GUESTR0_INST = $(INST_ADDITIONS)
1891TEMPLATE_VBOXW32GUESTR0_BLD_TRG = win
1892TEMPLATE_VBOXW32GUESTR0_BLD_TRG_ARCH = x86
1893TEMPLATE_VBOXW32GUESTR0_BLD_TRG_CPU = i386
1894TEMPLATE_VBOXW32GUESTR0_DEFS = IN_RING0 _X86_ IN_GUEST_R0 IN_RT_R0 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
1895TEMPLATE_VBOXW32GUESTR0_RCDEFS = \
1896 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1897 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1898 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1899 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1900 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1901 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1902TEMPLATE_VBOXW32GUESTR0_ASTOOL = YASM
1903TEMPLATE_VBOXW32GUESTR0_ASFLAGS = -f win32 -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
1904TEMPLATE_VBOXW32GUESTR0_SYSSUFF = .sys
1905ifdef VBOX_USE_VCC80
1906 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC80X86
1907 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
1908 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -EHs-c- -Zl
1909 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -O2 -Oy-
1910else
1911 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC70
1912 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -U__LINUX__ -U__OS2__ -W3
1913 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -GX- -Zl
1914 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -Ogitb2 -Oy-
1915endif
1916TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
1917TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
1918TEMPLATE_VBOXW32GUESTR0_CFLAGS = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS)
1919TEMPLATE_VBOXW32GUESTR0_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug)
1920TEMPLATE_VBOXW32GUESTR0_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
1921TEMPLATE_VBOXW32GUESTR0_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile)
1922TEMPLATE_VBOXW32GUESTR0_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile)
1923TEMPLATE_VBOXW32GUESTR0_LDFLAGS = \
1924 -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Machine:X86 -Debug \
1925 /DISALLOWLIB:libcd.lib \
1926 /DISALLOWLIB:msvcrt.lib \
1927 /DISALLOWLIB:msvcrtd.lib \
1928 /DISALLOWLIB:libcmtd.lib
1929
1930#
1931# R0 win32 guest libraries
1932#
1933TEMPLATE_VBOXW32GUESTR0LIB = VBox Win32 Guest Driver
1934TEMPLATE_VBOXW32GUESTR0LIB_EXTENDS = VBOXW32GUESTR0
1935TEMPLATE_VBOXW32GUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
1936
1937
1938#
1939# Windows rc workaround for crosscompiling.
1940# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
1941#
1942ifneq ($(BUILD_PLATFORM),win)
1943 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
1944 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
1945 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
1946 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
1947else
1948 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
1949 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
1950 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
1951 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
1952 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
1953 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
1954 ) Sorry_Cannot_find_mc_in_the_PSDK)
1955endif
1956
1957
1958#
1959# Template for syntax checking the linux guest additions.
1960# Not properly realized yet.
1961#
1962TEMPLATE_VBOXLNX32GUESTR0 = Template for *syntax checking* linux guest additions kernel modules
1963TEMPLATE_VBOXLNX32GUESTR0_TOOL = $(VBOX_GCC_TOOL)
1964TEMPLATE_VBOXLNX32GUESTR0_BLD_TRG = linux
1965TEMPLATE_VBOXLNX32GUESTR0_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0 IN_GUEST_R0
1966TEMPLATE_VBOXLNX32GUESTR0_INCS = $(VBOX_LINUX_INCS)
1967TEMPLATE_VBOXLNX32GUESTR0_CFLAGS = -nostdinc -iwithprefix include \
1968 -O2 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1969 $(VBOX_GCC_fno-stack-protector) -fno-strict-aliasing -fno-common \
1970 -mpreferred-stack-boundary=2 -msoft-float
1971TEMPLATE_VBOXLNX32GUESTR0_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXLNX32GUESTR0_CFLAGS)) -fno-exceptions -fno-rtti
1972ifndef VBOX_LINUX_VERSION_2_4
1973# 2.6
1974TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .ko
1975TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -m elf_i386 -r
1976else
1977# 2.4
1978TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .o
1979TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -r -s
1980endif
1981
1982
1983#
1984# Tools and templates for building 32-bit linux guest additions.
1985#
1986TOOL_VBOXLNX32NOCPPLD = Linker tool replacing the VBOX_GCC32_TOOL linker (g++).
1987TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_OUTPUT = $(outbase).map
1988TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1989TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_DEPORD =
1990define TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_CMDS
1991 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_CC) $(flags) -o $(out) $(objs)\
1992 $(foreach p,$(libpath), -L$(p))\
1993 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
1994 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_MAP,$(outbase).map)
1995endef
1996TOOL_VBOXLNX32NOCPPLD_LINK_DLL_OUTPUT = $(outbase).map
1997TOOL_VBOXLNX32NOCPPLD_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1998TOOL_VBOXLNX32NOCPPLD_LINK_DLL_DEPORD =
1999# (no SONAME for now)
2000define TOOL_VBOXLNX32NOCPPLD_LINK_DLL_CMDS
2001 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_CC) $(TOOL_$(VBOX_GCC32_TOOL)_LDFLAGS.dll) $(flags) -o $(out)\
2002 $(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_MAP,$(outbase).map)
2006endef
2007TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_OUTPUT = $(outbase).map
2008TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
2009TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_DEPORD =
2010define TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_CMDS
2011 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_LD_SYSMOD) $(TOOL_VBOXLNX32NOCPPLD_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
2012 $(foreach p,$(libpath), -L$(p))\
2013 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
2014 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_SYSMOD_MAP,$(outbase).map)
2015endef
2016
2017TEMPLATE_VBOXLNX32GUESTR3EXE = Template for building 32-bit linux guest additions programs.
2018TEMPLATE_VBOXLNX32GUESTR3EXE_INST = $(INST_ADDITIONS)
2019TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG = linux
2020TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_ARCH = x86
2021TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_CPU = i386
2022TEMPLATE_VBOXLNX32GUESTR3EXE_TOOL = $(VBOX_GCC32_TOOL)
2023TEMPLATE_VBOXLNX32GUESTR3EXE_ASTOOL = YASM
2024TEMPLATE_VBOXLNX32GUESTR3EXE_ASFLAGS = -f elf32 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels
2025TEMPLATE_VBOXLNX32GUESTR3EXE_DEFS = IN_RING3 IN_GUEST_R3 HC_ARCH_BITS=32 GC_ARCH_BITS=32
2026TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe $(VBOX_GCC_fno-stack-protector)
2027TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug = -fno-inline
2028TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2029TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2030TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2031TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.release = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2032TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug)
2033TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile)
2034TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile)
2035TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_fno-stack-protector)
2036# No LDFLAGS nor LIBS!
2037
2038TEMPLATE_VBOXLNX32GUESTR3EXENOCPP = Template for building 32-bit linux guest additions programs without any C++.
2039TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2040TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_LDTOOL = VBOXLNX32NOCPPLD
2041# No LDFLAGS nor LIBS!
2042
2043TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP = Template for building 32-bit linux guest additions shared objects without any C++.
2044TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2045TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDTOOL = VBOXLNX32NOCPPLD
2046TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS)
2047TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS)
2048TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDFLAGS = -fPIC
2049
2050TEMPLATE_VBOXLNX32GUESTR3LIB = Template for building 32-bit linux guest additions libraries.
2051TEMPLATE_VBOXLNX32GUESTR3LIB_EXTENDS = VBOXLNX32GUESTR3EXE
2052TEMPLATE_VBOXLNX32GUESTR3LIB_INST = $(INST_ADDITION_LIB)
2053
2054
2055#
2056# Two targets to coordinate version number changes properly. Note that the
2057# only way to get a really consistent build is to run 'kmk' in the top-level
2058# directory. If you don't run it there, you get a consistent sub-tree only.
2059#
2060VBOX_VERSION_STAMP = $(PATH_OUT)/version-stamp-$(VBOX_VERSION_STRING)
2061VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
2062VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
2063
2064$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
2065 $(MKDIR) -p $(@D)
2066 $(RM) -f $(filter-out $@,$(wildcard $(PATH_OUT)/version-stamp-*))
2067 $(ECHO_EXT) > $@
2068
2069$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
2070 $(MKDIR) -p $(@D)
2071 $(RM) -f $@ $@.tmp
2072 $(APPEND) $@.tmp "#ifndef __version_generated_h__"
2073 $(APPEND) $@.tmp "#define __version_generated_h__"
2074 $(APPEND) $@.tmp ""
2075 $(APPEND) $@.tmp "#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)"
2076 $(APPEND) $@.tmp "#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)"
2077 $(APPEND) $@.tmp "#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)"
2078 $(APPEND) $@.tmp '#define VBOX_VERSION_STRING "$(VBOX_VERSION_STRING)"'
2079 $(APPEND) $@.tmp ""
2080 $(APPEND) $@.tmp "#endif"
2081 $(MV) -f $@.tmp $@
2082
2083#
2084# Used for external makefiles which cannot include Config.kmk
2085#
2086$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
2087 $(MKDIR) -p $(@D)
2088 $(RM) -f $@ $@.tmp
2089 $(APPEND) $@.tmp "VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)"
2090 $(APPEND) $@.tmp "VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)"
2091 $(APPEND) $@.tmp "VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)"
2092 $(APPEND) $@.tmp "VBOX_VERSION_STRING = $(VBOX_VERSION_STRING)"
2093 $(MV) -f $@.tmp $@
2094
2095
2096# Force building of the version header file as the first thing anywhere in
2097# the tree. This eliminates the need for manual dependencies on it.
2098Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2099Makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2100makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2101
2102
2103#
2104# Legacy.
2105#
2106ifneq ($(LOCALCFG),)
2107 include $(LOCALCFG)
2108endif
2109
2110
2111#
2112# Some extra goals.
2113#
2114.PHONY: up update st stat status
2115up update::
2116 svn$(HOSTSUFF_EXE) up
2117
2118st stat status:
2119 svn$(HOSTSUFF_EXE) status
2120
2121quick:
2122 $(MAKE) VBOX_QUICK=1
2123
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