VirtualBox

source: vbox/trunk/Config.kmk@ 6361

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

Fixed OS/2 build.

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