VirtualBox

source: vbox/trunk/Config.kmk@ 1787

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

Some preliminary code signing work.

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