VirtualBox

source: vbox/trunk/Config.kmk@ 5809

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

Enabling package building on Solaris...

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