VirtualBox

source: vbox/trunk/Config.kmk@ 12502

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

VBOX_BRAND_LICENSE_TXT and VBOX_BRAND_LICENSE_VER

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