VirtualBox

source: vbox/trunk/Config.kmk@ 9365

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

temporarily remove openssl 0.9.8h again

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