VirtualBox

source: vbox/trunk/Config.kmk@ 5927

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

More cygwin avoidance hacking. Some todos as well.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 107.4 KB
Line 
1# $Id: Config.kmk 5902 2007-12-02 09:50:36Z 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),1267),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 headless frontend
192VBOX_WITH_HEADLESS = 1
193## the Direct Framebuffer GUI
194#VBOX_WITH_VBOXFB = 1
195# Enable the debugger.
196ifneq ($(BUILD_TYPE),release)
197 VBOX_WITH_DEBUGGER = 1
198 # Enable the debugger GUI.
199 VBOX_WITH_DEBUGGER_GUI = 1
200endif
201# the documentation
202VBOX_WITH_DOCS = 1
203# build the Host Guest Communication Manager component
204VBOX_WITH_HGCM = 1
205# Enable the USB feature.
206VBOX_WITH_USB = 1
207# Enable the USB 2.0 controller
208VBOX_WITH_EHCI = 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_HEADLESS=
273 VBOX_WITH_VBOXSDL=
274 VBOX_WITH_QTGUI=
275 VBOX_WITH_MAIN=
276 VBOX_WITH_DOCS=
277 VBOX_WITH_ISCSI=
278 VBOX_WITH_INTERNAL_NETWORKING=
279endif
280
281# Darwin have to skip a few things at present.
282ifeq ($(BUILD_TARGET),darwin)
283 # Internal networking requires testing and possibly proper ring-3/ring0 separation.
284 VBOX_WITH_INTERNAL_NETWORKING=
285 # Don't bother with SDL ttf for now.
286 VBOX_WITH_SECURELABEL=
287 # Later:
288 VBOX_WITH_VRDP_AUTHMOD=
289 VBOX_WITH_VRDP_RDESKTOP=
290endif
291
292# Most stuff doesn't build yet on the new targets.
293ifeq ($(BUILD_TARGET),os2)
294 VBOX_WITH_INSTALLER=
295 VBOX_WITH_SECURELABEL=
296 VBOX_WITH_VRDP_AUTHMOD=
297 VBOX_WITH_VRDP_RDESKTOP=
298 VBOX_WITH_TESTSUITE=
299 VBOX_WITH_USB=
300 VBOX_WITH_EHCI=
301 VBOX_WITH_DOCS=
302endif
303
304ifeq ($(BUILD_TARGET),solaris)
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
937# These tests never worked on Windows because of /dev/null, so, there
938# can be no harm in just dropping them until cygwin is mp safe.
939ifeq ($(BUILD_PLATFORM),win)
940VBOX_GCC_CHECK_CC = $(2)
941VBOX_GCC_CHECK_CXX = $(2)
942VBOX_GCC32_CHECK_CXX = $(2)
943else
944VBOX_GCC_CHECK_CC = $(shell \
945 if $(TOOL_$(VBOX_GCC_TOOL)_CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
946 then echo "$(1)"; \
947 else echo "$(2)"; fi; )
948
949VBOX_GCC_CHECK_CXX = $(shell \
950 if $(TOOL_$(VBOX_GCC_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
951 then echo "$(1)"; \
952 else echo "$(2)"; fi; )
953
954VBOX_GCC32_CHECK_CXX = $(shell \
955 if $(TOOL_$(VBOX_GCC32_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
956 then echo "$(1)"; \
957 else echo "$(2)"; fi; )
958endif
959
960ifeq ($(BUILD_PLATFORM),win)
961# This isn't important (yet) on windows, so cook the result until
962# cygwin is feeling better.
963VBOX_GCC_VERSION := $(int-add $(int-mul 10000, 3), $(int-mul 100, 3), 3)
964else
965# This is kind of bad, the returned string needs to be re-evaluated before use.
966# The reason for this hack is that the windows kmk_ash cannot deal with $((1+1)).
967VBOX_GCC_VERSION = $(shell \
968 $(1) -dumpversion | $(SED_EXT) 's|\([0-9]\)\.\([0-9]\)\.\([0-9]\)|$$(int-add $$(int-mul 10000, \1), $$(int-mul 100, \2), \3)|' )
969endif
970
971# No $(QUIET) here as it's interesting to see what goes into the file.
972$(PATH_OUT)/GCCConfig.kmk: $(PATH_ROOT)/Config.kmk $(LOCALCFG) $(AUTOCFG)
973 $(call MSG_GENERATE,,$@,)
974 $(QUIET)$(RM) -f '$@'
975 $(QUIET)$(MKDIR) -p $(@D)
976
977# HC compiler switch detection.
978 $(APPEND) '$@' 'VBOX_GCC_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CC))'
979 $(APPEND) '$@' 'VBOX_GCC_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC_TOOL)_CXX))'
980 $(APPEND) '$@' 'VBOX_GCC_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)'
981 $(APPEND) '$@' 'VBOX_GCC_Wno-pointer-sign ?= $(call VBOX_GCC_CHECK_CC,-Wno-pointer-sign,)'
982 $(APPEND) '$@' 'VBOX_GCC_Wno-variadic-macros ?= $(call VBOX_GCC_CHECK_CXX,-Wno-variadic-macros,)'
983 $(APPEND) '$@' 'VBOX_GCC_Wno-invalid-offsetof ?= $(call VBOX_GCC_CHECK_CXX,-Wno-invalid-offsetof,)'
984 $(APPEND) '$@' 'VBOX_GCC_Wno-extra ?= $(call VBOX_GCC_CHECK_CXX,-Wno-extra)'
985 $(APPEND) '$@' 'VBOX_GCC_fno-stack-protector ?= $(call VBOX_GCC_CHECK_CC,-fno-stack-protector,)'
986# Produce code optimized for the most common IA32/AMD64/EM64T processors. Introduced with gcc version 4.2.
987 $(APPEND) '$@' 'VBOX_GCC_mtune-generic ?= $(call VBOX_GCC_CHECK_CC,-mtune=generic,)'
988ifneq ($(BUILD_TARGET),l4)
989# Set default attribute for ELF and MACH-O symbols to ``hidden'' to reduce the number
990# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
991 $(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CC),)'
992 $(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CC),40000),)'
993 $(APPEND) '$@' ' VBOX_GCC_fvisibility-hidden ?= $(call VBOX_GCC_CHECK_CC,-fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN,)'
994 $(APPEND) '$@' ' endif'
995 $(APPEND) '$@' 'endif'
996endif
997ifneq ($(BUILD_TARGET),l4)
998# Set default attribute for inline functions to ``hidden'' to reduce the number
999# of relocation entries and PLT indirections in shared libraries. Don't allow for gcc version < 4.
1000 $(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CXX),)'
1001 $(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CXX),40000),)'
1002 $(APPEND) '$@' ' VBOX_GCC_fvisibility-inlines-hidden ?= $(call VBOX_GCC_CHECK_CXX,-fvisibility-inlines-hidden,)'
1003 $(APPEND) '$@' ' endif'
1004 $(APPEND) '$@' 'endif'
1005endif
1006# Find the compiler includes for IPRT no-crt.
1007# Note that `$(dir $(gcc -print-libgcc-file-name))/include does not work for a 64-bit cross build on a 32-bit build host.
1008ifeq ($(BUILD_PLATFORM),win)
1009# With the cygwin issues and gcc on windows returning a useless path, just skip this on windows.
1010 $(APPEND) '$@' 'VBOX_PATH_GCC_INCS ?= '
1011else
1012 $(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'
1013endif
1014# 32-bit (GC) compiler switch detection.
1015 $(APPEND) '$@' 'VBOX_GCC32_VERSION_CC ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CC))'
1016 $(APPEND) '$@' 'VBOX_GCC32_VERSION_CXX ?= $(call VBOX_GCC_VERSION,$(TOOL_$(VBOX_GCC32_TOOL)_CXX))'
1017 $(APPEND) '$@' 'VBOX_GCC32_LIBGCC ?= $(shell $(TOOL_$(VBOX_GCC32_TOOL)_CC) -print-libgcc-file-name)'
1018 $(APPEND) '$@' 'VBOX_GCC32_Wno-variadic-macros ?= $(call VBOX_GCC32_CHECK_CXX,-Wno-variadic-macros,)'
1019
1020include $(PATH_OUT)/GCCConfig.kmk
1021
1022
1023#
1024# Coding Signing.
1025#
1026ifdef VBOX_SIGNING_MODE
1027 ifeq ($(BUILD_PLATFORM),win)
1028 # VBOX_PATH_SELFSIGN points to the Vista WDK bin/SelfSign directory.
1029 ifndef VBOX_PATH_SELFSIGN
1030 VBOX_PATH_SELFSIGN := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS)/win.x86/selfsign/*)))
1031 ifeq ($(VBOX_PATH_SELFSIGN),)
1032 VBOX_PATH_SELFSIGN := $(PATH_DEVTOOLS)/win.x86/selfsign/r1
1033 endif
1034 endif
1035 VBOX_SIGNTOOL ?= $(VBOX_PATH_SELFSIGN)/SignTool.exe
1036 VBOX_INF2CAT ?= $(VBOX_PATH_SELFSIGN)/Inf2Cat.exe
1037
1038 # There are three signing modes; 'self', 'development' and 'release'.
1039 ifeq ($(strip $(VBOX_SIGNING_MODE)),self)
1040 ## @todo Figure out selfsigning and put up some docs in the wiki.
1041 else if1of ($(VBOX_SIGNING_MODE),release development)
1042 VBOX_CROSS_CERTIFICATE_FILE ?= $(VBOX_PATH_SELFSIGN)/MSCV-GlobalSign.cer
1043 VBOX_CROSS_CERTIFICATE_FILE_ARGS ?= /ac "$(VBOX_CROSS_CERTIFICATE_FILE)"
1044 VBOX_CERTIFICATE_SUBJECT_NAME ?= InnoTek Systemberatung GmbH
1045 VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
1046 VBOX_CERTIFICATE_STORE ?= my
1047 VBOX_CERTIFICATE_STORE_ARGS ?= /s "$(VBOX_CERTIFICATE_STORE)"
1048 VBOX_TSA_URL ?= http://timestamp.verisign.com/scripts/timestamp.dll
1049 VBOX_TSA_URL_ARGS ?= /t "$(VBOX_TSA_URL)"
1050 ## Commands for signing a driver image after link.
1051 VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_FILE_FN,$(out)))
1052 ## Sign a file.
1053 # @param 1 The file to sign.
1054 VBOX_SIGN_FILE_FN ?= $(VBOX_SIGNTOOL) sign \
1055 $(VBOX_CROSS_CERTIFICATE_FILE_ARGS) \
1056 $(VBOX_CERTIFICATE_STORE_ARGS) \
1057 $(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
1058 $(VBOX_TSA_URL_ARGS) \
1059 $(1)
1060 ## Create a security catalog file.
1061 # @param 1 The directory containing the stuff to sign.
1062 # @param 2 The expected .cat name. (Inf2Cat lowercases it)
1063 # @param 3 The list of OSes, separated by ';'.
1064 VBOX_MAKE_CAT_HLP_FN ?= \
1065 $(RM) -f $(2)\
1066 $(NL)$(TAB)$(VBOX_INF2CAT) /driver:$(strip $(1)) /os:$(strip $(subst ;,$(COMMA),$(3))) /verbose \
1067 $(NL)$(TAB)$(MV) $(2) $(2) \
1068 $(NL)$(TAB)$(call VBOX_SIGN_FILE_FN,$(2))
1069 VBOX_MAKE_CAT64_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),XP_X64;Server2003_X64;Vista_X64)
1070 VBOX_MAKE_CAT32_FN ?= $(call VBOX_MAKE_CAT_HLP_FN,$(1),$(2),2000;XP_X86;Server2003_X86;Vista_X86)
1071 ifeq ($(BUILD_TARGET_ARCH),x86)
1072 VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT32_FN,$(1),$(2))
1073 else
1074 VBOX_MAKE_CAT_FN ?= $(call VBOX_MAKE_CAT64_FN,$(1),$(2))
1075 endif
1076
1077 # Go nuts, sign everything.
1078 ifeq ($(strip $(VBOX_SIGNING_MODE)),release)
1079 ## Commands for signing an executable or a dll image after link.
1080 VBOX_SIGN_IMAGE_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_FILE_FN,$(out)))
1081 ## Enable signing of the additions.
1082 VBOX_SIGN_ADDITIONS ?= 1
1083 endif
1084
1085 else
1086 $(error Unknown VBOX_SIGNING_MODE: $(VBOX_SIGNING_MODE))
1087 endif
1088 else
1089 VBOX_SIGNING_MODE :=
1090 endif
1091endif
1092
1093#
1094# Windows .inf editing.
1095#
1096ifeq ($(BUILD_TARGET_ARCH),x86)
1097 VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF32_FN,$(1),$(2))
1098else
1099 VBOX_EDIT_INF_FN = $(call VBOX_EDIT_INF64_FN,$(1),$(2))
1100endif
1101## Edit an inf file an x86 target.
1102# @param 1 The inf file to edit.
1103# @param 2 The output file.
1104ifdef KMK_NEW_SED
1105VBOX_EDIT_INF32_FN = $(SED) $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d') -e 's/^;x86 *//' -e '/^;amd64 /d' --output $(2) $(1)
1106else
1107VBOX_EDIT_INF32_FN = $(SED) $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d') -e 's/^;x86 *//' -e '/^;amd64 /d' $(1) > $(2)
1108endif
1109## Edit an inf file an x86 target.
1110# @param 1 The inf file to edit.
1111# @param 2 The output file.
1112ifdef KMK_NEW_SED
1113VBOX_EDIT_INF64_FN = $(SED) $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d') -e 's/^;amd64 *//' -e '/^;x86 /d' --output $(2) $(1)
1114else
1115VBOX_EDIT_INF64_FN = $(SED) $(if $(VBOX_SIGNING_MODE),-e 's/^;cat *//', -e '/^;cat /d') -e 's/^;amd64 *//' -e '/^;x86 /d' $(1) > $(2)
1116endif
1117
1118#
1119# Default prefixes and suffixes.
1120#
1121VBOX_PREF_LIB =
1122ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
1123VBOX_SUFF_LIB = .lib
1124else
1125VBOX_SUFF_LIB = .a
1126endif
1127VBOX_SUFF_DLL = $(SUFF_DLL)
1128ifeq ($(BUILD_TARGET),os2) # GXX3OMF produces out .o at the moment.
1129VBOX_SUFF_OBJ = .o
1130else
1131VBOX_SUFF_OBJ = $(SUFF_OBJ)
1132endif
1133VBOXW32GUEST_SUFF_LIB = .lib
1134VBOXLNX32GUEST_SUFF_LIB = .a
1135
1136#
1137# SDKs for external libraries.
1138#
1139SDK_VBOX_XERCES = .
1140SDK_VBOX_XERCES_INCS ?= $(PATH_ROOT)/src/libs/xerces-2.6.0/src
1141SDK_VBOX_XERCES_LIBS ?= $(PATH_LIB)/VBox-xerces$(VBOX_SUFF_LIB)
1142
1143SDK_VBOX_XALAN = .
1144SDK_VBOX_XALAN_INCS ?= $(PATH_ROOT)/src/libs/xalan-1.10.0
1145SDK_VBOX_XALAN_LIBS ?= $(PATH_LIB)/VBox-xalan$(VBOX_SUFF_LIB)
1146
1147SDK_VBOX_LIBPNG = .
1148SDK_VBOX_LIBPNG_INCS ?= $(PATH_ROOT)/src/libs/libpng-1.2.8
1149SDK_VBOX_LIBPNG_LIBS ?= $(PATH_LIB)/VBox-libpng$(VBOX_SUFF_LIB)
1150
1151SDK_VBOX_ZLIB = .
1152ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
1153 SDK_VBOX_ZLIB_INCS ?= $(PATH_ROOT)/src/libs/zlib-1.2.1
1154 SDK_VBOX_ZLIB_LIBS ?= $(PATH_LIB)/VBox-zlib$(VBOX_SUFF_LIB)
1155else
1156 SDK_VBOX_ZLIB_INCS ?=
1157 SDK_VBOX_ZLIB_LIBS ?= z
1158endif
1159
1160SDK_VBOX_OPENSSL = .
1161SDK_VBOX_OPENSSL_INCS?= $(PATH_ROOT)/src/libs/openssl-0.9.7e/include
1162SDK_VBOX_OPENSSL_LIBS?= $(PATH_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB)
1163
1164SDK_VBOX_FFMPEG = .
1165ifeq ($(filter-out win os2 darwin,$(BUILD_TARGET)),)
1166 SDK_VBOX_FFMPEG_INCS ?= \
1167 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavutil \
1168 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavcodec \
1169 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavformat
1170 ifeq ($(BUILD_TARGET),win)
1171 ## @todo Michael! Where is $(PATH_LIB)/VBoxFFmpegImp$(VBOX_SUFF_LIB) supposed to come from?
1172 #SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpeg.a
1173 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpegImp.lib
1174 else
1175 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_BIN)/VBoxFFmpeg$(SUFF_DLL)
1176 endif
1177else
1178 SDK_VBOX_FFMPEG_INCS ?= /usr/include/ffmpeg /usr/include/libpng
1179 SDK_VBOX_FFMPEG_LIBS ?= avutil avcodec avformat
1180endif
1181
1182#
1183# Special SDK for the problematic NTDLL.LIB.
1184#
1185SDK_VBOX_NTDLL = Requires W2K3DDK
1186SDK_VBOX_NTDLL_LIBS ?= $(PATH_SDK_W2K3DDK_LIB)/ntdll.lib
1187
1188
1189#
1190# Qt build tools and libraries.
1191# For *NIX we require it to be present on the system.
1192#
1193## @todo convert this into SDK and integrate the Qt stuff into kBuild.
1194ifeq ($(BUILD_TARGET),win)
1195 ifeq ($(BUILD_TARGET_ARCH),x86)
1196 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.3
1197 LIB_QT ?= $(VBOX_PATH_QT)/lib/dynamic/qt-mt333.lib
1198 LIB_QTMAIN ?= $(VBOX_PATH_QT)/lib/dynamic/qtmain.lib
1199 else
1200 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.8
1201 LIB_QT ?= $(VBOX_PATH_QT)/lib/qt-mt338.lib
1202 LIB_QTMAIN ?= $(VBOX_PATH_QT)/lib/qtmain.lib
1203 endif
1204 ifndef QTDIR
1205 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
1206 QTDIR := $(call lastword,$(QTDIR))
1207 endif
1208else ifeq ($(BUILD_TARGET),os2)
1209 QTDIR ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.1
1210 VBOX_PATH_QT ?= $(QTDIR)
1211 LIB_QT ?= $(lastword $(sort $(wildcard $(VBOX_PATH_QT)/lib/*qt*.lib)))
1212 QTDIR := $(VBOX_PATH_QT)
1213else ifeq ($(BUILD_TARGET),darwin)
1214 ifndef VBOX_PATH_QT
1215 VBOX_PATH_QT := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v3.*)))
1216 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.8-r1
1217 endif
1218 VBOX_MUST_INSTALL_LIB_QT ?= 1
1219 LIB_QT ?= $(VBOX_PATH_QT)/lib/libqt-mt.3.dylib
1220 LIB_QTMAIN ?= $(NO_SUCH_VARIABLE)
1221 ifndef QTDIR
1222 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
1223 QTDIR := $(call lastword,$(QTDIR))
1224 endif
1225else
1226 ifndef QTDIR
1227 ifndef VBOX_PATH_QT
1228 # If QTDIR and VBOX_WITH_QTGUI aren't defined, we'll first
1229 # look in the tools tree and then on the system. If in the
1230 # tools, we'll have to install it.
1231 # Results are exported to avoid having to do this for every make file.
1232 VBOX_PATH_QT := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v3.*)))
1233 ifneq ($(VBOX_PATH_QT),)
1234 export VBOX_PATH_QT
1235 export VBOX_MUST_INSTALL_LIB_QT := 1
1236 export LIB_QT := $(VBOX_PATH_QT)/lib/libqt-mt.so.3
1237 export LD_LIBRARY_PATH := $(VBOX_PATH_QT)/lib:$(LD_LIBRARY_PATH)
1238 else
1239 QTDIR := $(wildcard /usr/share/qt3)
1240 ifeq ($(QTDIR),)
1241 QTDIR := $(patsubst %/bin/moc,%,$(firstword $(wildcard /usr/bin/moc /usr/local/bin/moc /usr/X11R6/bin/moc)))
1242 endif
1243 ifneq ($(QTDIR),)
1244 export QTDIR
1245 endif
1246 endif
1247 else
1248 QTDIR := $(VBOX_PATH_QT)
1249 export QTDIR
1250 endif
1251 endif
1252endif
1253ifndef VBOX_PATH_QT
1254 VBOX_PATH_QT ?= $(QTDIR)
1255 LIB_QT ?= qt-mt
1256endif
1257ifeq ($(BUILD_PLATFORM),$(BUILD_TARGET))
1258 VBOX_PATH_QT_HOST ?= $(VBOX_PATH_QT)
1259else
1260 VBOX_PATH_QT_HOST ?= $(QTDIR)
1261endif
1262VBOX_UIC ?= $(VBOX_PATH_QT_HOST)/bin/uic$(HOSTSUFF_EXE)
1263VBOX_MOC ?= $(VBOX_PATH_QT_HOST)/bin/moc$(HOSTSUFF_EXE)
1264VBOX_LUPDATE ?= $(VBOX_PATH_QT_HOST)/bin/lupdate$(HOSTSUFF_EXE)
1265VBOX_LRELEASE ?= $(VBOX_PATH_QT_HOST)/bin/lrelease$(HOSTSUFF_EXE)
1266
1267ifeq ($(BUILD_TARGET),os2)
1268 # search DLLs in the EXE directory first
1269 VBOX_UIC := BEGINLIBPATH="$(dir $(VBOX_UIC));$$BEGINLIBPATH" $(VBOX_UIC)
1270 VBOX_MOC := BEGINLIBPATH="$(dir $(VBOX_MOC));$$BEGINLIBPATH" $(VBOX_MOC)
1271 VBOX_LUPDATE := BEGINLIBPATH="$(dir $(VBOX_LUPDATE));$$BEGINLIBPATH" $(VBOX_LUPDATE)
1272 VBOX_LRELEASE := BEGINLIBPATH="$(dir $(VBOX_LRELEASE));$$BEGINLIBPATH" $(VBOX_LRELEASE)
1273endif
1274
1275#
1276# The linux kernel headers(/sources).
1277#
1278ifneq ($(filter linux,$(BUILD_TARGET)),)
1279 ifeq ($(origin VBOX_LINUX_SRC),undefined)
1280 ifneq ($(wildcard /lib/modules/$(shell uname -r)/build/include/linux/autoconf.h),)
1281 export VBOX_LINUX_SRC := /lib/modules/$(shell uname -r)/build
1282 else
1283 export VBOX_LINUX_SRC := /usr/src/linux
1284 endif
1285 endif
1286 ifeq ($(origin VBOX_LINUX_INCS),undefined)
1287 export VBOX_LINUX_INCS := $(VBOX_LINUX_SRC)/include
1288 # support splitted Linux kernels (make O=<build directory>)
1289 kernelsrc := $(shell $(SED_EXT) -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(VBOX_LINUX_SRC)/Makefile)
1290 ifneq ($(kernelsrc),)
1291 kernelpath := $(realpath $(VBOX_LINUX_SRC)/$(kernelsrc))
1292 VBOX_LINUX_INCS += $(VBOX_LINUX_SRC)/include2 $(kernelpath)/include
1293 else
1294 kernelpath := $(VBOX_LINUX_SRC)
1295 endif
1296 ifeq ($(BUILD_TARGET_ARCH),x86)
1297 VBOX_LINUX_INCS += $(kernelpath)/include/asm-i386/mach-default \
1298 $(kernelpath)/include/asm-x86/mach-default
1299 endif
1300 endif
1301endif
1302
1303
1304#
1305# Template for building GC things.
1306#
1307TEMPLATE_VBOXGC = VBox GC
1308TEMPLATE_VBOXGC_ASTOOL = $(VBOX_ASTOOL)
1309TEMPLATE_VBOXGC_ASFLAGS = $(VBOX_ASFLAGS32)
1310TEMPLATE_VBOXGC_DEFS = IN_GC $(ARCH_BITS_DEFS)
1311TEMPLATE_VBOXGC_SYSSUFF = .gc
1312TEMPLATE_VBOXGC_BLD_TRG_ARCH = x86
1313
1314ifeq ($(VBOX_LDR_FMT32),pe)
1315ifdef VBOX_USE_VCC80
1316 TEMPLATE_VBOXGC_TOOL = VCC80X86
1317 TEMPLATE_VBOXGC_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -W3 -wd4244 -wd4996 -Zc:wchar_t- -Gs8192 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP)
1318else
1319 TEMPLATE_VBOXGC_TOOL = VCC70
1320 TEMPLATE_VBOXGC_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP)
1321endif
1322TEMPLATE_VBOXGC_CFLAGS = $(TEMPLATE_VBOXGC_CXXFLAGS)
1323TEMPLATE_VBOXGC_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Lines -MapInfo:Exports -NoD
1324ifdef VBOX_USE_VCC80
1325 include $(PATH_KBUILD)/sdks/W2K3DDKX86.kmk
1326 TEMPLATE_VBOXGC_LIBS = \
1327 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1328else
1329 TEMPLATE_VBOXGC_LIBS = \
1330 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1331endif
1332endif
1333
1334ifeq ($(VBOX_LDR_FMT32),elf)
1335TEMPLATE_VBOXGC_TOOL = $(VBOX_GCC32_TOOL)
1336TEMPLATE_VBOXGC_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -fno-exceptions -fno-rtti $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
1337TEMPLATE_VBOXGC_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden)
1338ifeq ($(BUILD_TARGET),solaris)
1339 TEMPLATE_VBOXGC_LDFLAGS = -r
1340else
1341 TEMPLATE_VBOXGC_LDFLAGS = -nostdlib -Bsymbolic
1342 # temporarily, must fix the loader.
1343 TEMPLATE_VBOXGC_LDFLAGS += $(if $(VBOX_DO_STRIP_MODULES),-S,)
1344 TEMPLATE_VBOXGC_LDFLAGS.release = $(if $(VBOX_DO_STRIP_MODULES),-S,)
1345endif
1346ifneq ($(filter-out solaris freebsd,$(BUILD_TARGET)),)
1347TEMPLATE_VBOXGC_LIBS = \
1348 $(VBOX_GCC32_LIBGCC) # instricts
1349endif
1350endif
1351
1352ifeq ($(VBOX_LDR_FMT32),macho)
1353TEMPLATE_VBOXGC_TOOL = GXX4MACHO
1354TEMPLATE_VBOXGC_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -fno-common -msoft-float -static -fno-exceptions -fno-rtti $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing
1355TEMPLATE_VBOXGC_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -fno-common -msoft-float -static -Wno-trigraphs -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing
1356TEMPLATE_VBOXGC_LDFLAGS = -nostdlib
1357#TEMPLATE_VBOXGC_LDFLAGS.release = -Wl,-S ???
1358endif
1359
1360ifeq ($(VBOX_LDR_FMT32),lx)
1361TEMPLATE_VBOXGC_TOOL = GXX3OMF
1362TEMPLATE_VBOXGC_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -fno-exceptions -fno-rtti $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing
1363TEMPLATE_VBOXGC_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC32_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -fno-strict-aliasing
1364TEMPLATE_VBOXGC_LDFLAGS = -Zdll -nostdlib
1365TEMPLATE_VBOXGC_LIBS = \
1366 $(VBOX_GCC32_LIBGCC) \
1367 $(OBJ_SYS0) \
1368 end
1369endif
1370
1371
1372#
1373# Template for building a GC ring-3 testcase (tstVMStructGC, tstDevStructGC).
1374#
1375TEMPLATE_VBOXGCEXE = VBox GC as ring-3 testcase
1376TEMPLATE_VBOXGCEXE_EXTENDS = VBOXGC
1377
1378ifeq ($(VBOX_LDR_FMT32),pe)
1379 TEMPLATE_VBOXGCEXE_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD -Debug
1380 TEMPLATE_VBOXGCEXE_SDKS = WIN32SDK
1381 ifdef VBOX_USE_VCC80
1382 TEMPLATE_VBOXGCEXE_LIBS = \
1383 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
1384 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib
1385 else
1386 TEMPLATE_VBOXGCEXE_LIBS = \
1387 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
1388 $(PATH_TOOL_VCC70_LIB)/oldnames.lib
1389 endif
1390endif
1391
1392ifeq ($(VBOX_LDR_FMT32),elf)
1393 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1394 TEMPLATE_VBOXGCEXE_LDFLAGS.release = -g
1395endif
1396
1397ifeq ($(VBOX_LDR_FMT32),macho)
1398 TEMPLATE_VBOXGCEXE_CFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CFLAGS))
1399 TEMPLATE_VBOXGCEXE_CXXFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CXXFLAGS))
1400 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1401endif
1402
1403ifeq ($(VBOX_LDR_FMT32),lx)
1404 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1405 TEMPLATE_VBOXGCEXE_LIBS = $(NO_SUCH_VARIABLE)
1406endif
1407
1408
1409#
1410# Template for building R0 things.
1411#
1412TEMPLATE_VBOXR0 = VBox Ring 0
1413TEMPLATE_VBOXR0_ASTOOL = $(VBOX_ASTOOL)
1414TEMPLATE_VBOXR0_ASFLAGS = $(VBOX_ASFLAGS)
1415TEMPLATE_VBOXR0_DEFS = IN_RING0 $(ARCH_BITS_DEFS)
1416
1417ifeq ($(VBOX_LDR_FMT),pe)
1418TEMPLATE_VBOXR0_TOOL = $(VBOX_VCC_TOOL)
1419ifdef VBOX_USE_VCC80
1420 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -W3 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1421else
1422 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1423endif
1424TEMPLATE_VBOXR0_CFLAGS = $(TEMPLATE_VBOXR0_CXXFLAGS)
1425TEMPLATE_VBOXR0_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD
1426ifdef VBOX_USE_VCC80
1427 TEMPLATE_VBOXR0_LIBS.x86 = \
1428 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1429else
1430 TEMPLATE_VBOXR0_LIBS.x86 = \
1431 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1432endif
1433endif # pe
1434
1435ifeq ($(VBOX_LDR_FMT),elf)
1436TEMPLATE_VBOXR0_TOOL = $(VBOX_GCC_TOOL)
1437TEMPLATE_VBOXR0_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden)
1438TEMPLATE_VBOXR0_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -fno-rtti -fno-exceptions $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
1439TEMPLATE_VBOXR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding
1440TEMPLATE_VBOXR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables
1441ifeq ($(BUILD_TARGET),solaris)
1442 TEMPLATE_VBOXR0_LDFLAGS = -r
1443else
1444 TEMPLATE_VBOXR0_LDFLAGS = -nostdlib -Bsymbolic
1445 # temporarily, must fix the loader.
1446 TEMPLATE_VBOXR0_LDFLAGS += $(if $(VBOX_DO_STRIP_MODULES),-S,)
1447 TEMPLATE_VBOXR0_LDFLAGS.release = $(if $(VBOX_DO_STRIP_MODULES),-S,)
1448endif
1449
1450ifneq ($(filter-out solaris freebsd,$(BUILD_TARGET)),)
1451 TEMPLATE_VBOXR0_LIBS = \
1452 $(VBOX_GCC_LIBGCC) # instricts
1453endif
1454endif
1455
1456ifeq ($(VBOX_LDR_FMT),macho)
1457TEMPLATE_VBOXR0_TOOL = GXX4MACHO
1458TEMPLATE_VBOXR0_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -fno-common -msoft-float -static -fno-rtti -fno-exceptions $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing
1459TEMPLATE_VBOXR0_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -fno-common -msoft-float -static -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing
1460TEMPLATE_VBOXR0_LDFLAGS = -nostdlib
1461#TEMPLATE_VBOXR0_LDFLAGS.release = -Wl,-S ???
1462endif
1463
1464ifeq ($(VBOX_LDR_FMT),lx)
1465TEMPLATE_VBOXR0_TOOL = GXX3OMF
1466TEMPLATE_VBOXR0_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing
1467TEMPLATE_VBOXR0_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -fno-rtti -fno-exceptions $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing
1468TEMPLATE_VBOXR0_LDFLAGS = -Zdll -nostdlib
1469TEMPLATE_VBOXR0_LIBS = \
1470 $(VBOX_GCC_LIBGCC) \
1471 $(OBJ_SYS0) \
1472 end
1473endif
1474
1475
1476#
1477# Template for building SUPDRV R0 things.
1478#
1479TEMPLATE_VBOXR0DRV = VBox SUPDRV Ring 0
1480TEMPLATE_VBOXR0DRV_ASTOOL = $(VBOX_ASTOOL)
1481TEMPLATE_VBOXR0DRV_ASFLAGS = $(VBOX_ASFLAGS)
1482TEMPLATE_VBOXR0DRV_DEFS = IN_RING0 IN_RT_R0 $(ARCH_BITS_DEFS)
1483
1484ifeq ($(BUILD_TARGET),win)
1485 TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_VCC_TOOL)
1486 TEMPLATE_VBOXR0DRV_RCDEFS = \
1487 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1488 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1489 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1490 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1491 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1492 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1493 TEMPLATE_VBOXR0DRV_DEFS.x86 = _X86_
1494 TEMPLATE_VBOXR0DRV_DEFS.amd64 = _AMD64_
1495 ifdef VBOX_USE_VCC80
1496 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -W3 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1497 else
1498 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -W3 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1499 endif
1500 TEMPLATE_VBOXR0DRV_CFLAGS = $(TEMPLATE_VBOXR0DRV_CXXFLAGS)
1501 TEMPLATE_VBOXR0DRV_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Debug
1502 TEMPLATE_VBOXR0DRV_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
1503endif
1504
1505ifeq ($(BUILD_TARGET),linux)
1506TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1507TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0
1508TEMPLATE_VBOXR0DRV_INCS = $(VBOX_LINUX_INCS)
1509TEMPLATE_VBOXR0DRV_CFLAGS = -nostdinc -iwithprefix include \
1510 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1511 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1512TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mpreferred-stack-boundary=2 -msoft-float
1513TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1514 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1515 -Wno-sign-compare -Wdeclaration-after-statement
1516TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign -ffreestanding -Wdeclaration-after-statement,$(TEMPLATE_VBOXR0DRV_CFLAGS) $(TEMPLATE_VBOXR0DRV_CFLAGS.$(BUILD_TARGET_ARCH))) -fno-exceptions -fno-rtti
1517 ifndef VBOX_LINUX_VERSION_2_4
1518# 2.6
1519TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1520TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1521TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1522 else
1523# 2.4
1524TEMPLATE_VBOXR0DRV_SYSSUFF = .o
1525TEMPLATE_VBOXR0DRV_LDFLAGS = -r -s
1526 endif
1527endif
1528
1529ifeq ($(BUILD_TARGET),os2)
1530TEMPLATE_VBOXR0DRV_TOOL = GXX3OMF
1531TEMPLATE_VBOXR0DRV_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-rtti -fno-exceptions
1532TEMPLATE_VBOXR0DRV_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing
1533TEMPLATE_VBOXR0DRV_LIBS = $(VBOX_GCC_LIBGCC)
1534# wlink thinks physdevice doesn't need fixups and should have a stack - stupid!
1535TEMPLATE_VBOXR0DRV_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
1536endif
1537
1538ifeq ($(BUILD_TARGET),darwin)
1539TEMPLATE_VBOXR0DRV_TOOL = GXX4MACHO
1540TEMPLATE_VBOXR0DRV_DEFS += KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT
1541TEMPLATE_VBOXR0DRV_INCS += \
1542 /System/Library/Frameworks/Kernel.framework/PrivateHeaders \
1543 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Kernel.framework/Headers
1544TEMPLATE_VBOXR0DRV_CXXFLAGS = \
1545 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1546 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1547 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1548 -fapple-kext -fno-rtti -fcheck-new
1549TEMPLATE_VBOXR0DRV_CXXFLAGS.release = $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fasm-blocks
1550TEMPLATE_VBOXR0DRV_CXXFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1551TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1552TEMPLATE_VBOXR0DRV_CFLAGS = \
1553 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1554 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1555 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1556 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1557TEMPLATE_VBOXR0DRV_CFLAGS.release = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1558TEMPLATE_VBOXR0DRV_CFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.profile)
1559TEMPLATE_VBOXR0DRV_CFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile)
1560TEMPLATE_VBOXR0DRV_LDFLAGS = -static -nostdlib -r -Wl,-Y,1455 \
1561 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
1562TEMPLATE_VBOXR0DRV_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC)
1563endif
1564
1565ifeq ($(BUILD_TARGET),solaris)
1566## The Solaris /usr/include.
1567VBOX_SOLARIS_SYS_INCS ?= /usr/include
1568
1569TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1570TEMPLATE_VBOXR0DRV_DEFS = _KERNEL _STRICT_STDC IN_RING0 IN_RT_R0
1571TEMPLATE_VBOXR0DRV_SYSSUFF = .o
1572TEMPLATE_VBOXR0DRV_LDFLAGS = -r
1573TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -64
1574# Exclude -Wall because of solaris headers' pragma ident warnings that gcc refuses to supress.
1575TEMPLATE_VBOXR0DRV_CFLAGS = -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1576 -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \
1577 -O2 -ffreestanding -nodefaultlibs -fno-strict-aliasing -fno-common -std=c99
1578TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
1579TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-red-zone -mcmodel=kernel \
1580 -fno-reorder-blocks -fno-asynchronous-unwind-tables -funit-at-a-time
1581TEMPLATE_VBOXR0DRV_CXXFLAGS = -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1582 -O2 -nodefaultlibs -fno-strict-aliasing -fno-common
1583TEMPLATE_VBOXR0DRV_CXXFLAGS.x86 = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86)
1584TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64 = $(TEMPLATE_VBOXR0DRV_CFLAGS.amd64)
1585endif # Solaris
1586
1587ifeq ($(BUILD_TARGET),freebsd)
1588# x86 FreeBSD:
1589# cc -O2 -fno-strict-aliasing -pipe -Werror -D_KERNEL -DKLD_MODULE \
1590# -nostdinc -I- -I. -I@ -I@/contrib/altq -I@/../include -I/usr/include \
1591# -finline-limit=8000 -fno-common -mno-align-long-strings -mpreferred-stack-boundary=2 \
1592# -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -ffreestanding -Wall -Wredundant-decls -Wnested-externs \
1593# -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions \
1594# -std=c99 -c ../my.c
1595# ld -d -warn-common -r -d -o my.kld my.o
1596# :> export_syms
1597# awk -f /usr/src/sys/modules/my/../../conf/kmod_syms.awk my.kld export_syms | xargs -J% objcopy % my.kld
1598# ld -Bsharable -d warn-commnon -o my.ko my.kld
1599#
1600# Note: @ -> /usr/src/sys and machine -> /usr/src/sys/i386/include
1601
1602## The location of the FreeBSD kernel source.
1603VBOX_FREEBSD_SRC ?= /usr/src/sys
1604## The FreeBSD /usr/include.
1605VBOX_FREEBSD_SYS_INCS ?= /usr/include
1606
1607TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1608TEMPLATE_VBOXR0DRV_LDTOOL = FREEBSDKMODLD
1609TEMPLATE_VBOXR0DRV_DEFS = _KERNEL KLD_MODULE IN_RING0 IN_RT_R0
1610TEMPLATE_VBOXR0DRV_INCS = \
1611 $(VBOX_FREEBSD_SRC) \
1612 $(VBOX_FREEBSD_SRC)/contrib/altq \
1613 $(VBOX_FREEBSD_SRC)/../include \
1614 $(VBOX_FREEBSD_SYS_INCS)
1615# omitting: -Wcast-qual, -Wredundant-decls
1616TEMPLATE_VBOXR0DRV_CFLAGS = \
1617 -Wall -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1618 -Wstrict-prototypes -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \
1619 -O2 -fformat-extensions -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
1620 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) \
1621 -nostdinc -std=c99
1622TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -m32 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2
1623TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 "Port me to amd64 FreeBSD"
1624TEMPLATE_VBOXR0DRV_CXXFLAGS = -fno-exceptions -fno-rtti \
1625 -Wall -Wno-trigraphs -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) \
1626 -O2 -fno-format-extensions -fno-strict-aliasing -fno-common -finline-limit=8000 \
1627 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) \
1628 -nostdinc
1629TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1630TEMPLATE_VBOXR0DRV_LDFLAGS = -d --warn-common
1631TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386_fbsd
1632TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 "Port me to amd64 FreeBSD"
1633
1634TOOL_FREEBSDKMODLD = FreeBSD kernel module linker.
1635# See kBuild/tools/GCC3.kmk for docs.
1636TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT = $(outbase).kld
1637TOOL_FREEBSDKMODLD_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
1638TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1639TOOL_FREEBSDKMODLD_LINK_SYSMOD_DEPORD =
1640define TOOL_FREEBSDKMODLD_LINK_SYSMOD_CMDS
1641 @# Link intermediate .kld (a relocatable object).
1642 ld $(flags) -r -o $(outbase).kld $(objs) \
1643 $(foreach p,$(libpath), -L$(p))\
1644 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
1645 @# Strip non-exported symbols private and localize the exported ones.
1646 awk -f $(VBOX_FREEBSD_SRC)/conf/kmod_syms.awk $(outbase).kld $(if $(othersrc), $(othersrc),/dev/null) \
1647 | xargs -J% objcopy % $(outbase).kld
1648 @# Link the final .ko (a shared object).
1649 ld $(flags) -Bshareable -o $(out) $(outbase).kld
1650endef
1651
1652endif # FreeBSD
1653
1654ifdef VBOX_WITH_VBOXDRV
1655 ifndef TEMPLATE_VBOXR0DRV_TOOL
1656 $(warning Warning: VBox Build: Target $(BUILD_PLATFORM) is not officially supported!)
1657 endif
1658endif
1659
1660
1661
1662#
1663# Template for building R3 executables and static libraries which are linked into executables.
1664#
1665TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
1666TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
1667TEMPLATE_VBOXR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
1668TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
1669TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
1670ifeq ($(BUILD_TARGET),win)
1671 TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
1672 TEMPLATE_VBOXR3EXE_RCDEFS = \
1673 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1674 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1675 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1676 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1677 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1678 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1679 TEMPLATE_VBOXR3EXE_SDKS = WINPSDK
1680 ifdef VBOX_USE_VCC80
1681 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MD -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1682 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
1683 else
1684 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MD -W3 -wd4065 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1685 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -GZ
1686 endif
1687 TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
1688 TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
1689 TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1690 TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1691 TEMPLATE_VBOXR3EXE_LDFLAGS = \
1692 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1693 /DISALLOWLIB:libc.lib \
1694 /DISALLOWLIB:libcd.lib \
1695 /DISALLOWLIB:libcmt.lib \
1696 /DISALLOWLIB:libcmtd.lib \
1697 /DISALLOWLIB:msvcrtd.lib
1698 TEMPLATE_VBOXR3EXE_LIBS = \
1699 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1700 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1701 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib
1702 TEMPLATE_VBOXR3EXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1703
1704else # the gcc guys
1705TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
1706TEMPLATE_VBOXR3EXE_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
1707TEMPLATE_VBOXR3EXE_CXXFLAGS.x86 = -m32
1708TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64 = -m64
1709# L4 currently can't handle exception handling.
1710TEMPLATE_VBOXR3EXE_CXXFLAGS.l4 = -fno-exceptions -nostdinc \
1711 $(addprefix -I,$(VBOX_PATH_GCC_INCS) $(L4_INCDIR) $(FILE_TOOL_GPP3_INCDIR)) \
1712 $(DEBUG_L4)
1713TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
1714TEMPLATE_VBOXR3EXE_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-hidden)
1715TEMPLATE_VBOXR3EXE_CFLAGS.x86 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.x86)
1716TEMPLATE_VBOXR3EXE_CFLAGS.amd64 = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.amd64)
1717TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1718TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1719TEMPLATE_VBOXR3EXE_CFLAGS.darwin = -fno-common
1720TEMPLATE_VBOXR3EXE_CFLAGS.l4 = -nostdinc \
1721 $(addprefix -I,$(VBOX_PATH_GCC_INCS) $(L4_INCDIR)) $(DEBUG_L4)
1722TEMPLATE_VBOXR3EXE_DEFS.l4 = L4_THREAD_SAFE
1723TEMPLATE_VBOXR3EXE_LDFLAGS.x86 = -m32
1724TEMPLATE_VBOXR3EXE_LDFLAGS.amd64 = -m64
1725TEMPLATE_VBOXR3EXE_LDFLAGS.l4 = \
1726 $(L4_LIBDIR)/../crt0.o \
1727 -T$(L4_LIBDIR)/../main_dyn.ld -nostdlib \
1728 -Wl,--export-dynamic,--dynamic-linker=libld-l4.s.so \
1729 -Wl,--rpath-link,$(L4_LIBDIR)
1730TEMPLATE_VBOXR3EXE_LDFLAGS.linux = -Wl,-z,noexecstack $(VBOX_LD_as_needed)
1731 ifeq ($(BUILD_TARGET),linux)
1732TEMPLATE_VBOXR3EXE_LIBS = pthread m rt dl
1733 else ifeq ($(BUILD_TARGET),l4)
1734TEMPLATE_VBOXR3EXE_LIBS = \
1735 $(L4_LIBDIR)/libvboxserver.s.so \
1736 $(L4_LIBDIR)/libuc++.0.s.so \
1737 supc++ gcc_eh gcc \
1738 $(L4_LIBDIR)/libdl.s.so \
1739 $(L4_LIBDIR)/libuc.0.s.so
1740 else ifeq ($(BUILD_TARGET),os2)
1741TEMPLATE_VBOXR3EXE_TOOL = GXX3OMF
1742TEMPLATE_VBOXR3EXE_LIBS = socket iconv
1743 else ifeq ($(BUILD_TARGET),darwin)
1744TEMPLATE_VBOXR3EXE_TOOL = GXX4MACHO
1745TEMPLATE_VBOXR3EXE_LIBS =
1746TEMPLATE_VBOXR3EXE_LDFLAGS = -read_only_relocs suppress
1747TEMPLATE_VBOXR3EXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
1748 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1749TEMPLATE_VBOXR3EXE_TOOL = GXX3
1750TEMPLATE_VBOXR3EXE_LIBS = pthread
1751TEMPLATE_VBOXR3EXE_INCS += \
1752 /usr/include \
1753 /usr/X11R6/include \
1754 /usr/local/include
1755 else ifeq ($(BUILD_TARGET),solaris)
1756TEMPLATE_VBOXR3EXE_TOOL = GXX3PLAIN
1757TEMPLATE_VBOXR3EXE_DEFS += LIBICONV_PLUG _REENTRANT # Avoid the GNU libiconv, for now at least.
1758TEMPLATE_VBOXR3EXE_LIBS = rt socket
1759 else
1760$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1761TEMPLATE_VBOXR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.release)
1762TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease)
1763 endif
1764endif
1765
1766#
1767# Template for building R3 shared objects / DLLs.
1768# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
1769#
1770TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
1771TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
1772TEMPLATE_VBOXR3_LDFLAGS.l4 = $(L4_LIBDIR)/../crt0.s.o -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
1773TEMPLATE_VBOXR3_DEFS.l4 = $(TEMPLATE_VBOXR3EXE_DEFS.l4) __PIC__
1774TEMPLATE_VBOXR3_DEFS.darwin = $(TEMPLATE_VBOXR3EXE_DEFS.darwin) PIC
1775ifeq ($(filter-out solaris.x86 %.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
1776 ifneq ($(BUILD_TARGET),win)
1777 TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
1778 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
1779 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
1780 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
1781 endif
1782endif
1783
1784#
1785# Ring-3 testcase.
1786# This is the VBOXR3EXE template only with a different install dir.
1787#
1788TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
1789TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
1790TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
1791TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
1792ifeq ($(BUILD_TARGET),win)
1793 ifdef VBOX_SIGNING_MODE
1794 TEMPLATE_VBOXR3TSTEXE_POST_CMDS =
1795 endif
1796endif
1797
1798#
1799# Template for the CppUnit kind of testcases.
1800#
1801TEMPLATE_VBOXCPPUNITEXE = VBox CppUnit Testcase Exe
1802TEMPLATE_VBOXCPPUNITEXE_EXTENDS = VBOXR3TSTEXE
1803## @todo make a CPPUNIT SDK and add cppunit tools packages for windows, mac, solaris and OS/2.
1804#TEMPLATE_VBOXCPPUNITEXE_SDKS = CPPUNIT -
1805TEMPLATE_VBOXCPPUNITEXE_LIBS = \
1806 $(TEMPLATE_VBOXR3TSTEXE_LIBS) \
1807 cppunit
1808
1809#
1810# Template for building bad C/C++ style R3 executables (no -pedantic).
1811#
1812TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
1813TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
1814ifneq ($(BUILD_TARGET),win)
1815 # (only gcc)
1816 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
1817 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
1818 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3EXE_CFLAGS))
1819endif
1820
1821#
1822# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
1823# This is mostly identical to the VBOXR3NPEXE template.
1824#
1825TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
1826TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3NPEXE
1827TEMPLATE_VBOXR3NP_LDFLAGS.l4 = \
1828 $(L4_LIBDIR)/../crt0.s.o \
1829 -T$(L4_LIBDIR)/../main_rel.ld \
1830 -nostdlib
1831TEMPLATE_VBOXR3NP_DEFS.l4 = $(TEMPLATE_VBOXR3NPEXE_DEFS.l4) __PIC__
1832ifeq ($(filter-out solaris.x86 %.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
1833 ifneq ($(BUILD_TARGET),win)
1834 TEMPLATE_VBOXR3NP_DEFS = $(TEMPLATE_VBOXR3NPEXE_DEFS) PIC
1835 TEMPLATE_VBOXR3NP_CFLAGS = $(TEMPLATE_VBOXR3NPEXE_CFLAGS) -fPIC
1836 TEMPLATE_VBOXR3NP_CXXFLAGS = $(TEMPLATE_VBOXR3NPEXE_CXXFLAGS) -fPIC
1837 TEMPLATE_VBOXR3NP_LDFLAGS = $(TEMPLATE_VBOXR3NPEXE_LDFLAGS) -fPIC
1838 endif
1839endif
1840
1841
1842#
1843# Template for building libraries, shared libraries / modules
1844# which only depends on IPRT for crt.
1845#
1846TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
1847TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
1848TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
1849TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno -Wall
1850TEMPLATE_VBOXNOCRTGCC_CFLAGS.x86 = -m32
1851TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -m64 -mcmodel=medium -fno-common
1852TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
1853TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1854TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1855ifdef VBOX_TARGET_MAC_OS_X_VERSION_10_5 ## @todo this probably works for 10.4 too, check.
1856 TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -static
1857else
1858 TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -mdynamic-no-pic
1859endif
1860TEMPLATE_VBOXNOCRTGCC_CXXFLAGS = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS)
1861TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(BUILD_TARGET) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(BUILD_TARGET))
1862TEMPLATE_VBOXNOCRTGCC_CXXFLAGS.$(BUILD_TARGET_ARCH) = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.$(BUILD_TARGET_ARCH))
1863TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
1864
1865ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.amd64)
1866 # cross compile to 64-bit ELF (linux).
1867 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
1868 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
1869 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
1870 TEMPLATE_VBOXNOCRTGCC_LIBS = $(PATH_DEVTOOLS)/win.x86/x86_64-unknown-linux-gnu/20060701-r2/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/libgcc.a
1871 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1872
1873else ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1874 # Use the default GCC (MinGW) with the Microsoft linker.
1875 # (Drop all '-g' options as we're unable to strip the debug info.)
1876 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1877 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1878 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1879 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
1880 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
1881 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1882 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
1883
1884else
1885 # Use the default GCC.
1886 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
1887 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1888 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1889 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1890 TEMPLATE_VBOXNOCRTGCC_CFLAGS += $(VBOX_GCC_fno-stack-protector)
1891 TEMPLATE_VBOXNOCRTGCC_CXXFLAGS += $(VBOX_GCC_fno-stack-protector)
1892 ifeq ($(BUILD_TARGET_ARCH),amd64)
1893 # in 64-bit mode we'll build a sys-module (VBoxREM2).
1894 if1of ($(BUILD_TARGET),darwin solaris)
1895 TEMPLATE_VBOXNOCRTGCC_LDFLAGS.solaris= -64 -r
1896 else
1897 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1898 endif
1899 else # x86:
1900 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1901 ifneq ($(filter-out os2 darwin solaris,$(BUILD_TARGET)),)
1902 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
1903 endif
1904 endif # x86
1905 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
1906endif
1907
1908
1909#
1910# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
1911#
1912TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
1913TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
1914TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
1915ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1916 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
1917else
1918 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
1919endif
1920TEMPLATE_VBOXNOCRTGAS_ASFLAGS.x86 = -m32
1921TEMPLATE_VBOXNOCRTGAS_ASFLAGS.amd64 = -m64
1922
1923
1924#
1925# Template for building executables that are part of the VBox Main component
1926# (COM/XPCOM interface to VirtualBox).
1927#
1928
1929TEMPLATE_VBOXMAINEXE = VBox Main Executable
1930TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
1931TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
1932TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE NDEBUG=1
1933TEMPLATE_VBOXMAINEXE_DEFS.win = _UNICODE
1934TEMPLATE_VBOXMAINEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS)
1935TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
1936TEMPLATE_VBOXMAINEXE_INCS = \
1937 $(VBOX_PATH_SDK)/include
1938
1939ifeq ($(BUILD_TARGET),win)
1940 TEMPLATE_VBOXMAINEXE_SDKS = WINPSDK W2K3DDK
1941 ifdef VBOX_USE_VCC80
1942 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
1943 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GF- -MD -EHsc -W3 -wd4065 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1944 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
1945 else
1946 TEMPLATE_VBOXMAINEXE_TOOL = VCC70
1947 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GX- -GF- -MD -EHsc -W3 -wd4065 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1948 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -GZ
1949 endif
1950 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
1951 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1952 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
1953 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1954 TEMPLATE_VBOXMAINEXE_INCS += \
1955 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1956 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
1957 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
1958 /DISALLOWLIB:libc.lib \
1959 /DISALLOWLIB:libcd.lib \
1960 /DISALLOWLIB:msvcrt.lib \
1961 /DISALLOWLIB:msvcrtd.lib \
1962 /DISALLOWLIB:libcmtd.lib \
1963 /DISALLOWLIB:libcmt.lib
1964 TEMPLATE_VBOXMAINEXE_LIBS = \
1965 $(LIB_RUNTIME) \
1966 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1967 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1968 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1969 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1970 TEMPLATE_VBOXMAINEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
1971
1972else # the GCC guys:
1973
1974TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
1975TEMPLATE_VBOXMAINEXE_CXXFLAGS = -g -Wall -Wno-long-long -Wno-trigraphs -pipe -Wno-non-virtual-dtor -fshort-wchar -fpermissive $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
1976TEMPLATE_VBOXMAINEXE_CXXFLAGS.x86 = -m32
1977TEMPLATE_VBOXMAINEXE_CXXFLAGS.amd64 = -m64
1978TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
1979TEMPLATE_VBOXMAINEXE_CFLAGS = -g -Wall -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing $(VBOX_GCC_fvisibility-hidden)
1980TEMPLATE_VBOXMAINEXE_CFLAGS.x86 = -m32
1981TEMPLATE_VBOXMAINEXE_CFLAGS.amd64 = -m64
1982TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1983TEMPLATE_VBOXMAINEXE_LDFLAGS.x86 = -m32
1984TEMPLATE_VBOXMAINEXE_LDFLAGS.amd64 = -m64
1985 ifeq ($(BUILD_TARGET),linux)
1986TEMPLATE_VBOXMAINEXE_LIBS = pthread m rt $(LIB_RUNTIME)
1987TEMPLATE_VBOXMAINEXE_LDFLAGS.linux = $(VBOX_LD_as_needed)
1988 else ifeq ($(BUILD_TARGET),l4)
1989TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1990# no libs as yet in l4 target - must be added later
1991 else ifeq ($(BUILD_TARGET),os2)
1992TEMPLATE_VBOXMAINEXE_TOOL = GXX3OMF
1993TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1994 else ifeq ($(BUILD_TARGET),darwin)
1995TEMPLATE_VBOXMAINEXE_TOOL = GXX4MACHO
1996TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1997TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin = -bind_at_load -framework Carbon
1998 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1999TEMPLATE_VBOXMAINEXE_TOOL = GXX3
2000TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
2001TEMPLATE_VBOXMAINEXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
2002 else ifeq ($(BUILD_TARGET),solaris)
2003TEMPLATE_VBOXMAINEXE_TOOL = GXX3PLAIN
2004TEMPLATE_VBOXMAINEXE_DEFS += _REENTRANT
2005TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt
2006 else
2007$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
2008TEMPLATE_VBOXMAINEXE_LIBS =
2009 endif
2010
2011endif # !win
2012
2013# Add COM/XPCOM stuff
2014TEMPLATE_VBOXMAINEXE_LIBS += \
2015 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
2016ifdef VBOX_WITH_XPCOM
2017 ## @todo may be worth creating the VBOX_XPCOM SDK def
2018 TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
2019 TEMPLATE_VBOXMAINEXE_INCS += \
2020 $(VBOX_XPCOM_INCS)
2021 TEMPLATE_VBOXMAINEXE_LIBS += \
2022 $(LIB_XPCOM)
2023endif
2024
2025#
2026# Template for building the Main DLL modules (such as in-process COM/XPCOM
2027# components for Main).
2028#
2029# This differs from VBOXMAINEXE only in PIC handling and similar DLL stuff.
2030#
2031
2032TEMPLATE_VBOXMAINDLL = VBox Main Component (shared library)
2033TEMPLATE_VBOXMAINDLL_EXTENDS = VBOXMAINEXE
2034ifeq ($(filter-out solaris.x86 %.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
2035 ifneq ($(BUILD_TARGET),win)
2036 TEMPLATE_VBOXMAINDLL_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
2037 TEMPLATE_VBOXMAINDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
2038 TEMPLATE_VBOXMAINDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
2039 TEMPLATE_VBOXMAINDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
2040 endif
2041endif
2042TEMPLATE_VBOXMAINDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin))
2043
2044#
2045# Template for building the Main static libraries.
2046#
2047# This differs from VBOXMAINDLL only that it zeroes out the _LIBS definition.
2048#
2049
2050TEMPLATE_VBOXMAINLIB = VBox Main Component (static library)
2051TEMPLATE_VBOXMAINLIB_EXTENDS = VBOXMAINDLL
2052TEMPLATE_VBOXMAINLIB_LIBS =
2053
2054#
2055# Template for building executables that use the VBox Main component.
2056#
2057
2058TEMPLATE_VBOXMAINCLIENTEXE = VBox Main Client (executable)
2059TEMPLATE_VBOXMAINCLIENTEXE_EXTENDS = VBOXMAINEXE
2060ifeq ($(BUILD_TARGET),win)
2061 TEMPLATE_VBOXMAINCLIENTEXE_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
2062 $(PATH_SDK_WINPSDK_LIB)/User32.Lib \
2063 $(PATH_SDK_WINPSDK_LIB)/Shell32.Lib \
2064 $(PATH_SDK_WINPSDK_LIB)/ShLwApi.Lib \
2065 $(PATH_SDK_WINPSDK_LIB)/Ole32.Lib \
2066 $(PATH_SDK_WINPSDK_LIB)/OleAut32.Lib \
2067 $(PATH_SDK_WINPSDK_LIB)/Uuid.Lib
2068else
2069 TEMPLATE_VBOXMAINCLIENTEXE_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
2070 NDEBUG TRIMMED
2071 ## @todo remove
2072 ## Wonder why we compile main with defaults for these two and then drops it
2073 ## in the client executables...
2074 #TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS) \
2075 # -fno-rtti -fno-exceptions
2076 TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
2077 -pthread
2078 TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin = $(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin) \
2079 -bind_at_load -framework Carbon
2080endif
2081
2082#
2083# Template for building shared libraries / DLLs that use the VBox Main component.
2084#
2085# This differs from VBOXMAINCLIENTEXE only in PIC handling and similar DLL stuff.
2086#
2087
2088TEMPLATE_VBOXMAINCLIENTDLL = VBox MAIN Client (shared library)
2089TEMPLATE_VBOXMAINCLIENTDLL_EXTENDS = VBOXMAINCLIENTEXE
2090ifeq ($(filter-out solaris.x86 %.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
2091 ifneq ($(BUILD_TARGET),win)
2092 TEMPLATE_VBOXMAINCLIENTDLL_DEFS = PIC $(TEMPLATE_VBOXMAINCLIENTEXE_DEFS)
2093 TEMPLATE_VBOXMAINCLIENTDLL_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CFLAGS)
2094 TEMPLATE_VBOXMAINCLIENTDLL_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS)
2095 TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)
2096 endif
2097endif
2098TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin))
2099
2100
2101#
2102# Template for building Qt GUI executables.
2103#
2104
2105TEMPLATE_VBOXQTGUIEXE = VBox Qt GUI Executable
2106TEMPLATE_VBOXQTGUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS)
2107TEMPLATE_VBOXQTGUIEXE_INCS = \
2108 $(VBOX_PATH_SDK)/include \
2109 $(VBOX_PATH_QT)/include
2110
2111ifeq ($(BUILD_TARGET),win)
2112 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_VCC_TOOL)
2113 TEMPLATE_VBOXQTGUIEXE_DEFS += \
2114 _WIN32_WINNT=0x0500 UNICODE _UNICODE \
2115 QT_DLL _CRT_SECURE_NO_DEPRECATE
2116 ## @todo VCC70 flags?
2117 ifdef VBOX_USE_VCC80
2118 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
2119 -nologo -Zm200 -W3 -MD -Zi -EHsc -Zc:wchar_t-
2120 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu
2121 else
2122 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
2123 -nologo -Zm200 -W3 -MD -Zi -GX
2124 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -GZ
2125 endif
2126 TEMPLATE_VBOXQTGUIEXE_INCS += \
2127 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
2128 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = \
2129 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
2130 /DELAYLOAD:oleaut32.dll
2131 TEMPLATE_VBOXQTGUIEXE_SDKS = WINPSDK
2132 TEMPLATE_VBOXQTGUIEXE_LIBS = \
2133 $(LIB_QT) \
2134 $(LIB_QTMAIN) \
2135 $(LIB_RUNTIME) \
2136 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
2137 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
2138 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
2139 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
2140 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
2141 TEMPLATE_VBOXQTGUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2142
2143else # the gcc guys:
2144 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_GCC_TOOL)
2145 TEMPLATE_VBOXQTGUIEXE_DEFS.linux = _REENTRANT
2146 TEMPLATE_VBOXQTGUIEXE_DEFS.solaris = _REENTRANT
2147
2148 TEMPLATE_VBOXQTGUIEXE_INCS += \
2149 $(LIB_SDL_INC)
2150 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
2151 -pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
2152 -Wno-long-long -fshort-wchar -fno-strict-aliasing \
2153 $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
2154 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.x86 = -m32
2155 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.amd64 = -m64
2156 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -pthread
2157 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.x86 = -m32
2158 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.amd64 = -m64
2159 ## @todo no $(LIB_QTMAIN) here?
2160 TEMPLATE_VBOXQTGUIEXE_LIBS = \
2161 $(LIB_QT) \
2162 $(LIB_SDL) \
2163 $(LIB_RUNTIME) \
2164 $(LIB_REM) \
2165 $(LIB_VMM)
2166
2167 ifeq ($(BUILD_TARGET_ARCH),amd64)
2168 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
2169 $(VBOX_PATH_QT)/lib64 $(VBOX_PATH_QT)/lib
2170 else
2171 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
2172 $(VBOX_PATH_QT)/lib
2173 endif
2174
2175 ifeq ($(BUILD_TARGET),linux)
2176 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += $(VBOX_LD_as_needed)
2177 else ifeq ($(BUILD_TARGET),darwin)
2178 TEMPLATE_VBOXQTGUIEXE_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
2179 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -framework Carbon -framework QuickTime -bind_at_load
2180 TEMPLATE_VBOXQTGUIEXE_LIBS +=
2181 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
2182 else ifeq ($(BUILD_TARGET),os2)
2183 TEMPLATE_VBOXQTGUIEXE_LIBS +=
2184 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
2185 else
2186 TEMPLATE_VBOXQTGUIEXE_INCS += \
2187 $(VBOX_XCURSOR_INCS)
2188 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2189 $(VBOX_XCURSOR_LIBS) \
2190 Xext \
2191 X11 \
2192 m \
2193 $(LIB_PTHREAD)
2194 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \
2195 $(VBOX_LIBPATH_X11)
2196 ifeq ($(BUILD_TARGET),freebsd)
2197 TEMPLATE_VBOXQTGUIEXE_INCS += \
2198 /usr/include \
2199 /usr/X11R6/include \
2200 /usr/local/include
2201 endif
2202 ifeq ($(BUILD_TARGET),solaris)
2203 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2204 rt socket nsl
2205 endif
2206 endif
2207
2208endif
2209
2210# Add COM/XPCOM stuff
2211TEMPLATE_VBOXQTGUIEXE_LIBS += \
2212 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
2213ifdef VBOX_WITH_XPCOM
2214 ## @todo may be worth creating the VBOX_XPCOM SDK def
2215 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM
2216 TEMPLATE_VBOXQTGUIEXE_INCS += \
2217 $(VBOX_XPCOM_INCS)
2218 TEMPLATE_VBOXQTGUIEXE_LIBS += \
2219 $(LIB_XPCOM)
2220endif
2221
2222#
2223# Template for building Qt GUI components.
2224#
2225TEMPLATE_VBOXQTGUI = VBox Qt GUI Components
2226TEMPLATE_VBOXQTGUI_EXTENDS = VBOXQTGUIEXE
2227TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN) $(PATH_BIN)/VBoxXML$(VBOX_SUFF_DLL),$(TEMPLATE_VBOXQTGUIEXE_LIBS))
2228ifeq ($(BUILD_TARGET),darwin)
2229 TEMPLATE_VBOXQTGUI_LDFLAGS = $(filter-out -framework Carbon -framework QuickTime -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS))
2230endif
2231ifeq ($(filter-out solaris.x86 %.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
2232 ifneq ($(BUILD_TARGET),win)
2233 TEMPLATE_VBOXQTGUI_DEFS = PIC $(TEMPLATE_VBOXQTGUIEXE_DEFS)
2234 TEMPLATE_VBOXQTGUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CFLAGS)
2235 TEMPLATE_VBOXQTGUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS)
2236 TEMPLATE_VBOXQTGUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_LDFLAGS)
2237 endif
2238endif
2239
2240
2241#
2242# Template for building build bldprogs.
2243#
2244TEMPLATE_VBOXBLDPROG = VBox Build Program
2245TEMPLATE_VBOXBLDPROG_DEFS = IN_RING3
2246ifeq ($(BUILD_PLATFORM),win)
2247 ifeq ($(BUILD_PLATFORM_ARCH),x86)
2248 ifdef VBOX_USE_VCC80
2249 TEMPLATE_VBOXBLDPROG_TOOL = VCC80X86
2250 else
2251 TEMPLATE_VBOXBLDPROG_TOOL = VCC70
2252 endif
2253 TEMPLATE_VBOXBLDPROG_SDKS = WIN32SDK
2254 else
2255 TEMPLATE_VBOXBLDPROG_TOOL = VCC80AMD64
2256 TEMPLATE_VBOXBLDPROG_SDKS = WIN64SDK
2257 endif
2258 ifneq ($(TEMPLATE_VBOXBLDPROG_TOOL),VCC70)
2259 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -W3 -wd4996 -Zc:wchar_t-
2260 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -RTCsu
2261 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -Oy- -GS-
2262 else
2263 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -W3
2264 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -GZ
2265 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -Ogitb2 -Oy-
2266 endif
2267 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2268 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2269 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
2270 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
2271 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2272 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
2273 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
2274 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
2275 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
2276 /DISALLOWLIB:libcd.lib \
2277 /DISALLOWLIB:libcmtd.lib \
2278 /DISALLOWLIB:msvcrt.lib \
2279 /DISALLOWLIB:msvcrtd.lib \
2280 /DISALLOWLIB:msvcprt.lib \
2281 /DISALLOWLIB:msvcprtd.lib
2282 TEMPLATE_VBOXBLDPROG_LIBS = \
2283 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
2284 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt.lib \
2285 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt.lib
2286
2287else
2288# (gcc of some kind )
2289TEMPLATE_VBOXBLDPROG_TOOL = GXX3
2290TEMPLATE_VBOXBLDPROG_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
2291TEMPLATE_VBOXBLDPROG_CFLAGS.x86 = -m32
2292TEMPLATE_VBOXBLDPROG_CFLAGS.amd64 = -m64
2293TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2294TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
2295TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
2296TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe
2297TEMPLATE_VBOXBLDPROG_CXXFLAGS.x86 = -m32
2298TEMPLATE_VBOXBLDPROG_CXXFLAGS.amd64 = -m64
2299TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2300TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2301TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
2302TEMPLATE_VBOXBLDPROG_LDFLAGS.x86 = -m32
2303TEMPLATE_VBOXBLDPROG_LDFLAGS.amd64 = -m64
2304 ifeq ($(BUILD_PLATFORM),linux)
2305TEMPLATE_VBOXBLDPROG_LIBS = pthread m rt dl
2306 else ifeq ($(BUILD_PLATFORM),os2)
2307TEMPLATE_VBOXBLDPROG_TOOL = GXX3OMF
2308TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
2309 else ifeq ($(BUILD_PLATFORM),darwin)
2310TEMPLATE_VBOXBLDPROG_TOOL = GXX4MACHO
2311TEMPLATE_VBOXBLDPROG_LIBS =
2312TEMPLATE_VBOXBLDPROG_INCS += $(VBOX_PATH_MACOSX_SDK_INCS)
2313 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_PLATFORM)),)
2314TEMPLATE_VBOXBLDPROG_TOOL = GXX3
2315TEMPLATE_VBOXBLDPROG_LIBS =
2316 else ifeq ($(BUILD_PLATFORM),solaris)
2317TEMPLATE_VBOXBLDPROG_TOOL = GXX3PLAIN
2318TEMPLATE_VBOXBLDPROG_LIBS = rt
2319 else
2320$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
2321 endif
2322
2323endif # !win
2324
2325
2326
2327#
2328# Template for building R3 win32 guest additions.
2329#
2330TEMPLATE_VBOXW32GUESTR3 = VBox Win32 Guest Program
2331TEMPLATE_VBOXW32GUESTR3_INST = $(INST_ADDITIONS)
2332TEMPLATE_VBOXW32GUESTR3_BLD_TRG = win
2333TEMPLATE_VBOXW32GUESTR3_BLD_TRG_ARCH = x86
2334TEMPLATE_VBOXW32GUESTR3_BLD_TRG_CPU = i386
2335TEMPLATE_VBOXW32GUESTR3_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 IN_RT_R3 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
2336TEMPLATE_VBOXW32GUESTR3_RCDEFS = \
2337 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
2338 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
2339 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
2340 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
2341 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
2342 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
2343TEMPLATE_VBOXW32GUESTR3_ASTOOL = YASM
2344TEMPLATE_VBOXW32GUESTR3_ASFLAGS = -f win32 -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
2345TEMPLATE_VBOXW32GUESTR3_DLLSUFF = .dll
2346TEMPLATE_VBOXW32GUESTR3_EXESUFF = .exe
2347TEMPLATE_VBOXW32GUESTR3_LIBSUFF = .lib
2348TEMPLATE_VBOXW32GUESTR3_ARLIBSUFF = .lib
2349TEMPLATE_VBOXW32GUESTR3_SDKS = WIN32SDK W2K3DDKX86
2350ifdef VBOX_USE_VCC80
2351 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC80X86
2352 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
2353 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -RTCsu
2354 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -O2 -Oy- -GS-
2355else
2356 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC70
2357 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -U__LINUX__ -U__OS2__ -W3
2358 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -GZ
2359 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -Ogitb2 -Oy-
2360endif
2361TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2362TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2363TEMPLATE_VBOXW32GUESTR3_CFLAGS = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS)
2364TEMPLATE_VBOXW32GUESTR3_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug)
2365TEMPLATE_VBOXW32GUESTR3_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
2366TEMPLATE_VBOXW32GUESTR3_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile)
2367TEMPLATE_VBOXW32GUESTR3_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile)
2368TEMPLATE_VBOXW32GUESTR3_INCS = \
2369 $(VBOX_PATH_SDK)/include
2370TEMPLATE_VBOXW32GUESTR3_LDFLAGS = \
2371 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE \
2372 /DISALLOWLIB:libc.lib \
2373 /DISALLOWLIB:libcd.lib \
2374 /DISALLOWLIB:msvcrt.lib \
2375 /DISALLOWLIB:libcmtd.lib \
2376 /DISALLOWLIB:msvcrtd.lib
2377ifdef VBOX_USE_VCC80
2378 TEMPLATE_VBOXW32GUESTR3_LIBS = \
2379 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib \
2380 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
2381 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
2382else
2383 TEMPLATE_VBOXW32GUESTR3_LIBS = \
2384 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \
2385 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
2386 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
2387endif
2388TEMPLATE_VBOXW32GUESTR3_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
2389
2390#
2391# R3 win32 guest libraries
2392#
2393TEMPLATE_VBOXW32GUESTR3LIB = VBox Win32 Guest User Libraries
2394TEMPLATE_VBOXW32GUESTR3LIB_EXTENDS = VBOXW32GUESTR3
2395TEMPLATE_VBOXW32GUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
2396
2397
2398#
2399# Template for building R0 win32 guest tools.
2400#
2401TEMPLATE_VBOXW32GUESTR0 = VBox Win32 Guest Driver
2402TEMPLATE_VBOXW32GUESTR0_INST = $(INST_ADDITIONS)
2403TEMPLATE_VBOXW32GUESTR0_BLD_TRG = win
2404TEMPLATE_VBOXW32GUESTR0_BLD_TRG_ARCH = x86
2405TEMPLATE_VBOXW32GUESTR0_BLD_TRG_CPU = i386
2406TEMPLATE_VBOXW32GUESTR0_DEFS = _X86_ IN_GUEST IN_GUEST_R0 IN_RING0 IN_RT_R0 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
2407TEMPLATE_VBOXW32GUESTR0_RCDEFS = \
2408 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
2409 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
2410 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
2411 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
2412 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
2413 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
2414TEMPLATE_VBOXW32GUESTR0_ASTOOL = YASM
2415TEMPLATE_VBOXW32GUESTR0_ASFLAGS = -f win32 -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
2416TEMPLATE_VBOXW32GUESTR0_SYSSUFF = .sys
2417ifdef VBOX_USE_VCC80
2418 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC80X86
2419 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -U__LINUX__ -W3 -wd4996 -Zc:wchar_t-
2420 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -EHs-c- -Zl
2421 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -O2 -Oy-
2422else
2423 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC70
2424 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -U__LINUX__ -W3
2425 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -GX- -Zl
2426 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -Ogitb2 -Oy-
2427endif
2428TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2429TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2430TEMPLATE_VBOXW32GUESTR0_CFLAGS = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS)
2431TEMPLATE_VBOXW32GUESTR0_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug)
2432TEMPLATE_VBOXW32GUESTR0_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
2433TEMPLATE_VBOXW32GUESTR0_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile)
2434TEMPLATE_VBOXW32GUESTR0_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile)
2435TEMPLATE_VBOXW32GUESTR0_LDFLAGS = \
2436 -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Machine:X86 -Debug \
2437 /DISALLOWLIB:libcd.lib \
2438 /DISALLOWLIB:msvcrt.lib \
2439 /DISALLOWLIB:msvcrtd.lib \
2440 /DISALLOWLIB:libcmtd.lib
2441TEMPLATE_VBOXW32GUESTR0_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS)
2442
2443#
2444# R0 win32 guest libraries
2445#
2446TEMPLATE_VBOXW32GUESTR0LIB = VBox Win32 Guest Driver
2447TEMPLATE_VBOXW32GUESTR0LIB_EXTENDS = VBOXW32GUESTR0
2448TEMPLATE_VBOXW32GUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
2449
2450
2451#
2452# Windows rc workaround for crosscompiling.
2453# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
2454#
2455ifneq ($(BUILD_PLATFORM),win)
2456 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2457 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2458 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
2459 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
2460else
2461 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
2462 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
2463 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
2464 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
2465 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
2466 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
2467 ) Sorry_Cannot_find_mc_in_the_PSDK)
2468endif
2469
2470
2471#
2472# Template for syntax checking the linux guest additions.
2473# Not properly realized yet.
2474#
2475TEMPLATE_VBOXLNX32GUESTR0 = Template for *syntax checking* linux guest additions kernel modules
2476TEMPLATE_VBOXLNX32GUESTR0_TOOL = $(VBOX_GCC_TOOL)
2477TEMPLATE_VBOXLNX32GUESTR0_BLD_TRG = linux
2478TEMPLATE_VBOXLNX32GUESTR0_DEFS = __KERNEL__ MODULE IN_GUEST IN_GUEST_R0 IN_RING0 IN_RT_R0
2479TEMPLATE_VBOXLNX32GUESTR0_INCS = $(VBOX_LINUX_INCS)
2480TEMPLATE_VBOXLNX32GUESTR0_CFLAGS = -nostdinc -iwithprefix include \
2481 -O2 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
2482 $(VBOX_GCC_fno-stack-protector) -fno-strict-aliasing -fno-common \
2483 -mpreferred-stack-boundary=2 -msoft-float
2484TEMPLATE_VBOXLNX32GUESTR0_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXLNX32GUESTR0_CFLAGS)) -fno-exceptions -fno-rtti
2485ifndef VBOX_LINUX_VERSION_2_4
2486# 2.6
2487TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .ko
2488TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -m elf_i386 -r
2489else
2490# 2.4
2491TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .o
2492TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -r -s
2493endif
2494
2495
2496#
2497# Templates for building 32-bit linux guest additions.
2498#
2499
2500TEMPLATE_VBOXLNX32GUESTR3EXE = Template for building 32-bit linux guest additions programs.
2501TEMPLATE_VBOXLNX32GUESTR3EXE_INST = $(INST_ADDITIONS)
2502TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG = linux
2503TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_ARCH = x86
2504TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_CPU = i386
2505TEMPLATE_VBOXLNX32GUESTR3EXE_TOOL = $(VBOX_GCC32_TOOL)
2506TEMPLATE_VBOXLNX32GUESTR3EXE_ASTOOL = YASM
2507TEMPLATE_VBOXLNX32GUESTR3EXE_ASFLAGS = -f elf32 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels
2508TEMPLATE_VBOXLNX32GUESTR3EXE_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 HC_ARCH_BITS=32 GC_ARCH_BITS=32
2509TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe $(VBOX_GCC_fno-stack-protector)
2510TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
2511TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2512TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2513TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.release = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2514TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug)
2515TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile)
2516TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile)
2517TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_fno-stack-protector)
2518# No LDFLAGS nor LIBS!
2519
2520TEMPLATE_VBOXLNX32GUESTR3EXENOCPP = Template for building 32-bit linux guest additions programs without any C++.
2521TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2522TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_TOOL := $(subst GXX,GCC,$(VBOX_GCC32_TOOL))
2523# No LDFLAGS nor LIBS!
2524
2525TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP = Template for building 32-bit linux guest additions shared objects without any C++.
2526TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2527TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_TOOL = $(TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_TOOL)
2528TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS)
2529TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS)
2530TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDFLAGS = -fPIC
2531
2532TEMPLATE_VBOXLNX32GUESTR3LIB = Template for building 32-bit linux guest additions libraries.
2533TEMPLATE_VBOXLNX32GUESTR3LIB_EXTENDS = VBOXLNX32GUESTR3EXE
2534TEMPLATE_VBOXLNX32GUESTR3LIB_INST = $(INST_ADDITION_LIB)
2535
2536
2537
2538
2539ifdef VBOX_WITH_OS2_ADDITIONS
2540
2541#
2542# Template for building R3 OS/2 guest additions.
2543#
2544TEMPLATE_VBOXOS2GUESTR3 = VBox OS/2 Guest Programs and DLLs
2545TEMPLATE_VBOXOS2GUESTR3_INST = $(INST_ADDITIONS)os2/
2546TEMPLATE_VBOXOS2GUESTR3_BLD_TRG = os2
2547TEMPLATE_VBOXOS2GUESTR3_BLD_TRG_ARCH = x86
2548TEMPLATE_VBOXOS2GUESTR3_BLD_TRG_CPU = blend
2549TEMPLATE_VBOXOS2GUESTR3_DEFS = IN_GUEST IN_GUEST_R3 IN_RING3 IN_RT_R3 HC_ARCH_BITS=32 GC_ARCH_BITS=32
2550TEMPLATE_VBOXOS2GUESTR3_ASTOOL = NASM
2551TEMPLATE_VBOXOS2GUESTR3_ASFLAGS = -f obj -DASM_FORMAT_OMF -D__NASM__ -w+orphan-labels -g
2552TEMPLATE_VBOXOS2GUESTR3_DLLSUFF = .dll
2553TEMPLATE_VBOXOS2GUESTR3_EXESUFF = .exe
2554TEMPLATE_VBOXOS2GUESTR3_LIBSUFF = .lib
2555TEMPLATE_VBOXOS2GUESTR3_ARLIBSUFF = .lib
2556TEMPLATE_VBOXOS2GUESTR3_TOOL = GXX3OMF
2557TEMPLATE_VBOXOS2GUESTR3_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -fno-strict-aliasing -fno-rtti -fno-exceptions
2558TEMPLATE_VBOXOS2GUESTR3_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -fno-strict-aliasing
2559ifneq ($(BUILD_TYPE),debug)
2560 TEMPLATE_VBOXOS2GUESTR3_CFLAGS += -O2 -fno-omit-frame-pointer
2561 TEMPLATE_VBOXOS2GUESTR3_CXXFLAGS += -O2 -fno-omit-frame-pointer
2562endif
2563TEMPLATE_VBOXOS2GUESTR3_INCS = \
2564 $(VBOX_PATH_SDK)/include
2565
2566#
2567# Template for building OS/2 guest R3 libraries.
2568#
2569TEMPLATE_VBOXOS2GUESTR3LIB = VBox OS/2 Guest Usermode Libraries
2570TEMPLATE_VBOXOS2GUESTR3LIB_EXTENDS = VBOXOS2GUESTR3
2571TEMPLATE_VBOXOS2GUESTR3LIB_INST = $(INST_ADDITIONS_LIB)os2/
2572
2573#
2574# Template for building OS/2 Guest R0 images.
2575#
2576TEMPLATE_VBOXOS2GUESTR0 = VBox OS/2 Guest Driver
2577TEMPLATE_VBOXOS2GUESTR0_INST = $(INST_ADDITIONS)os2/
2578TEMPLATE_VBOXOS2GUESTR0_BLD_TRG = os2
2579TEMPLATE_VBOXOS2GUESTR0_BLD_TRG_ARCH = x86
2580TEMPLATE_VBOXOS2GUESTR0_BLD_TRG_CPU = blend
2581TEMPLATE_VBOXOS2GUESTR0_DEFS = IN_RING0 IN_GUEST IN_GUEST_R0 IN_RT_R0 HC_ARCH_BITS=32 GC_ARCH_BITS=32 LOG_TO_BACKDOOR
2582TEMPLATE_VBOXOS2GUESTR0_SYSSUFF = .sys
2583TEMPLATE_VBOXOS2GUESTR0_ASTOOL = NASM
2584TEMPLATE_VBOXOS2GUESTR0_ASFLAGS = -f obj -DASM_FORMAT_OMF -D__NASM__ -w+orphan-labels -g
2585TEMPLATE_VBOXOS2GUESTR0_TOOL = GXX3OMF
2586TEMPLATE_VBOXOS2GUESTR0_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -fno-strict-aliasing -fno-rtti -fno-exceptions
2587TEMPLATE_VBOXOS2GUESTR0_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -fno-strict-aliasing
2588ifneq ($(BUILD_TYPE),debug)
2589 TEMPLATE_VBOXOS2GUESTR0_CFLAGS += -O2 -fno-omit-frame-pointer
2590 TEMPLATE_VBOXOS2GUESTR0_CXXFLAGS += -O2 -fno-omit-frame-pointer
2591endif
2592TEMPLATE_VBOXOS2GUESTR0_LIBS = $(VBOX_GCC_LIBGCC) ## @todo this isn't nice.
2593TEMPLATE_VBOXOS2GUESTR0_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
2594
2595#
2596# Template for building OS/2 Guest R0 libraries.
2597#
2598TEMPLATE_VBOXOS2GUESTR0LIB = VBox OS/2 Guest Driver Library
2599TEMPLATE_VBOXOS2GUESTR0LIB_EXTENDS = VBOXOS2GUESTR0
2600TEMPLATE_VBOXOS2GUESTR0LIB_INST = $(INST_ADDITIONS_LIB)os2/
2601
2602#
2603# OS/2 Guest Libraries.
2604#
2605VBOX_LIB_IPRT_OS2_GUEST_R0 = $(PATH_LIB)/additions/os2/RuntimeOS2GuestR0.lib
2606VBOX_LIB_IPRT_OS2_GUEST_R3 = $(PATH_LIB)/additions/os2/RuntimeOS2GuestR3.lib
2607VBOX_LIB_VBGL_OS2_R3 = $(PATH_LIB)/additions/os2/VBoxGuestR3LibOS2.lib
2608VBOX_LIB_VBGL_OS2_R0BASE = $(PATH_LIB)/additions/os2/VBoxGuestR0LibBaseOS2.lib
2609VBOX_LIB_VBGL_OS2_R0 = $(PATH_LIB)/additions/os2/VBoxGuestR0LibOS2.lib
2610
2611endif # VBOX_WITH_OS2_ADDITIONS
2612
2613
2614#
2615# Two targets to coordinate version number changes properly. Note that the
2616# only way to get a really consistent build is to run 'kmk' in the top-level
2617# directory. If you don't run it there, you get a consistent sub-tree only.
2618#
2619VBOX_VERSION_STAMP = $(PATH_OUT)/version-stamp-$(VBOX_VERSION_STRING)
2620VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
2621VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
2622
2623$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
2624 $(call MSG_GENERATE,,$@)
2625 $(QUIET)$(MKDIR) -p $(@D)
2626 $(QUIET)$(RM) -f $(wildcard $(PATH_OUT)/version-stamp-*)
2627 $(QUIET)$(APPEND) $@ $(VBOX_VERSION_STRING)
2628
2629$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
2630 $(call MSG_GENERATE,,$@)
2631 $(QUIET)$(MKDIR) -p $(@D)
2632 $(QUIET)$(RM) -f $@ [email protected]
2633 $(QUIET)$(APPEND) [email protected] '#ifndef ___version_generated_h___'
2634 $(QUIET)$(APPEND) [email protected] '#define ___version_generated_h___'
2635 $(QUIET)$(APPEND) [email protected] ''
2636 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)'
2637 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)'
2638 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)'
2639 $(QUIET)$(APPEND) [email protected] '#define VBOX_VERSION_STRING "$(VBOX_VERSION_STRING)"'
2640 $(QUIET)$(APPEND) [email protected] ''
2641 $(QUIET)$(APPEND) [email protected] '#endif'
2642 $(QUIET)$(MV) -f [email protected] $@
2643
2644#
2645# Used for external makefiles which cannot include Config.kmk
2646#
2647$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
2648 $(call MSG_GENERATE,,$@)
2649 $(QUIET)$(RM) -f $@ [email protected]
2650 $(QUIET)$(MKDIR) -p $(@D)
2651 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)'
2652 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)'
2653 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)'
2654 $(QUIET)$(APPEND) [email protected] 'VBOX_VERSION_STRING = $(VBOX_VERSION_STRING)'
2655 $(QUIET)$(MV) -f [email protected] $@
2656
2657ifndef VBOX_OSE
2658ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # linux only, yea, right.
2659VBOX_LICENSE_SRC := $(PATH_ROOT)/doc/License.html
2660## @todo this can be done by sed alone. Why do we have to do this $(shell ) stuff in *all* make
2661# files btw? If this is really necessary, then just do it once for <insert deity of choice>'s sake.
2662VBOX_LICENSE_VER := $(shell grep Version $(VBOX_LICENSE_SRC)|sed -e 's/.*Version \([0-9.]*\),.*/\1/g')
2663VBOX_LICENSE_BIN := $(PATH_BIN)/License-$(VBOX_LICENSE_VER).html
2664
2665$(VBOX_LICENSE_BIN): $(VBOX_LICENSE_SRC)
2666 $(call MSG_GENERATE,,$@)
2667 $(QUIET)$(CP) $< $@
2668endif
2669endif
2670
2671
2672# Force building of the version header file as the first thing anywhere in
2673# the tree. This eliminates the need for manual dependencies on it.
2674## @todo there gotta be a better way of doing this.
2675Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2676Makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2677makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2678
2679
2680#
2681# Subversion tree revision.
2682#
2683# The VBOX_SVN_REV contains our best guess. Use svn info on the
2684# root of the treeto determin this it if .svn/entries is found,
2685# otherwise fall back on the Config.kmk revision.
2686#
2687SVN ?= svn$(HOSTSUFF_EXE)
2688VBOX_SVN_REV_KMK = $(PATH_OUT)/revision.kmk
2689ifndef VBOX_SVN_REV
2690 VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 5902 $ )
2691 VBOX_SVN_DEP := $(wildcard $(PATH_ROOT)/.svn/entries)
2692ifeq ($(KBUILD_VERSION_PATCH),2) ## tmp, remove later.
2693 ifeq ($(which (SVN)),)
2694 VBOX_SVN_DEP :=
2695 endif
2696
2697# Rule for generating a timestamp and updating the real thing on change.
2698$(VBOX_SVN_REV_KMK).ts +| $(VBOX_SVN_REV_KMK): $(if $(VBOX_SVN_DEP), $(VBOX_SVN_DEP), $(PATH_ROOT)/Config.kmk)
2699 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
2700 $(QUIET)$(RM) -f $@ [email protected]
2701 $(QUIET)$(MKDIR) -p $(@D)
2702 ifneq ($(VBOX_SVN_DEP),)
2703 $(REDIRECT) -E 'LC_ALL=C' -- $(SVN) info $(PATH_ROOT) [email protected]
2704 $(SED) -e '/^Revision/!d' -e 's/Revision\: */export VBOX_SVN_REV=/' --output $@ [email protected]
2705 $(QUIET)$(RM) -f [email protected]
2706 else
2707 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV_FALLBACK)'
2708 endif
2709 $(QUIET)$(CP) --changed -fv $@ $(VBOX_SVN_REV_KMK)
2710
2711else ## tmp, remove later.
2712 ifneq ($(USERNAME),bird) # Wastes nearly half a second on windows, very annoying. TODO: $(which ).
2713 ifneq ($(shell $(SVN) --version > /dev/null 2>&1 || echo 'svn not installed'),)
2714 VBOX_SVN_DEP :=
2715 endif
2716 endif
2717
2718# Rule for generating a timestamp and updating the real thing on change.
2719 ifneq ($(VBOX_SVN_DEP),)
2720$(VBOX_SVN_REV_KMK).ts: $(VBOX_SVN_DEP)
2721 else
2722$(VBOX_SVN_REV_KMK).ts: $(PATH_ROOT)/Config.kmk
2723 endif
2724 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
2725 $(QUIET)$(RM) -f $@
2726 $(QUIET)$(MKDIR) -p $(@D)
2727 ifneq ($(VBOX_SVN_DEP),)
2728# $(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\: *//")'
2729 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(shell LC_ALL=C $(SVN) info $(PATH_ROOT) | $(SED) -e '/^Revision/!d' -e "s/Revision\: *//")'
2730 else
2731 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV_FALLBACK)'
2732 endif
2733 $(QUIET)if test ! -f $(VBOX_SVN_REV_KMK) \
2734 || test ! "`$(CAT_EXT) $@`" = "`$(CAT_EXT) $(VBOX_SVN_REV_KMK)`"; \
2735 then \
2736 $(RM_EXT) -f $(VBOX_SVN_REV_KMK); \
2737 $(CP_EXT) -f $@ $(VBOX_SVN_REV_KMK) || exit 1; \
2738 echo '* $(VBOX_SVN_REV_KMK) was updated:'; \
2739 else \
2740 echo '* $(VBOX_SVN_REV_KMK) was not changed:'; \
2741 fi
2742 $(QUIET)$(CAT) $(VBOX_SVN_REV_KMK)
2743
2744$(VBOX_SVN_REV_KMK): $(VBOX_SVN_REV_KMK).ts # remove when kBuild is updated.
2745endif ## tmp, remove later
2746
2747 include $(VBOX_SVN_REV_KMK)
2748else
2749# allow to overwrite VBOX_SVN_REV externally (mainly for building .debs/.rpms)
2750$(VBOX_SVN_REV_KMK):
2751 $(call MSG_GENERATE,,$(VBOX_SVN_REV_KMK))
2752 $(QUIET)$(RM) -f $@
2753 $(QUIET)$(MKDIR) -p $(@D)
2754 $(QUIET)$(APPEND) $@ 'export VBOX_SVN_REV=$(VBOX_SVN_REV)'
2755 $(QUIET)echo '* $(VBOX_SVN_REV_KMK) was externally overwritten:'
2756 $(QUIET)$(CAT) $(VBOX_SVN_REV_KMK)
2757endif
2758
2759
2760#
2761# Legacy.
2762#
2763ifneq ($(LOCALCFG),)
2764 include $(LOCALCFG)
2765endif
2766
2767
2768#
2769# Some extra goals.
2770#
2771.PHONY: up update st stat status
2772up update::
2773 $(SVN) up
2774
2775st stat status:
2776 $(SVN) status
2777
2778quick:
2779 $(MAKE) VBOX_QUICK=1
2780
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