VirtualBox

source: vbox/trunk/Config.kmk@ 9744

Last change on this file since 9744 was 9696, checked in by vboxsync, 17 years ago

INST_VBOXNETFLT and INST_VBOXNETTAP (darwin).

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