VirtualBox

source: vbox/trunk/Config.kmk@ 5618

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

Disable ehci where usb is disabled.

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