VirtualBox

source: vbox/trunk/Config.kmk@ 9120

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

fixed Solaris version detection

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