VirtualBox

source: vbox/trunk/Config.kmk@ 9173

Last change on this file since 9173 was 9169, checked in by vboxsync, 17 years ago

that should do the trick for solaris guests drivers.

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