VirtualBox

source: vbox/trunk/Config.kmk@ 3517

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

fixed VBOX_PATH_GCC_INCS for 64-bit cross builds on 32-bit hosts

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