VirtualBox

source: vbox/trunk/Config.kmk@ 3888

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

Solaris.

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