VirtualBox

source: vbox/trunk/Config.kmk@ 9902

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

Config.kmk: enable the host/guest registry and information service

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