VirtualBox

source: vbox/trunk/Config.kmk@ 1448

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

Remove the -private version string suffix.

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