VirtualBox

source: vbox/trunk/Config.kmk@ 6031

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

Added VBOX_PATH_ADDITIONS and VBOX_PATH_ADDITIONS_LIB. Added a set of VBOX_LIB_* for the generic addition build setup. Made VBOXGUESTR3EXE static.

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