VirtualBox

source: vbox/trunk/Config.kmk@ 4050

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

Export installer to OSE again and fix a few copyright headers.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 99.4 KB
Line 
1# $Id: Config.kmk 4050 2007-08-07 08:04:12Z 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
423 VBOX_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 Solaris /usr/include.
1459VBOX_SOLARIS_SYS_INCS ?= /usr/include
1460
1461TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1462TEMPLATE_VBOXR0DRV_DEFS = _KERNEL _STRICT_STDC IN_RING0 IN_RT_R0
1463#TEMPLATE_VBOXR0DRV_INCS = \
1464# $(VBOX_SOLARIS_SYS_INCS)
1465TEMPLATE_VBOXR0DRV_SYSSUFF = .o
1466TEMPLATE_VBOXR0DRV_LDFLAGS = -r
1467# exclude -Wall because of solaris headers' pragma ident warnings that gcc refuses to supress!!
1468TEMPLATE_VBOXR0DRV_CFLAGS = -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1469 -Wmissing-prototypes -Wstrict-prototypes \
1470 -O2 -ffreestanding -nodefaultlibs -fno-strict-aliasing -fno-common -std=c99
1471## *************************** SOLARISTODO ******************
1472endif # solaris
1473
1474ifeq ($(BUILD_TARGET),freebsd)
1475# x86 FreeBSD:
1476# cc -O2 -fno-strict-aliasing -pipe -Werror -D_KERNEL -DKLD_MODULE \
1477# -nostdinc -I- -I. -I@ -I@/contrib/altq -I@/../include -I/usr/include \
1478# -finline-limit=8000 -fno-common -mno-align-long-strings -mpreferred-stack-boundary=2 \
1479# -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -ffreestanding -Wall -Wredundant-decls -Wnested-externs \
1480# -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions \
1481# -std=c99 -c ../my.c
1482# ld -d -warn-common -r -d -o my.kld my.o
1483# :> export_syms
1484# awk -f /usr/src/sys/modules/my/../../conf/kmod_syms.awk my.kld export_syms | xargs -J% objcopy % my.kld
1485# ld -Bsharable -d warn-commnon -o my.ko my.kld
1486#
1487# Note: @ -> /usr/src/sys and machine -> /usr/src/sys/i386/include
1488
1489## The location of the FreeBSD kernel source.
1490VBOX_FREEBSD_SRC ?= /usr/src/sys
1491## The FreeBSD /usr/include.
1492VBOX_FREEBSD_SYS_INCS ?= /usr/include
1493
1494TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1495TEMPLATE_VBOXR0DRV_LDTOOL = FREEBSDKMODLD
1496TEMPLATE_VBOXR0DRV_DEFS = _KERNEL KLD_MODULE IN_RING0 IN_RT_R0
1497TEMPLATE_VBOXR0DRV_INCS = \
1498 $(VBOX_FREEBSD_SRC) \
1499 $(VBOX_FREEBSD_SRC)/contrib/altq \
1500 $(VBOX_FREEBSD_SRC)/../include \
1501 $(VBOX_FREEBSD_SYS_INCS)
1502# omitting: -Wcast-qual, -Wredundant-decls
1503TEMPLATE_VBOXR0DRV_CFLAGS = \
1504 -Wall -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1505 -Wstrict-prototypes -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \
1506 -O2 -fformat-extensions -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
1507 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) \
1508 -nostdinc -std=c99
1509TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2
1510TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 "Port me to amd64 FreeBSD"
1511TEMPLATE_VBOXR0DRV_CXXFLAGS = -fno-exceptions -fno-rtti \
1512 -Wall -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1513 -O2 -fno-format-extensions -fno-strict-aliasing -fno-common -finline-limit=8000 \
1514 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) \
1515 -nostdinc
1516TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1517TEMPLATE_VBOXR0DRV_LDFLAGS = -d --warn-common
1518TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386_fbsd
1519TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 "Port me to amd64 FreeBSD"
1520
1521TOOL_FREEBSDKMODLD = FreeBSD kernel module linker.
1522# See kBuild/tools/GCC3.kmk for docs.
1523TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT = $(outbase).kld
1524TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
1525TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1526TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPORD =
1527define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
1528 @# Link intermediate .kld (a relocatable object).
1529 ld $(flags) -r -o $(outbase).kld $(objs) \
1530 $(foreach p,$(libpath), -L$(p))\
1531 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
1532 @# Strip non-exported symbols private and localize the exported ones.
1533 awk -f $(VBOX_FREEBSD_SRC)/conf/kmod_syms.awk $(outbase).kld $(if $(othersrc), $(othersrc),/dev/null) \
1534 | xargs -J% objcopy % $(outbase).kld
1535 @# Link the final .ko (a shared object).
1536 ld $(flags) -Bshareable -o $(out) $(outbase).kld
1537endef
1538
1539endif # FreeBSD
1540
1541ifdef VBOX_WITH_VBOXDRV
1542 ifndef TEMPLATE_VBOXR0DRV_TOOL
1543 $(warning Warning: VBox Build: Target $(BUILD_PLATFORM) is not officially supported!)
1544 endif
1545endif
1546
1547
1548
1549#
1550# Template for building R3 executables and static libraries which are linked into executables.
1551#
1552TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
1553TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
1554TEMPLATE_VBOXR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
1555TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
1556TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
1557ifeq ($(BUILD_TARGET),win)
1558 TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
1559 TEMPLATE_VBOXR3EXE_RCDEFS = \
1560 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1561 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1562 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1563 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1564 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1565 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1566 TEMPLATE_VBOXR3EXE_SDKS = WINPSDK
1567 ifdef VBOX_USE_VCC80
1568 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MD -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1569 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
1570 else
1571 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MD -W3 -wd4065 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1572 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -GZ
1573 endif
1574 TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
1575 TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
1576 TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1577 TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1578 TEMPLATE_VBOXR3EXE_LDFLAGS = \
1579 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1580 /DISALLOWLIB:libc.lib \
1581 /DISALLOWLIB:libcd.lib \
1582 /DISALLOWLIB:libcmt.lib \
1583 /DISALLOWLIB:libcmtd.lib \
1584 /DISALLOWLIB:msvcrtd.lib
1585 TEMPLATE_VBOXR3EXE_LIBS = \
1586 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1587 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1588 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib
1589 TEMPLATE_VBOXR3EXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1590
1591else # the gcc guys
1592TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
1593TEMPLATE_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)
1594# L4 currently can't handle exception handling.
1595TEMPLATE_VBOXR3EXE_CXXFLAGS.l4 = -fno-exceptions -nostdinc \
1596 $(addprefix -I,$(VBOX_PATH_GCC_INCS) $(L4_INCDIR) $(FILE_TOOL_GPP3_INCDIR)) \
1597 $(DEBUG_L4)
1598TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
1599TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1600TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1601TEMPLATE_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)
1602TEMPLATE_VBOXR3EXE_CFLAGS.darwin = -fno-common
1603TEMPLATE_VBOXR3EXE_CFLAGS.l4 = -nostdinc \
1604 $(addprefix -I,$(VBOX_PATH_GCC_INCS) $(L4_INCDIR)) $(DEBUG_L4)
1605TEMPLATE_VBOXR3EXE_DEFS.l4 = L4_THREAD_SAFE
1606TEMPLATE_VBOXR3EXE_LDFLAGS.l4 = \
1607 $(L4_LIBDIR)/../crt0.o \
1608 -T$(L4_LIBDIR)/../main_dyn.ld -nostdlib \
1609 -Wl,--export-dynamic,--dynamic-linker=libld-l4.s.so \
1610 -Wl,--rpath-link,$(L4_LIBDIR)
1611TEMPLATE_VBOXR3EXE_LDFLAGS.linux = -Wl,-z,noexecstack
1612 ifeq ($(BUILD_TARGET),linux)
1613TEMPLATE_VBOXR3EXE_LIBS = pthread m rt dl
1614 else ifeq ($(BUILD_TARGET),l4)
1615TEMPLATE_VBOXR3EXE_LIBS = \
1616 $(L4_LIBDIR)/libvboxserver.s.so \
1617 $(L4_LIBDIR)/libuc++.0.s.so \
1618 supc++ gcc_eh gcc \
1619 $(L4_LIBDIR)/libdl.s.so \
1620 $(L4_LIBDIR)/libuc.0.s.so
1621 else ifeq ($(BUILD_TARGET),os2)
1622TEMPLATE_VBOXR3EXE_TOOL = GXX3OMF
1623TEMPLATE_VBOXR3EXE_LIBS = socket iconv
1624 else ifeq ($(BUILD_TARGET),darwin)
1625TEMPLATE_VBOXR3EXE_TOOL = GXX4MACHO
1626TEMPLATE_VBOXR3EXE_LIBS =
1627TEMPLATE_VBOXR3EXE_LDFLAGS = -read_only_relocs suppress
1628TEMPLATE_VBOXR3EXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1629 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1630TEMPLATE_VBOXR3EXE_TOOL = GXX3
1631TEMPLATE_VBOXR3EXE_LIBS = pthread
1632 else ifeq ($(BUILD_TARGET),solaris)
1633TEMPLATE_VBOXR3EXE_TOOL = GXX3PLAIN
1634TEMPLATE_VBOXR3EXE_LIBS = rt socket
1635 else
1636$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1637TEMPLATE_VBOXR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.release)
1638TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease)
1639 endif
1640endif
1641
1642#
1643# Template for building R3 shared objects / DLLs.
1644# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
1645#
1646TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
1647TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
1648TEMPLATE_VBOXR3_LDFLAGS.l4 = $(L4_LIBDIR)/../crt0.s.o -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
1649TEMPLATE_VBOXR3_DEFS.l4 = $(TEMPLATE_VBOXR3EXE_DEFS.l4) __PIC__
1650TEMPLATE_VBOXR3_DEFS.darwin = $(TEMPLATE_VBOXR3EXE_DEFS.darwin) PIC
1651ifeq ($(filter-out solaris.x86 %.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
1652 ifneq ($(BUILD_TARGET),win)
1653 TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
1654 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
1655 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
1656 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
1657 endif
1658endif
1659
1660#
1661# Ring-3 testcase.
1662# This is the VBOXR3EXE template only with a different install dir.
1663#
1664TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
1665TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
1666TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
1667TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
1668ifeq ($(BUILD_TARGET),win)
1669 ifdef VBOX_SIGNING_MODE
1670 TEMPLATE_VBOXR3TSTEXE_POST_CMDS =
1671 endif
1672endif
1673
1674#
1675# Template for building bad C/C++ style R3 executables (no -pedantic).
1676#
1677TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
1678TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
1679ifneq ($(BUILD_TARGET),win)
1680 # (only gcc)
1681 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
1682 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
1683 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3EXE_CFLAGS))
1684endif
1685
1686#
1687# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
1688# This is mostly identical to the VBOXR3NPEXE template.
1689#
1690TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
1691TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3NPEXE
1692TEMPLATE_VBOXR3NP_LDFLAGS.l4 = \
1693 $(L4_LIBDIR)/../crt0.s.o \
1694 -T$(L4_LIBDIR)/../main_rel.ld \
1695 -nostdlib
1696TEMPLATE_VBOXR3NP_DEFS.l4 = $(TEMPLATE_VBOXR3NPEXE_DEFS.l4) __PIC__
1697ifeq ($(BUILD_TARGET_ARCH),amd64)
1698 ifneq ($(BUILD_TARGET),win)
1699 TEMPLATE_VBOXR3NP_DEFS = $(TEMPLATE_VBOXR3NPEXE_DEFS) PIC
1700 TEMPLATE_VBOXR3NP_CFLAGS = $(TEMPLATE_VBOXR3NPEXE_CFLAGS) -fPIC
1701 TEMPLATE_VBOXR3NP_CXXFLAGS = $(TEMPLATE_VBOXR3NPEXE_CXXFLAGS) -fPIC
1702 TEMPLATE_VBOXR3NP_LDFLAGS = $(TEMPLATE_VBOXR3NPEXE_LDFLAGS) -fPIC
1703 endif
1704endif
1705
1706
1707#
1708# Template for building libraries, shared libraries / modules
1709# which only depends on IPRT for crt.
1710#
1711TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
1712TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
1713TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
1714## @todo C++
1715TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno -Wall
1716TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -mcmodel=medium -fno-common
1717#TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O0 -fno-math-errno -fno-peephole2 -fno-strict-aliasing - for win64.
1718TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
1719TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1720TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1721TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -mdynamic-no-pic
1722TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
1723
1724ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.amd64)
1725 # cross compile to 64-bit ELF (linux).
1726 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
1727 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
1728 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
1729 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
1730 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1731
1732else ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1733 # Use the default GCC (MinGW) with the Microsoft linker.
1734 # (Drop all '-g' options as we're unable to strip the debug info.)
1735 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1736 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1737 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1738 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
1739 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
1740 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1741 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
1742
1743else
1744 # Use the default GCC.
1745 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
1746 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1747 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1748 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1749 TEMPLATE_VBOXNOCRTGCC_CFLAGS += $(VBOX_GCC_fno-stack-protector)
1750 TEMPLATE_VBOXNOCRTGCC_CXXFLAGS += $(VBOX_GCC_fno-stack-protector)
1751 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1752 ifneq ($(filter-out os2 darwin solaris,$(BUILD_TARGET)),)
1753 ifneq ($(BUILD_TARGET_ARCH),amd64)
1754 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
1755 endif
1756 endif
1757 ifneq ($(filter-out freebsd,$(BUILD_TARGET)),)
1758 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
1759 else
1760 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1761 endif
1762endif
1763
1764
1765#
1766# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
1767#
1768TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
1769TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
1770TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
1771ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1772 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
1773else
1774 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
1775endif
1776
1777
1778#
1779# Template for building executables that are part of the VBox Main component
1780# (COM/XPCOM interface to VirtualBox).
1781#
1782
1783TEMPLATE_VBOXMAINEXE = VBox Main Executable
1784TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
1785TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
1786TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE NDEBUG=1
1787TEMPLATE_VBOXMAINEXE_DEFS.win = _UNICODE
1788TEMPLATE_VBOXMAINEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
1789TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
1790TEMPLATE_VBOXMAINEXE_INCS = \
1791 $(VBOX_PATH_SDK)/include
1792
1793ifeq ($(BUILD_TARGET),win)
1794 TEMPLATE_VBOXMAINEXE_SDKS = WINPSDK W2K3DDK
1795 ifdef VBOX_USE_VCC80
1796 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
1797 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GF- -MD -EHsc -W3 -wd4065 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1798 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
1799 else
1800 TEMPLATE_VBOXMAINEXE_TOOL = VCC70
1801 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GX- -GF- -MD -EHsc -W3 -wd4065 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1802 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -GZ
1803 endif
1804 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
1805 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1806 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
1807 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1808 TEMPLATE_VBOXMAINEXE_INCS += \
1809 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1810 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
1811 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
1812 /DISALLOWLIB:libc.lib \
1813 /DISALLOWLIB:libcd.lib \
1814 /DISALLOWLIB:msvcrt.lib \
1815 /DISALLOWLIB:msvcrtd.lib \
1816 /DISALLOWLIB:libcmtd.lib \
1817 /DISALLOWLIB:libcmt.lib
1818 TEMPLATE_VBOXMAINEXE_LIBS = \
1819 $(LIB_RUNTIME) \
1820 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1821 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1822 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1823 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1824 TEMPLATE_VBOXMAINEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1825
1826else # the GCC guys:
1827
1828TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
1829TEMPLATE_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)
1830TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -fno-inline
1831TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
1832TEMPLATE_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)
1833TEMPLATE_VBOXMAINEXE_CFLAGS.debug = -fno-inline
1834TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1835 ifeq ($(BUILD_TARGET),linux)
1836TEMPLATE_VBOXMAINEXE_LIBS = pthread m rt $(LIB_RUNTIME)
1837 else ifeq ($(BUILD_TARGET),l4)
1838TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1839# no libs as yet in l4 target - must be added later
1840 else ifeq ($(BUILD_TARGET),os2)
1841TEMPLATE_VBOXMAINEXE_TOOL = GXX3OMF
1842TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1843 else ifeq ($(BUILD_TARGET),darwin)
1844TEMPLATE_VBOXMAINEXE_TOOL = GXX4MACHO
1845TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1846TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin = -bind_at_load -framework Carbon
1847 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1848TEMPLATE_VBOXMAINEXE_TOOL = GXX3
1849TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1850TEMPLATE_VBOXMAINEXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1851 else ifeq ($(BUILD_TARGET),solaris)
1852TEMPLATE_VBOXMAINEXE_TOOL = GXX3PLAIN
1853TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt
1854 else
1855$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1856TEMPLATE_VBOXMAINEXE_LIBS =
1857 endif
1858
1859endif # !win
1860
1861# Add COM/XPCOM stuff
1862TEMPLATE_VBOXMAINEXE_LIBS += \
1863 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
1864ifdef VBOX_WITH_XPCOM
1865 ## @todo may be worth creating the VBOX_XPCOM SDK def
1866 TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
1867 TEMPLATE_VBOXMAINEXE_INCS += \
1868 $(VBOX_XPCOM_INCS)
1869 TEMPLATE_VBOXMAINEXE_LIBS += \
1870 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
1871 $(LIB_XPCOM)
1872endif
1873
1874#
1875# Template for building the Main DLL modules (such as in-process COM/XPCOM
1876# components for Main).
1877#
1878# This differs from VBOXMAINEXE only in PIC handling and similar DLL stuff.
1879#
1880
1881TEMPLATE_VBOXMAINDLL = VBox Main Component (shared library)
1882TEMPLATE_VBOXMAINDLL_EXTENDS = VBOXMAINEXE
1883ifeq ($(BUILD_TARGET_ARCH),amd64)
1884 ifneq ($(BUILD_TARGET),win)
1885 TEMPLATE_VBOXMAINDLL_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
1886 TEMPLATE_VBOXMAINDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
1887 TEMPLATE_VBOXMAINDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1888 TEMPLATE_VBOXMAINDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
1889 endif
1890endif
1891TEMPLATE_VBOXMAINDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin))
1892
1893ifdef VBOX_WITH_XPCOM
1894 # XPCOM component modules don't need the XPCOM glue library
1895 TEMPLATE_VBOXMAINDLL_LIBS = $(filter-out \
1896 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB),\
1897 $(TEMPLATE_VBOXMAINEXE_LIBS))
1898endif
1899
1900#
1901# Template for building the Main static libraries.
1902#
1903# This differs from VBOXMAINDLL only that it zeroes out the _LIBS definition.
1904#
1905
1906TEMPLATE_VBOXMAINLIB = VBox Main Component (static library)
1907TEMPLATE_VBOXMAINLIB_EXTENDS = VBOXMAINDLL
1908TEMPLATE_VBOXMAINLIB_LIBS =
1909
1910#
1911# Template for building executables that use the VBox Main component.
1912#
1913
1914TEMPLATE_VBOXMAINCLIENTEXE = VBox Main Client (executable)
1915TEMPLATE_VBOXMAINCLIENTEXE_EXTENDS = VBOXMAINEXE
1916ifeq ($(BUILD_TARGET),win)
1917 TEMPLATE_VBOXMAINCLIENTEXE_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
1918 $(PATH_SDK_WINPSDK_LIB)/User32.Lib \
1919 $(PATH_SDK_WINPSDK_LIB)/Shell32.Lib \
1920 $(PATH_SDK_WINPSDK_LIB)/ShLwApi.Lib \
1921 $(PATH_SDK_WINPSDK_LIB)/Ole32.Lib \
1922 $(PATH_SDK_WINPSDK_LIB)/OleAut32.Lib \
1923 $(PATH_SDK_WINPSDK_LIB)/Uuid.Lib
1924else
1925 TEMPLATE_VBOXMAINCLIENTEXE_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
1926 NDEBUG TRIMMED
1927 ## @todo remove
1928 ## Wonder why we compile main with defaults for these two and then drops it
1929 ## in the client executables...
1930 #TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS) \
1931 # -fno-rtti -fno-exceptions
1932 TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
1933 -pthread
1934 TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin = $(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin) \
1935 -bind_at_load -framework Carbon
1936endif
1937
1938#
1939# Template for building shared libraries / DLLs that use the VBox Main component.
1940#
1941# This differs from VBOXMAINCLIENTEXE only in PIC handling and similar DLL stuff.
1942#
1943
1944TEMPLATE_VBOXMAINCLIENTDLL = VBox MAIN Client (shared library)
1945TEMPLATE_VBOXMAINCLIENTDLL_EXTENDS = VBOXMAINCLIENTEXE
1946ifeq ($(BUILD_TARGET_ARCH),amd64)
1947 ifneq ($(BUILD_TARGET),win)
1948 TEMPLATE_VBOXMAINCLIENTDLL_DEFS = PIC $(TEMPLATE_VBOXMAINCLIENTEXE_DEFS)
1949 TEMPLATE_VBOXMAINCLIENTDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CFLAGS)
1950 TEMPLATE_VBOXMAINCLIENTDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS)
1951 TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)
1952 endif
1953endif
1954TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin))
1955
1956
1957#
1958# Template for building Qt GUI executables.
1959#
1960
1961TEMPLATE_VBOXQTGUIEXE = VBox Qt GUI Executable
1962TEMPLATE_VBOXQTGUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS)
1963TEMPLATE_VBOXQTGUIEXE_INCS = \
1964 $(VBOX_PATH_SDK)/include \
1965 $(VBOX_PATH_QT)/include
1966
1967ifeq ($(BUILD_TARGET),win)
1968 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_VCC_TOOL)
1969 TEMPLATE_VBOXQTGUIEXE_DEFS += \
1970 _WIN32_WINNT=0x0500 UNICODE _UNICODE \
1971 QT_DLL _CRT_SECURE_NO_DEPRECATE
1972 ## @todo VCC70 flags?
1973 ifdef VBOX_USE_VCC80
1974 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1975 -nologo -Zm200 -W3 -MD -EHsc -Zc:wchar_t-
1976 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu
1977 else
1978 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1979 -nologo -Zm200 -W3 -MD -GX
1980 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -GZ
1981 endif
1982 TEMPLATE_VBOXQTGUIEXE_INCS += \
1983 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1984 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = \
1985 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
1986 /DELAYLOAD:oleaut32.dll
1987 TEMPLATE_VBOXQTGUIEXE_SDKS = WINPSDK
1988 TEMPLATE_VBOXQTGUIEXE_LIBS = \
1989 $(LIB_QT) \
1990 $(LIB_QTMAIN) \
1991 $(LIB_RUNTIME) \
1992 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1993 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1994 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1995 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
1996 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1997 TEMPLATE_VBOXQTGUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1998
1999else # the gcc guys:
2000 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_GCC_TOOL)
2001 TEMPLATE_VBOXQTGUIEXE_DEFS.linux = _REENTRANT
2002
2003 TEMPLATE_VBOXQTGUIEXE_INCS += \
2004 $(LIB_SDL_INC)
2005 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
2006 -pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
2007 -Wno-long-long -fshort-wchar -fno-strict-aliasing \
2008 $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
2009 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -pthread
2010 ## @todo no $(LIB_QTMAIN) here?
2011 TEMPLATE_VBOXQTGUIEXE_LIBS = \
2012 $(LIB_QT) \
2013 $(LIB_SDL) \
2014 $(LIB_RUNTIME) \
2015 $(LIB_REM) \
2016 $(LIB_VMM)
2017
2018 ifeq ($(BUILD_TARGET_ARCH),amd64)
2019 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
2020 $(VBOX_PATH_QT)/lib64 $(VBOX_PATH_QT)/lib
2021 else
2022 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
2023 $(VBOX_PATH_QT)/lib
2024 endif
2025
2026 ifeq ($(BUILD_TARGET),darwin)
2027 TEMPLATE_VBOXQTGUIEXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
2028 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -framework Carbon -framework QuickTime -bind_at_load
2029 TEMPLATE_VBOXQTGUIEXE_LIBS +=
2030 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
2031 else ifeq ($(BUILD_TARGET),os2)
2032 TEMPLATE_VBOXQTGUIEXE_LIBS +=
2033 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
2034 else
2035 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2036 Xext \
2037 X11 \
2038 m \
2039 $(LIB_PTHREAD)
2040 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \
2041 $(VBOX_LIBPATH_X11)
2042 endif
2043
2044endif
2045
2046# Add COM/XPCOM stuff
2047TEMPLATE_VBOXQTGUIEXE_LIBS += \
2048 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
2049ifdef VBOX_WITH_XPCOM
2050 ## @todo may be worth creating the VBOX_XPCOM SDK def
2051 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM
2052 TEMPLATE_VBOXQTGUIEXE_INCS += \
2053 $(VBOX_XPCOM_INCS)
2054 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2055 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
2056 $(LIB_XPCOM)
2057endif
2058
2059#
2060# Template for building Qt GUI components.
2061#
2062TEMPLATE_VBOXQTGUI = VBox Qt GUI Components
2063TEMPLATE_VBOXQTGUI_EXTENDS = VBOXQTGUIEXE
2064TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN) $(PATH_BIN)/VBoxXML$(VBOX_SUFF_DLL),$(TEMPLATE_VBOXQTGUIEXE_LIBS))
2065ifeq ($(BUILD_TARGET),darwin)
2066 TEMPLATE_VBOXQTGUI_LDFLAGS = $(filter-out -framework Carbon -framework QuickTime -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS))
2067endif
2068ifeq ($(BUILD_TARGET_ARCH),amd64)
2069 ifneq ($(BUILD_TARGET),win)
2070 TEMPLATE_VBOXQTGUI_DEFS = PIC $(TEMPLATE_VBOXQTGUIEXE_DEFS)
2071 TEMPLATE_VBOXQTGUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CFLAGS)
2072 TEMPLATE_VBOXQTGUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS)
2073 TEMPLATE_VBOXQTGUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_LDFLAGS)
2074 endif
2075endif
2076
2077
2078#
2079# Template for building build bldprogs.
2080#
2081TEMPLATE_VBOXBLDPROG = VBox Build Program
2082TEMPLATE_VBOXBLDPROG_DEFS = IN_RING3
2083ifeq ($(BUILD_PLATFORM),win)
2084 ifeq ($(BUILD_PLATFORM_ARCH),x86)
2085 ifdef VBOX_USE_VCC80
2086 TEMPLATE_VBOXBLDPROG_TOOL = VCC80X86
2087 else
2088 TEMPLATE_VBOXBLDPROG_TOOL = VCC70
2089 endif
2090 TEMPLATE_VBOXBLDPROG_SDKS = WIN32SDK
2091 else
2092 TEMPLATE_VBOXBLDPROG_TOOL = VCC80AMD64
2093 TEMPLATE_VBOXBLDPROG_SDKS = WIN64SDK
2094 endif
2095 ifneq ($(TEMPLATE_VBOXBLDPROG_TOOL),VCC70)
2096 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -W3 -wd4996 -Zc:wchar_t-
2097 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -RTCsu
2098 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -Oy- -GS-
2099 else
2100 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -W3
2101 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -GZ
2102 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -Ogitb2 -Oy-
2103 endif
2104 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2105 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2106 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
2107 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
2108 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2109 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
2110 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
2111 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
2112 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
2113 /DISALLOWLIB:libcd.lib \
2114 /DISALLOWLIB:libcmtd.lib \
2115 /DISALLOWLIB:msvcrt.lib \
2116 /DISALLOWLIB:msvcrtd.lib \
2117 /DISALLOWLIB:msvcprt.lib \
2118 /DISALLOWLIB:msvcprtd.lib
2119 TEMPLATE_VBOXBLDPROG_LIBS = \
2120 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
2121 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt.lib \
2122 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt.lib
2123
2124else
2125# (gcc of some kind )
2126TEMPLATE_VBOXBLDPROG_TOOL = GXX3
2127TEMPLATE_VBOXBLDPROG_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
2128TEMPLATE_VBOXBLDPROG_CFLAGS.debug = -fno-inline
2129TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2130TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
2131TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
2132TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe
2133TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -fno-inline
2134TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2135TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2136TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2137 ifeq ($(BUILD_PLATFORM),linux)
2138TEMPLATE_VBOXBLDPROG_LIBS = pthread m rt dl
2139 else ifeq ($(BUILD_PLATFORM),os2)
2140TEMPLATE_VBOXBLDPROG_TOOL = GXX3OMF
2141TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
2142 else ifeq ($(BUILD_PLATFORM),darwin)
2143TEMPLATE_VBOXBLDPROG_TOOL = GXX4MACHO
2144TEMPLATE_VBOXBLDPROG_LIBS =
2145TEMPLATE_VBOXBLDPROG_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
2146 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_PLATFORM)),)
2147TEMPLATE_VBOXBLDPROG_TOOL = GXX3
2148TEMPLATE_VBOXBLDPROG_LIBS =
2149 else ifeq ($(BUILD_PLATFORM),solaris)
2150TEMPLATE_VBOXBLDPROG_TOOL = GXX3PLAIN
2151TEMPLATE_VBOXBLDPROG_LIBS = rt
2152 else
2153$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
2154 endif
2155
2156endif # !win
2157
2158
2159
2160#
2161# Template for building R3 win32 guest additions.
2162#
2163TEMPLATE_VBOXW32GUESTR3 = VBox Win32 Guest Program
2164TEMPLATE_VBOXW32GUESTR3_INST = $(INST_ADDITIONS)
2165TEMPLATE_VBOXW32GUESTR3_BLD_TRG = win
2166TEMPLATE_VBOXW32GUESTR3_BLD_TRG_ARCH = x86
2167TEMPLATE_VBOXW32GUESTR3_BLD_TRG_CPU = i386
2168TEMPLATE_VBOXW32GUESTR3_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 IN_RT_R3 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
2169TEMPLATE_VBOXW32GUESTR3_RCDEFS = \
2170 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
2171 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
2172 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
2173 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
2174 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
2175 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
2176TEMPLATE_VBOXW32GUESTR3_ASTOOL = YASM
2177TEMPLATE_VBOXW32GUESTR3_ASFLAGS = -f win -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
2178TEMPLATE_VBOXW32GUESTR3_DLLSUFF = .dll
2179TEMPLATE_VBOXW32GUESTR3_EXESUFF = .exe
2180TEMPLATE_VBOXW32GUESTR3_LIBSUFF = .lib
2181TEMPLATE_VBOXW32GUESTR3_ARLIBSUFF = .lib
2182TEMPLATE_VBOXW32GUESTR3_SDKS = WIN32SDK W2K3DDKX86
2183ifdef VBOX_USE_VCC80
2184 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC80X86
2185 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
2186 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -RTCsu
2187 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -O2 -Oy- -GS-
2188else
2189 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC70
2190 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -U__LINUX__ -U__OS2__ -W3
2191 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -GZ
2192 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -Ogitb2 -Oy-
2193endif
2194TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2195TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2196TEMPLATE_VBOXW32GUESTR3_CFLAGS = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS)
2197TEMPLATE_VBOXW32GUESTR3_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug)
2198TEMPLATE_VBOXW32GUESTR3_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2199TEMPLATE_VBOXW32GUESTR3_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile)
2200TEMPLATE_VBOXW32GUESTR3_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile)
2201TEMPLATE_VBOXW32GUESTR3_INCS = \
2202 $(VBOX_PATH_SDK)/include
2203TEMPLATE_VBOXW32GUESTR3_LDFLAGS = \
2204 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE \
2205 /DISALLOWLIB:libc.lib \
2206 /DISALLOWLIB:libcd.lib \
2207 /DISALLOWLIB:msvcrt.lib \
2208 /DISALLOWLIB:libcmtd.lib \
2209 /DISALLOWLIB:msvcrtd.lib
2210ifdef VBOX_USE_VCC80
2211 TEMPLATE_VBOXW32GUESTR3_LIBS = \
2212 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib \
2213 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
2214 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
2215else
2216 TEMPLATE_VBOXW32GUESTR3_LIBS = \
2217 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \
2218 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
2219 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
2220endif
2221TEMPLATE_VBOXW32GUESTR3_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2222
2223#
2224# R3 win32 guest libraries
2225#
2226TEMPLATE_VBOXW32GUESTR3LIB = VBox Win32 Guest User Libraries
2227TEMPLATE_VBOXW32GUESTR3LIB_EXTENDS = VBOXW32GUESTR3
2228TEMPLATE_VBOXW32GUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
2229
2230
2231#
2232# Template for building R0 win32 guest tools.
2233#
2234TEMPLATE_VBOXW32GUESTR0 = VBox Win32 Guest Driver
2235TEMPLATE_VBOXW32GUESTR0_INST = $(INST_ADDITIONS)
2236TEMPLATE_VBOXW32GUESTR0_BLD_TRG = win
2237TEMPLATE_VBOXW32GUESTR0_BLD_TRG_ARCH = x86
2238TEMPLATE_VBOXW32GUESTR0_BLD_TRG_CPU = i386
2239TEMPLATE_VBOXW32GUESTR0_DEFS = _X86_ IN_GUEST IN_GUEST_R0 IN_RING0 IN_RT_R0 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
2240TEMPLATE_VBOXW32GUESTR0_RCDEFS = \
2241 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
2242 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
2243 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
2244 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
2245 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
2246 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
2247TEMPLATE_VBOXW32GUESTR0_ASTOOL = YASM
2248TEMPLATE_VBOXW32GUESTR0_ASFLAGS = -f win32 -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
2249TEMPLATE_VBOXW32GUESTR0_SYSSUFF = .sys
2250ifdef VBOX_USE_VCC80
2251 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC80X86
2252 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -U__LINUX__ -W3 -wd4996 -Zc:wchar_t-
2253 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -EHs-c- -Zl
2254 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -O2 -Oy-
2255else
2256 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC70
2257 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -U__LINUX__ -W3
2258 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -GX- -Zl
2259 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -Ogitb2 -Oy-
2260endif
2261TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2262TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2263TEMPLATE_VBOXW32GUESTR0_CFLAGS = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS)
2264TEMPLATE_VBOXW32GUESTR0_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug)
2265TEMPLATE_VBOXW32GUESTR0_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2266TEMPLATE_VBOXW32GUESTR0_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile)
2267TEMPLATE_VBOXW32GUESTR0_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile)
2268TEMPLATE_VBOXW32GUESTR0_LDFLAGS = \
2269 -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Machine:X86 -Debug \
2270 /DISALLOWLIB:libcd.lib \
2271 /DISALLOWLIB:msvcrt.lib \
2272 /DISALLOWLIB:msvcrtd.lib \
2273 /DISALLOWLIB:libcmtd.lib
2274TEMPLATE_VBOXW32GUESTR0_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
2275
2276#
2277# R0 win32 guest libraries
2278#
2279TEMPLATE_VBOXW32GUESTR0LIB = VBox Win32 Guest Driver
2280TEMPLATE_VBOXW32GUESTR0LIB_EXTENDS = VBOXW32GUESTR0
2281TEMPLATE_VBOXW32GUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
2282
2283
2284#
2285# Windows rc workaround for crosscompiling.
2286# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
2287#
2288ifneq ($(BUILD_PLATFORM),win)
2289 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2290 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2291 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2292 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
2293else
2294 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
2295 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
2296 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
2297 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
2298 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
2299 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
2300 ) Sorry_Cannot_find_mc_in_the_PSDK)
2301endif
2302
2303
2304#
2305# Template for syntax checking the linux guest additions.
2306# Not properly realized yet.
2307#
2308TEMPLATE_VBOXLNX32GUESTR0 = Template for *syntax checking* linux guest additions kernel modules
2309TEMPLATE_VBOXLNX32GUESTR0_TOOL = $(VBOX_GCC_TOOL)
2310TEMPLATE_VBOXLNX32GUESTR0_BLD_TRG = linux
2311TEMPLATE_VBOXLNX32GUESTR0_DEFS = __KERNEL__ MODULE IN_GUEST IN_GUEST_R0 IN_RING0 IN_RT_R0
2312TEMPLATE_VBOXLNX32GUESTR0_INCS = $(VBOX_LINUX_INCS)
2313TEMPLATE_VBOXLNX32GUESTR0_CFLAGS = -nostdinc -iwithprefix include \
2314 -O2 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
2315 $(VBOX_GCC_fno-stack-protector) -fno-strict-aliasing -fno-common \
2316 -mpreferred-stack-boundary=2 -msoft-float
2317TEMPLATE_VBOXLNX32GUESTR0_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXLNX32GUESTR0_CFLAGS)) -fno-exceptions -fno-rtti
2318ifndef VBOX_LINUX_VERSION_2_4
2319# 2.6
2320TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .ko
2321TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -m elf_i386 -r
2322else
2323# 2.4
2324TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .o
2325TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -r -s
2326endif
2327
2328
2329#
2330# Templates for building 32-bit linux guest additions.
2331#
2332
2333TEMPLATE_VBOXLNX32GUESTR3EXE = Template for building 32-bit linux guest additions programs.
2334TEMPLATE_VBOXLNX32GUESTR3EXE_INST = $(INST_ADDITIONS)
2335TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG = linux
2336TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_ARCH = x86
2337TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_CPU = i386
2338TEMPLATE_VBOXLNX32GUESTR3EXE_TOOL = $(VBOX_GCC32_TOOL)
2339TEMPLATE_VBOXLNX32GUESTR3EXE_ASTOOL = YASM
2340TEMPLATE_VBOXLNX32GUESTR3EXE_ASFLAGS = -f elf32 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels
2341TEMPLATE_VBOXLNX32GUESTR3EXE_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 HC_ARCH_BITS=32 GC_ARCH_BITS=32
2342TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe $(VBOX_GCC_fno-stack-protector)
2343TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug = -fno-inline
2344TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2345TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2346TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2347TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.release = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2348TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug)
2349TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile)
2350TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile)
2351TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_fno-stack-protector)
2352# No LDFLAGS nor LIBS!
2353
2354TEMPLATE_VBOXLNX32GUESTR3EXENOCPP = Template for building 32-bit linux guest additions programs without any C++.
2355TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2356TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_TOOL := $(subst GXX,GCC,$(VBOX_GCC32_TOOL))
2357# No LDFLAGS nor LIBS!
2358
2359TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP = Template for building 32-bit linux guest additions shared objects without any C++.
2360TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2361TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_TOOL = $(TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_TOOL)
2362TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS)
2363TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS)
2364TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDFLAGS = -fPIC
2365
2366TEMPLATE_VBOXLNX32GUESTR3LIB = Template for building 32-bit linux guest additions libraries.
2367TEMPLATE_VBOXLNX32GUESTR3LIB_EXTENDS = VBOXLNX32GUESTR3EXE
2368TEMPLATE_VBOXLNX32GUESTR3LIB_INST = $(INST_ADDITION_LIB)
2369
2370
2371
2372
2373ifdef VBOX_WITH_OS2_ADDITIONS
2374
2375#
2376# Template for building R3 OS/2 guest additions.
2377#
2378TEMPLATE_VBOXOS2GUESTR3 = VBox OS/2 Guest Programs and DLLs
2379TEMPLATE_VBOXOS2GUESTR3_INST = $(INST_ADDITIONS)os2/
2380TEMPLATE_VBOXOS2GUESTR3_BLD_TRG = os2
2381TEMPLATE_VBOXOS2GUESTR3_BLD_TRG_ARCH = x86
2382TEMPLATE_VBOXOS2GUESTR3_BLD_TRG_CPU = blend
2383TEMPLATE_VBOXOS2GUESTR3_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 IN_RT_R3 HC_ARCH_BITS=32 GC_ARCH_BITS=32
2384TEMPLATE_VBOXOS2GUESTR3_ASTOOL = NASM
2385TEMPLATE_VBOXOS2GUESTR3_ASFLAGS = -f obj -DASM_FORMAT_OMF -D__NASM__ -w+orphan-labels -g
2386TEMPLATE_VBOXOS2GUESTR3_DLLSUFF = .dll
2387TEMPLATE_VBOXOS2GUESTR3_EXESUFF = .exe
2388TEMPLATE_VBOXOS2GUESTR3_LIBSUFF = .lib
2389TEMPLATE_VBOXOS2GUESTR3_ARLIBSUFF = .lib
2390TEMPLATE_VBOXOS2GUESTR3_TOOL = GXX3OMF
2391TEMPLATE_VBOXOS2GUESTR3_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -fno-strict-aliasing -fno-rtti -fno-exceptions
2392TEMPLATE_VBOXOS2GUESTR3_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -fno-strict-aliasing
2393ifneq ($(BUILD_TYPE),debug)
2394 TEMPLATE_VBOXOS2GUESTR3_CFLAGS += -O2 -fno-omit-frame-pointer
2395 TEMPLATE_VBOXOS2GUESTR3_CXXFLAGS += -O2 -fno-omit-frame-pointer
2396endif
2397TEMPLATE_VBOXOS2GUESTR3_INCS = \
2398 $(VBOX_PATH_SDK)/include
2399
2400#
2401# Template for building OS/2 guest R3 libraries.
2402#
2403TEMPLATE_VBOXOS2GUESTR3LIB = VBox OS/2 Guest Usermode Libraries
2404TEMPLATE_VBOXOS2GUESTR3LIB_EXTENDS = VBOXOS2GUESTR3
2405TEMPLATE_VBOXOS2GUESTR3LIB_INST = $(INST_ADDITIONS_LIB)os2/
2406
2407#
2408# Template for building OS/2 Guest R0 images.
2409#
2410TEMPLATE_VBOXOS2GUESTR0 = VBox OS/2 Guest Driver
2411TEMPLATE_VBOXOS2GUESTR0_INST = $(INST_ADDITIONS)os2/
2412TEMPLATE_VBOXOS2GUESTR0_BLD_TRG = os2
2413TEMPLATE_VBOXOS2GUESTR0_BLD_TRG_ARCH = x86
2414TEMPLATE_VBOXOS2GUESTR0_BLD_TRG_CPU = blend
2415TEMPLATE_VBOXOS2GUESTR0_DEFS = IN_RING0 IN_GUEST IN_GUEST_R0 IN_RT_R0 HC_ARCH_BITS=32 GC_ARCH_BITS=32 LOG_TO_BACKDOOR
2416TEMPLATE_VBOXOS2GUESTR0_SYSSUFF = .sys
2417TEMPLATE_VBOXOS2GUESTR0_ASTOOL = NASM
2418TEMPLATE_VBOXOS2GUESTR0_ASFLAGS = -f obj -DASM_FORMAT_OMF -D__NASM__ -w+orphan-labels -g
2419TEMPLATE_VBOXOS2GUESTR0_TOOL = GXX3OMF
2420TEMPLATE_VBOXOS2GUESTR0_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -fno-strict-aliasing -fno-rtti -fno-exceptions
2421TEMPLATE_VBOXOS2GUESTR0_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -fno-strict-aliasing
2422ifneq ($(BUILD_TYPE),debug)
2423 TEMPLATE_VBOXOS2GUESTR0_CFLAGS += -O2 -fno-omit-frame-pointer
2424 TEMPLATE_VBOXOS2GUESTR0_CXXFLAGS += -O2 -fno-omit-frame-pointer
2425endif
2426TEMPLATE_VBOXOS2GUESTR0_LIBS = $(VBOX_GCC_LIBGCC) ## @todo this isn't nice.
2427TEMPLATE_VBOXOS2GUESTR0_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
2428
2429#
2430# Template for building OS/2 Guest R0 libraries.
2431#
2432TEMPLATE_VBOXOS2GUESTR0LIB = VBox OS/2 Guest Driver Library
2433TEMPLATE_VBOXOS2GUESTR0LIB_EXTENDS = VBOXOS2GUESTR0
2434TEMPLATE_VBOXOS2GUESTR0LIB_INST = $(INST_ADDITIONS_LIB)os2/
2435
2436#
2437# OS/2 Guest Libraries.
2438#
2439VBOX_LIB_IPRT_OS2_GUEST_R0 = $(PATH_LIB)/additions/os2/RuntimeOS2GuestR0.lib
2440VBOX_LIB_IPRT_OS2_GUEST_R3 = $(PATH_LIB)/additions/os2/RuntimeOS2GuestR3.lib
2441VBOX_LIB_VBGL_OS2_R3 = $(PATH_LIB)/additions/os2/VBoxGuestR3LibOS2.lib
2442VBOX_LIB_VBGL_OS2_R0BASE = $(PATH_LIB)/additions/os2/VBoxGuestR0LibBaseOS2.lib
2443VBOX_LIB_VBGL_OS2_R0 = $(PATH_LIB)/additions/os2/VBoxGuestR0LibOS2.lib
2444
2445endif # VBOX_WITH_OS2_ADDITIONS
2446
2447
2448#
2449# Two targets to coordinate version number changes properly. Note that the
2450# only way to get a really consistent build is to run 'kmk' in the top-level
2451# directory. If you don't run it there, you get a consistent sub-tree only.
2452#
2453VBOX_VERSION_STAMP = $(PATH_OUT)/version-stamp-$(VBOX_VERSION_STRING)
2454VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
2455VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
2456
2457$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
2458 $(call MSG_GENERATE,,$@)
2459 $(QUIET)$(MKDIR) -p $(@D)
2460 $(QUIET)$(RM) -f $(filter-out $@,$(wildcard $(PATH_OUT)/version-stamp-*))
2461 $(QUIET)$(ECHO_EXT) > $@
2462
2463$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
2464 $(call MSG_GENERATE,,$@)
2465 $(QUIET)$(MKDIR) -p $(@D)
2466 $(QUIET)$(RM) -f $@ [email protected]
2467 $(QUIET)$(APPEND) [email protected] "#ifndef ___version_generated_h___"
2468 $(QUIET)$(APPEND) [email protected] "#define ___version_generated_h___"
2469 $(QUIET)$(APPEND) [email protected] ""
2470 $(QUIET)$(APPEND) [email protected] "#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)"
2471 $(QUIET)$(APPEND) [email protected] "#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)"
2472 $(QUIET)$(APPEND) [email protected] "#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)"
2473 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_STRING "$(VBOX_VERSION_STRING)"'
2474 $(QUIET)$(APPEND) [email protected] ""
2475 $(QUIET)$(APPEND) [email protected] "#endif"
2476 $(QUIET)$(MV) -f [email protected] $@
2477
2478#
2479# Used for external makefiles which cannot include Config.kmk
2480#
2481$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
2482 $(call MSG_GENERATE,,$@)
2483 $(QUIET)$(RM) -f $@ [email protected]
2484 $(QUIET)$(MKDIR) -p $(@D)
2485 $(QUIET)$(APPEND) [email protected] "VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)"
2486 $(QUIET)$(APPEND) [email protected] "VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)"
2487 $(QUIET)$(APPEND) [email protected] "VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)"
2488 $(QUIET)$(APPEND) [email protected] "VBOX_VERSION_STRING = $(VBOX_VERSION_STRING)"
2489 $(QUIET)$(MV) -f [email protected] $@
2490
2491
2492# Force building of the version header file as the first thing anywhere in
2493# the tree. This eliminates the need for manual dependencies on it.
2494Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2495Makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2496makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2497
2498
2499#
2500# Subversion tree revision.
2501#
2502# The VBOX_SVN_REV contains our best guess. Use svn info on the
2503# root of the treeto determin this it if .svn/entries is found,
2504# otherwise fall back on the Config.kmk revision.
2505#
2506SVN ?= svn$(HOSTSUFF_EXE)
2507VBOX_SVN_REV_KMK = $(PATH_OUT)/revision.kmk
2508ifndef VBOX_SVN_REV
2509 VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 4050 $ )
2510 VBOX_SVN_DEP := $(wildcard $(PATH_ROOT)/.svn/entries)
2511
2512# Rule for generating a timestamp and updating the real thing on change.
2513 ifneq ($(VBOX_SVN_DEP),)
2514$(VBOX_SVN_REV_KMK).ts: $(VBOX_SVN_DEP)
2515 else
2516$(VBOX_SVN_REV_KMK).ts: $(PATH_ROOT)/Config.kmk
2517 endif
2518 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
2519 $(QUIET)$(RM) -f $@
2520 $(QUIET)$(MKDIR) -p $(@D)
2521 ifneq ($(VBOX_SVN_DEP),)
2522# $(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\: *//")"
2523 $(QUIET)$(APPEND) $@ "export VBOX_SVN_REV=$(shell LC_ALL=C $(SVN) info $(PATH_ROOT) | $(SED) -e '/^Revision/!d' -e "s/Revision\: *//")"
2524 else
2525 $(QUIET)$(APPEND) $@ "export VBOX_SVN_REV=$(VBOX_SVN_REV_FALLBACK)"
2526 endif
2527 $(QUIET)if test ! -f $(VBOX_SVN_REV_KMK) \
2528 || test ! "`$(CAT_EXT) $@`" = "`$(CAT_EXT) $(VBOX_SVN_REV_KMK)`"; \
2529 then \
2530 $(RM_EXT) -f $(VBOX_SVN_REV_KMK); \
2531 $(CP_EXT) -f $@ $(VBOX_SVN_REV_KMK) || exit 1; \
2532 echo '* $(VBOX_SVN_REV_KMK) was updated:'; \
2533 else \
2534 echo '* $(VBOX_SVN_REV_KMK) was not changed:'; \
2535 fi
2536 $(QUIET)$(CAT_EXT) $(VBOX_SVN_REV_KMK)
2537
2538# Dependency on timestamp without any commands, so we
2539# won't be bother if nothing changed.
2540$(VBOX_SVN_REV_KMK): $(VBOX_SVN_REV_KMK).ts
2541
2542## @todo kBuild: Fix problem with using '$(VBOX_SVN_REV_KMK).ts +| $(VBOX_SVN_REV_KMK)' so the
2543# problem with missing $(VBOX_SVN_REV_KMK) and not $(VBOX_SVN_REV_KMK).ts can be addressed
2544
2545## @todo kbuild: Need $(CMP)!
2546
2547 include $(VBOX_SVN_REV_KMK)
2548else
2549# allow to overwrite VBOX_SVN_REV externally (mainly for building .debs/.rpms)
2550$(VBOX_SVN_REV_KMK):
2551 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
2552 $(QUIET)$(RM) -f $@
2553 $(QUIET)$(MKDIR) -p $(@D)
2554 $(QUIET)$(APPEND) $@ "export VBOX_SVN_REV=$(VBOX_SVN_REV)"
2555 $(QUIET)echo '* $(VBOX_SVN_REV_KMK) was externally overwritten:'
2556 $(QUIET)$(CAT_EXT) $(VBOX_SVN_REV_KMK)
2557endif
2558
2559
2560#
2561# Legacy.
2562#
2563ifneq ($(LOCALCFG),)
2564 include $(LOCALCFG)
2565endif
2566
2567
2568#
2569# Some extra goals.
2570#
2571.PHONY: up update st stat status
2572up update::
2573 $(SVN) up
2574
2575st stat status:
2576 $(SVN) status
2577
2578quick:
2579 $(MAKE) VBOX_QUICK=1
2580
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