VirtualBox

source: vbox/trunk/Config.kmk@ 11614

Last change on this file since 11614 was 11612, checked in by vboxsync, 16 years ago

major rework of sdk dirs layout

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