VirtualBox

source: vbox/trunk/Config.kmk@ 5287

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

Updated kBuild to r1191.

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