VirtualBox

source: vbox/trunk/Config.kmk@ 3406

Last change on this file since 3406 was 3406, checked in by vboxsync, 17 years ago

Confing.kmk: Use kmk_ash instead of cmd.exe and don't kill inherited BEGINLIBPATH (OS/2).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 94.9 KB
Line 
1# $Id: Config.kmk 3406 2007-07-03 23:43:34Z 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-2007 innotek 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_TESTSUITE = testsuite/
71 INST_LIB = lib/
72 INST_ADDITIONS_LIB = $(PATH_LIB)/additions/
73
74else
75
76 INST_BIN = bin/
77 INST_DIST = $(INST_BIN)
78 INST_DLL = $(INST_BIN)
79 INST_SDK = $(INST_BIN)sdk/
80 INST_SDK_SAMPLES = $(INST_SDK)samples
81 INST_DLL = $(INST_BIN)
82 INST_SYS = $(INST_BIN)
83 INST_TESTCASE = $(INST_BIN)testcase/
84 INST_ADDITIONS = $(INST_BIN)additions/
85
86 INST_TESTSUITE = testsuite/
87 INST_LIB = lib/
88 INST_ADDITIONS_LIB = $(INST_LIB)additions/
89endif
90
91PATH_BIN = $(patsubst %/,%,$(PATH_INS)/$(INST_BIN))
92PATH_DLL = $(patsubst %/,%,$(PATH_INS)/$(INST_DLL))
93PATH_SYS = $(patsubst %/,%,$(PATH_INS)/$(INST_SYS))
94PATH_LIB = $(patsubst %/,%,$(PATH_INS)/$(INST_LIB))
95PATH_DOC = $(PATH_OUT)/doc
96VBOX_PATH_SDK = $(patsubst %/,%,$(PATH_INS)/$(INST_SDK))
97VBOX_PATH_DIST = $(patsubst %/,%,$(PATH_INS)/$(INST_DIST))
98VBOX_PATH_TESTSUITE = $(patsubst %/,%,$(PATH_INS)/$(INST_TESTSUITE))
99
100
101# Delete targets on failure.
102.DELETE_ON_ERROR:
103
104# Notify about important kBuild updates.
105ifneq ($(call int-ge,$(KMK_REVISION),972),1)
106 $(error You must update kBuild!)
107endif
108
109#
110# Define USERNAME early on.
111#
112ifndef USERNAME
113 ifdef USER
114 USERNAME = $(USER)
115 else
116 $(warning Warning: You must have USERNAME or USER in your environment.)
117 endif
118endif
119
120#
121# The VirtualBox version.
122#
123
124# Major version.
125VBOX_VERSION_MAJOR = 1
126# Minor version.
127VBOX_VERSION_MINOR = 4
128# This is the current build number. It should be increased every time we publish a
129# new build. The define is available in every source file. Only even build numbers
130# will be published, odd numbers are set during development.
131VBOX_VERSION_BUILD = 1
132# Full version string (may include more than just x.y.z, but no spaces or other problematic chars).
133VBOX_VERSION_STRING = $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
134
135
136#
137# The VirtualBox Configuration Defaults.
138#
139
140# Build linux / win32 additions.
141ifeq ($(BUILD_TARGET),linux)
142 VBOX_WITH_LINUX_ADDITIONS = 1
143 VBOX_WITH_WIN32_ADDITIONS = 1
144endif
145ifeq ($(BUILD_TARGET),l4)
146 VBOX_WITH_LINUX_ADDITIONS = 1
147 VBOX_WITH_WIN32_ADDITIONS = 1
148endif
149ifeq ($(BUILD_TARGET),os2)
150 VBOX_WITH_OS2_ADDITIONS = 1
151endif
152ifeq ($(BUILD_TARGET),win)
153 VBOX_WITH_WIN32_ADDITIONS = 1
154endif
155ifdef VBOX_WITH_LINUX_ADDITIONS
156 ifeq ($(BUILD_TARGET).$(BUILD_PLATFORM_ARCH),linux.x86)
157 VBOX_WITH_LINUX_ADDITIONS_32BIT_R0 = 1
158 endif
159endif
160# Enable the building of shared folders in the windows additions.
161VBOX_WITH_WIN32_ADDITIONS_SHAREDFOLDERS = 1
162
163# build the installer
164VBOX_WITH_INSTALLER = 1
165# enable VRDP server
166VBOX_WITH_VRDP = 1
167# enable new multiconnection code
168VBOX_WITH_VRDP_MC = 1
169# build VRDP authentication modules
170VBOX_WITH_VRDP_AUTHMOD = 1
171# build enhanced version of rdesktop
172VBOX_WITH_VRDP_RDESKTOP = 1
173ifeq ($(filter-out darwin.x86 darwin.amd64 os2.x86 win.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
174# build the support driver & library without IDT patching.
175## @todo invert this!
176VBOX_WITHOUT_IDT_PATCHING = 1
177endif
178# The kernel driver/module and related runtime libraries.
179VBOX_WITH_VBOXDRV = 1
180# build with secure label support
181ifeq ($(filter win.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),) # too much work with freetype and all that.
182VBOX_WITH_SECURELABEL = 1
183endif
184
185# the main api
186VBOX_WITH_MAIN = 1
187# the SDL based GUI
188VBOX_WITH_VBOXSDL = 1
189# the basic frontend (w/o Main)
190VBOX_WITH_VBOXBFE = 1
191# the Qt GUI
192VBOX_WITH_QTGUI = 1
193## the Direct Framebuffer GUI
194#VBOX_WITH_VBOXFB = 1
195# the gui debugger
196ifneq ($(BUILD_TYPE),release)
197VBOX_WITH_DEBUGGER_GUI = 1
198endif
199# the documentation
200VBOX_WITH_DOCS = 1
201# build the Host Guest Communication Manager component
202VBOX_WITH_HGCM = 1
203# Enable the USB feature.
204VBOX_WITH_USB = 1
205# Enable the ISCSI feature.
206VBOX_WITH_ISCSI = 1
207# Enable ALSA support for Linux
208VBOX_WITH_ALSA = 1
209# Disable WINMM support for Windows (not implemented)
210VBOX_WITH_WINMM =
211# Enable the kchmviewer
212VBOX_WITH_KCHMVIEWER = 1
213# Build the testsuite.
214VBOX_WITH_TESTSUITE = 1
215# Build the testcases.
216VBOX_WITH_TESTCASES = 1
217# Set this to not use COM or XPCOM in places where it can be avoided.
218#VBOX_WITHOUT_COM = 1
219# Set this to skip installing the redistributable compiler runtime.
220#VBOX_WITHOUT_COMPILER_REDIST = 1
221# Enabled internal networking.
222VBOX_WITH_INTERNAL_NETWORKING = 1
223# Enables the ffmpeg module for recording test runs.
224#VBOX_WITH_FFMPEG = 1
225
226
227#
228# Skip stuff.
229#
230
231# VBOX_QUICK can be used by core developers to speed to the build
232ifdef VBOX_QUICK
233 # undefine variables by assigning blank.
234 VBOX_WITH_TESTSUITE=
235 VBOX_WITH_TESTCASES=
236 VBOX_WITH_MAIN =
237 VBOX_WITH_VBOXSDL =
238 VBOX_WITH_VBOXBFE =
239 VBOX_WITH_QTGUI =
240 VBOX_WITH_DEBUGGER_GUI =
241 VBOX_WITH_DOCS =
242endif # VBOX_QUICK
243
244# l4 have to skip a few things.
245ifeq ($(BUILD_TARGET),l4)
246 VBOX_WITH_VBOXDRV=
247 VBOX_WITH_VRDP=
248 VBOX_WITH_VBOXSDL=
249 VBOX_WITH_QTGUI=
250 VBOX_WITH_MAIN=
251 VBOX_WITH_DOCS=
252 VBOX_WITH_ISCSI=
253 VBOX_WITH_INTERNAL_NETWORKING=
254endif
255
256# Darwin have to skip a few things at present.
257ifeq ($(BUILD_TARGET),darwin)
258 # Internal networking requires testing and possibly proper ring-3/ring0 separation.
259 VBOX_WITH_INTERNAL_NETWORKING=
260 # Don't bother with SDL ttf for now.
261 VBOX_WITH_SECURELABEL=
262 ifdef VBOX_OSE
263 # Qt/Mac v3.3.x requires patching to work for us.
264 VBOX_WITH_QTGUI=
265 endif
266 # Later:
267 VBOX_WITH_VRDP_AUTHMOD=
268 VBOX_WITH_VRDP_RDESKTOP=
269endif
270
271# Most stuff doesn't build yet on the new targets.
272ifeq ($(BUILD_TARGET),os2)
273 VBOX_WITH_DEBUGGER_GUI=
274 VBOX_WITH_INSTALLER=
275 VBOX_WITH_SECURELABEL=
276 VBOX_WITH_VRDP=
277 VBOX_WITH_VRDP_AUTHMOD=
278 VBOX_WITH_VRDP_RDESKTOP=
279 VBOX_WITH_TESTSUITE=
280 VBOX_WITH_USB=
281 VBOX_WITH_DOCS=
282endif
283
284# Most stuff doesn't build yet on the new targets.
285ifeq ($(filter-out freebsd solaris,$(BUILD_TARGET)),)
286 #VBOX_WITH_VBOXBFE=
287 VBOX_WITH_MAIN=
288 VBOX_WITH_VBOXSDL=
289 VBOX_WITH_QTGUI=
290 VBOX_WITH_DEBUGGER_GUI=
291 VBOX_WITH_INSTALLER=
292 VBOX_WITH_SECURELABEL=
293 VBOX_WITH_VRDP=
294 VBOX_WITH_VRDP_AUTHMOD=
295 VBOX_WITH_VRDP_RDESKTOP=
296 VBOX_WITH_TESTSUITE=
297 VBOX_WITH_USB=
298 VBOX_WITH_DOCS=
299endif
300
301
302#
303# Include automatic and local config file to override the above settings
304# and to provide defaults for the settings below this point.
305#
306AUTOCFG := $(wildcard $(PATH_ROOT)/AutoConfig.kmk)
307ifeq ($(AUTOCFG),)
308 # deprecated name. to be removed.
309 AUTOCFG := $(wildcard $(PATH_ROOT)/Config.kmkconf)
310 ifneq ($(AUTOCFG),)
311 $(warning Config.kmkconf has been renamed. Please re-run configure.)
312 endif
313endif
314ifneq ($(AUTOCFG),)
315 include $(AUTOCFG)
316endif
317
318LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
319ifeq ($(LOCALCFG),)
320 # deprecated name. to be removed.
321 LOCALCFG := $(wildcard $(PATH_ROOT)/Config.kmklocal)
322 ifneq ($(LOCALCFG),)
323 $(warning Please rename your Config.kmklocal to LocalConfig.kmk.)
324 endif
325endif
326ifneq ($(LOCALCFG),)
327 include $(LOCALCFG)
328endif
329
330
331#
332# Disable components that are not open sourced.
333#
334ifdef VBOX_OSE
335 VBOX_WITH_VRDP=
336 VBOX_WITH_USB=
337 VBOX_WITH_ISCSI=
338 VBOX_WITH_DEBUGGER_GUI=
339 VBOX_WITH_WIN32_ADDITIONS_SHAREDFOLDERS=
340 VBOX_WITH_SECURELABEL=
341 VBOX_WITH_INSTALLER=
342 VBOX_WITH_KCHMVIEWER=
343 VBOX_WITH_DOCS=
344 VBOX_WITH_TESTSUITE=
345 PASSES := $(filter-out PACKING,$(PASSES))
346endif
347
348#
349# Undefined VBOX_WITH_MAIN implies exclusion of a few more items.
350#
351ifndef VBOX_WITH_MAIN
352 VBOX_WITH_VRDP=
353 VBOX_WITH_VBOXSDL=
354 VBOX_WITH_QTGUI=
355 VBOX_WITH_DEBUGGER_GUI=
356endif
357
358#
359# Mark OSE builds clearly, helps figuring out limitations more easily.
360#
361ifdef VBOX_OSE
362VBOX_VERSION_STRING = $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)_OSE
363endif
364
365
366#
367# Image and object format config.
368#
369ifeq ($(filter-out linux l4 freebsd netbsd openbsd solaris,$(BUILD_TARGET)),)
370 VBOX_LDR_FMT = elf
371endif
372ifeq ($(BUILD_TARGET),darwin)
373 VBOX_LDR_FMT = macho
374endif
375ifeq ($(BUILD_TARGET),os2)
376 VBOX_LDR_FMT = lx
377 VBOX_LDR_FMT32 = lx
378 VBOX_LDR_FMT64 = elf
379 DONT_USE_YASM = 1 # yasm doesn't implement omf yet.
380endif
381ifeq ($(BUILD_TARGET),win)
382 VBOX_LDR_FMT = pe
383endif
384VBOX_LDR_FMT32 ?= $(VBOX_LDR_FMT)
385VBOX_LDR_FMT64 ?= $(VBOX_LDR_FMT)
386
387#
388# Assembler setup.
389#
390# This is a bit complicated since we have to support two different assmblers
391# (yasm/nasm) and possibly two different formats (32-bit/64-bit).
392#
393ifeq ($(VBOX_LDR_FMT),elf)
394 ifeq ($(BUILD_TARGET_ARCH),x86)
395VBOX_ASFLAGS_FMT = -f elf32 -DASM_FORMAT_ELF
396 else
397VBOX_ASFLAGS_FMT = -f elf64 -DASM_FORMAT_ELF
398 endif
399VBOX_ASFLAGS_DBFINFO = -g dwarf2
400endif
401ifeq ($(VBOX_LDR_FMT),lx)
402 VBOX_ASFLAGS_FMT = -f obj -DASM_FORMAT_OMF
403 VBOX_ASFLAGS_DBFINFO = -g stabs
404endif
405ifeq ($(VBOX_LDR_FMT),macho)
406 VBOX_ASFLAGS_FMT = -f macho -DASM_FORMAT_MACHO
407 VBOX_ASFLAGS_DBFINFO = -g dwarf2
408endif
409ifeq ($(VBOX_LDR_FMT),pe)
410 ifeq ($(BUILD_TARGET_ARCH),x86)
411VBOX_ASFLAGS_FMT = -f win32 -DASM_FORMAT_PE
412 else
413VBOX_ASFLAGS_FMT = -f win64 -DASM_FORMAT_PE
414 endif
415endif
416ifndef VBOX_ASFLAGS_FMT
417 $(error VBOX_ASFLAGS_FMT is not defined. VBOX_LDR_FMT=$(VBOX_LDR_FMT))
418endif
419
420ifeq ($(VBOX_LDR_FMT32),elf)
421 VBOX_ASFLAGS_FMT32 = -f elf32 -DASM_FORMAT_ELF
422 VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
423endif
424ifeq ($(VBOX_LDR_FMT32),lx)
425 VBOX_ASFLAGS_FMT32 = -f obj -DASM_FORMAT_OMF
426 VBOX_ASFLAGS_DBFINFO32 = -g stabs
427endif
428ifeq ($(VBOX_LDR_FMT32),macho)
429 VBOX_ASFLAGS_FMT32 = -f macho -DASM_FORMAT_MACHO
430 VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
431endif
432ifeq ($(VBOX_LDR_FMT32),pe)
433 VBOX_ASFLAGS_FMT32 = -f win32 -DASM_FORMAT_PE
434endif
435ifndef VBOX_ASFLAGS_FMT32
436 $(error VBOX_ASFLAGS_FMT32 is not defined. VBOX_LDR_FMT32=$(VBOX_LDR_FMT32))
437endif
438
439ifeq ($(VBOX_LDR_FMT64),elf)
440 VBOX_ASFLAGS_FMT64 = -f elf64 -DASM_FORMAT_ELF
441 VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
442endif
443ifeq ($(VBOX_LDR_FMT64),macho)
444 VBOX_ASFLAGS_FMT64 = -f macho64 -DASM_FORMAT_MACHO
445 VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
446endif
447ifeq ($(VBOX_LDR_FMT64),pe)
448 VBOX_ASFLAGS_FMT64 = -f win64 -DASM_FORMAT_PE
449endif
450ifndef VBOX_ASFLAGS_FMT64
451 $(error VBOX_ASFLAGS_FMT64 is not defined. VBOX_LDR_FMT64=$(VBOX_LDR_FMT64))
452endif
453
454ifndef DONT_USE_YASM
455 VBOX_ASTOOL = YASM
456 VBOX_LDR_FMT_2_YASM_DBGINFO.elf = -g dwarf2
457 VBOX_LDR_FMT_2_YASM_DBGINFO.lx = -g stabs
458 VBOX_LDR_FMT_2_YASM_DBGINFO.macho =
459 VBOX_LDR_FMT_2_YASM_DBGINFO.pe =
460 VBOX_ASFLAGS = $(VBOX_ASFLAGS_FMT) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT))
461 VBOX_ASFLAGS32 = $(VBOX_ASFLAGS_FMT32) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT32))
462 VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__YASM__ -Worphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT64))
463else
464 VBOX_ASTOOL = NASM
465 VBOX_ASFLAGS = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT)) -D__NASM__ -w+orphan-labels -g
466 VBOX_ASFLAGS32 = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT32)) -D__NASM__ -w+orphan-labels -g
467 VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__NASM__ -w+orphan-labels -g
468endif
469
470#
471# Windows only has mingw handy. On *nix we have to deal with cross compiling
472# 32-bit targets on 64-bit platforms, meaning we'll be using gcc32/g++32.
473# In the latter case we'll also have to disable all the all the R0 driver related stuff.
474#
475ifndef VBOX_GCC_TOOL
476 ifeq ($(BUILD_TARGET),win)
477 VBOX_GCC_TOOL := MINGW32
478 TOOL_MINGW32_CFLAGS := $(UNDEFINED) # override -g
479 else ifeq ($(BUILD_TARGET),os2)
480 VBOX_GCC_TOOL := GXX3OMF
481 else ifeq ($(BUILD_TARGET),darwin)
482 VBOX_GCC_TOOL := GXX4MACHO
483 else
484 VBOX_GCC_TOOL := GXX3
485 ifeq ($(BUILD_TARGET),$(BUILD_PLATFORM))
486 ifneq ($(BUILD_TARGET_ARCH),$(BUILD_PLATFORM_ARCH))
487 VBOX_GCC_TOOL := GXX32
488 VBOX_WITH_VBOXDRV=
489 VBOX_WITH_LINUX_ADDITIONS=
490 VBOX_WITH_WIN32_ADDITIONS=
491 endif
492 endif
493 endif
494endif
495ifndef VBOX_GCC32_TOOL
496 ifeq ($(BUILD_TARGET_ARCH),x86)
497 VBOX_GCC32_TOOL := $(VBOX_GCC_TOOL)
498 else ifeq ($(BUILD_TARGET),win)
499 VBOX_GCC32_TOOL := MINGW32
500 else
501 VBOX_GCC32_TOOL := GXX32
502 endif
503endif
504
505#
506# Decide which Visual C++ compiler version we're using by default.
507#
508ifndef VBOX_VCC_TOOL
509 ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.amd64)
510 VBOX_USE_VCC80 ?= 1 # Enforce VCC80 when targetting AMD64.
511 endif
512 ifdef VBOX_USE_VCC80
513 ifeq ($(BUILD_TARGET_ARCH),x86)
514 VBOX_VCC_TOOL := VCC80X86
515 else
516 VBOX_VCC_TOOL := VCC80AMD64
517 endif
518 else
519 VBOX_VCC_TOOL := VCC70
520 endif
521endif
522
523#
524# The kBuild tools and SDKs are using PATH_DEVTOOLS, PATH_DEVTOOLS_BLD
525# and PATH_DEVTOOLS_TRG to find things if we give them specific locations.
526#
527PATH_DEVTOOLS ?= $(PATH_ROOT)/tools
528PATH_DEVTOOLS := $(abspath $(PATH_DEVTOOLS))
529PATH_DEVTOOLS_BLD ?= $(PATH_DEVTOOLS)/$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)
530PATH_DEVTOOLS_TRG ?= $(PATH_DEVTOOLS)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)
531
532## @todo Remove the default tool crap here!
533TOOL = $(VBOX_GCC_TOOL)
534ifdef VBOX_USE_VCC80
535 TOOL.win.x86 = VCC80X86
536 TOOL.win.amd64 = VCC80AMD64
537else
538 TOOL.win = VCC70
539endif
540ASTOOL = $(VBOX_ASTOOL)
541
542#
543# L4.
544#
545ifdef L4_DIR
546 # default CPU type
547 ifeq ($(L4_CPU),)
548 L4_CPU = 586
549 endif
550 ifeq ($(L4_API),)
551 L4_API = l4v2
552 endif
553 L4_OBJ := $(L4_DIR)/build-x86-$(L4_CPU)-$(L4_API)
554 ifeq ($(BUILD_TARGET),l4)
555 L4LINUX26_INCDIR := \
556 $(L4LINUX26_DIR)/include \
557 $(L4LINUX26_DIR)/include/asm-l4/i386-arch
558 # support splitted Linux kernels (make O=<build directory>)
559 kernelsrc := $(shell $(SED_EXT) -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(L4LINUX26_DIR)/Makefile)
560 ifneq ($(kernelsrc),)
561 kernelpath := $(realpath $(kernelsrc))
562 L4LINUX26_INCDIR += \
563 $(L4LINUX26_DIR)/include2 \
564 $(kernelpath)/include
565 endif
566 L4_INCDIR := \
567 $(L4_OBJ)/include/uclibc++ \
568 $(L4_OBJ)/include/x86/uclibc \
569 $(L4_OBJ)/include/uclibc \
570 $(L4LINUX26_INCDIR) \
571 $(L4_OBJ)/include/x86/$(L4_API) \
572 $(L4_OBJ)/include/x86 \
573 $(L4_OBJ)/include \
574 $(L4_DIR)/tool/dice/include
575 L4_LIBDIR := \
576 $(L4_DIR)/build-x86-$(L4_CPU)-$(L4_API)/lib/x86_$(L4_CPU)/$(L4_API)
577 endif # BUILD_TARGET == l4
578endif # L4_DIR
579
580# Produce debugging information that the Fiasco kernel debugger can read.
581ifeq ($(BUILD_TARGET).$(BUILD_TYPE),l4.debug)
582 DEBUG_L4 = -gstabs+
583endif
584
585#
586# Setup the global defines and includes.
587#
588## @todo PATH_CURRENT has to go, fix the places where we rely on it.
589INCS += $(PATH_ROOT)/include $(PATH_OUT)
590DEFS += VBOX
591DEFS.debug := DEBUG DEBUG_$(subst $(subst _, ,_),_,$(USERNAME)) DEBUG_USERNAME=$(subst $(subst _, ,_),_,$(USERNAME))
592DEFS.profile = VBOX_WITH_STATISTICS
593DEFS.x86 = __X86__
594DEFS.amd64 = __AMD64__
595DEFS.darwin = __DARWIN__
596DEFS.darwin.x86 = VBOX_WITH_HYBIRD_32BIT_KERNEL
597DEFS.freebsd = __FREEBSD__
598DEFS.l4 = __L4__ __L4ENV__ L4API_l4v2 ARCH_x86 __NO_CTYPE _FILE_OFFSET_BITS=64
599ifeq ($(L4_API),l4v2onv4)
600 DEFS.l4 += L4API_l4v2onv4 STATIC_L4_INLINE
601endif
602DEFS.linux = __LINUX__ _FILE_OFFSET_BITS=64
603DEFS.netbsd = __NETBSD__
604DEFS.openbsd = __OPENBSD__
605DEFS.os2 = __OS2__
606DEFS.solaris = __SOLARIS__
607DEFS.win = __WIN__
608DEFS.win.x86 = __WIN32__
609DEFS.win.amd64 = __WIN64__
610# optional defines (use environment or make commandline)
611ifdef VBOX_WITH_DEBUGGER
612 DEFS += VBOX_WITH_DEBUGGER
613endif
614ifdef VBOX_WITH_DEBUGGER_GUI
615 DEFS += VBOX_WITH_DEBUGGER_GUI
616endif
617ifdef VBOX_WITH_STATISTICS
618 DEFS += VBOX_WITH_STATISTICS
619endif
620ifdef VBOX_STRICT
621 DEFS += VBOX_STRICT
622endif
623ifdef VBOX_WITHOUT_IDT_PATCHING
624 DEFS += VBOX_WITHOUT_IDT_PATCHING
625endif
626ifdef LOG_ENABLED
627 DEFS += LOG_ENABLED
628endif
629ifdef VBOX_OSE
630 DEFS += VBOX_OSE
631endif
632
633#
634# Compiler optimization flags.
635#
636ifeq ($(BUILD_TYPE),debug)
637 VBOX_GCC_FP ?= -fno-omit-frame-pointer
638 VBOX_GCC_OPT ?= -O0
639 VBOX_VCC_FP ?= -Oy-
640 VBOX_VCC_OPT ?=
641 VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer
642 VBOX_GCC_GC_OPT ?= -O0
643 VBOX_VCC_GC_FP ?= -Oy-
644 VBOX_VCC_GC_OPT ?=
645else
646 # We should use -fomit-frame-pointer for GCC / -Oy for VCC.
647 # -funwind-tables provides support for backtraces in gdb then.
648 VBOX_GCC_FP ?= -fno-omit-frame-pointer
649 VBOX_GCC_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
650 VBOX_VCC_FP ?= -Oy-
651 ifdef VBOX_USE_VCC80
652 VBOX_VCC_OPT ?= -O2 -GS-
653 else
654 VBOX_VCC_OPT ?= -Ogitb2
655 endif
656 VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer
657 VBOX_GCC_GC_OPT ?= -O2 $(VBOX_GCC_mtune-generic)
658 VBOX_VCC_GC_FP ?= -Oy-
659 ifdef VBOX_USE_VCC80
660 VBOX_VCC_GC_OPT ?= -O2
661 else
662 VBOX_VCC_GC_OPT ?= -Ogitb2
663 endif
664endif
665
666#
667# ARCH_BITS_DEFS.
668#
669ifeq ($(BUILD_TARGET_ARCH),amd64)
670 ARCH_BITS_DEFS := HC_ARCH_BITS=64 GC_ARCH_BITS=32
671else ifeq ($(BUILD_TARGET_ARCH),x86)
672 ARCH_BITS_DEFS := HC_ARCH_BITS=32 GC_ARCH_BITS=32
673else
674 error BUILD_TARGET_ARCH=$(BUILD_TARGET_ARCH)
675endif
676
677#
678# Add the output dir(s) to the dynamic loader search path.
679#
680ifeq ($(filter-out linux l4 freebsd netbsd openbsd solaris,$(BUILD_TARGET)),)
681 export LD_LIBRARY_PATH:=$(PATH_BIN):$(PATH_LIB):$(LD_LIBRARY_PATH)
682endif
683ifeq ($(BUILD_TARGET),os2)
684 #fixme! export BEGINLIBPATH:=$(PATH_BIN);$(PATH_LIB);$(BEGINLIBPATH)
685endif
686ifeq ($(BUILD_TARGET),win)
687 export PATH:=$(PATH_BIN);$(PATH_LIB);$(PATH)
688endif
689
690#
691# Common libraries and tools.
692#
693ifeq ($(BUILD_TARGET),darwin)
694 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.dylib
695 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
696 LIB_KPROFILE = $(PATH_BIN)/kPrf2.dylib
697 LIB_VMM = $(PATH_BIN)/VBoxVMM.dylib
698 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
699 LIB_REM = $(PATH_LIB)/VBoxREMImp.dylib
700 LIB_XPCOM = $(PATH_BIN)/VBoxXPCOM.dylib
701endif
702ifeq ($(BUILD_TARGET),l4)
703 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.s.so
704 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
705 LIB_KPROFILE = $(PATH_BIN)/kPrf2.s.so
706 LIB_VMM = $(PATH_BIN)/VBoxVMM.s.so
707 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
708 LIB_REM = $(PATH_BIN)/VBoxREMImp.s.so
709 LIB_XPCOM = $(PATH_BIN)/VBoxXPCOM.s.so
710endif
711ifeq ($(filter-out linux freebsd netbsd openbsd solaris,$(BUILD_TARGET)),)
712 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.so
713 LIB_RUNTIME_EF = $(PATH_LIB)/RuntimeEFCPP.a
714 LIB_KPROFILE = $(PATH_BIN)/kPrf2.so
715 LIB_VMM = $(PATH_BIN)/VBoxVMM.so
716 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
717 LIB_REM = $(PATH_BIN)/VBoxREMImp.so
718 LIB_XPCOM = $(PATH_BIN)/VBoxXPCOM.so
719endif
720ifeq ($(BUILD_TARGET),os2)
721 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.dll
722 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
723 LIB_KPROFILE = $(PATH_BIN)/kPrf2.dll
724 LIB_VMM = $(PATH_BIN)/VBoxVMM.dll
725 LIB_VMMGC = $(PATH_LIB)/VMMGCImp.lib
726 LIB_REM = $(PATH_LIB)/VBoxREMImp.lib
727 LIB_XPCOM = $(PATH_BIN)/VBoxXCOM.dll
728 OBJ_SYS0 = $(PATH_OBJ)/src/VBox/Runtime/RuntimeR0/os2/sys0.obj
729endif
730ifeq ($(BUILD_TARGET),win)
731 LIB_RUNTIME = $(PATH_LIB)/VBoxRT.lib
732 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.lib
733 LIB_KPROFILE = $(PATH_LIB)/kPrf2.lib
734 LIB_VMM = $(PATH_LIB)/VBoxVMM.lib
735 LIB_VMMGC = $(PATH_OUT)/obj/src/VBox/VMM/VMMGC/VMMGC.lib
736 LIB_REM = $(PATH_LIB)/VBoxREMImp.lib
737 LIB_XPCOM = $(PATH_BIN)/VBoxXPCOM.dll
738endif
739
740# The kprofile build automagically links with kProfile.
741ifeq ($(BUILD_TYPE),kprofile)
742 LIB_RUNTIME += $(LIB_KPROFILE)
743endif
744
745# Overridable libraries (unix).
746LIB_PTHREAD ?= pthread
747LIB_XCURSOR ?= Xcursor
748
749## Enable C++ electric fence heap.
750#LIB_RUNTIME += $(LIB_RUNTIME_EF) $(LIB_RUNTIME)
751
752# Intel ASL compiler for ACPI
753VBOX_IASLCMD ?= $(firstword $(wildcard $(PATH_DEVTOOLS_BLD)/bin/iasl$(HOSTSUFF_EXE)) iasl$(HOSTSUFF_EXE))
754
755# Bruce's C compile is a C-compiler for BIOS-related 8086 code
756VBOX_BCC ?= $(PATH_DEVTOOLS_BLD)/bin/bcc$(HOSTSUFF_EXE) -B $(PATH_DEVTOOLS_BLD)/bin/
757
758# Assembler for BIOS-related 8086 code
759VBOX_AS86 ?= $(PATH_DEVTOOLS_BLD)/bin/as86$(HOSTSUFF_EXE)
760
761# libxslt XSLT processor. (see PATH_TOOL_YASM for explanation why it's temporarily located in bin.)
762ifeq ($(BUILD_PLATFORM),win)
763# VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/win.x86/libxslt/10114/xsltproc.exe
764 VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/win.x86/bin/xsltproc.exe
765else ifeq ($(BUILD_PLATFORM),os2)
766 VBOX_XSLTPROC ?= $(PATH_DEVTOOLS_BLD)/bin/xsltproc.exe
767else
768 VBOX_XSLTPROC ?= xsltproc$(HOSTSUFF_EXE)
769endif
770
771# bin2c (convert binary files into C arrays)
772VBOX_BIN2C ?= $(PATH_OBJ)/src/bldprogs/bin2c/bin2c$(HOSTSUFF_EXE)
773
774# mkisofs
775ifeq ($(BUILD_PLATFORM),win)
776 VBOX_MKISOFS ?= $(PATH_DEVTOOLS_BLD)/bin/mkisofs.exe
777else
778 VBOX_MKISOFS ?= mkisofs
779endif
780
781# Makeself for the linux installers.
782VBOX_MAKESELF ?= $(PATH_DEVTOOLS)/common/makeself/v2.1.4_1/makeself.sh
783
784# Microsoft HTML Help Workshop.
785VBOX_PATH_HTML_HELP_WORKSHOP ?= $(PATH_DEVTOOLS)/win.x86/HTML_Help_Workshop/v1.3/
786
787# Path to the null soft installer.
788VBOX_PATH_NSIS ?= $(PATH_DEVTOOLS)/win.x86/nsis/v2.22
789
790# Windows install tools...
791VBOX_PATH_WIX ?= $(PATH_DEVTOOLS)/win.x86/wix/v2.0.4611.0
792VBOX_PATH_DIFX ?= $(PATH_DEVTOOLS)/win.x86/DIFx/v2.1
793
794# We need to export YASM for OSE, but since it was converted to .zip we need to
795# allow for the location used by the zip to be properly cleaned up first.
796ifeq ($(filter-out win.x86 linux.x86, $(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)),)
797 PATH_TOOL_YASM ?= $(PATH_DEVTOOLS_BLD)/bin
798endif
799
800# XPCOM setup for all but win32.
801ifneq ($(BUILD_TARGET),win)
802 VBOX_WITH_XPCOM = 1
803 VBOX_XPIDL ?= $(VBOX_PATH_SDK)/bin/xpidl$(HOSTSUFF_EXE)
804 VBOX_PATH_XPCOM_IDL ?= $(VBOX_PATH_SDK)/idl
805 VBOX_XPCOM_INCS ?= \
806 $(VBOX_PATH_SDK)/include \
807 $(VBOX_PATH_SDK)/include/xpcom \
808 $(VBOX_PATH_SDK)/include/xpcom/nsprpub \
809 $(VBOX_PATH_SDK)/include/xpcom/string \
810 $(VBOX_PATH_SDK)/include/xpcom/xpcom \
811 $(VBOX_PATH_SDK)/include/xpcom/ipcd
812 ifneq ($(BUILD_TARGET),os2)
813 # libIDL-config (for xpcom18a4)
814 ifeq ($(origin VBOX_LIBIDL_CONFIG),undefined)
815 export VBOX_LIBIDL_CONFIG := $(firstword $(shell which libIDL-config-2 libIDL-config 2> /dev/null))
816 endif
817 endif
818endif
819
820ifeq ($(BUILD_TARGET),os2)
821 # search DLLs in the EXE directory first
822 VBOX_XPIDL := BEGINLIBPATH="$(dir $(VBOX_XPIDL));$$BEGINLIBPATH" $(VBOX_XPIDL)
823endif
824#$(error $(VBOX_XPIDL))
825
826# The X11 LIBPATH. (The amd64 hack is for RHEL4.)
827ifeq ($(BUILD_TARGET_ARCH),amd64)
828 VBOX_LIBPATH_X11 ?= /usr/X11R6/lib64 /usr/X11R6/lib
829else
830 VBOX_LIBPATH_X11 ?= /usr/X11R6/lib
831endif
832
833# 32bit X11 LIBPATH for building 32bit guest additions
834VBOX_LIBPATH32_X11 ?= /usr/X11R6/lib32 /usr/X11R6/lib
835
836#
837# Mac OS X SDK paths.
838#
839VBOX_PATH_MACOSX_SDK ?= /Developer/SDKs/MacOSX10.4u.sdk
840VBOX_PATH_MACOSX_SDK_INCS ?= $(VBOX_PATH_MACOSX_SDK)/Developer/Headers
841
842
843#
844# GCC stuff properties.
845# Most of this is resolved on first kmk invocation and cached in PATH_OUT.
846#
847# Note! That a harmless warning is printed if the file doesn't exist.
848# Note! Changes in GCC are not detected automatically (yet).
849#
850include $(PATH_KBUILD)/tools/$(VBOX_GCC_TOOL).kmk
851ifneq ($(VBOX_GCC_TOOL),$(VBOX_GCC32_TOOL))
852 include $(PATH_KBUILD)/tools/$(VBOX_GCC32_TOOL).kmk
853endif
854
855VBOX_GCC_CHECK_CC = $(shell \
856 if $(TOOL_$(VBOX_GCC_TOOL)_CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
857 then echo "$(1)"; \
858 else echo "$(2)"; fi; )
859
860VBOX_GCC_CHECK_CXX = $(shell \
861 if $(TOOL_$(VBOX_GCC_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
862 then echo "$(1)"; \
863 else echo "$(2)"; fi; )
864
865VBOX_GCC32_CHECK_CXX = $(shell \
866 if $(TOOL_$(VBOX_GCC32_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
867 then echo "$(1)"; \
868 else echo "$(2)"; fi; )
869
870# This is kind of bad, the returned string needs to be re-evaluated before use.
871# The reason for this hack is that the windows kmk_ash cannot deal with $((1+1)).
872VBOX_GCC_VERSION = $(shell \
873 $(1) -dumpversion | $(SED_EXT) 's|\([0-9]\)\.\([0-9]\)\.\([0-9]\)|$$(int-add $$(int-mul 10000, \1), $$(int-mul 100, \2), \3)|' )
874
875# No $(QUIET) here as it's interesting to see what goes into the file.
876$(PATH_OUT)/GCCConfig.kmk: $(PATH_ROOT)/Config.kmk $(LOCALCFG) $(AUTOCFG)
877 $(call MSG_GENERATE,,$@,)
878 $(QUIET)$(RM) -f "$@"
879 $(QUIET)$(MKDIR) -p $(@D)
880
881 @# HC compiler switch detction.
882 $(APPEND) "$@" "VBOX_GCC_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CC))"
883 $(APPEND) "$@" "VBOX_GCC_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CXX))"
884 $(APPEND) "$@" "VBOX_GCC_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)"
885 $(APPEND) "$@" "VBOX_GCC_Wno-pointer-sign ?= $(call VBOX_GCC_CHECK_CC,-Wno-pointer-sign,)"
886 $(APPEND) "$@" "VBOX_GCC_Wno-variadic-macros ?= $(call VBOX_GCC_CHECK_CXX,-Wno-variadic-macros,)"
887 $(APPEND) "$@" "VBOX_GCC_Wno-invalid-offsetof ?= $(call VBOX_GCC_CHECK_CXX,-Wno-invalid-offsetof,)"
888 $(APPEND) "$@" "VBOX_GCC_Wno-extra ?= $(call VBOX_GCC_CHECK_CXX,-Wno-extra)"
889 $(APPEND) "$@" "VBOX_GCC_fno-stack-protector ?= $(call VBOX_GCC_CHECK_CC,-fno-stack-protector,)"
890 @# Produce code optimized for the most common IA32/AMD64/EM64T processors. Introduced with gcc version 4.2.
891 $(APPEND) "$@" "VBOX_GCC_mtune-generic ?= $(call VBOX_GCC_CHECK_CC,-mtune=generic,)"
892ifneq ($(BUILD_TARGET),l4)
893 @# Set default attribute for ELF and MACH-O symbols to ``hidden'' to reduce the number
894 @# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
895 $(APPEND) "$@" "ifneq ($$(VBOX_GCC_VERSION_CC),)"
896 $(APPEND) "$@" " ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CC),40000),)"
897 $(APPEND) "$@" " VBOX_GCC_fvisibility-hidden ?= $(call VBOX_GCC_CHECK_CC,-fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN,)"
898 $(APPEND) "$@" " endif"
899 $(APPEND) "$@" "endif"
900endif
901ifneq ($(BUILD_TARGET),l4)
902 @# Set default attribute for inline functions to ``hidden'' to reduce the number
903 @# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
904 $(APPEND) "$@" "ifneq ($$(VBOX_GCC_VERSION_CXX),)"
905 $(APPEND) "$@" " ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CXX),40000),)"
906 $(APPEND) "$@" " VBOX_GCC_fvisibility-inlines-hidden ?= $(call VBOX_GCC_CHECK_CXX,-fvisibility-inlines-hidden,)"
907 $(APPEND) "$@" " endif"
908 $(APPEND) "$@" "endif"
909endif
910 @# Find the compiler includes for IPRT no-crt.
911 $(APPEND) "$@" "VBOX_PATH_GCC_INCS ?= $(abspath $(dir $(shell LC_ALL=C $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)))/include"
912
913 @# 32-bit (GC) compiler switch detection.
914 $(APPEND) "$@" "VBOX_GCC32_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CC))"
915 $(APPEND) "$@" "VBOX_GCC32_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CXX))"
916 $(APPEND) "$@" "VBOX_GCC32_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC32_TOOL)_CC) -print-libgcc-file-name)"
917 $(APPEND) "$@" "VBOX_GCC32_Wno-variadic-macros ?= $(call VBOX_GCC32_CHECK_CXX,-Wno-variadic-macros,)"
918
919ifeq ($(BUILD_TARGET),l4)
920 @# L4
921 $(APPEND) "$@" "VBOX_PATH_L4_GCC3_INSTALL ?= $(shell LANG=C $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-search-dirs|$(SED_EXT) -ne 's+^install: \(.*[^/][^/]*\)/\?+\1+p')"
922endif
923
924include $(PATH_OUT)/GCCConfig.kmk
925
926ifeq ($(BUILD_TARGET),l4)
927 VBOX_L4_GCC3_INCS := $(VBOX_PATH_L4_GCC3_INSTALL)/include
928 # L4_GPP3_INCS := \
929 # $(VBOX_PATH_L4_GCC3_INSTALL)/include/g++-v3/ \
930 # $(VBOX_PATH_L4_GCC3_INSTALL)/include/g++-v3/i386-pc-linux-gnu/
931endif
932
933#
934# Coding Signing.
935#
936ifdef VBOX_SIGNING_MODE
937 ifeq ($(BUILD_PLATFORM),win)
938 # VBOX_PATH_SELFSIGN points to the Vista WDK bin/SelfSign directory.
939 ifndef VBOX_PATH_SELFSIGN
940 VBOX_PATH_SELFSIGN := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS)/win.x86/selfsign/*)))
941 ifeq ($(VBOX_PATH_SELFSIGN),)
942 VBOX_PATH_SELFSIGN := $(PATH_DEVTOOLS)/win.x86/selfsign/r1
943 endif
944 endif
945 VBOX_SIGNTOOL ?= $(VBOX_PATH_SELFSIGN)/SignTool.exe
946 VBOX_INF2CAT ?= $(VBOX_PATH_SELFSIGN)/Inf2Cat.exe
947
948 # There are two signing modes; 'self' and 'release'.
949 ifeq ($(strip $(VBOX_SIGNING_MODE)),self)
950 ## @todo
951 else ifeq ($(strip $(VBOX_SIGNING_MODE)),release)
952 VBOX_CROSS_CERTIFICATE_FILE ?= $(VBOX_PATH_SELFSIGN)/MSCV-GlobalSign.cer
953 VBOX_CROSS_CERTIFICATE_FILE_ARGS ?= /ac "$(VBOX_CROSS_CERTIFICATE_FILE)"
954 VBOX_CERTIFICATE_SUBJECT_NAME ?= InnoTek Systemberatung GmbH
955 VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
956 VBOX_CERTIFICATE_STORE ?= my
957 VBOX_CERTIFICATE_STORE_ARGS ?= /s "$(VBOX_CERTIFICATE_STORE)"
958 VBOX_TSA_URL ?= http://timestamp.verisign.com/scripts/timestamp.dll
959 VBOX_TSA_URL_ARGS ?= /t "$(VBOX_TSA_URL)"
960 ## Commands for signing a driver image after link.
961 VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_FILE_FN,$(out)))
962 ## Commands for signing an executable or a dll image after link.
963 VBOX_SIGN_IMAGE_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_FILE_FN,$(out)))
964 ## Sign a file.
965 # @param 1 The file to sign.
966 VBOX_SIGN_FILE_FN ?= $(VBOX_SIGNTOOL) sign \
967 $(VBOX_CROSS_CERTIFICATE_FILE_ARGS) \
968 $(VBOX_CERTIFICATE_STORE_ARGS) \
969 $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
970 $(VBOX_TSA_URL_ARGS) \
971 $(1)
972 ## Create a security catalog file.
973 # @param 1 The directory containing the stuff to sign.
974 # @param 2 The expected .cat name. (Inf2Cat lowercases it)
975 # @param 3 The list of OSes, separated by ';'.
976 VBOX_MAKE_CAT_HLP_FN ?= \
977 $(RM) -f $(2)\
978 $(NL)$(TAB)$(VBOX_INF2CAT) /driver:$(strip $(1)) /os:$(strip $(subst ;,$(COMMA),$(3))) /verbose \
979 $(NL)$(TAB)$(MV) $(2) $(2) \
980 $(NL)$(TAB)$(call VBOX_SIGN_FILE_FN,$(2))
981 VBOX_MAKE_CAT64_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),XP_X64;Server2003_X64;Vista_X64)
982 VBOX_MAKE_CAT32_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),2000;XP_X86;Server2003_X86;Vista_X86)
983 ifeq ($(BUILD_TARGET_ARCH),x86)
984 VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT32_FN,$(1),$(2))
985 else
986 VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT64_FN,$(1),$(2))
987 endif
988
989 # Enable signing of the additions.
990 VBOX_SIGN_ADDITIONS ?= 1
991
992 else
993 $(error Unknown VBOX_SIGNING_MODE: $(VBOX_SIGNING_MODE))
994 endif
995 else
996 VBOX_SIGNING_MODE :=
997 endif
998endif
999
1000#
1001# Windows .inf editing.
1002#
1003ifeq ($(BUILD_TARGET_ARCH),x86)
1004 VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF32_FN,$(1),$(2))
1005else
1006 VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF64_FN,$(1),$(2))
1007endif
1008## Edit an inf file an x86 target.
1009# @param 1 The inf file to edit.
1010# @param 2 The output file.
1011VBOX_EDIT_INF32_FN = $(SED) $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d') -e 's/^;x86 *//' -e '/^;amd64 /d' $(1) > $(2)
1012## Edit an inf file an x86 target.
1013# @param 1 The inf file to edit.
1014# @param 2 The output file.
1015VBOX_EDIT_INF64_FN = $(SED) $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d') -e 's/^;amd64 *//' -e '/^;x86 /d' $(1) > $(2)
1016
1017#
1018# Default prefixes and suffixes.
1019#
1020VBOX_PREF_LIB =
1021ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
1022VBOX_SUFF_LIB = .lib
1023else
1024VBOX_SUFF_LIB = .a
1025endif
1026VBOX_SUFF_DLL = $(SUFF_DLL)
1027ifeq ($(BUILD_TARGET),os2) # GXX3OMF produces out .o at the moment.
1028VBOX_SUFF_OBJ = .o
1029else
1030VBOX_SUFF_OBJ = $(SUFF_OBJ)
1031endif
1032VBOXW32GUEST_SUFF_LIB = .lib
1033VBOXLNX32GUEST_SUFF_LIB = .a
1034
1035#
1036# SDKs for external libraries.
1037#
1038SDK_VBOX_XERCES = .
1039SDK_VBOX_XERCES_INCS ?= $(PATH_ROOT)/src/libs/xerces-2.6.0/src
1040SDK_VBOX_XERCES_LIBS ?= $(PATH_LIB)/VBox-xerces$(VBOX_SUFF_LIB)
1041
1042SDK_VBOX_XALAN = .
1043SDK_VBOX_XALAN_INCS ?= $(PATH_ROOT)/src/libs/xalan-1.10.0
1044SDK_VBOX_XALAN_LIBS ?= $(PATH_LIB)/VBox-xalan$(VBOX_SUFF_LIB)
1045
1046SDK_VBOX_LIBPNG = .
1047SDK_VBOX_LIBPNG_INCS ?= $(PATH_ROOT)/src/libs/libpng-1.2.8
1048SDK_VBOX_LIBPNG_LIBS ?= $(PATH_LIB)/VBox-libpng$(VBOX_SUFF_LIB)
1049
1050SDK_VBOX_ZLIB = .
1051ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
1052 SDK_VBOX_ZLIB_INCS ?= $(PATH_ROOT)/src/libs/zlib-1.2.1
1053 SDK_VBOX_ZLIB_LIBS ?= $(PATH_LIB)/VBox-zlib$(VBOX_SUFF_LIB)
1054else
1055 SDK_VBOX_ZLIB_INCS ?=
1056 SDK_VBOX_ZLIB_LIBS ?= z
1057endif
1058
1059SDK_VBOX_OPENSSL = .
1060SDK_VBOX_OPENSSL_INCS?= $(PATH_ROOT)/src/libs/openssl-0.9.7e/include
1061SDK_VBOX_OPENSSL_LIBS?= $(PATH_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB)
1062
1063SDK_VBOX_FFMPEG = .
1064ifeq ($(filter-out win os2 darwin,$(BUILD_TARGET)),)
1065 SDK_VBOX_FFMPEG_INCS ?= \
1066 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavutil \
1067 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavcodec \
1068 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavformat
1069 ifeq ($(BUILD_TARGET),win)
1070 ## @todo Michael! Where is $(PATH_LIB)/VBoxFFmpegImp$(VBOX_SUFF_LIB) supposed to come from?
1071 #SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpeg.a
1072 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpegImp.lib
1073 else
1074 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_BIN)/VBoxFFmpeg$(SUFF_DLL)
1075 endif
1076else
1077 SDK_VBOX_FFMPEG_INCS ?= /usr/include/ffmpeg /usr/include/libpng
1078 SDK_VBOX_FFMPEG_LIBS ?= avutil avcodec avformat
1079endif
1080
1081#
1082# Special SDK for the problematic NTDLL.LIB.
1083#
1084SDK_VBOX_NTDLL = Requires W2K3DDK
1085SDK_VBOX_NTDLL_LIBS ?= $(PATH_SDK_W2K3DDK_LIB)/ntdll.lib
1086
1087
1088#
1089# Qt build tools and libraries.
1090# For *NIX we require it to be present on the system.
1091#
1092## @todo convert this into SDK and integrate the Qt stuff into kBuild.
1093ifeq ($(BUILD_TARGET),win)
1094 ifeq ($(BUILD_TARGET_ARCH),x86)
1095 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.3
1096 LIB_QT ?= $(VBOX_PATH_QT)/lib/dynamic/qt-mt333.lib
1097 else
1098 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.6
1099 LIB_QT ?= $(VBOX_PATH_QT)/lib/dynamic/qt-mt336.lib
1100 endif
1101 LIB_QTMAIN ?= $(VBOX_PATH_QT)/lib/dynamic/qtmain.lib
1102 ifndef QTDIR
1103 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
1104 QTDIR := $(call lastword,$(QTDIR))
1105 endif
1106else ifeq ($(BUILD_TARGET),os2)
1107 QTDIR ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.1
1108 VBOX_PATH_QT ?= $(QTDIR)
1109 LIB_QT ?= $(lastword $(sort $(wildcard $(VBOX_PATH_QT)/lib/qt331*.lib)))
1110 QTDIR := $(VBOX_PATH_QT)
1111else ifeq ($(BUILD_TARGET),darwin)
1112 ifndef VBOX_PATH_QT
1113 VBOX_PATH_QT := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v3.*)))
1114 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.8-r1
1115 endif
1116 LIB_QT ?= $(VBOX_PATH_QT)/lib/libqt-mt.3.dylib
1117 LIB_QTMAIN ?= $(NO_SUCH_VARIABLE)
1118 ifndef QTDIR
1119 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
1120 QTDIR := $(call lastword,$(QTDIR))
1121 endif
1122else
1123 ifndef QTDIR
1124 # This is a pretty safe shot.
1125 export QTDIR := $(wildcard /usr/share/qt3)
1126 endif
1127endif
1128ifndef VBOX_PATH_QT
1129 VBOX_PATH_QT ?= $(QTDIR)
1130 LIB_QT ?= qt-mt
1131endif
1132ifeq ($(BUILD_PLATFORM),$(BUILD_TARGET))
1133 VBOX_PATH_QT_HOST ?= $(VBOX_PATH_QT)
1134else
1135 VBOX_PATH_QT_HOST ?= $(QTDIR)
1136endif
1137VBOX_UIC ?= $(VBOX_PATH_QT_HOST)/bin/uic$(HOSTSUFF_EXE)
1138VBOX_MOC ?= $(VBOX_PATH_QT_HOST)/bin/moc$(HOSTSUFF_EXE)
1139VBOX_LUPDATE ?= $(VBOX_PATH_QT_HOST)/bin/lupdate$(HOSTSUFF_EXE)
1140VBOX_LRELEASE ?= $(VBOX_PATH_QT_HOST)/bin/lrelease$(HOSTSUFF_EXE)
1141
1142ifeq ($(BUILD_TARGET),os2)
1143 # search DLLs in the EXE directory first
1144 VBOX_UIC := BEGINLIBPATH="$(dir $(VBOX_UIC));$$BEGINLIBPATH" $(VBOX_UIC)
1145 VBOX_MOC := BEGINLIBPATH="$(dir $(VBOX_MOC));$$BEGINLIBPATH" $(VBOX_MOC)
1146 VBOX_LUPDATE := BEGINLIBPATH="$(dir $(VBOX_LUPDATE));$$BEGINLIBPATH" $(VBOX_LUPDATE)
1147 VBOX_LRELEASE := BEGINLIBPATH="$(dir $(VBOX_LRELEASE));$$BEGINLIBPATH" $(VBOX_LRELEASE)
1148endif
1149
1150#
1151# The linux kernel headers(/sources).
1152#
1153ifneq ($(filter linux,$(BUILD_TARGET)),)
1154 ifeq ($(origin VBOX_LINUX_SRC),undefined)
1155 ifneq ($(wildcard /lib/modules/$(shell uname -r)/build/include/linux/autoconf.h),)
1156 export VBOX_LINUX_SRC := /lib/modules/$(shell uname -r)/build
1157 else
1158 export VBOX_LINUX_SRC := /usr/src/linux
1159 endif
1160 endif
1161 ifeq ($(origin VBOX_LINUX_INCS),undefined)
1162 export VBOX_LINUX_INCS := $(VBOX_LINUX_SRC)/include
1163 # support splitted Linux kernels (make O=<build directory>)
1164 kernelsrc := $(shell $(SED_EXT) -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(VBOX_LINUX_SRC)/Makefile)
1165 ifneq ($(kernelsrc),)
1166 kernelpath := $(realpath $(VBOX_LINUX_SRC)/$(kernelsrc))
1167 VBOX_LINUX_INCS += $(VBOX_LINUX_SRC)/include2 $(kernelpath)/include
1168 else
1169 kernelpath := $(VBOX_LINUX_SRC)
1170 endif
1171 ifeq ($(BUILD_TARGET_ARCH),x86)
1172 VBOX_LINUX_INCS += $(kernelpath)/include/asm-i386/mach-default
1173 endif
1174 endif
1175endif
1176
1177
1178#
1179# Template for building GC things.
1180#
1181TEMPLATE_VBOXGC = VBox GC
1182TEMPLATE_VBOXGC_ASTOOL = $(VBOX_ASTOOL)
1183TEMPLATE_VBOXGC_ASFLAGS = $(VBOX_ASFLAGS32)
1184TEMPLATE_VBOXGC_DEFS = IN_GC $(ARCH_BITS_DEFS)
1185TEMPLATE_VBOXGC_SYSSUFF = .gc
1186TEMPLATE_VBOXGC_BLD_TRG_ARCH = x86
1187
1188ifeq ($(VBOX_LDR_FMT32),pe)
1189ifdef VBOX_USE_VCC80
1190 TEMPLATE_VBOXGC_TOOL = VCC80X86
1191 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)
1192else
1193 TEMPLATE_VBOXGC_TOOL = VCC70
1194 TEMPLATE_VBOXGC_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP)
1195endif
1196TEMPLATE_VBOXGC_CFLAGS = $(TEMPLATE_VBOXGC_CXXFLAGS)
1197TEMPLATE_VBOXGC_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Lines -MapInfo:Exports -NoD
1198ifdef VBOX_USE_VCC80
1199 include $(PATH_KBUILD)/sdks/W2K3DDKX86.kmk
1200 TEMPLATE_VBOXGC_LIBS = \
1201 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1202else
1203 TEMPLATE_VBOXGC_LIBS = \
1204 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1205endif
1206endif
1207
1208ifeq ($(VBOX_LDR_FMT32),elf)
1209TEMPLATE_VBOXGC_TOOL = $(VBOX_GCC32_TOOL)
1210TEMPLATE_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) $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
1211TEMPLATE_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) $(VBOX_GCC_fvisibility-hidden)
1212TEMPLATE_VBOXGC_LDFLAGS = -nostdlib -Bsymbolic
1213# temporarily, must fix the loader.
1214TEMPLATE_VBOXGC_LDFLAGS += -S
1215TEMPLATE_VBOXGC_LDFLAGS.release = -S
1216TEMPLATE_VBOXGC_LIBS = \
1217 $(VBOX_GCC32_LIBGCC) # instricts
1218endif
1219
1220ifeq ($(VBOX_LDR_FMT32),macho)
1221TEMPLATE_VBOXGC_TOOL = GXX4MACHO
1222TEMPLATE_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
1223TEMPLATE_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
1224TEMPLATE_VBOXGC_LDFLAGS = -nostdlib
1225#TEMPLATE_VBOXGC_LDFLAGS.release = -Wl,-S ???
1226endif
1227
1228ifeq ($(VBOX_LDR_FMT32),lx)
1229TEMPLATE_VBOXGC_TOOL = GXX3OMF
1230TEMPLATE_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
1231TEMPLATE_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
1232TEMPLATE_VBOXGC_LDFLAGS = -Zdll -nostdlib
1233TEMPLATE_VBOXGC_LIBS = \
1234 $(VBOX_GCC32_LIBGCC) \
1235 $(OBJ_SYS0) \
1236 end
1237endif
1238
1239
1240#
1241# Template for building a GC ring-3 testcase (tstVMStructGC, tstDevStructGC).
1242#
1243TEMPLATE_VBOXGCEXE = VBox GC as ring-3 testcase
1244TEMPLATE_VBOXGCEXE_EXTENDS = VBOXGC
1245
1246ifeq ($(VBOX_LDR_FMT32),pe)
1247 TEMPLATE_VBOXGCEXE_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD -Debug
1248 TEMPLATE_VBOXGCEXE_SDKS = WIN32SDK
1249 ifdef VBOX_USE_VCC80
1250 TEMPLATE_VBOXGCEXE_LIBS = \
1251 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
1252 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib
1253 else
1254 TEMPLATE_VBOXGCEXE_LIBS = \
1255 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
1256 $(PATH_TOOL_VCC70_LIB)/oldnames.lib
1257 endif
1258endif
1259
1260ifeq ($(VBOX_LDR_FMT32),elf)
1261 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1262 TEMPLATE_VBOXGCEXE_LDFLAGS.release = -g
1263endif
1264
1265ifeq ($(VBOX_LDR_FMT32),macho)
1266 TEMPLATE_VBOXGCEXE_CFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CFLAGS))
1267 TEMPLATE_VBOXGCEXE_CXXFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CXXFLAGS))
1268 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1269endif
1270
1271ifeq ($(VBOX_LDR_FMT32),lx)
1272 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1273 TEMPLATE_VBOXGCEXE_LIBS = $(NO_SUCH_VARIABLE)
1274endif
1275
1276
1277#
1278# Template for building R0 things.
1279#
1280TEMPLATE_VBOXR0 = VBox Ring 0
1281TEMPLATE_VBOXR0_ASTOOL = $(VBOX_ASTOOL)
1282TEMPLATE_VBOXR0_ASFLAGS = $(VBOX_ASFLAGS)
1283TEMPLATE_VBOXR0_DEFS = IN_RING0 $(ARCH_BITS_DEFS)
1284
1285ifeq ($(VBOX_LDR_FMT),pe)
1286TEMPLATE_VBOXR0_TOOL = $(VBOX_VCC_TOOL)
1287ifdef VBOX_USE_VCC80
1288 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -W3 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1289else
1290 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1291endif
1292TEMPLATE_VBOXR0_CFLAGS = $(TEMPLATE_VBOXR0_CXXFLAGS)
1293TEMPLATE_VBOXR0_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD
1294ifdef VBOX_USE_VCC80
1295 TEMPLATE_VBOXR0_LIBS.x86 = \
1296 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1297else
1298 TEMPLATE_VBOXR0_LIBS.x86 = \
1299 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1300endif
1301endif # pe
1302
1303ifeq ($(VBOX_LDR_FMT),elf)
1304TEMPLATE_VBOXR0_TOOL = $(VBOX_GCC_TOOL)
1305TEMPLATE_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) $(VBOX_GCC_fvisibility-hidden)
1306TEMPLATE_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) $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
1307TEMPLATE_VBOXR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding
1308TEMPLATE_VBOXR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables
1309TEMPLATE_VBOXR0_LDFLAGS = -nostdlib -Bsymbolic
1310# temporarily, must fix the loader.
1311TEMPLATE_VBOXR0_LDFLAGS += -S
1312TEMPLATE_VBOXR0_LDFLAGS.release = -S
1313TEMPLATE_VBOXR0_LIBS = \
1314 $(VBOX_GCC_LIBGCC) # instricts
1315endif
1316
1317ifeq ($(VBOX_LDR_FMT),macho)
1318TEMPLATE_VBOXR0_TOOL = GXX4MACHO
1319TEMPLATE_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
1320TEMPLATE_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
1321TEMPLATE_VBOXR0_LDFLAGS = -nostdlib
1322#TEMPLATE_VBOXR0_LDFLAGS.release = -Wl,-S ???
1323endif
1324
1325ifeq ($(VBOX_LDR_FMT),lx)
1326TEMPLATE_VBOXR0_TOOL = GXX3OMF
1327TEMPLATE_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
1328TEMPLATE_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
1329TEMPLATE_VBOXR0_LDFLAGS = -Zdll -nostdlib
1330TEMPLATE_VBOXR0_LIBS = \
1331 $(VBOX_GCC_LIBGCC) \
1332 $(OBJ_SYS0) \
1333 end
1334endif
1335
1336
1337#
1338# Template for building SUPDRV R0 things.
1339#
1340TEMPLATE_VBOXR0DRV = VBox SUPDRV Ring 0
1341TEMPLATE_VBOXR0DRV_ASTOOL = $(VBOX_ASTOOL)
1342TEMPLATE_VBOXR0DRV_ASFLAGS = $(VBOX_ASFLAGS)
1343TEMPLATE_VBOXR0DRV_DEFS = IN_RING0 IN_RT_R0 $(ARCH_BITS_DEFS)
1344
1345ifeq ($(BUILD_TARGET),win)
1346 TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_VCC_TOOL)
1347 TEMPLATE_VBOXR0DRV_RCDEFS = \
1348 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1349 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1350 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1351 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1352 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1353 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1354 TEMPLATE_VBOXR0DRV_DEFS.x86 = _X86_
1355 TEMPLATE_VBOXR0DRV_DEFS.amd64 = _AMD64_
1356 ifdef VBOX_USE_VCC80
1357 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -W3 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1358 else
1359 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -W3 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1360 endif
1361 TEMPLATE_VBOXR0DRV_CFLAGS = $(TEMPLATE_VBOXR0DRV_CXXFLAGS)
1362 TEMPLATE_VBOXR0DRV_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Debug
1363 TEMPLATE_VBOXR0DRV_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
1364endif
1365
1366ifeq ($(BUILD_TARGET),linux)
1367TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1368TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0
1369TEMPLATE_VBOXR0DRV_INCS = $(VBOX_LINUX_INCS)
1370TEMPLATE_VBOXR0DRV_CFLAGS = -nostdinc -iwithprefix include \
1371 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1372 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1373TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mpreferred-stack-boundary=2 -msoft-float
1374TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1375 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1376 -Wno-sign-compare -Wdeclaration-after-statement
1377TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXR0DRV_CFLAGS) $(TEMPLATE_VBOXR0DRV_CFLAGS.$(BUILD_TARGET_ARCH))) -fno-exceptions -fno-rtti
1378 ifndef VBOX_LINUX_VERSION_2_4
1379# 2.6
1380TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1381TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1382TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1383 else
1384# 2.4
1385TEMPLATE_VBOXR0DRV_SYSSUFF = .o
1386TEMPLATE_VBOXR0DRV_LDFLAGS = -r -s
1387 endif
1388endif
1389
1390ifeq ($(BUILD_TARGET),os2)
1391TEMPLATE_VBOXR0DRV_TOOL = GXX3OMF
1392TEMPLATE_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
1393TEMPLATE_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
1394TEMPLATE_VBOXR0DRV_LIBS = $(VBOX_GCC_LIBGCC)
1395# wlink thinks physdevice doesn't need fixups and should have a stack - stupid!
1396TEMPLATE_VBOXR0DRV_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
1397endif
1398
1399ifeq ($(BUILD_TARGET),darwin)
1400TEMPLATE_VBOXR0DRV_TOOL = GXX4MACHO
1401TEMPLATE_VBOXR0DRV_DEFS += KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT
1402TEMPLATE_VBOXR0DRV_INCS += \
1403 /System/Library/Frameworks/Kernel.framework/PrivateHeaders \
1404 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Kernel.framework/Headers
1405TEMPLATE_VBOXR0DRV_CXXFLAGS = \
1406 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1407 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1408 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1409 -fapple-kext -fno-rtti -fcheck-new
1410TEMPLATE_VBOXR0DRV_CXXFLAGS.release = $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fasm-blocks
1411TEMPLATE_VBOXR0DRV_CXXFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1412TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1413TEMPLATE_VBOXR0DRV_CFLAGS = \
1414 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1415 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1416 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1417 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1418TEMPLATE_VBOXR0DRV_CFLAGS.release = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1419TEMPLATE_VBOXR0DRV_CFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.profile)
1420TEMPLATE_VBOXR0DRV_CFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile)
1421TEMPLATE_VBOXR0DRV_LDFLAGS = -static -nostdlib -r -Wl,-Y,1455 \
1422 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
1423TEMPLATE_VBOXR0DRV_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC)
1424endif
1425
1426ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),) # pure guess work just to avoid the warning below
1427TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1428TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ IN_RING0 IN_RT_R0
1429TEMPLATE_VBOXR0DRV_CFLAGS = \
1430 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1431 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1432TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -msoft-float
1433TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1434 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1435 -Wno-sign-compare -Wdeclaration-after-statement
1436TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXR0DRV_CFLAGS)) -fno-exceptions -fno-rtti
1437TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1438TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1439TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1440endif
1441
1442ifdef VBOX_WITH_VBOXDRV
1443 ifndef TEMPLATE_VBOXR0DRV_TOOL
1444 $(warning Warning: VBox Build: Target $(BUILD_PLATFORM) is not officially supported!)
1445 endif
1446endif
1447
1448
1449
1450#
1451# Template for building R3 executables and static libraries which are linked into executables.
1452#
1453TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
1454TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
1455TEMPLATE_VBOXR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
1456TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
1457TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
1458ifeq ($(BUILD_TARGET),win)
1459 TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
1460 TEMPLATE_VBOXR3EXE_RCDEFS = \
1461 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1462 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1463 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1464 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1465 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1466 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1467 TEMPLATE_VBOXR3EXE_SDKS = WINPSDK
1468 ifdef VBOX_USE_VCC80
1469 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MD -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1470 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
1471 else
1472 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MD -W3 -wd4065 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1473 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -GZ
1474 endif
1475 TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
1476 TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
1477 TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1478 TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1479 TEMPLATE_VBOXR3EXE_LDFLAGS = \
1480 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1481 /DISALLOWLIB:libc.lib \
1482 /DISALLOWLIB:libcd.lib \
1483 /DISALLOWLIB:libcmt.lib \
1484 /DISALLOWLIB:libcmtd.lib \
1485 /DISALLOWLIB:msvcrtd.lib
1486 TEMPLATE_VBOXR3EXE_LIBS = \
1487 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1488 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1489 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib
1490 TEMPLATE_VBOXR3EXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1491
1492else # the gcc guys
1493TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
1494TEMPLATE_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 $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
1495# L4 currently can't handle exception handling.
1496TEMPLATE_VBOXR3EXE_CXXFLAGS.l4 = -fno-exceptions -nostdinc \
1497 $(addprefix -I,$(VBOX_L4_GCC3_INCS) $(L4_INCDIR) $(FILE_TOOL_GPP3_INCDIR)) \
1498 $(DEBUG_L4)
1499TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
1500TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1501TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1502TEMPLATE_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 $(VBOX_GCC_fvisibility-hidden)
1503TEMPLATE_VBOXR3EXE_CFLAGS.darwin = -fno-common
1504TEMPLATE_VBOXR3EXE_CFLAGS.l4 = -nostdinc \
1505 $(addprefix -I,$(VBOX_L4_GCC3_INCS) $(L4_INCDIR)) $(DEBUG_L4)
1506TEMPLATE_VBOXR3EXE_DEFS.l4 = L4_THREAD_SAFE
1507TEMPLATE_VBOXR3EXE_LDFLAGS.l4 = \
1508 $(L4_LIBDIR)/../crt0.o \
1509 -T$(L4_LIBDIR)/../main_dyn.ld -nostdlib \
1510 -Wl,--export-dynamic,--dynamic-linker=libld-l4.s.so \
1511 -Wl,--rpath-link,$(L4_LIBDIR)
1512TEMPLATE_VBOXR3EXE_LDFLAGS.linux = -Wl,-z,noexecstack
1513 ifeq ($(BUILD_TARGET),linux)
1514TEMPLATE_VBOXR3EXE_LIBS = pthread m rt dl
1515 else ifeq ($(BUILD_TARGET),l4)
1516TEMPLATE_VBOXR3EXE_LIBS = \
1517 $(L4_LIBDIR)/libvboxserver.s.so \
1518 $(L4_LIBDIR)/libuc++.0.s.so \
1519 supc++ gcc_eh gcc \
1520 $(L4_LIBDIR)/libdl.s.so \
1521 $(L4_LIBDIR)/libuc.0.s.so
1522 else ifeq ($(BUILD_TARGET),os2)
1523TEMPLATE_VBOXR3EXE_TOOL = GXX3OMF
1524TEMPLATE_VBOXR3EXE_LIBS = socket iconv
1525 else ifeq ($(BUILD_TARGET),darwin)
1526TEMPLATE_VBOXR3EXE_TOOL = GXX4MACHO
1527TEMPLATE_VBOXR3EXE_LIBS =
1528TEMPLATE_VBOXR3EXE_LDFLAGS = -read_only_relocs suppress
1529TEMPLATE_VBOXR3EXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1530 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1531TEMPLATE_VBOXR3EXE_TOOL = GXX3
1532TEMPLATE_VBOXR3EXE_LIBS = pthread
1533 else ifeq ($(BUILD_TARGET),solaris)
1534$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1535TEMPLATE_VBOXR3EXE_TOOL = GXX3PLAIN
1536TEMPLATE_VBOXR3EXE_LIBS = rt
1537 else
1538$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1539TEMPLATE_VBOXR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.release)
1540TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease)
1541 endif
1542endif
1543
1544#
1545# Template for building R3 shared objects / DLLs.
1546# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
1547#
1548TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
1549TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
1550TEMPLATE_VBOXR3_LDFLAGS.l4 = $(L4_LIBDIR)/../crt0.s.o -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
1551TEMPLATE_VBOXR3_DEFS.l4 = $(TEMPLATE_VBOXR3EXE_DEFS.l4) __PIC__
1552TEMPLATE_VBOXR3_DEFS.darwin = $(TEMPLATE_VBOXR3EXE_DEFS.darwin) PIC
1553ifeq ($(BUILD_TARGET_ARCH),amd64)
1554 ifneq ($(BUILD_TARGET),win)
1555 TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
1556 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
1557 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
1558 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
1559 endif
1560endif
1561
1562#
1563# Ring-3 testcase.
1564# This is the VBOXR3EXE template only with a different install dir.
1565#
1566TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
1567TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
1568TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
1569TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
1570ifeq ($(BUILD_TARGET),win)
1571 ifdef VBOX_SIGNING_MODE
1572 TEMPLATE_VBOXR3TSTEXE_POST_CMDS =
1573 endif
1574endif
1575
1576#
1577# Template for building bad C/C++ style R3 executables (no -pedantic).
1578#
1579TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
1580TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
1581ifneq ($(BUILD_TARGET),win)
1582 # (only gcc)
1583 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
1584 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
1585 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3EXE_CFLAGS))
1586endif
1587
1588#
1589# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
1590# This is mostly identical to the VBOXR3NPEXE template.
1591#
1592TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
1593TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3NPEXE
1594TEMPLATE_VBOXR3NP_LDFLAGS.l4 = \
1595 $(L4_LIBDIR)/../crt0.s.o \
1596 -T$(L4_LIBDIR)/../main_rel.ld \
1597 -nostdlib
1598TEMPLATE_VBOXR3NP_DEFS.l4 = $(TEMPLATE_VBOXR3NPEXE_DEFS.l4) __PIC__
1599ifeq ($(BUILD_TARGET_ARCH),amd64)
1600 ifneq ($(BUILD_TARGET),win)
1601 TEMPLATE_VBOXR3NP_DEFS = $(TEMPLATE_VBOXR3NPEXE_DEFS) PIC
1602 TEMPLATE_VBOXR3NP_CFLAGS = $(TEMPLATE_VBOXR3NPEXE_CFLAGS) -fPIC
1603 TEMPLATE_VBOXR3NP_CXXFLAGS = $(TEMPLATE_VBOXR3NPEXE_CXXFLAGS) -fPIC
1604 TEMPLATE_VBOXR3NP_LDFLAGS = $(TEMPLATE_VBOXR3NPEXE_LDFLAGS) -fPIC
1605 endif
1606endif
1607
1608
1609#
1610# Template for building libraries, shared libraries / modules
1611# which only depends on IPRT for crt.
1612#
1613TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
1614TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
1615TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
1616## @todo C++
1617TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno -Wall
1618TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -mcmodel=medium -fno-common
1619#TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O0 -fno-math-errno -fno-peephole2 -fno-strict-aliasing - for win64.
1620TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
1621TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1622TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1623TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -mdynamic-no-pic
1624TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
1625
1626ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.amd64)
1627 # cross compile to 64-bit ELF (linux).
1628 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
1629 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
1630 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
1631 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
1632 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1633
1634else ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1635 # Use the default GCC (MinGW) with the Microsoft linker.
1636 # (Drop all '-g' options as we're unable to strip the debug info.)
1637 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1638 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1639 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1640 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
1641 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
1642 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1643 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
1644
1645else
1646 # Use the default GCC.
1647 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
1648 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1649 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1650 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1651 TEMPLATE_VBOXNOCRTGCC_CFLAGS += $(VBOX_GCC_fno-stack-protector)
1652 TEMPLATE_VBOXNOCRTGCC_CXXFLAGS += $(VBOX_GCC_fno-stack-protector)
1653 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1654 ifneq ($(filter-out os2 darwin solaris,$(BUILD_TARGET)),)
1655 ifneq ($(BUILD_TARGET_ARCH),amd64)
1656 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
1657 endif
1658 endif
1659 ifneq ($(filter-out freebsd,$(BUILD_TARGET)),)
1660 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
1661 else
1662 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1663 endif
1664endif
1665
1666
1667#
1668# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
1669#
1670TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
1671TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
1672TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
1673ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1674 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
1675else
1676 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
1677endif
1678
1679
1680#
1681# Template for building executables that are part of the VBox Main component
1682# (COM/XPCOM interface to VirtualBox).
1683#
1684
1685TEMPLATE_VBOXMAINEXE = VBox Main Executable
1686TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
1687TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
1688TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE NDEBUG=1
1689TEMPLATE_VBOXMAINEXE_DEFS.win = _UNICODE
1690TEMPLATE_VBOXMAINEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
1691TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
1692TEMPLATE_VBOXMAINEXE_INCS = \
1693 $(VBOX_PATH_SDK)/include
1694
1695ifeq ($(BUILD_TARGET),win)
1696 TEMPLATE_VBOXMAINEXE_SDKS = WINPSDK W2K3DDK
1697 ifdef VBOX_USE_VCC80
1698 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
1699 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GF- -MD -EHsc -W3 -wd4065 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1700 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
1701 else
1702 TEMPLATE_VBOXMAINEXE_TOOL = VCC70
1703 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GX- -GF- -MD -EHsc -W3 -wd4065 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1704 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -GZ
1705 endif
1706 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
1707 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1708 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
1709 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1710 TEMPLATE_VBOXMAINEXE_INCS += \
1711 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1712 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
1713 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
1714 /DISALLOWLIB:libc.lib \
1715 /DISALLOWLIB:libcd.lib \
1716 /DISALLOWLIB:msvcrt.lib \
1717 /DISALLOWLIB:msvcrtd.lib \
1718 /DISALLOWLIB:libcmtd.lib \
1719 /DISALLOWLIB:libcmt.lib
1720 TEMPLATE_VBOXMAINEXE_LIBS = \
1721 $(LIB_RUNTIME) \
1722 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1723 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1724 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1725 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1726 TEMPLATE_VBOXMAINEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1727
1728else # the GCC guys:
1729
1730TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
1731TEMPLATE_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 $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
1732TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -fno-inline
1733TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
1734TEMPLATE_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 $(VBOX_GCC_fvisibility-hidden)
1735TEMPLATE_VBOXMAINEXE_CFLAGS.debug = -fno-inline
1736TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1737 ifeq ($(BUILD_TARGET),linux)
1738TEMPLATE_VBOXMAINEXE_LIBS = pthread m rt $(LIB_RUNTIME)
1739 else ifeq ($(BUILD_TARGET),l4)
1740TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1741# no libs as yet in l4 target - must be added later
1742 else ifeq ($(BUILD_TARGET),os2)
1743TEMPLATE_VBOXMAINEXE_TOOL = GXX3OMF
1744TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1745 else ifeq ($(BUILD_TARGET),darwin)
1746TEMPLATE_VBOXMAINEXE_TOOL = GXX4MACHO
1747TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1748TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin = -bind_at_load -framework Carbon
1749 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1750TEMPLATE_VBOXMAINEXE_TOOL = GXX3
1751TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1752TEMPLATE_VBOXMAINEXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1753 else ifeq ($(BUILD_TARGET),solaris)
1754$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1755TEMPLATE_VBOXMAINEXE_TOOL = GXX3PLAIN
1756TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt
1757 else
1758$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1759TEMPLATE_VBOXMAINEXE_LIBS =
1760 endif
1761
1762endif # !win
1763
1764# Add COM/XPCOM stuff
1765TEMPLATE_VBOXMAINEXE_LIBS += \
1766 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
1767ifdef VBOX_WITH_XPCOM
1768 ## @todo may be worth creating the VBOX_XPCOM SDK def
1769 TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
1770 TEMPLATE_VBOXMAINEXE_INCS += \
1771 $(VBOX_XPCOM_INCS)
1772 TEMPLATE_VBOXMAINEXE_LIBS += \
1773 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
1774 $(LIB_XPCOM)
1775endif
1776
1777#
1778# Template for building the Main DLL modules (such as in-process COM/XPCOM
1779# components for Main).
1780#
1781# This differs from VBOXMAINEXE only in PIC handling and similar DLL stuff.
1782#
1783
1784TEMPLATE_VBOXMAINDLL = VBox Main Component (shared library)
1785TEMPLATE_VBOXMAINDLL_EXTENDS = VBOXMAINEXE
1786ifeq ($(BUILD_TARGET_ARCH),amd64)
1787 ifneq ($(BUILD_TARGET),win)
1788 TEMPLATE_VBOXMAINDLL_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
1789 TEMPLATE_VBOXMAINDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
1790 TEMPLATE_VBOXMAINDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1791 TEMPLATE_VBOXMAINDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
1792 endif
1793endif
1794TEMPLATE_VBOXMAINDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin))
1795
1796ifdef VBOX_WITH_XPCOM
1797 # XPCOM component modules don't need the XPCOM glue library
1798 TEMPLATE_VBOXMAINDLL_LIBS = $(filter-out \
1799 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB),\
1800 $(TEMPLATE_VBOXMAINEXE_LIBS))
1801endif
1802
1803#
1804# Template for building the Main static libraries.
1805#
1806# This differs from VBOXMAINDLL only that it zeroes out the _LIBS definition.
1807#
1808
1809TEMPLATE_VBOXMAINLIB = VBox Main Component (static library)
1810TEMPLATE_VBOXMAINLIB_EXTENDS = VBOXMAINDLL
1811TEMPLATE_VBOXMAINLIB_LIBS =
1812
1813#
1814# Template for building executables that use the VBox Main component.
1815#
1816
1817TEMPLATE_VBOXMAINCLIENTEXE = VBox Main Client (executable)
1818TEMPLATE_VBOXMAINCLIENTEXE_EXTENDS = VBOXMAINEXE
1819ifeq ($(BUILD_TARGET),win)
1820 TEMPLATE_VBOXMAINCLIENTEXE_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
1821 $(PATH_SDK_WINPSDK_LIB)/User32.Lib \
1822 $(PATH_SDK_WINPSDK_LIB)/Shell32.Lib \
1823 $(PATH_SDK_WINPSDK_LIB)/ShLwApi.Lib \
1824 $(PATH_SDK_WINPSDK_LIB)/Ole32.Lib \
1825 $(PATH_SDK_WINPSDK_LIB)/OleAut32.Lib \
1826 $(PATH_SDK_WINPSDK_LIB)/Uuid.Lib
1827else
1828 TEMPLATE_VBOXMAINCLIENTEXE_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
1829 NDEBUG TRIMMED
1830 ## @todo remove
1831 ## Wonder why we compile main with defaults for these two and then drops it
1832 ## in the client executables...
1833 #TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS) \
1834 # -fno-rtti -fno-exceptions
1835 TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
1836 -pthread
1837 TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin = $(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin) \
1838 -bind_at_load -framework Carbon
1839endif
1840
1841#
1842# Template for building shared libraries / DLLs that use the VBox Main component.
1843#
1844# This differs from VBOXMAINCLIENTEXE only in PIC handling and similar DLL stuff.
1845#
1846
1847TEMPLATE_VBOXMAINCLIENTDLL = VBox MAIN Client (shared library)
1848TEMPLATE_VBOXMAINCLIENTDLL_EXTENDS = VBOXMAINCLIENTEXE
1849ifeq ($(BUILD_TARGET_ARCH),amd64)
1850 ifneq ($(BUILD_TARGET),win)
1851 TEMPLATE_VBOXMAINCLIENTDLL_DEFS = PIC $(TEMPLATE_VBOXMAINCLIENTEXE_DEFS)
1852 TEMPLATE_VBOXMAINCLIENTDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CFLAGS)
1853 TEMPLATE_VBOXMAINCLIENTDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS)
1854 TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)
1855 endif
1856endif
1857TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin))
1858
1859
1860#
1861# Template for building Qt GUI executables.
1862#
1863
1864TEMPLATE_VBOXQTGUIEXE = VBox Qt GUI Executable
1865TEMPLATE_VBOXQTGUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS)
1866TEMPLATE_VBOXQTGUIEXE_INCS = \
1867 $(VBOX_PATH_SDK)/include \
1868 $(VBOX_PATH_QT)/include
1869
1870ifeq ($(BUILD_TARGET),win)
1871 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_VCC_TOOL)
1872 TEMPLATE_VBOXQTGUIEXE_DEFS += \
1873 _WIN32_WINNT=0x0500 UNICODE _UNICODE \
1874 QT_DLL _CRT_SECURE_NO_DEPRECATE
1875 ## @todo VCC70 flags?
1876 ifdef VBOX_USE_VCC80
1877 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1878 -nologo -Zm200 -W3 -MD -EHsc -Zc:wchar_t-
1879 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu
1880 else
1881 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1882 -nologo -Zm200 -W3 -MD -GX
1883 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -GZ
1884 endif
1885 TEMPLATE_VBOXQTGUIEXE_INCS += \
1886 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1887 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = \
1888 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
1889 /DELAYLOAD:oleaut32.dll
1890 TEMPLATE_VBOXQTGUIEXE_SDKS = WINPSDK
1891 TEMPLATE_VBOXQTGUIEXE_LIBS = \
1892 $(LIB_QT) \
1893 $(LIB_QTMAIN) \
1894 $(LIB_RUNTIME) \
1895 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1896 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1897 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1898 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
1899 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1900 TEMPLATE_VBOXQTGUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1901
1902else # the gcc guys:
1903 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_GCC_TOOL)
1904 TEMPLATE_VBOXQTGUIEXE_DEFS.linux = _REENTRANT
1905
1906 TEMPLATE_VBOXQTGUIEXE_INCS += \
1907 $(LIB_SDL_INC)
1908 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1909 -pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
1910 -Wno-long-long -fshort-wchar -fno-strict-aliasing \
1911 $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
1912 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -pthread
1913 ## @todo no $(LIB_QTMAIN) here?
1914 TEMPLATE_VBOXQTGUIEXE_LIBS = \
1915 $(LIB_QT) \
1916 $(LIB_SDL) \
1917 $(LIB_RUNTIME) \
1918 $(LIB_REM) \
1919 $(LIB_VMM)
1920
1921 ifeq ($(BUILD_TARGET_ARCH),amd64)
1922 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
1923 $(VBOX_PATH_QT)/lib64 $(VBOX_PATH_QT)/lib
1924 else
1925 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
1926 $(VBOX_PATH_QT)/lib
1927 endif
1928
1929 ifeq ($(BUILD_TARGET),darwin)
1930 TEMPLATE_VBOXQTGUIEXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1931 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -framework Carbon -framework QuickTime -bind_at_load
1932 TEMPLATE_VBOXQTGUIEXE_LIBS +=
1933 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
1934 else ifeq ($(BUILD_TARGET),os2)
1935 TEMPLATE_VBOXQTGUIEXE_LIBS +=
1936 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
1937 else
1938 TEMPLATE_VBOXQTGUIEXE_LIBS += \
1939 Xext \
1940 X11 \
1941 m \
1942 $(LIB_PTHREAD)
1943 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \
1944 $(VBOX_LIBPATH_X11)
1945 endif
1946
1947endif
1948
1949# Add COM/XPCOM stuff
1950TEMPLATE_VBOXQTGUIEXE_LIBS += \
1951 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
1952ifdef VBOX_WITH_XPCOM
1953 ## @todo may be worth creating the VBOX_XPCOM SDK def
1954 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM
1955 TEMPLATE_VBOXQTGUIEXE_INCS += \
1956 $(VBOX_XPCOM_INCS)
1957 TEMPLATE_VBOXQTGUIEXE_LIBS += \
1958 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
1959 $(LIB_XPCOM)
1960endif
1961
1962#
1963# Template for building Qt GUI components.
1964#
1965TEMPLATE_VBOXQTGUI = VBox Qt GUI Components
1966TEMPLATE_VBOXQTGUI_EXTENDS = VBOXQTGUIEXE
1967TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN) $(PATH_BIN)/VBoxXML$(VBOX_SUFF_DLL),$(TEMPLATE_VBOXQTGUIEXE_LIBS))
1968ifeq ($(BUILD_TARGET),darwin)
1969 TEMPLATE_VBOXQTGUI_LDFLAGS = $(filter-out -framework Carbon -framework QuickTime -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS))
1970endif
1971ifeq ($(BUILD_TARGET_ARCH),amd64)
1972 ifneq ($(BUILD_TARGET),win)
1973 TEMPLATE_VBOXQTGUI_DEFS = PIC $(TEMPLATE_VBOXQTGUIEXE_DEFS)
1974 TEMPLATE_VBOXQTGUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CFLAGS)
1975 TEMPLATE_VBOXQTGUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS)
1976 TEMPLATE_VBOXQTGUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_LDFLAGS)
1977 endif
1978endif
1979
1980
1981#
1982# Template for building build bldprogs.
1983#
1984TEMPLATE_VBOXBLDPROG = VBox Build Program
1985TEMPLATE_VBOXBLDPROG_DEFS = IN_RING3
1986ifeq ($(BUILD_PLATFORM),win)
1987 ifeq ($(BUILD_PLATFORM_ARCH),x86)
1988 ifdef VBOX_USE_VCC80
1989 TEMPLATE_VBOXBLDPROG_TOOL = VCC80X86
1990 else
1991 TEMPLATE_VBOXBLDPROG_TOOL = VCC70
1992 endif
1993 TEMPLATE_VBOXBLDPROG_SDKS = WIN32SDK
1994 else
1995 TEMPLATE_VBOXBLDPROG_TOOL = VCC80AMD64
1996 TEMPLATE_VBOXBLDPROG_SDKS = WIN64SDK
1997 endif
1998 ifneq ($(TEMPLATE_VBOXBLDPROG_TOOL),VCC70)
1999 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -W3 -wd4996 -Zc:wchar_t-
2000 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -RTCsu
2001 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -Oy- -GS-
2002 else
2003 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -W3
2004 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -GZ
2005 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -Ogitb2 -Oy-
2006 endif
2007 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2008 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2009 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
2010 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
2011 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2012 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
2013 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
2014 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
2015 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
2016 /DISALLOWLIB:libcd.lib \
2017 /DISALLOWLIB:libcmtd.lib \
2018 /DISALLOWLIB:msvcrt.lib \
2019 /DISALLOWLIB:msvcrtd.lib \
2020 /DISALLOWLIB:msvcprt.lib \
2021 /DISALLOWLIB:msvcprtd.lib
2022 TEMPLATE_VBOXBLDPROG_LIBS = \
2023 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
2024 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt.lib \
2025 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt.lib
2026
2027else
2028# (gcc of some kind )
2029TEMPLATE_VBOXBLDPROG_TOOL = GXX3
2030TEMPLATE_VBOXBLDPROG_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
2031TEMPLATE_VBOXBLDPROG_CFLAGS.debug = -fno-inline
2032TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2033TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
2034TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
2035TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe
2036TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -fno-inline
2037TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2038TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2039TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2040 ifeq ($(BUILD_PLATFORM),linux)
2041TEMPLATE_VBOXBLDPROG_LIBS = pthread m rt dl
2042 else ifeq ($(BUILD_PLATFORM),os2)
2043TEMPLATE_VBOXBLDPROG_TOOL = GXX3OMF
2044TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
2045 else ifeq ($(BUILD_PLATFORM),darwin)
2046TEMPLATE_VBOXBLDPROG_TOOL = GXX4MACHO
2047TEMPLATE_VBOXBLDPROG_LIBS =
2048TEMPLATE_VBOXBLDPROG_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
2049 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_PLATFORM)),)
2050TEMPLATE_VBOXBLDPROG_TOOL = GXX3
2051TEMPLATE_VBOXBLDPROG_LIBS =
2052 else ifeq ($(BUILD_PLATFORM),solaris)
2053$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
2054TEMPLATE_VBOXBLDPROG_TOOL = GXX3PLAIN
2055TEMPLATE_VBOXBLDPROG_LIBS = rt
2056 else
2057$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
2058 endif
2059
2060endif # !win
2061
2062
2063
2064#
2065# Template for building R3 win32 guest additions.
2066#
2067TEMPLATE_VBOXW32GUESTR3 = VBox Win32 Guest Program
2068TEMPLATE_VBOXW32GUESTR3_INST = $(INST_ADDITIONS)
2069TEMPLATE_VBOXW32GUESTR3_BLD_TRG = win
2070TEMPLATE_VBOXW32GUESTR3_BLD_TRG_ARCH = x86
2071TEMPLATE_VBOXW32GUESTR3_BLD_TRG_CPU = i386
2072TEMPLATE_VBOXW32GUESTR3_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 IN_RT_R3 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
2073TEMPLATE_VBOXW32GUESTR3_RCDEFS = \
2074 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
2075 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
2076 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
2077 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
2078 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
2079 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
2080TEMPLATE_VBOXW32GUESTR3_ASTOOL = YASM
2081TEMPLATE_VBOXW32GUESTR3_ASFLAGS = -f win -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
2082TEMPLATE_VBOXW32GUESTR3_DLLSUFF = .dll
2083TEMPLATE_VBOXW32GUESTR3_EXESUFF = .exe
2084TEMPLATE_VBOXW32GUESTR3_LIBSUFF = .lib
2085TEMPLATE_VBOXW32GUESTR3_ARLIBSUFF = .lib
2086TEMPLATE_VBOXW32GUESTR3_SDKS = WIN32SDK W2K3DDKX86
2087ifdef VBOX_USE_VCC80
2088 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC80X86
2089 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
2090 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -RTCsu
2091 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -O2 -Oy- -GS-
2092else
2093 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC70
2094 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -U__LINUX__ -U__OS2__ -W3
2095 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -GZ
2096 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -Ogitb2 -Oy-
2097endif
2098TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2099TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2100TEMPLATE_VBOXW32GUESTR3_CFLAGS = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS)
2101TEMPLATE_VBOXW32GUESTR3_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug)
2102TEMPLATE_VBOXW32GUESTR3_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2103TEMPLATE_VBOXW32GUESTR3_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile)
2104TEMPLATE_VBOXW32GUESTR3_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile)
2105TEMPLATE_VBOXW32GUESTR3_INCS = \
2106 $(VBOX_PATH_SDK)/include
2107TEMPLATE_VBOXW32GUESTR3_LDFLAGS = \
2108 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE \
2109 /DISALLOWLIB:libc.lib \
2110 /DISALLOWLIB:libcd.lib \
2111 /DISALLOWLIB:msvcrt.lib \
2112 /DISALLOWLIB:libcmtd.lib \
2113 /DISALLOWLIB:msvcrtd.lib
2114ifdef VBOX_USE_VCC80
2115 TEMPLATE_VBOXW32GUESTR3_LIBS = \
2116 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib \
2117 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
2118 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
2119else
2120 TEMPLATE_VBOXW32GUESTR3_LIBS = \
2121 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \
2122 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
2123 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
2124endif
2125TEMPLATE_VBOXW32GUESTR3_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2126
2127#
2128# R3 win32 guest libraries
2129#
2130TEMPLATE_VBOXW32GUESTR3LIB = VBox Win32 Guest User Libraries
2131TEMPLATE_VBOXW32GUESTR3LIB_EXTENDS = VBOXW32GUESTR3
2132TEMPLATE_VBOXW32GUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
2133
2134
2135#
2136# Template for building R0 win32 guest tools.
2137#
2138TEMPLATE_VBOXW32GUESTR0 = VBox Win32 Guest Driver
2139TEMPLATE_VBOXW32GUESTR0_INST = $(INST_ADDITIONS)
2140TEMPLATE_VBOXW32GUESTR0_BLD_TRG = win
2141TEMPLATE_VBOXW32GUESTR0_BLD_TRG_ARCH = x86
2142TEMPLATE_VBOXW32GUESTR0_BLD_TRG_CPU = i386
2143TEMPLATE_VBOXW32GUESTR0_DEFS = _X86_ IN_GUEST IN_GUEST_R0 IN_RING0 IN_RT_R0 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
2144TEMPLATE_VBOXW32GUESTR0_RCDEFS = \
2145 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
2146 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
2147 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
2148 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
2149 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
2150 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
2151TEMPLATE_VBOXW32GUESTR0_ASTOOL = YASM
2152TEMPLATE_VBOXW32GUESTR0_ASFLAGS = -f win32 -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
2153TEMPLATE_VBOXW32GUESTR0_SYSSUFF = .sys
2154ifdef VBOX_USE_VCC80
2155 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC80X86
2156 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
2157 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -EHs-c- -Zl
2158 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -O2 -Oy-
2159else
2160 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC70
2161 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -U__LINUX__ -U__OS2__ -W3
2162 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -GX- -Zl
2163 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -Ogitb2 -Oy-
2164endif
2165TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2166TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2167TEMPLATE_VBOXW32GUESTR0_CFLAGS = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS)
2168TEMPLATE_VBOXW32GUESTR0_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug)
2169TEMPLATE_VBOXW32GUESTR0_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2170TEMPLATE_VBOXW32GUESTR0_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile)
2171TEMPLATE_VBOXW32GUESTR0_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile)
2172TEMPLATE_VBOXW32GUESTR0_LDFLAGS = \
2173 -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Machine:X86 -Debug \
2174 /DISALLOWLIB:libcd.lib \
2175 /DISALLOWLIB:msvcrt.lib \
2176 /DISALLOWLIB:msvcrtd.lib \
2177 /DISALLOWLIB:libcmtd.lib
2178TEMPLATE_VBOXW32GUESTR0_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
2179
2180#
2181# R0 win32 guest libraries
2182#
2183TEMPLATE_VBOXW32GUESTR0LIB = VBox Win32 Guest Driver
2184TEMPLATE_VBOXW32GUESTR0LIB_EXTENDS = VBOXW32GUESTR0
2185TEMPLATE_VBOXW32GUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
2186
2187
2188#
2189# Windows rc workaround for crosscompiling.
2190# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
2191#
2192ifneq ($(BUILD_PLATFORM),win)
2193 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2194 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2195 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2196 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
2197else
2198 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
2199 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
2200 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
2201 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
2202 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
2203 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
2204 ) Sorry_Cannot_find_mc_in_the_PSDK)
2205endif
2206
2207
2208#
2209# Template for syntax checking the linux guest additions.
2210# Not properly realized yet.
2211#
2212TEMPLATE_VBOXLNX32GUESTR0 = Template for *syntax checking* linux guest additions kernel modules
2213TEMPLATE_VBOXLNX32GUESTR0_TOOL = $(VBOX_GCC_TOOL)
2214TEMPLATE_VBOXLNX32GUESTR0_BLD_TRG = linux
2215TEMPLATE_VBOXLNX32GUESTR0_DEFS = __KERNEL__ MODULE IN_GUEST IN_GUEST_R0 IN_RING0 IN_RT_R0
2216TEMPLATE_VBOXLNX32GUESTR0_INCS = $(VBOX_LINUX_INCS)
2217TEMPLATE_VBOXLNX32GUESTR0_CFLAGS = -nostdinc -iwithprefix include \
2218 -O2 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
2219 $(VBOX_GCC_fno-stack-protector) -fno-strict-aliasing -fno-common \
2220 -mpreferred-stack-boundary=2 -msoft-float
2221TEMPLATE_VBOXLNX32GUESTR0_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXLNX32GUESTR0_CFLAGS)) -fno-exceptions -fno-rtti
2222ifndef VBOX_LINUX_VERSION_2_4
2223# 2.6
2224TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .ko
2225TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -m elf_i386 -r
2226else
2227# 2.4
2228TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .o
2229TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -r -s
2230endif
2231
2232
2233#
2234# Tools and templates for building 32-bit linux guest additions.
2235#
2236TOOL_VBOXLNX32NOCPPLD = Linker tool replacing the VBOX_GCC32_TOOL linker (g++).
2237TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_OUTPUT = $(outbase).map
2238TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
2239TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_DEPORD =
2240define TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_CMDS
2241 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_CC) $(flags) -o $(out) $(objs)\
2242 $(foreach p,$(libpath), -L$(p))\
2243 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
2244 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_MAP,$(outbase).map)
2245endef
2246TOOL_VBOXLNX32NOCPPLD_LINK_DLL_OUTPUT = $(outbase).map
2247TOOL_VBOXLNX32NOCPPLD_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
2248TOOL_VBOXLNX32NOCPPLD_LINK_DLL_DEPORD =
2249# (no SONAME for now)
2250define TOOL_VBOXLNX32NOCPPLD_LINK_DLL_CMDS
2251 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_CC) $(TOOL_$(VBOX_GCC32_TOOL)_LDFLAGS.dll) $(flags) -o $(out)\
2252 $(objs)\
2253 $(foreach p,$(libpath), -L$(p))\
2254 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
2255 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_MAP,$(outbase).map)
2256endef
2257TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_OUTPUT = $(outbase).map
2258TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
2259TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_DEPORD =
2260define TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_CMDS
2261 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_LD_SYSMOD) $(TOOL_VBOXLNX32NOCPPLD_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
2262 $(foreach p,$(libpath), -L$(p))\
2263 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
2264 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_SYSMOD_MAP,$(outbase).map)
2265endef
2266
2267TEMPLATE_VBOXLNX32GUESTR3EXE = Template for building 32-bit linux guest additions programs.
2268TEMPLATE_VBOXLNX32GUESTR3EXE_INST = $(INST_ADDITIONS)
2269TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG = linux
2270TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_ARCH = x86
2271TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_CPU = i386
2272TEMPLATE_VBOXLNX32GUESTR3EXE_TOOL = $(VBOX_GCC32_TOOL)
2273TEMPLATE_VBOXLNX32GUESTR3EXE_ASTOOL = YASM
2274TEMPLATE_VBOXLNX32GUESTR3EXE_ASFLAGS = -f elf32 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels
2275TEMPLATE_VBOXLNX32GUESTR3EXE_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 HC_ARCH_BITS=32 GC_ARCH_BITS=32
2276TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe $(VBOX_GCC_fno-stack-protector)
2277TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug = -fno-inline
2278TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2279TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2280TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2281TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.release = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2282TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug)
2283TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile)
2284TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile)
2285TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_fno-stack-protector)
2286# No LDFLAGS nor LIBS!
2287
2288TEMPLATE_VBOXLNX32GUESTR3EXENOCPP = Template for building 32-bit linux guest additions programs without any C++.
2289TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2290TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_LDTOOL = VBOXLNX32NOCPPLD
2291# No LDFLAGS nor LIBS!
2292
2293TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP = Template for building 32-bit linux guest additions shared objects without any C++.
2294TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2295TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDTOOL = VBOXLNX32NOCPPLD
2296TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS)
2297TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS)
2298TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDFLAGS = -fPIC
2299
2300TEMPLATE_VBOXLNX32GUESTR3LIB = Template for building 32-bit linux guest additions libraries.
2301TEMPLATE_VBOXLNX32GUESTR3LIB_EXTENDS = VBOXLNX32GUESTR3EXE
2302TEMPLATE_VBOXLNX32GUESTR3LIB_INST = $(INST_ADDITION_LIB)
2303
2304
2305
2306
2307ifdef VBOX_WITH_OS2_ADDITIONS
2308
2309#
2310# Template for building R3 OS/2 guest additions.
2311#
2312TEMPLATE_VBOXOS2GUESTR3 = VBox OS/2 Guest Programs and DLLs
2313TEMPLATE_VBOXOS2GUESTR3_INST = $(INST_ADDITIONS)os2/
2314TEMPLATE_VBOXOS2GUESTR3_BLD_TRG = os2
2315TEMPLATE_VBOXOS2GUESTR3_BLD_TRG_ARCH = x86
2316TEMPLATE_VBOXOS2GUESTR3_BLD_TRG_CPU = blend
2317TEMPLATE_VBOXOS2GUESTR3_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 IN_RT_R3 HC_ARCH_BITS=32 GC_ARCH_BITS=32
2318TEMPLATE_VBOXOS2GUESTR3_ASTOOL = NASM
2319TEMPLATE_VBOXOS2GUESTR3_ASFLAGS = -f obj -DASM_FORMAT_OMF -D__NASM__ -w+orphan-labels -g
2320TEMPLATE_VBOXOS2GUESTR3_DLLSUFF = .dll
2321TEMPLATE_VBOXOS2GUESTR3_EXESUFF = .exe
2322TEMPLATE_VBOXOS2GUESTR3_LIBSUFF = .lib
2323TEMPLATE_VBOXOS2GUESTR3_ARLIBSUFF = .lib
2324TEMPLATE_VBOXOS2GUESTR3_TOOL = GXX3OMF
2325TEMPLATE_VBOXOS2GUESTR3_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -fno-strict-aliasing -fno-rtti -fno-exceptions
2326TEMPLATE_VBOXOS2GUESTR3_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -fno-strict-aliasing
2327ifneq ($(BUILD_TYPE),debug)
2328 TEMPLATE_VBOXOS2GUESTR3_CFLAGS += -O2 -fno-omit-frame-pointer
2329 TEMPLATE_VBOXOS2GUESTR3_CXXFLAGS += -O2 -fno-omit-frame-pointer
2330endif
2331TEMPLATE_VBOXOS2GUESTR3_INCS = \
2332 $(VBOX_PATH_SDK)/include
2333
2334#
2335# Template for building OS/2 guest R3 libraries.
2336#
2337TEMPLATE_VBOXOS2GUESTR3LIB = VBox OS/2 Guest Usermode Libraries
2338TEMPLATE_VBOXOS2GUESTR3LIB_EXTENDS = VBOXOS2GUESTR3
2339TEMPLATE_VBOXOS2GUESTR3LIB_INST = $(INST_ADDITIONS_LIB)os2/
2340
2341#
2342# Template for building OS/2 Guest R0 images.
2343#
2344TEMPLATE_VBOXOS2GUESTR0 = VBox OS/2 Guest Driver
2345TEMPLATE_VBOXOS2GUESTR0_INST = $(INST_ADDITIONS)os2/
2346TEMPLATE_VBOXOS2GUESTR0_BLD_TRG = os2
2347TEMPLATE_VBOXOS2GUESTR0_BLD_TRG_ARCH = x86
2348TEMPLATE_VBOXOS2GUESTR0_BLD_TRG_CPU = blend
2349TEMPLATE_VBOXOS2GUESTR0_DEFS = IN_RING0 IN_GUEST IN_GUEST_R0 IN_RT_R0 HC_ARCH_BITS=32 GC_ARCH_BITS=32 LOG_TO_BACKDOOR
2350TEMPLATE_VBOXOS2GUESTR0_SYSSUFF = .sys
2351TEMPLATE_VBOXOS2GUESTR0_ASTOOL = NASM
2352TEMPLATE_VBOXOS2GUESTR0_ASFLAGS = -f obj -DASM_FORMAT_OMF -D__NASM__ -w+orphan-labels -g
2353TEMPLATE_VBOXOS2GUESTR0_TOOL = GXX3OMF
2354TEMPLATE_VBOXOS2GUESTR0_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -fno-strict-aliasing -fno-rtti -fno-exceptions
2355TEMPLATE_VBOXOS2GUESTR0_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -fno-strict-aliasing
2356ifneq ($(BUILD_TYPE),debug)
2357 TEMPLATE_VBOXOS2GUESTR0_CFLAGS += -O2 -fno-omit-frame-pointer
2358 TEMPLATE_VBOXOS2GUESTR0_CXXFLAGS += -O2 -fno-omit-frame-pointer
2359endif
2360TEMPLATE_VBOXOS2GUESTR0_LIBS = $(VBOX_GCC_LIBGCC) ## @todo this isn't nice.
2361TEMPLATE_VBOXOS2GUESTR0_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
2362
2363#
2364# Template for building OS/2 Guest R0 libraries.
2365#
2366TEMPLATE_VBOXOS2GUESTR0LIB = VBox OS/2 Guest Driver Library
2367TEMPLATE_VBOXOS2GUESTR0LIB_EXTENDS = VBOXOS2GUESTR0
2368TEMPLATE_VBOXOS2GUESTR0LIB_INST = $(INST_ADDITIONS_LIB)os2/
2369
2370#
2371# OS/2 Guest Libraries.
2372#
2373VBOX_LIB_IPRT_OS2_GUEST_R0 = $(PATH_LIB)/additions/os2/RuntimeOS2GuestR0.lib
2374VBOX_LIB_IPRT_OS2_GUEST_R3 = $(PATH_LIB)/additions/os2/RuntimeOS2GuestR3.lib
2375VBOX_LIB_VBGL_OS2_R3 = $(PATH_LIB)/additions/os2/VBoxGuestR3LibOS2.lib
2376VBOX_LIB_VBGL_OS2_R0BASE = $(PATH_LIB)/additions/os2/VBoxGuestR0LibBaseOS2.lib
2377VBOX_LIB_VBGL_OS2_R0 = $(PATH_LIB)/additions/os2/VBoxGuestR0LibOS2.lib
2378
2379endif # VBOX_WITH_OS2_ADDITIONS
2380
2381
2382#
2383# Two targets to coordinate version number changes properly. Note that the
2384# only way to get a really consistent build is to run 'kmk' in the top-level
2385# directory. If you don't run it there, you get a consistent sub-tree only.
2386#
2387VBOX_VERSION_STAMP = $(PATH_OUT)/version-stamp-$(VBOX_VERSION_STRING)
2388VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
2389VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
2390
2391$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
2392 $(call MSG_GENERATE,,$@)
2393 $(QUIET)$(MKDIR) -p $(@D)
2394 $(QUIET)$(RM) -f $(filter-out $@,$(wildcard $(PATH_OUT)/version-stamp-*))
2395 $(QUIET)$(ECHO_EXT) > $@
2396
2397$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
2398 $(call MSG_GENERATE,,$@)
2399 $(QUIET)$(MKDIR) -p $(@D)
2400 $(QUIET)$(RM) -f $@ [email protected]
2401 $(QUIET)$(APPEND) [email protected] "#ifndef __version_generated_h__"
2402 $(QUIET)$(APPEND) [email protected] "#define __version_generated_h__"
2403 $(QUIET)$(APPEND) [email protected] ""
2404 $(QUIET)$(APPEND) [email protected] "#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)"
2405 $(QUIET)$(APPEND) [email protected] "#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)"
2406 $(QUIET)$(APPEND) [email protected] "#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)"
2407 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_STRING "$(VBOX_VERSION_STRING)"'
2408 $(QUIET)$(APPEND) [email protected] ""
2409 $(QUIET)$(APPEND) [email protected] "#endif"
2410 $(QUIET)$(MV) -f [email protected] $@
2411
2412#
2413# Used for external makefiles which cannot include Config.kmk
2414#
2415$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
2416 $(call MSG_GENERATE,,$@)
2417 $(QUIET)$(MKDIR) -p $(@D)
2418 $(QUIET)$(RM) -f $@ [email protected]
2419 $(QUIET)$(APPEND) [email protected] "VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)"
2420 $(QUIET)$(APPEND) [email protected] "VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)"
2421 $(QUIET)$(APPEND) [email protected] "VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)"
2422 $(QUIET)$(APPEND) [email protected] "VBOX_VERSION_STRING = $(VBOX_VERSION_STRING)"
2423 $(QUIET)$(MV) -f [email protected] $@
2424
2425
2426# Force building of the version header file as the first thing anywhere in
2427# the tree. This eliminates the need for manual dependencies on it.
2428Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2429Makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2430makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2431
2432
2433#
2434# Legacy.
2435#
2436ifneq ($(LOCALCFG),)
2437 include $(LOCALCFG)
2438endif
2439
2440
2441#
2442# Some extra goals.
2443#
2444.PHONY: up update st stat status
2445up update::
2446 svn$(HOSTSUFF_EXE) up
2447
2448st stat status:
2449 svn$(HOSTSUFF_EXE) status
2450
2451quick:
2452 $(MAKE) VBOX_QUICK=1
2453
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