VirtualBox

source: vbox/trunk/Config.kmk@ 7944

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

Made the rpath $ORIGIN feature available to everyone (was solaris specific) so developers can drop that annoying LD_LIBRARY_PATH stuff. (Make sure your ld.so groks $ORIGIN and add VBOX_WITH_ORIGIN=1 to LocalConfig.kmk.) Hope solaris still works...

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