VirtualBox

source: vbox/trunk/Config.kmk@ 7363

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

Moved VBOX_X11_SEAMLESS_GUEST to Config.kmk so it can be overridden.

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