VirtualBox

source: vbox/trunk/Config.kmk@ 6667

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

Added VBOXGUESTR3XORGMOD and VBOXGUESTR3XF86MOD for the X11 drivers. Made VBOXGUESTR* cross build linux when BUILD_TARGET is l4 (untested).

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