VirtualBox

source: vbox/trunk/Config.kmk@ 3392

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

If we're targetting OS/2 we can build the OS/2 additions.

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