VirtualBox

source: vbox/trunk/Config.kmk@ 9380

Last change on this file since 9380 was 9378, checked in by vboxsync, 17 years ago

fixed openssl 0.9.8h include path

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