VirtualBox

source: vbox/trunk/Config.kmk@ 3837

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

preparations for shipping the Linux installer with OSE

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