VirtualBox

source: vbox/trunk/Config.kmk@ 3233

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

fixed CXXFLAGS for VBOXR0DRV/Linux

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