VirtualBox

source: vbox/trunk/Config.kmk@ 3810

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

Use the GCC* tool variant instead of cooking our own linker tool for the guest additions.

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