VirtualBox

source: vbox/trunk/Config.kmk@ 5605

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

fixed kStuff test, hope it doesn't break darwin.

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