VirtualBox

source: vbox/trunk/Config.kmk@ 8759

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

BUILD_TYPE -> KBUILD_TYPE.

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