VirtualBox

source: vbox/trunk/Config.kmk@ 12466

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

Build system: introduce separate variables for packing additions and documentation.

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