VirtualBox

source: vbox/trunk/Config.kmk@ 10053

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

Added explicit dependency on the VirtualBox*.h in the SDK to the VBOXQTGUIEXE template.

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