VirtualBox

source: vbox/trunk/Config.kmk@ 3439

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

Added VBOX_WITH_OPENGL (default 1)

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