VirtualBox

source: vbox/trunk/Config.kmk@ 7558

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

Runtime/Logger: added "LOG_TO_BACKDOOR_FULL" for guest R3 executables to control what is (debug) logged to the backdoor logger using the usual VBOX_LOG environment variable

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