VirtualBox

source: vbox/trunk/Config.kmk@ 4876

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

solaris + qt

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