VirtualBox

source: vbox/trunk/Config.kmk@ 5786

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

small -include fix when compiling Linux kernel modules

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