VirtualBox

source: vbox/trunk/Config.kmk@ 3911

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

instroduced global VBOX_HEADLESS

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