VirtualBox

source: vbox/trunk/Config.kmk@ 5703

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

Solaris setuid wrapper, in progress.

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