VirtualBox

source: vbox/trunk/Config.kmk@ 3597

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

adapt to L4 changes

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