VirtualBox

source: vbox/trunk/Config.kmk@ 9136

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

Solaris 10 gcc doesn't understand this.

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