VirtualBox

source: vbox/trunk/Config.kmk@ 957

Last change on this file since 957 was 957, checked in by vboxsync, 18 years ago

Qt portability.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 77.6 KB
Line 
1# $Id: Config.kmk 957 2007-02-17 04:43:22Z 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 InnoTek Systemberatung 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# If you received this file as part of a commercial VirtualBox
22# distribution, then only the terms of your commercial VirtualBox
23# license agreement apply instead of the previous paragraph.
24#
25
26
27#
28# kBuild stuff
29#
30
31# Enable automatic installation of what's built.
32KBUILD_DO_AUTO_INSTALL := 1
33# Add the GPLExport pass.
34PASSES := $(filter-out PACKING,$(PASSES)) PACKING # temporary hack
35PASSES += GPLEXPORT
36# Modify the order of the INSTALLS and OTHERS passes.
37DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES INSTALLS OTHERS
38
39## PASS: gplexport
40# This pass processes custom gplexport rules listed in
41# the GPLEXPORTS variable.
42PASS_GPLEXPORT := GPL and LGPL source export
43PASS_GPLEXPORT_trgs :=
44PASS_GPLEXPORT_vars := GPLEXPORTS
45PASS_GPLEXPORT_pass := gplexport
46#alias
47gplexport: pass_gplexport
48
49# Install paths.
50PATH_INS := $(PATH_OUT)
51PATH_BIN = $(PATH_INS)/bin
52PATH_DLL = $(PATH_INS)/bin
53PATH_SYS = $(PATH_INS)/bin
54PATH_LIB = $(PATH_INS)/lib
55PATH_DOC = $(PATH_INS)/doc
56INST_TESTCASE = bin/testcase/
57INST_ADDITIONS = bin/additions/
58INST_ADDITIONS_LIB = lib/additions/
59INST_SDK = bin/sdk
60INST_SDK_SAMPLES = $(INST_SDK)/samples
61
62# Delete targets on failure.
63.DELETE_ON_ERROR:
64
65# Notify about important kBuild updates.
66ifneq ($(call int-ge,$(KMK_REVISION),830),1)
67 $(error You must update kBuild!)
68endif
69
70#
71# Define USERNAME early on.
72#
73ifndef USERNAME
74 ifdef USER
75 USERNAME = $(USER)
76 else
77 $(warning Warning: You must have USERNAME or USER in your environment.)
78 endif
79endif
80
81#
82# The VirtualBox version.
83#
84
85# Major version.
86VBOX_VERSION_MAJOR = 1
87# Minor version.
88VBOX_VERSION_MINOR = 3
89# This is the current build number. It should be increased every time we publish a
90# new build. The define is available in every source file. Only even build numbers
91# will be published, odd numbers are set during development.
92VBOX_VERSION_BUILD = 99
93# For convenience
94VBOX_VERSION = $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)
95
96
97#
98# The VirtualBox Configuration Defaults.
99#
100
101# Build linux / win32 additions.
102ifeq ($(BUILD_TARGET),linux)
103 VBOX_WITH_LINUX_ADDITIONS = 1
104 VBOX_WITH_WIN32_ADDITIONS = 1
105endif
106ifeq ($(BUILD_TARGET),l4)
107 VBOX_WITH_LINUX_ADDITIONS = 1
108 VBOX_WITH_WIN32_ADDITIONS = 1
109endif
110ifeq ($(BUILD_TARGET),win)
111 VBOX_WITH_WIN32_ADDITIONS = 1
112endif
113ifdef VBOX_WITH_LINUX_ADDITIONS
114 ifeq ($(BUILD_TARGET).$(BUILD_PLATFORM_ARCH),linux.x86)
115 VBOX_WITH_LINUX_ADDITIONS_32BIT_R0 = 1
116 endif
117endif
118# Enable the building of shared folders in the windows additions.
119VBOX_WITH_WIN32_ADDITIONS_SHAREDFOLDERS = 1
120
121# build the installer
122VBOX_WITH_INSTALLER = 1
123# enable VRDP server
124VBOX_WITH_VRDP = 1
125# build VRDP authentication modules
126VBOX_WITH_VRDP_AUTHMOD = 1
127# build enhanced version of rdesktop
128VBOX_WITH_VRDP_RDESKTOP = 1
129ifeq ($(BUILD_TARGET),darwin)
130# build the support driver & library without IDT patching.
131## @todo invert this!
132VBOX_WITHOUT_IDT_PATCHING = 1
133endif
134# The kernel driver/module and related runtime libraries.
135VBOX_WITH_VBOXDRV = 1
136# build with secure label support
137ifeq ($(filter win.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),) # too much work with freetype and all that.
138VBOX_WITH_SECURELABEL = 1
139endif
140
141# the main api
142VBOX_WITH_MAIN = 1
143# the SDL based GUI
144VBOX_WITH_VBOXSDL = 1
145# the basic frontend (w/o Main)
146VBOX_WITH_VBOXBFE = 1
147# the Qt GUI
148VBOX_WITH_QTGUI = 1
149## the Direct Framebuffer GUI
150#VBOX_WITH_VBOXFB = 1
151# the gui debugger
152ifneq ($(BUILD_TYPE),release)
153VBOX_WITH_DEBUGGER_GUI = 1
154endif
155# the documentation
156VBOX_WITH_DOCS = 1
157# build the Host Guest Communication Manager component
158VBOX_WITH_HGCM = 1
159# Enable the USB feature.
160VBOX_WITH_USB = 1
161# Enable the ISCSI feature.
162VBOX_WITH_ISCSI = 1
163# Disable ALSA support for Linux (currently broken).
164VBOX_WITH_ALSA = 1
165# Enable the kchmviewer
166VBOX_WITH_KCHMVIEWER = 1
167# Build the testsuite.
168VBOX_WITH_TESTSUITE = 1
169# Build the testcases.
170VBOX_WITH_TESTCASES = 1
171# Set this to not use COM or XPCOM in places where it can be avoided.
172#VBOX_WITHOUT_COM = 1
173# Set this to skip installing the redistributable compiler runtime.
174#VBOX_WITHOUT_COMPILER_REDIST = 1
175
176
177#
178# Skip stuff.
179#
180
181# VBOX_QUICK can be used by core developers to speed to the build
182ifdef VBOX_QUICK
183 # undefine variables by assigning blank.
184 VBOX_WITH_TESTSUITE=
185 VBOX_WITH_TESTCASES=
186 VBOX_WITH_MAIN =
187 VBOX_WITH_VBOXSDL =
188 VBOX_WITH_VBOXBFE =
189 VBOX_WITH_QTGUI =
190 VBOX_WITH_DEBUGGER_GUI =
191 VBOX_WITH_DOCS =
192endif # VBOX_QUICK
193
194# l4 have to skip a few things.
195ifeq ($(BUILD_TARGET),l4)
196 VBOX_WITH_VBOXDRV=
197 VBOX_WITH_VRDP=
198 VBOX_WITH_VBOXSDL=
199 VBOX_WITH_QTGUI=
200 VBOX_WITH_MAIN=
201 VBOX_WITH_DOCS=
202 VBOX_WITH_ISCSI=
203endif
204
205# Most stuff doesn't build yet on the two new targets.
206ifeq ($(filter-out darwin os2 freebsd,$(BUILD_TARGET)),)
207 #VBOX_WITH_VBOXBFE=
208 ifneq ($(filter-out darwin,$(BUILD_TARGET)),)
209 VBOX_WITH_MAIN=
210 VBOX_WITH_VBOXSDL=
211 VBOX_WITH_QTGUI=
212 VBOX_WITH_DEBUGGER_GUI=
213 endif
214 VBOX_WITH_INSTALLER=
215 VBOX_WITH_SECURELABEL=
216 VBOX_WITH_VRDP=
217 VBOX_WITH_VRDP_AUTHMOD=
218 VBOX_WITH_VRDP_RDESKTOP=
219 VBOX_WITH_TESTSUITE=
220 VBOX_WITH_USB=
221 VBOX_WITH_DOCS=
222endif
223
224
225#
226# Include automatic and local config file to override the above settings
227# and to provide defaults for the settings below this point.
228#
229AUTOCFG := $(wildcard $(PATH_ROOT)/AutoConfig.kmk)
230ifeq ($(AUTOCFG),)
231 # deprecated name. to be removed.
232 AUTOCFG := $(wildcard $(PATH_ROOT)/Config.kmkconf)
233 ifneq ($(AUTOCFG),)
234 $(warning Config.kmkconf has been renamed. Please re-run configure.)
235 endif
236endif
237ifneq ($(AUTOCFG),)
238 include $(AUTOCFG)
239endif
240
241LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
242ifeq ($(LOCALCFG),)
243 # deprecated name. to be removed.
244 LOCALCFG := $(wildcard $(PATH_ROOT)/Config.kmklocal)
245 ifneq ($(LOCALCFG),)
246 $(warning Please rename your Config.kmklocal to LocalConfig.kmk.)
247 endif
248endif
249ifneq ($(LOCALCFG),)
250 include $(LOCALCFG)
251endif
252
253
254#
255# Disable components that are not open sourced.
256#
257ifdef VBOX_OSE
258 VBOX_WITH_VRDP=
259 VBOX_WITH_USB=
260 VBOX_WITH_ISCSI=
261 VBOX_WITH_DEBUGGER_GUI=
262 VBOX_WITH_WIN32_ADDITIONS_SHAREDFOLDERS=
263 VBOX_WITH_SECURELABEL=
264 VBOX_WITH_INSTALLER=
265 VBOX_WITH_KCHMVIEWER=
266 VBOX_WITH_DOCS=
267 VBOX_WITH_TESTSUITE=
268 PASSES := $(filter-out PACKING,$(PASSES))
269endif
270
271##
272## HACK ALERT!
273## OVerride anyone attempting to build Linux/GNU additions when targeting AMD64.
274##
275#ifdef VBOX_WITH_LINUX_ADDITIONS
276# ifeq ($(BUILD_TARGET_ARCH),amd64)
277# VBOX_WITH_LINUX_ADDITIONS :=
278# endif
279#endif
280
281#
282# Image and object format config.
283#
284ifeq ($(filter-out linux l4 freebsd netbsd openbsd solaris,$(BUILD_TARGET)),)
285 VBOX_LDR_FMT = elf
286endif
287ifeq ($(BUILD_TARGET),darwin)
288 VBOX_LDR_FMT = macho
289 DONT_USE_YASM = 1 # yasm doesn't implement macho yet.
290endif
291ifeq ($(BUILD_TARGET),os2)
292 VBOX_LDR_FMT = lx
293 VBOX_LDR_FMT32 = lx
294 VBOX_LDR_FMT64 = elf
295 DONT_USE_YASM = 1 # yasm doesn't implement omf yet.
296endif
297ifeq ($(BUILD_TARGET),win)
298 VBOX_LDR_FMT = pe
299endif
300VBOX_LDR_FMT32 ?= $(VBOX_LDR_FMT)
301VBOX_LDR_FMT64 ?= $(VBOX_LDR_FMT)
302
303#
304# Assembler setup.
305#
306# This is a bit complicated since we have to support two different assmblers
307# (yasm/nasm) and possibly two different formats (32-bit/64-bit).
308#
309ifeq ($(VBOX_LDR_FMT),elf)
310 ifeq ($(BUILD_TARGET_ARCH),x86)
311VBOX_ASFLAGS_FMT = -f elf32 -DASM_FORMAT_ELF
312 else
313VBOX_ASFLAGS_FMT = -f elf64 -DASM_FORMAT_ELF
314 endif
315VBOX_ASFLAGS_DBFINFO = -g dwarf2
316endif
317ifeq ($(VBOX_LDR_FMT),lx)
318 VBOX_ASFLAGS_FMT = -f obj -DASM_FORMAT_OMF
319 VBOX_ASFLAGS_DBFINFO = -g stabs
320endif
321ifeq ($(VBOX_LDR_FMT),macho)
322 VBOX_ASFLAGS_FMT = -f macho -DASM_FORMAT_MACHO
323 VBOX_ASFLAGS_DBFINFO = -g dwarf2
324endif
325ifeq ($(VBOX_LDR_FMT),pe)
326 ifeq ($(BUILD_TARGET_ARCH),x86)
327VBOX_ASFLAGS_FMT = -f win32 -DASM_FORMAT_PE
328 else
329VBOX_ASFLAGS_FMT = -f win64 -DASM_FORMAT_PE
330 endif
331endif
332ifndef VBOX_ASFLAGS_FMT
333 $(error VBOX_ASFLAGS_FMT is not defined. VBOX_LDR_FMT=$(VBOX_LDR_FMT))
334endif
335
336ifeq ($(VBOX_LDR_FMT32),elf)
337 VBOX_ASFLAGS_FMT32 = -f elf32 -DASM_FORMAT_ELF
338 VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
339endif
340ifeq ($(VBOX_LDR_FMT32),lx)
341 VBOX_ASFLAGS_FMT32 = -f obj -DASM_FORMAT_OMF
342 VBOX_ASFLAGS_DBFINFO32 = -g stabs
343endif
344ifeq ($(VBOX_LDR_FMT32),macho)
345 VBOX_ASFLAGS_FMT32 = -f macho -DASM_FORMAT_MACHO
346 VBOX_ASFLAGS_DBFINFO32 = -g dwarf2
347endif
348ifeq ($(VBOX_LDR_FMT32),pe)
349 VBOX_ASFLAGS_FMT32 = -f win32 -DASM_FORMAT_PE
350endif
351ifndef VBOX_ASFLAGS_FMT32
352 $(error VBOX_ASFLAGS_FMT32 is not defined. VBOX_LDR_FMT32=$(VBOX_LDR_FMT32))
353endif
354
355ifeq ($(VBOX_LDR_FMT64),elf)
356 VBOX_ASFLAGS_FMT64 = -f elf64 -DASM_FORMAT_ELF
357 VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
358endif
359ifeq ($(VBOX_LDR_FMT64),macho)
360 VBOX_ASFLAGS_FMT64 = -f macho -DASM_FORMAT_MACHO
361 VBOX_ASFLAGS_DBFINFO64 = -g dwarf2
362endif
363ifeq ($(VBOX_LDR_FMT64),pe)
364 VBOX_ASFLAGS_FMT64 = -f win64 -DASM_FORMAT_PE
365endif
366ifndef VBOX_ASFLAGS_FMT64
367 $(error VBOX_ASFLAGS_FMT64 is not defined. VBOX_LDR_FMT64=$(VBOX_LDR_FMT64))
368endif
369
370ifndef DONT_USE_YASM
371 VBOX_ASTOOL = YASM
372 VBOX_LDR_FMT_2_YASM_DBGINFO.elf = -g dwarf2
373 VBOX_LDR_FMT_2_YASM_DBGINFO.lx = -g stabs
374 VBOX_LDR_FMT_2_YASM_DBGINFO.macho = -g dwarf2
375 VBOX_LDR_FMT_2_YASM_DBGINFO.pe =
376 VBOX_ASFLAGS = $(VBOX_ASFLAGS_FMT) -D__YASM__ -w+orphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT))
377 VBOX_ASFLAGS32 = $(VBOX_ASFLAGS_FMT32) -D__YASM__ -w+orphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT32))
378 VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__YASM__ -w+orphan-labels $(VBOX_LDR_FMT_2_YASM_DBGINFO.$(VBOX_LDR_FMT64))
379else
380 VBOX_ASTOOL = NASM
381 VBOX_ASFLAGS = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT)) -D__NASM__ -w+orphan-labels -g
382 VBOX_ASFLAGS32 = $(subst elf32,elf,$(VBOX_ASFLAGS_FMT32)) -D__NASM__ -w+orphan-labels -g
383 VBOX_ASFLAGS64 = $(VBOX_ASFLAGS_FMT64) -D__NASM__ -w+orphan-labels -g
384endif
385
386#
387# Windows only has mingw handy. On *nix we have to deal with cross compiling
388# 32-bit targets on 64-bit platforms, meaning we'll be using gcc32/g++32.
389# In the latter case we'll also have to disable all the all the R0 driver related stuff.
390#
391ifndef VBOX_GCC_TOOL
392 ifeq ($(BUILD_TARGET),win)
393 VBOX_GCC_TOOL := MINGW32
394 TOOL_MINGW32_CFLAGS := $(UNDEFINED) # override -g
395 else ifeq ($(BUILD_TARGET),os2)
396 VBOX_GCC_TOOL := GCC3OMF
397 else ifeq ($(BUILD_TARGET),darwin)
398 VBOX_GCC_TOOL := GCC4MACHO
399 else
400 VBOX_GCC_TOOL := GCC3
401 ifeq ($(BUILD_TARGET),$(BUILD_PLATFORM))
402 ifneq ($(BUILD_TARGET_ARCH),$(BUILD_PLATFORM_ARCH))
403 VBOX_GCC_TOOL := GCC32
404 VBOX_WITH_VBOXDRV=
405 VBOX_WITH_LINUX_ADDITIONS=
406 VBOX_WITH_WIN32_ADDITIONS=
407 endif
408 endif
409 endif
410endif
411ifndef VBOX_GCC32_TOOL
412 ifeq ($(BUILD_TARGET_ARCH),x86)
413 VBOX_GCC32_TOOL := $(VBOX_GCC_TOOL)
414 else ifeq ($(BUILD_TARGET),win)
415 VBOX_GCC32_TOOL := MINGW32
416 else
417 VBOX_GCC32_TOOL := GCC32
418 endif
419endif
420
421#
422# Decide which Visual C++ compiler version we're using by default.
423#
424ifndef VBOX_VCC_TOOL
425 ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.amd64)
426 VBOX_USE_VCC80 ?= 1 # Enforce VCC80 when targetting AMD64.
427 endif
428 ifdef VBOX_USE_VCC80
429 ifeq ($(BUILD_TARGET_ARCH),x86)
430 VBOX_VCC_TOOL := VCC80X86
431 else
432 VBOX_VCC_TOOL := VCC80AMD64
433 endif
434 else
435 VBOX_VCC_TOOL := VCC70
436 endif
437endif
438
439#
440# The kBuild tools and SDKs are using PATH_DEVTOOLS, PATH_DEVTOOLS_BLD
441# and PATH_DEVTOOLS_TRG to find things if we give them specific locations.
442#
443PATH_DEVTOOLS ?= $(PATH_ROOT)/tools
444PATH_DEVTOOLS := $(abspath $(PATH_DEVTOOLS))
445PATH_DEVTOOLS_BLD ?= $(PATH_DEVTOOLS)/$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)
446PATH_DEVTOOLS_TRG ?= $(PATH_DEVTOOLS)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)
447
448## @todo Remove the default tool crap here!
449TOOL = $(VBOX_GCC_TOOL)
450ifdef VBOX_USE_VCC80
451 TOOL.win.x86 = VCC80X86
452 TOOL.win.amd64 = VCC80AMD64
453else
454 TOOL.win = VCC70
455endif
456ASTOOL = $(VBOX_ASTOOL)
457
458#
459# L4.
460#
461ifdef L4_DIR
462 # default CPU type
463 ifeq ($(L4_CPU),)
464 L4_CPU = 586
465 endif
466 ifeq ($(L4_API),)
467 L4_API = l4v2
468 endif
469 L4_OBJ := $(L4_DIR)/build-x86-$(L4_CPU)-$(L4_API)
470 ifeq ($(BUILD_TARGET),l4)
471 L4_INCDIR := \
472 $(L4_OBJ)/include/uclibc++ \
473 $(L4_OBJ)/include/x86/uclibc \
474 $(L4_OBJ)/include/uclibc \
475 $(L4LINUX26_DIR)/include \
476 $(L4LINUX26_DIR)/include/asm-l4/i386-arch \
477 $(L4_OBJ)/include/x86/$(L4_API) \
478 $(L4_OBJ)/include/x86 \
479 $(L4_OBJ)/include \
480 $(L4_DIR)/tool/dice/include
481 L4_LIBDIR := \
482 $(L4_DIR)/build-x86-$(L4_CPU)-$(L4_API)/lib/x86_$(L4_CPU)/$(L4_API)
483 endif # BUILD_TARGET == l4
484endif # L4_DIR
485
486# Produce debugging information that the Fiasco kernel debugger can read.
487ifeq ($(BUILD_TARGET).$(BUILD_TYPE),l4.debug)
488 DEBUG_L4 = -gstabs+
489endif
490
491#
492# Setup the global defines and includes.
493#
494## @todo PATH_CURRENT has to go, fix the places where we rely on it.
495INCS += $(PATH_ROOT)/include $(PATH_CURRENT) $(PATH_OUT)
496DEFS += VBOX
497DEFS.debug := DEBUG DEBUG_$(subst $(subst _, ,_),_,$(USERNAME)) DEBUG_USERNAME=$(subst $(subst _, ,_),_,$(USERNAME))
498DEFS.profile = VBOX_WITH_STATISTICS
499DEFS.x86 = __X86__
500DEFS.amd64 = __AMD64__
501DEFS.darwin = __DARWIN__
502DEFS.freebsd = __FREEBSD__
503DEFS.l4 = __L4__ __L4ENV__ L4API_l4v2 __NO_CTYPE _FILE_OFFSET_BITS=64
504ifeq ($(L4_API),l4v2onv4)
505 DEFS.l4 += L4API_l4v2onv4 STATIC_L4_INLINE
506endif
507DEFS.linux = __LINUX__ _FILE_OFFSET_BITS=64
508DEFS.netbsd = __NETBSD__
509DEFS.openbsd = __OPENBSD__
510DEFS.os2 = __OS2__
511DEFS.solaris = __SOLARIS__
512DEFS.win = __WIN__
513DEFS.win.x86 = __WIN32__
514DEFS.win.amd64 = __WIN64__
515# optional defines (use environment or make commandline)
516ifdef VBOX_WITH_DEBUGGER
517 DEFS += VBOX_WITH_DEBUGGER
518endif
519ifdef VBOX_WITH_DEBUGGER_GUI
520 DEFS += VBOX_WITH_DEBUGGER_GUI
521endif
522ifdef VBOX_WITH_STATISTICS
523 DEFS += VBOX_WITH_STATISTICS
524endif
525ifdef VBOX_STRICT
526 DEFS += VBOX_STRICT
527endif
528ifdef VBOX_WITHOUT_IDT_PATCHING
529 DEFS += VBOX_WITHOUT_IDT_PATCHING
530endif
531ifdef LOG_ENABLED
532 DEFS += LOG_ENABLED
533endif
534ifdef VBOX_OSE
535 DEFS += VBOX_OSE
536endif
537
538#
539# Compiler optimization flags.
540#
541ifeq ($(BUILD_TYPE),debug)
542 VBOX_GCC_FP ?= -fno-omit-frame-pointer
543 VBOX_GCC_OPT ?= -O0
544 VBOX_VCC_FP ?= -Oy-
545 VBOX_VCC_OPT ?=
546 VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer
547 VBOX_GCC_GC_OPT ?= -O0
548 VBOX_VCC_GC_FP ?= -Oy-
549 VBOX_VCC_GC_OPT ?=
550else
551 # We should use -fomit-frame-pointer for GCC / -Oy for VCC.
552 # -funwind-tables provides support for backtraces in gdb then.
553 VBOX_GCC_FP ?= -fno-omit-frame-pointer
554 VBOX_GCC_OPT ?= -O2
555 VBOX_VCC_FP ?= -Oy-
556 ifdef VBOX_USE_VCC80
557 VBOX_VCC_OPT ?= -O2 -GS-
558 else
559 VBOX_VCC_OPT ?= -Ogitb2
560 endif
561 VBOX_GCC_GC_FP ?= -fno-omit-frame-pointer
562 VBOX_GCC_GC_OPT ?= -O2
563 VBOX_VCC_GC_FP ?= -Oy-
564 ifdef VBOX_USE_VCC80
565 VBOX_VCC_GC_OPT ?= -O2
566 else
567 VBOX_VCC_GC_OPT ?= -Ogitb2
568 endif
569endif
570
571#
572# ARCH_BITS_DEFS.
573#
574ifeq ($(BUILD_TARGET_ARCH),amd64)
575 ARCH_BITS_DEFS := HC_ARCH_BITS=64 GC_ARCH_BITS=32
576else ifeq ($(BUILD_TARGET_ARCH),x86)
577 ARCH_BITS_DEFS := HC_ARCH_BITS=32 GC_ARCH_BITS=32
578else
579 error BUILD_TARGET_ARCH=$(BUILD_TARGET_ARCH)
580endif
581
582#
583# Add the output dir(s) to the dynamic loader search path.
584#
585ifeq ($(filter-out linux l4 freebsd netbsd openbsd solaris,$(BUILD_TARGET)),)
586 export LD_LIBRARY_PATH:=$(PATH_BIN):$(PATH_LIB):$(LD_LIBRARY_PATH)
587endif
588ifeq ($(BUILD_TARGET),os2)
589 #fixme! export BEGINLIBPATH:=$(PATH_BIN);$(PATH_LIB);$(BEGINLIBPATH)
590endif
591ifeq ($(BUILD_TARGET),win)
592 export PATH:=$(PATH_BIN);$(PATH_LIB);$(PATH)
593endif
594
595#
596# Common libraries and tools.
597#
598ifeq ($(BUILD_TARGET),darwin)
599 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.dylib
600 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
601 LIB_KPROFILE = $(PATH_BIN)/kPrf2.dylib
602 LIB_VMM = $(PATH_BIN)/VBoxVMM.dylib
603 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
604 LIB_REM = $(PATH_BIN)/VBoxREMImp.dylib
605endif
606ifeq ($(BUILD_TARGET),l4)
607 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.s.so
608 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
609 LIB_KPROFILE = $(PATH_BIN)/kPrf2.s.so
610 LIB_VMM = $(PATH_BIN)/VBoxVMM.s.so
611 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
612 LIB_REM = $(PATH_BIN)/VBoxREMImp.s.so
613endif
614ifeq ($(filter-out linux freebsd netbsd openbsd solaris,$(BUILD_TARGET)),)
615 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.so
616 LIB_RUNTIME_EF = $(PATH_LIB)/RuntimeEFCPP.a
617 LIB_KPROFILE = $(PATH_BIN)/kPrf2.so
618 LIB_VMM = $(PATH_BIN)/VBoxVMM.so
619 LIB_VMMGC = $(PATH_BIN)/VMMGC.gc
620 LIB_REM = $(PATH_BIN)/VBoxREMImp.so
621endif
622ifeq ($(BUILD_TARGET),os2)
623 LIB_RUNTIME = $(PATH_BIN)/VBoxRT.dll
624 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.a
625 LIB_KPROFILE = $(PATH_BIN)/kPrf2.dll
626 LIB_VMM = $(PATH_BIN)/VBoxVMM.dll
627 LIB_VMMGC = $(PATH_LIB)/VMMGCImp.lib
628 LIB_REM = $(PATH_LIB)/VBoxREMImp.lib
629 OBJ_SYS0 = $(PATH_OBJ)/src/VBox/Runtime/RuntimeR0/os2/sys0.obj
630endif
631ifeq ($(BUILD_TARGET),win)
632 LIB_RUNTIME = $(PATH_LIB)/VBoxRT.lib
633 LIB_RUNTIME_EF = #$(PATH_LIB)/RuntimeEFCPP.lib
634 LIB_KPROFILE = $(PATH_LIB)/kPrf2.lib
635 LIB_VMM = $(PATH_LIB)/VBoxVMM.lib
636 LIB_VMMGC = $(PATH_OUT)/obj/src/VBox/VMM/VMMGC/VMMGC.lib
637 LIB_REM = $(PATH_LIB)/VBoxREMImp.lib
638endif
639
640# The kprofile build automagically links with kProfile.
641ifeq ($(BUILD_TYPE),kprofile)
642 LIB_RUNTIME += $(LIB_KPROFILE)
643endif
644
645# Overridable libraries (unix).
646LIB_UUID ?= uuid
647LIB_PTHREAD ?= pthread
648LIB_XCURSOR ?= Xcursor
649
650## Enable C++ electric fence heap.
651#LIB_RUNTIME += $(LIB_RUNTIME_EF) $(LIB_RUNTIME)
652
653# Intel ASL compiler for ACPI
654VBOX_IASLCMD ?= $(firstword $(wildcard $(PATH_DEVTOOLS_BLD)/bin/iasl$(HOSTSUFF_EXE)) iasl$(HOSTSUFF_EXE))
655
656# Bruce's C compile is a C-compiler for BIOS-related 8086 code
657VBOX_BCC ?= $(PATH_DEVTOOLS_BLD)/bin/bcc$(HOSTSUFF_EXE) -B $(PATH_DEVTOOLS_BLD)/bin/
658
659# Assembler for BIOS-related 8086 code
660VBOX_AS86 ?= $(PATH_DEVTOOLS_BLD)/bin/as86$(HOSTSUFF_EXE)
661
662# libxslt XSLT processor. (see PATH_TOOL_YASM for explanation why it's temporarily located in bin.)
663ifeq ($(BUILD_PLATFORM),win)
664# VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/win.x86/libxslt/10114/xsltproc.exe
665 VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/win.x86/bin/xsltproc.exe
666else
667 VBOX_XSLTPROC ?= xsltproc$(HOSTSUFF_EXE)
668endif
669
670# bin2c (convert binary files into C arrays)
671VBOX_BIN2C ?= $(PATH_OBJ)/src/bldprogs/bin2c/bin2c$(HOSTSUFF_EXE)
672
673# mkisofs
674ifeq ($(BUILD_PLATFORM),win)
675 VBOX_MKISOFS ?= $(PATH_DEVTOOLS_BLD)/bin/mkisofs.exe
676else
677 VBOX_MKISOFS ?= mkisofs
678endif
679
680# Makeself for the linux installers.
681VBOX_MAKESELF ?= $(PATH_DEVTOOLS)/common/makeself/v2.1.4_1/makeself.sh
682
683# Microsoft HTML Help Workshop.
684VBOX_PATH_HTML_HELP_WORKSHOP ?= $(PATH_DEVTOOLS)/win.x86/HTML_Help_Workshop/v1.3/
685
686# Path to the null soft installer.
687VBOX_PATH_NSIS ?= $(PATH_DEVTOOLS)/win.x86/nsis/v2.22
688
689# Windows install tools...
690VBOX_PATH_WIX ?= $(PATH_DEVTOOLS)/win.x86/wix/v2.0.4611.0
691VBOX_PATH_DIFX ?= $(PATH_DEVTOOLS)/win.x86/DIFx/v2.1
692
693# We need to export YASM for OSE, but since it was converted to .zip we need to
694# allow for the location used by the zip to be properly cleaned up first.
695ifeq ($(filter-out win.x86 linux.x86, $(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)),)
696 PATH_TOOL_YASM ?= $(PATH_DEVTOOLS_BLD)/bin
697endif
698
699# XPCOM setup for all but win32.
700ifneq ($(BUILD_TARGET),win)
701 VBOX_WITH_XPCOM = 1
702 VBOX_XPIDL ?= $(PATH_OBJ)/src/libs/xpcom18a4/xpidl/xpidl$(HOSTSUFF_EXE)
703 VBOX_PATH_XPCOM_IDL ?= $(PATH_BIN)/sdk/idl
704 VBOX_XPCOM_INCS ?= \
705 $(PATH_BIN)/sdk/include \
706 $(PATH_BIN)/sdk/include/xpcom \
707 $(PATH_BIN)/sdk/include/xpcom/nsprpub \
708 $(PATH_BIN)/sdk/include/xpcom/string \
709 $(PATH_BIN)/sdk/include/xpcom/xpcom \
710 $(PATH_BIN)/sdk/include/xpcom/ipcd
711 # libIDL-config (for xpcom18a4)
712 ifeq ($(origin VBOX_LIBIDL_CONFIG),undefined)
713 export VBOX_LIBIDL_CONFIG := $(firstword $(shell which libIDL-config-2 libIDL-config 2> /dev/null))
714 endif
715endif
716
717# The X11 LIBPATH. (The amd64 hack is for RHEL4.)
718ifeq ($(BUILD_TARGET_ARCH),amd64)
719 VBOX_LIBPATH_X11 ?= /usr/X11R6/lib64 /usr/X11R6/lib
720else
721 VBOX_LIBPATH_X11 ?= /usr/X11R6/lib
722endif
723
724
725#
726# GCC stuff properties.
727#
728# These will be resolved on the first kmk invocation and passed on to recursive
729# instances in the environment.
730#q
731# Note. If we add much more to here, we should seriously consider moving this to a
732# gcc configure script which we invoke automatically.
733#
734include $(PATH_KBUILD)/tools/$(VBOX_GCC_TOOL).kmk
735
736ifndef VBOX_GCC_LIBGCC
737 export VBOX_GCC_LIBGCC := $(shell $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)
738endif
739
740# HC compiler switch detction.
741VBOX_GCC_CHECK_CC = $(shell \
742 if $(TOOL_$(VBOX_GCC_TOOL)_CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
743 then echo "$(1)"; \
744 else echo "$(2)"; fi; )
745VBOX_GCC_CHECK_CXX = $(shell \
746 if $(TOOL_$(VBOX_GCC_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
747 then echo "$(1)"; \
748 else echo "$(2)"; fi; )
749ifeq ($(origin VBOX_GCC_Wno-pointer-sign),undefined)
750 export VBOX_GCC_Wno-pointer-sign := $(call VBOX_GCC_CHECK_CC,-Wno-pointer-sign,)
751endif
752ifeq ($(origin VBOX_GCC_Wno-variadic-macros),undefined)
753 export VBOX_GCC_Wno-variadic-macros := $(call VBOX_GCC_CHECK_CXX,-Wno-variadic-macros,)
754endif
755ifeq ($(origin VBOX_GCC_Wno-invalid-offsetof),undefined)
756 export VBOX_GCC_Wno-invalid-offsetof := $(call VBOX_GCC_CHECK_CXX,-Wno-invalid-offsetof,)
757endif
758ifeq ($(origin VBOX_GCC_fno-stack-protector),undefined)
759 export VBOX_GCC_fno-stack-protector := $(call VBOX_GCC_CHECK_CC,-fno-stack-protector,)
760endif
761
762# 32-bit (GC) compiler switch detection.
763VBOX_GCC32_CHECK_CXX = $(shell \
764 if $(TOOL_$(VBOX_GCC32_TOOL)_CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
765 then echo "$(1)"; \
766 else echo "$(2)"; fi; )
767ifneq ($(VBOX_GCC_TOOL),$(VBOX_GCC32_TOOL))
768 include $(PATH_KBUILD)/tools/$(VBOX_GCC32_TOOL).kmk
769 ifeq ($(origin VBOX_GCC32_Wno-variadic-macros),undefined)
770 export VBOX_GCC32_Wno-variadic-macros := $(call VBOX_GCC32_CHECK_CXX,-Wno-variadic-macros,)
771 endif
772 ifndef VBOX_GCC32_LIBGCC
773 export VBOX_GCC32_LIBGCC := $(shell $(TOOL_$(VBOX_GCC32_TOOL)_CC) -print-libgcc-file-name)
774 endif
775else
776 VBOX_GCC32_Wno-variadic-macros ?= $(VBOX_GCC_Wno-variadic-macros)
777 VBOX_GCC32_LIBGCC ?= $(VBOX_GCC_LIBGCC)
778endif
779
780# Find the compiler defines (for IPRT no-crt).
781ifndef VBOX_PATH_GCC_INCS
782 export VBOX_PATH_GCC_INCS := $(abspath $(dir $(shell LC_ALL=C $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-libgcc-file-name)))/include
783endif
784
785# L4
786ifeq ($(BUILD_TARGET),l4)
787 ifndef VBOX_PATH_L4_GCC3_INSTALL
788 export VBOX_PATH_L4_GCC3_INSTALL := $(shell LANG=C $(TOOL_$(VBOX_GCC_TOOL)_CC) -print-search-dirs|sed -ne 's+^install: \(.*[^/][^/]*\)/\?+\1+p')
789 endif
790 VBOX_L4_GCC3_INCS := $(VBOX_PATH_L4_GCC3_INSTALL)/include
791 # L4_GPP3_INCS := \
792 # $(VBOX_PATH_L4_GCC3_INSTALL)/include/g++-v3/ \
793 # $(VBOX_PATH_L4_GCC3_INSTALL)/include/g++-v3/i386-pc-linux-gnu/
794endif
795
796#
797# Default prefixes and suffixes.
798#
799VBOX_PREF_LIB =
800ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
801VBOX_SUFF_LIB = .lib
802else
803VBOX_SUFF_LIB = .a
804endif
805VBOX_SUFF_DLL = $(SUFF_DLL)
806VBOXW32GUEST_SUFF_LIB = .lib
807VBOXLNX32GUEST_SUFF_LIB = .a
808
809#
810# SDKs for external libraries.
811#
812SDK_VBOX_XERCES = .
813SDK_VBOX_XERCES_INCS ?= $(PATH_ROOT)/src/libs/xerces-2.6.0/src
814SDK_VBOX_XERCES_LIBS ?= $(PATH_LIB)/VBox-xerces$(VBOX_SUFF_LIB)
815
816SDK_VBOX_XALAN = .
817SDK_VBOX_XALAN_INCS ?= $(PATH_ROOT)/src/libs/xalan-1.10.0
818SDK_VBOX_XALAN_LIBS ?= $(PATH_LIB)/VBox-xalan$(VBOX_SUFF_LIB)
819
820SDK_VBOX_LIBPNG = .
821SDK_VBOX_LIBPNG_INCS ?= $(PATH_ROOT)/src/libs/libpng-1.2.8
822SDK_VBOX_LIBPNG_LIBS ?= $(PATH_LIB)/VBox-libpng$(VBOX_SUFF_LIB)
823
824SDK_VBOX_ZLIB = .
825ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
826 SDK_VBOX_ZLIB_INCS ?= $(PATH_ROOT)/src/libs/zlib-1.2.1
827 SDK_VBOX_ZLIB_LIBS ?= $(PATH_LIB)/VBox-zlib$(VBOX_SUFF_LIB)
828else
829 SDK_VBOX_ZLIB_INCS ?=
830 SDK_VBOX_ZLIB_LIBS ?= z
831endif
832
833SDK_VBOX_OPENSSL = .
834SDK_VBOX_OPENSSL_INCS?= $(PATH_ROOT)/src/libs/openssl-0.9.7e/include
835SDK_VBOX_OPENSSL_LIBS?= $(PATH_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB)
836
837SDK_VBOX_FFMPEG = .
838ifeq ($(filter-out win os2,$(BUILD_TARGET)),)
839 SDK_VBOX_FFMPEG_INCS ?= \
840 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavutil \
841 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavcodec \
842 $(PATH_ROOT)/src/libs/ffmpeg-20060710/libavformat
843 ifeq ($(BUILD_TARGET),win)
844 ## Michael! Where is $(PATH_LIB)/VBoxFFmpegImp$(VBOX_SUFF_LIB) supposed to come from?
845 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_LIB)/VBoxFFmpeg.a
846 else
847 SDK_VBOX_FFMPEG_LIBS ?= $(PATH_BIN)/VBoxFFmpeg$(SUFF_DLL)
848 endif
849else
850 SDK_VBOX_FFMPEG_INCS ?=
851 SDK_VBOX_FFMPEG_LIBS ?= avutil avcodec avformat
852endif
853
854#
855# Special SDK for the problematic NTDLL.LIB.
856#
857SDK_VBOX_NTDLL = Requires W2K3DDK
858SDK_VBOX_NTDLL_LIBS ?= $(PATH_SDK_W2K3DDK_LIB)/ntdll.lib
859
860
861#
862# Qt build tools and libraries.
863# For *NIX we require it to be present on the system.
864#
865## @todo convert this into SDK and integrate the Qt stuff into kBuild.
866ifeq ($(BUILD_TARGET),win)
867 ifeq ($(BUILD_TARGET_ARCH),x86)
868 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.3
869 LIB_QT ?= $(VBOX_PATH_QT)/lib/dynamic/qt-mt333.lib
870 else
871 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.6
872 LIB_QT ?= $(VBOX_PATH_QT)/lib/dynamic/qt-mt336.lib
873 endif
874 LIB_QTMAIN ?= $(VBOX_PATH_QT)/lib/dynamic/qtmain.lib
875 ifndef QTDIR
876 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
877 QTDIR := $(call lastword,$(QTDIR))
878 endif
879
880else ifeq ($(BUILD_TARGET),darwin)
881 VBOX_PATH_QT ?= $(PATH_DEVTOOLS_TRG)/qt/v3.3.8
882 LIB_QT ?= $(VBOX_PATH_QT)/lib/libqt-mt.3.dylib
883 LIB_QTMAIN ?= $(NO_SUCH_VARIABLE)
884 ifndef QTDIR
885 QTDIR := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/v*))
886 QTDIR := $(call lastword,$(QTDIR))
887 endif
888endif
889ifndef VBOX_PATH_QT
890 VBOX_PATH_QT ?= $(QTDIR)
891 LIB_QT ?= qt-mt
892endif
893ifeq ($(BUILD_PLATFORM),$(BUILD_TARGET))
894 VBOX_PATH_QT_HOST ?= $(VBOX_PATH_QT)
895else
896 VBOX_PATH_QT_HOST ?= $(QTDIR)
897endif
898VBOX_UIC ?= $(VBOX_PATH_QT_HOST)/bin/uic$(HOSTSUFF_EXE)
899VBOX_MOC ?= $(VBOX_PATH_QT_HOST)/bin/moc$(HOSTSUFF_EXE)
900VBOX_LUPDATE ?= $(VBOX_PATH_QT_HOST)/bin/lupdate$(HOSTSUFF_EXE)
901VBOX_LRELEASE ?= $(VBOX_PATH_QT_HOST)/bin/lrelease$(HOSTSUFF_EXE)
902
903#
904# The linux kernel headers(/sources).
905#
906ifneq ($(filter linux l4,$(BUILD_TARGET)),)
907 ifeq ($(origin VBOX_LINUX_SRC),undefined)
908 ifneq ($(wildcard /lib/modules/$(shell uname -r)/build/include/linux/autoconf.h),)
909 export VBOX_LINUX_SRC := /lib/modules/$(shell uname -r)/build
910 else
911 export VBOX_LINUX_SRC := /usr/src/linux
912 endif
913 endif
914 ifeq ($(origin VBOX_LINUX_INCS),undefined)
915 export VBOX_LINUX_INCS := $(VBOX_LINUX_SRC)/include
916 # support splitted Linux kernels (make O=<build directory>)
917 kernelsrc := $(shell sed -ne 's+^KERNELSRC.*= *\(.*\)+\1+p' $(VBOX_LINUX_SRC)/Makefile)
918 ifneq ($(kernelsrc),)
919 kernelpath := $(realpath $(VBOX_LINUX_SRC)/$(kernelsrc))
920 VBOX_LINUX_INCS += $(VBOX_LINUX_SRC)/include2 $(kernelpath)/include
921 else
922 kernelpath := $(VBOX_LINUX_SRC)
923 endif
924 ifeq ($(BUILD_TARGET_ARCH),x86)
925 VBOX_LINUX_INCS += $(kernelpath)/include/asm-i386/mach-default
926 endif
927 endif
928endif
929
930
931#
932# Template for building GC things.
933#
934TEMPLATE_VBOXGC = VBox GC
935TEMPLATE_VBOXGC_ASTOOL = $(VBOX_ASTOOL)
936TEMPLATE_VBOXGC_ASFLAGS = $(VBOX_ASFLAGS32)
937TEMPLATE_VBOXGC_DEFS = IN_GC $(ARCH_BITS_DEFS)
938TEMPLATE_VBOXGC_SYSSUFF = .gc
939TEMPLATE_VBOXGC_BLD_TRG_ARCH = x86
940
941ifeq ($(VBOX_LDR_FMT32),pe)
942ifdef VBOX_USE_VCC80
943 TEMPLATE_VBOXGC_TOOL = VCC80X86
944 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)
945else
946 TEMPLATE_VBOXGC_TOOL = VCC70
947 TEMPLATE_VBOXGC_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP)
948endif
949TEMPLATE_VBOXGC_CFLAGS = $(TEMPLATE_VBOXGC_CXXFLAGS)
950TEMPLATE_VBOXGC_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Lines -MapInfo:Exports -NoD
951ifdef VBOX_USE_VCC80
952 include $(PATH_KBUILD)/sdks/W2K3DDKX86.kmk
953 TEMPLATE_VBOXGC_LIBS = \
954 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
955else
956 TEMPLATE_VBOXGC_LIBS = \
957 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
958endif
959endif
960
961ifeq ($(VBOX_LDR_FMT32),elf)
962TEMPLATE_VBOXGC_TOOL = $(VBOX_GCC32_TOOL)
963TEMPLATE_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)
964TEMPLATE_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)
965TEMPLATE_VBOXGC_LDFLAGS = -nostdlib -Bsymbolic
966# temporarily, must fix the loader.
967TEMPLATE_VBOXGC_LDFLAGS += -S
968TEMPLATE_VBOXGC_LDFLAGS.release = -S
969TEMPLATE_VBOXGC_LIBS = \
970 $(VBOX_GCC32_LIBGCC) # instricts
971endif
972
973ifeq ($(VBOX_LDR_FMT32),macho)
974TEMPLATE_VBOXGC_TOOL = GCC4MACHO
975TEMPLATE_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
976TEMPLATE_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
977TEMPLATE_VBOXGC_LDFLAGS = -nostdlib
978#TEMPLATE_VBOXGC_LDFLAGS.release = -Wl,-S ???
979endif
980
981ifeq ($(VBOX_LDR_FMT32),lx)
982TEMPLATE_VBOXGC_TOOL = GCC3OMF
983TEMPLATE_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
984TEMPLATE_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
985TEMPLATE_VBOXGC_LDFLAGS = -Zdll -nostdlib
986TEMPLATE_VBOXGC_LIBS = \
987 $(VBOX_GCC32_LIBGCC) \
988 $(OBJ_SYS0) \
989 end
990endif
991
992
993#
994# Template for building a GC ring-3 testcase (tstVMStructGC, tstDevStructGC).
995#
996TEMPLATE_VBOXGCEXE = VBox GC as ring-3 testcase
997TEMPLATE_VBOXGCEXE_EXTENDS = VBOXGC
998
999ifeq ($(VBOX_LDR_FMT32),pe)
1000 TEMPLATE_VBOXGCEXE_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD -Debug
1001 TEMPLATE_VBOXGCEXE_SDKS = WIN32SDK
1002 ifdef VBOX_USE_VCC80
1003 TEMPLATE_VBOXGCEXE_LIBS = \
1004 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
1005 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib
1006 else
1007 TEMPLATE_VBOXGCEXE_LIBS = \
1008 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
1009 $(PATH_TOOL_VCC70_LIB)/oldnames.lib
1010 endif
1011endif
1012
1013ifeq ($(VBOX_LDR_FMT32),elf)
1014 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1015 TEMPLATE_VBOXGCEXE_LDFLAGS.release = -g
1016endif
1017
1018ifeq ($(VBOX_LDR_FMT32),macho)
1019 TEMPLATE_VBOXGCEXE_CFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CFLAGS))
1020 TEMPLATE_VBOXGCEXE_CXXFLAGS = $(filter-out -static,$(TEMPLATE_VBOXGC_CXXFLAGS))
1021 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1022endif
1023
1024ifeq ($(VBOX_LDR_FMT32),lx)
1025 TEMPLATE_VBOXGCEXE_LDFLAGS = -g
1026 TEMPLATE_VBOXGCEXE_LIBS = $(NO_SUCH_VARIABLE)
1027endif
1028
1029
1030#
1031# Template for building R0 things.
1032#
1033TEMPLATE_VBOXR0 = VBox Ring 0
1034TEMPLATE_VBOXR0_ASTOOL = $(VBOX_ASTOOL)
1035TEMPLATE_VBOXR0_ASFLAGS = $(VBOX_ASFLAGS)
1036TEMPLATE_VBOXR0_DEFS = IN_RING0 $(ARCH_BITS_DEFS)
1037
1038ifeq ($(VBOX_LDR_FMT),pe)
1039TEMPLATE_VBOXR0_TOOL = $(VBOX_VCC_TOOL)
1040ifdef VBOX_USE_VCC80
1041 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -W3 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1042else
1043 TEMPLATE_VBOXR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1044endif
1045TEMPLATE_VBOXR0_CFLAGS = $(TEMPLATE_VBOXR0_CXXFLAGS)
1046TEMPLATE_VBOXR0_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD
1047ifdef VBOX_USE_VCC80
1048 TEMPLATE_VBOXR0_LIBS.x86 = \
1049 $(PATH_SDK_W2K3DDKX86_LIB)/int64.lib
1050else
1051 TEMPLATE_VBOXR0_LIBS.x86 = \
1052 $(PATH_TOOL_VCC70_LIB)/libcmt.lib # for 64-bit int
1053endif
1054endif # pe
1055
1056ifeq ($(VBOX_LDR_FMT),elf)
1057TEMPLATE_VBOXR0_TOOL = $(VBOX_GCC_TOOL)
1058TEMPLATE_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)
1059TEMPLATE_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)
1060TEMPLATE_VBOXR0_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables -ffreestanding
1061TEMPLATE_VBOXR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-asynchronous-unwind-tables
1062TEMPLATE_VBOXR0_LDFLAGS = -nostdlib -Bsymbolic
1063# temporarily, must fix the loader.
1064TEMPLATE_VBOXR0_LDFLAGS += -S
1065TEMPLATE_VBOXR0_LDFLAGS.release = -S
1066TEMPLATE_VBOXR0_LIBS = \
1067 $(VBOX_GCC_LIBGCC) # instricts
1068endif
1069
1070ifeq ($(VBOX_LDR_FMT),macho)
1071TEMPLATE_VBOXR0_TOOL = GCC4MACHO
1072TEMPLATE_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
1073TEMPLATE_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
1074TEMPLATE_VBOXR0_LDFLAGS = -nostdlib
1075#TEMPLATE_VBOXR0_LDFLAGS.release = -Wl,-S ???
1076endif
1077
1078ifeq ($(VBOX_LDR_FMT),lx)
1079TEMPLATE_VBOXR0_TOOL = GCC3OMF
1080TEMPLATE_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
1081TEMPLATE_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
1082TEMPLATE_VBOXR0_LDFLAGS = -Zdll -nostdlib
1083TEMPLATE_VBOXR0_LIBS = \
1084 $(VBOX_GCC_LIBGCC) \
1085 $(OBJ_SYS0) \
1086 end
1087endif
1088
1089
1090#
1091# Template for building SUPDRV R0 things.
1092#
1093TEMPLATE_VBOXR0DRV = VBox SUPDRV Ring 0
1094TEMPLATE_VBOXR0DRV_ASTOOL = $(VBOX_ASTOOL)
1095TEMPLATE_VBOXR0DRV_ASFLAGS = $(VBOX_ASFLAGS)
1096TEMPLATE_VBOXR0DRV_DEFS = IN_RING0 IN_RT_R0 $(ARCH_BITS_DEFS)
1097
1098ifeq ($(BUILD_TARGET),win)
1099 TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_VCC_TOOL)
1100 TEMPLATE_VBOXR0DRV_RCDEFS = \
1101 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1102 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1103 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1104 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1105 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1106 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1107 TEMPLATE_VBOXR0DRV_DEFS.x86 = _X86_
1108 TEMPLATE_VBOXR0DRV_DEFS.amd64 = _AMD64_
1109 ifdef VBOX_USE_VCC80
1110 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -W3 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1111 else
1112 TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -W3 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1113 endif
1114 TEMPLATE_VBOXR0DRV_CFLAGS = $(TEMPLATE_VBOXR0DRV_CXXFLAGS)
1115 TEMPLATE_VBOXR0DRV_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Debug
1116endif
1117
1118ifeq ($(BUILD_TARGET),linux)
1119TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1120TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0
1121TEMPLATE_VBOXR0DRV_INCS.x86 = $(VBOX_LINUX_INCS)
1122TEMPLATE_VBOXR0DRV_INCS.amd64 = $(VBOX_LINUX_INCS)
1123TEMPLATE_VBOXR0DRV_CFLAGS = -nostdinc -iwithprefix include \
1124 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1125 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1126TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -mpreferred-stack-boundary=2 -msoft-float
1127TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1128 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1129 -Wno-sign-compare -Wdeclaration-after-statement
1130TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXR0DRV_CFLAGS)) -fno-exceptions -fno-rtti
1131 ifndef VBOX_LINUX_VERSION_2_4
1132# 2.6
1133TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1134TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1135TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1136 else
1137# 2.4
1138TEMPLATE_VBOXR0DRV_SYSSUFF = .o
1139TEMPLATE_VBOXR0DRV_LDFLAGS = -r -s
1140 endif
1141endif
1142
1143ifeq ($(BUILD_TARGET),os2)
1144TEMPLATE_VBOXR0DRV_TOOL = GCC3OMF
1145TEMPLATE_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
1146TEMPLATE_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
1147endif
1148
1149ifeq ($(BUILD_TARGET),darwin)
1150TEMPLATE_VBOXR0DRV_TOOL = GCC4MACHO
1151TEMPLATE_VBOXR0DRV_DEFS += KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT
1152TEMPLATE_VBOXR0DRV_INCS += \
1153 /System/Library/Frameworks/Kernel.framework/PrivateHeaders \
1154 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Kernel.framework/Headers
1155TEMPLATE_VBOXR0DRV_CXXFLAGS = \
1156 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1157 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1158 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1159 -fapple-kext -fno-rtti -fcheck-new
1160TEMPLATE_VBOXR0DRV_CXXFLAGS.release = $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fasm-blocks
1161TEMPLATE_VBOXR0DRV_CXXFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1162TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1163TEMPLATE_VBOXR0DRV_CFLAGS = \
1164 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1165 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1166 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1167 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1168TEMPLATE_VBOXR0DRV_CFLAGS.release = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1169TEMPLATE_VBOXR0DRV_CFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.profile)
1170TEMPLATE_VBOXR0DRV_CFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile)
1171TEMPLATE_VBOXR0DRV_LDFLAGS = -static -nostdlib -r -Wl,-Y,1455 \
1172 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
1173TEMPLATE_VBOXR0DRV_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC)
1174endif
1175
1176ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),) # pure guess work just to avoid the warning below
1177TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1178TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ IN_RING0 IN_RT_R0
1179TEMPLATE_VBOXR0DRV_CFLAGS = \
1180 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1181 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1182TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -msoft-float
1183TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1184 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1185 -Wno-sign-compare -Wdeclaration-after-statement
1186TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXR0DRV_CFLAGS)) -fno-exceptions -fno-rtti
1187TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1188TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1189TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1190endif
1191
1192ifdef VBOX_WITH_VBOXDRV
1193 ifndef TEMPLATE_VBOXR0DRV_TOOL
1194 $(warning Warning: VBox Build: Target $(BUILD_PLATFORM) is not officially supported!)
1195 endif
1196endif
1197
1198
1199
1200#
1201# Template for building R3 executables and static libraries which are linked into executables.
1202#
1203TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
1204TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
1205TEMPLATE_VBOXR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
1206TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
1207TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
1208ifeq ($(BUILD_TARGET),win)
1209 TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
1210 TEMPLATE_VBOXR3EXE_RCDEFS = \
1211 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1212 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1213 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1214 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1215 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1216 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1217 TEMPLATE_VBOXR3EXE_SDKS = WINPSDK
1218 ifdef VBOX_USE_VCC80
1219 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MD -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1220 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
1221 else
1222 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MD -W3 -wd4065 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1223 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -GZ
1224 endif
1225 TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
1226 TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
1227 TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1228 TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1229 TEMPLATE_VBOXR3EXE_LDFLAGS = \
1230 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1231 /DISALLOWLIB:libc.lib \
1232 /DISALLOWLIB:libcd.lib \
1233 /DISALLOWLIB:libcmt.lib \
1234 /DISALLOWLIB:libcmtd.lib \
1235 /DISALLOWLIB:msvcrtd.lib
1236 TEMPLATE_VBOXR3EXE_LIBS = \
1237 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1238 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1239 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib
1240
1241else # the gcc guys
1242TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
1243TEMPLATE_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
1244# L4 currently can't handle exception handling.
1245TEMPLATE_VBOXR3EXE_CXXFLAGS.l4 = -fno-exceptions -nostdinc \
1246 $(addprefix -I,$(VBOX_L4_GCC3_INCS) $(L4_INCDIR) $(FILE_TOOL_GPP3_INCDIR)) \
1247 $(DEBUG_L4)
1248TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
1249TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1250TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1251TEMPLATE_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
1252TEMPLATE_VBOXR3EXE_CFLAGS.darwin = -fno-common
1253TEMPLATE_VBOXR3EXE_CFLAGS.l4 = -nostdinc \
1254 $(addprefix -I,$(VBOX_L4_GCC3_INCS) $(L4_INCDIR)) $(DEBUG_L4)
1255TEMPLATE_VBOXR3EXE_DEFS.l4 = L4_THREAD_SAFE
1256TEMPLATE_VBOXR3EXE_LDFLAGS.l4 = \
1257 $(L4_LIBDIR)/../crt0.o \
1258 -T$(L4_LIBDIR)/../main_dyn.ld -nostdlib \
1259 -Wl,--export-dynamic,--dynamic-linker=libld-l4.s.so \
1260 -Wl,--rpath-link,$(L4_LIBDIR)
1261 ifeq ($(BUILD_TARGET),linux)
1262TEMPLATE_VBOXR3EXE_LIBS = pthread m $(LIB_UUID) rt dl
1263 else ifeq ($(BUILD_TARGET),l4)
1264TEMPLATE_VBOXR3EXE_LIBS = \
1265 $(L4_LIBDIR)/libvboxserver.s.so \
1266 $(L4_LIBDIR)/libuc++.0.s.so \
1267 supc++ gcc_eh gcc \
1268 $(L4_LIBDIR)/libdl.s.so \
1269 $(L4_LIBDIR)/libuc.0.s.so
1270 else ifeq ($(BUILD_TARGET),os2)
1271TEMPLATE_VBOXR3EXE_TOOL = GCC3OMF
1272TEMPLATE_VBOXR3EXE_LIBS = socket iconv
1273 else ifeq ($(BUILD_TARGET),darwin)
1274TEMPLATE_VBOXR3EXE_TOOL = GCC4MACHO
1275TEMPLATE_VBOXR3EXE_LIBS =
1276TEMPLATE_VBOXR3EXE_LDFLAGS = -read_only_relocs suppress
1277 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1278TEMPLATE_VBOXR3EXE_TOOL = GCC3
1279TEMPLATE_VBOXR3EXE_LIBS = pthread
1280 else ifeq ($(BUILD_TARGET),solaris)
1281$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1282TEMPLATE_VBOXR3EXE_TOOL = GCC3PLAIN
1283TEMPLATE_VBOXR3EXE_LIBS = rt
1284 else
1285$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1286TEMPLATE_VBOXR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.release)
1287TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease)
1288 endif
1289endif
1290
1291#
1292# Template for building R3 shared objects / DLLs.
1293# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
1294#
1295TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
1296TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
1297TEMPLATE_VBOXR3_LDFLAGS.l4 = $(L4_LIBDIR)/../crt0.s.o -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
1298TEMPLATE_VBOXR3_DEFS.darwin = $(TEMPLATE_VBOXR3EXE_DEFS.darwin) PIC
1299ifeq ($(BUILD_TARGET_ARCH),amd64)
1300 ifneq ($(BUILD_TARGET),win)
1301 TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
1302 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
1303 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
1304 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
1305 endif
1306endif
1307
1308#
1309# Ring-3 testcase.
1310# This is the VBOXR3EXE template only with a different install dir.
1311#
1312TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
1313TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
1314TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
1315TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
1316
1317#
1318# Template for building bad C/C++ style R3 executables (no -pedantic).
1319#
1320TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
1321TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
1322ifneq ($(BUILD_TARGET),win)
1323 # (only gcc)
1324 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
1325 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
1326 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations ,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
1327endif
1328
1329#
1330# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
1331# This is mostly identical to the VBOXR3NPEXE template.
1332#
1333TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
1334TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3NPEXE
1335TEMPLATE_VBOXR3NP_LDFLAGS.l4 = \
1336 $(L4_LIBDIR)/../crt0.s.o \
1337 -T$(L4_LIBDIR)/../main_rel.ld \
1338 -nostdlib
1339ifeq ($(BUILD_TARGET_ARCH),amd64)
1340 ifneq ($(BUILD_TARGET),win)
1341 TEMPLATE_VBOXR3NP_DEFS = $(TEMPLATE_VBOXR3NPEXE_DEFS) PIC
1342 TEMPLATE_VBOXR3NP_CFLAGS = $(TEMPLATE_VBOXR3NPEXE_CFLAGS) -fPIC
1343 TEMPLATE_VBOXR3NP_CXXFLAGS = $(TEMPLATE_VBOXR3NPEXE_CXXFLAGS) -fPIC
1344 TEMPLATE_VBOXR3NP_LDFLAGS = $(TEMPLATE_VBOXR3NPEXE_LDFLAGS) -fPIC
1345 endif
1346endif
1347
1348
1349#
1350# Template for building libraries, shared libraries / modules
1351# which only depends on IPRT for crt.
1352#
1353TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
1354TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
1355TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
1356## @todo C++
1357TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno -Wall
1358TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -mcmodel=medium -fno-common
1359#TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O0 -fno-math-errno -fno-peephole2 -fno-strict-aliasing - for win64.
1360TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
1361TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1362TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1363TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -mdynamic-no-pic
1364TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
1365
1366ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.amd64)
1367 # cross compile to 64-bit ELF (linux).
1368 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
1369 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
1370 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
1371 TEMPLATE_VBOXNOCRTGCC_LIBS = $(PATH_DEVTOOLS)/win.x86/x86_64-unknown-linux-gnu/20060701/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/libgcc.a
1372 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1373
1374else ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1375 # Use the default GCC (MinGW) with the Microsoft linker.
1376 # (Drop all '-g' options as we're unable to strip the debug info.)
1377 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1378 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1379 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1380 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
1381 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
1382 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1383 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
1384
1385else
1386 # Use the default GCC.
1387 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
1388 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1389 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1390 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1391 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1392 ifneq ($(filter-out os2 darwin solaris,$(BUILD_TARGET)),)
1393 ifneq ($(BUILD_TARGET_ARCH),amd64)
1394 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
1395 endif
1396 endif
1397 ifneq ($(filter-out freebsd,$(BUILD_TARGET)),)
1398 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
1399 else
1400 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1401 endif
1402endif
1403
1404
1405#
1406# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
1407#
1408TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
1409TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
1410TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
1411ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1412 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
1413else
1414 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
1415endif
1416
1417
1418#
1419# Template for building executables that is part of the VBox MAIN component.
1420#
1421TEMPLATE_VBOXMAINEXE = VBox Main Executables
1422TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
1423TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
1424TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE
1425TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
1426
1427ifeq ($(BUILD_TARGET),win)
1428 TEMPLATE_VBOXMAINEXE_SDKS = WINPSDK W2K3DDK
1429 ifdef VBOX_USE_VCC80
1430 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
1431 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GF- -MD -EHsc -W3 -wd4065 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1432 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
1433 else
1434 TEMPLATE_VBOXMAINEXE_TOOL = VCC70
1435 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GX- -GF- -MD -EHsc -W3 -wd4065 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1436 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -GZ
1437 endif
1438 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
1439 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1440 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
1441 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1442 TEMPLATE_VBOXMAINEXE_INCS = \
1443 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1444 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
1445 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
1446 /DISALLOWLIB:libc.lib \
1447 /DISALLOWLIB:libcd.lib \
1448 /DISALLOWLIB:msvcrt.lib \
1449 /DISALLOWLIB:msvcrtd.lib \
1450 /DISALLOWLIB:libcmtd.lib \
1451 /DISALLOWLIB:libcmt.lib
1452 TEMPLATE_VBOXMAINEXE_LIBS = \
1453 $(LIB_RUNTIME) \
1454 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1455 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1456 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1457 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1458
1459else # the GCC guys:
1460
1461TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
1462TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
1463TEMPLATE_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
1464TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -fno-inline
1465TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
1466TEMPLATE_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
1467TEMPLATE_VBOXMAINEXE_CFLAGS.debug = -fno-inline
1468TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1469 ifeq ($(BUILD_TARGET),linux)
1470TEMPLATE_VBOXMAINEXE_LIBS = pthread m $(LIB_UUID) rt
1471 else ifeq ($(BUILD_TARGET),l4)
1472TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1473# no libs as yet in l4 target - must be added later
1474 else ifeq ($(BUILD_TARGET),os2)
1475TEMPLATE_VBOXMAINEXE_TOOL = GCC3OMF
1476TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1477 else ifeq ($(BUILD_TARGET),darwin)
1478TEMPLATE_VBOXMAINEXE_TOOL = GCC4MACHO
1479TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1480TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin = -bind_at_load -framework Carbon
1481 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1482TEMPLATE_VBOXMAINEXE_TOOL = GCC3
1483TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1484 else ifeq ($(BUILD_TARGET),solaris)
1485$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1486TEMPLATE_VBOXMAINEXE_TOOL = GCC3PLAIN
1487TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt
1488 else
1489$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1490TEMPLATE_VBOXMAINEXE_LIBS =
1491 endif
1492
1493endif # !win
1494
1495#
1496# Template for building the Main (+GUI) components
1497# This differ from VBOXMAINEXE only in PIC handling and similar DLL stuff.
1498#
1499TEMPLATE_VBOXMAIN = VBox MAIN
1500TEMPLATE_VBOXMAIN_EXTENDS = VBOXMAINEXE
1501ifeq ($(BUILD_TARGET_ARCH),amd64)
1502 ifneq ($(BUILD_TARGET),win)
1503 TEMPLATE_VBOXMAIN_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
1504 TEMPLATE_VBOXMAIN_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
1505 TEMPLATE_VBOXMAIN_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1506 TEMPLATE_VBOXMAIN_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
1507 endif
1508endif
1509TEMPLATE_VBOXMAIN_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin))
1510
1511#
1512# Template for building executables that is part of the VBox MAIN component.
1513# This is (pretty much) identical to VBOXMAIN except for PIC handling (which will be fixed later).
1514#
1515TEMPLATE_VBOXMAIN = VBox Main
1516TEMPLATE_VBOXMAIN_EXTENDS = VBOXMAINEXE
1517
1518
1519#
1520# Template for building executables that use the VBox MAIN component (COM stuff etc.)
1521#
1522TEMPLATE_VBOXMAINCLIENT = VBox MAIN Client
1523TEMPLATE_VBOXMAINCLIENT_EXTENDS = VBOXMAINEXE
1524TEMPLATE_VBOXMAINCLIENT_INCS = $(TEMPLATE_VBOXMAINEXE_INCS) \
1525 $(PATH_BIN)/sdk/include
1526ifdef VBOX_WITH_XPCOM
1527TEMPLATE_VBOXMAINCLIENT_INCS += \
1528 $(VBOX_XPCOM_INCS)
1529endif
1530TEMPLATE_VBOXMAINCLIENT_LIBS = $(TEMPLATE_VBOXMAINEXE_LIBS) \
1531 $(LIB_RUNTIME)
1532ifeq ($(BUILD_TARGET),win)
1533 TEMPLATE_VBOXMAINCLIENT_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
1534 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
1535 $(PATH_SDK_WINPSDK_LIB)/User32.Lib \
1536 $(PATH_SDK_WINPSDK_LIB)/Shell32.Lib \
1537 $(PATH_SDK_WINPSDK_LIB)/ShLwApi.Lib \
1538 $(PATH_SDK_WINPSDK_LIB)/Ole32.Lib \
1539 $(PATH_SDK_WINPSDK_LIB)/OleAut32.Lib \
1540 $(PATH_SDK_WINPSDK_LIB)/Uuid.Lib
1541else
1542 TEMPLATE_VBOXMAINCLIENT_LIBS = $(TEMPLATE_VBOXMAINEXE_LIBS) \
1543 $(PATH_LIB)/VBoxXPCOM$(VBOX_SUFF_LIB) \
1544 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
1545 $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL) \
1546 $(LIB_RUNTIME)
1547
1548 TEMPLATE_VBOXMAINCLIENT_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
1549 NDEBUG TRIMMED
1550 ## Wonder why we compile main with defaults for these two and then drops it in the client executables...
1551 TEMPLATE_VBOXMAINCLIENT_CXXFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS) \
1552 -fno-rtti -fno-exceptions
1553 TEMPLATE_VBOXMAINCLIENT_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
1554 -pthread
1555 TEMPLATE_VBOXMAINCLIENT_LDFLAGS.darwin = $(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin) \
1556 -bind_at_load -framework Carbon
1557endif
1558
1559
1560#
1561# Template for building Qt GUI executables.
1562#
1563TEMPLATE_VBOXQTGUIEXE = VBox Qt GUI Executable
1564TEMPLATE_VBOXQTGUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS)
1565TEMPLATE_VBOXQTGUIEXE_INCS = \
1566 $(PATH_BIN)/sdk/include \
1567 $(VBOX_PATH_QT)/include
1568
1569ifeq ($(BUILD_TARGET),win)
1570 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_VCC_TOOL)
1571 TEMPLATE_VBOXQTGUIEXE_DEFS += _WIN32_WINNT=0x0500 UNICODE QT_DLL _CRT_SECURE_NO_DEPRECATE
1572 ## @todo VCC70 flags?
1573 ifdef VBOX_USE_VCC80
1574 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1575 -nologo -Zm200 -W3 -MD -EHsc -Zc:wchar_t-
1576 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu
1577 else
1578 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1579 -nologo -Zm200 -W3 -MD -GX
1580 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -GZ
1581 endif
1582 TEMPLATE_VBOXQTGUIEXE_INCS += \
1583 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1584 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = \
1585 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
1586 /DELAYLOAD:oleaut32.dll
1587 TEMPLATE_VBOXQTGUIEXE_SDKS = WINPSDK
1588 TEMPLATE_VBOXQTGUIEXE_LIBS = \
1589 $(LIB_QT) \
1590 $(LIB_QTMAIN) \
1591 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
1592 $(LIB_RUNTIME) \
1593 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1594 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1595 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1596 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
1597 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1598
1599else # the gcc guys:
1600 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_GCC_TOOL)
1601 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM
1602 TEMPLATE_VBOXQTGUIEXE_DEFS.linux = _REENTRANT
1603
1604 TEMPLATE_VBOXQTGUIEXE_INCS += \
1605 $(LIB_SDL_INC) \
1606 $(VBOX_XPCOM_INCS)
1607 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1608 -pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
1609 -Wno-long-long -fshort-wchar -fno-strict-aliasing
1610 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -pthread
1611 ## @todo no $(LIB_QTMAIN) here?
1612 TEMPLATE_VBOXQTGUIEXE_LIBS = \
1613 $(LIB_QT) \
1614 $(LIB_SDL) \
1615 $(PATH_LIB)/VBoxXPCOM$(VBOX_SUFF_LIB) \
1616 $(LIB_RUNTIME) \
1617 $(LIB_REM) \
1618 $(LIB_VMM) \
1619 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
1620 $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
1621
1622 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
1623 $(VBOX_PATH_QT)/lib
1624
1625 ifeq ($(BUILD_TARGET),darwin)
1626 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -framework Carbon -bind_at_load
1627 TEMPLATE_VBOXQTGUIEXE_LIBS +=
1628 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
1629 else ifeq ($(BUILD_TARGET),os2)
1630 TEMPLATE_VBOXQTGUIEXE_LIBS +=
1631 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
1632 else
1633 TEMPLATE_VBOXQTGUIEXE_LIBS += \
1634 Xext \
1635 X11 \
1636 m \
1637 $(LIB_PTHREAD)
1638 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \
1639 $(VBOX_LIBPATH_X11)
1640 endif
1641
1642endif
1643
1644#
1645# Template for building Qt GUI components.
1646#
1647TEMPLATE_VBOXQTGUI = VBox Qt GUI Components
1648TEMPLATE_VBOXQTGUI_EXTENDS = VBOXQTGUIEXE
1649TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN) $(PATH_BIN)/VBoxXML$(VBOX_SUFF_DLL),$(TEMPLATE_VBOXQTGUIEXE_LIBS))
1650ifeq ($(BUILD_TARGET),darwin)
1651 TEMPLATE_VBOXQTGUI_LDFLAGS = $(filter-out -framework Carbon -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS))
1652endif
1653ifeq ($(BUILD_TARGET_ARCH),amd64)
1654 ifneq ($(BUILD_TARGET),win)
1655 TEMPLATE_VBOXQTGUI_DEFS = PIC $(TEMPLATE_VBOXQTGUIEXE_DEFS)
1656 TEMPLATE_VBOXQTGUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CFLAGS)
1657 TEMPLATE_VBOXQTGUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS)
1658 TEMPLATE_VBOXQTGUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_LDFLAGS)
1659 endif
1660endif
1661
1662
1663#
1664# Template for building build bldprogs.
1665#
1666TEMPLATE_VBOXBLDPROG = VBox Build Program
1667TEMPLATE_VBOXBLDPROG_DEFS = IN_RING3
1668ifeq ($(BUILD_PLATFORM),win)
1669 ifeq ($(BUILD_PLATFORM_ARCH),x86)
1670 ifdef VBOX_USE_VCC80
1671 TEMPLATE_VBOXBLDPROG_TOOL = VCC80X86
1672 else
1673 TEMPLATE_VBOXBLDPROG_TOOL = VCC70
1674 endif
1675 TEMPLATE_VBOXBLDPROG_SDKS = WIN32SDK
1676 else
1677 TEMPLATE_VBOXBLDPROG_TOOL = VCC80AMD64
1678 TEMPLATE_VBOXBLDPROG_SDKS = WIN64SDK
1679 endif
1680 ifneq ($(TEMPLATE_VBOXBLDPROG_TOOL),VCC70)
1681 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -W3 -wd4996 -Zc:wchar_t-
1682 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -RTCsu
1683 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -Oy- -GS-
1684 else
1685 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -W3
1686 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -GZ
1687 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -Ogitb2 -Oy-
1688 endif
1689 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1690 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1691 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
1692 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
1693 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1694 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
1695 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
1696 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
1697 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1698 /DISALLOWLIB:libcd.lib \
1699 /DISALLOWLIB:libcmtd.lib \
1700 /DISALLOWLIB:msvcrt.lib \
1701 /DISALLOWLIB:msvcrtd.lib \
1702 /DISALLOWLIB:msvcprt.lib \
1703 /DISALLOWLIB:msvcprtd.lib
1704 TEMPLATE_VBOXBLDPROG_LIBS = \
1705 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
1706 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt.lib \
1707 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt.lib
1708
1709else
1710# (gcc of some kind )
1711TEMPLATE_VBOXBLDPROG_TOOL = GCC3
1712TEMPLATE_VBOXBLDPROG_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1713TEMPLATE_VBOXBLDPROG_CFLAGS.debug = -fno-inline
1714TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
1715TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
1716TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
1717TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe
1718TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -fno-inline
1719TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
1720TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1721TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1722 ifeq ($(BUILD_PLATFORM),linux)
1723TEMPLATE_VBOXBLDPROG_LIBS = pthread m $(LIB_UUID) rt dl
1724 else ifeq ($(BUILD_PLATFORM),os2)
1725TEMPLATE_VBOXBLDPROG_TOOL = GCC3OMF
1726TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
1727 else ifeq ($(BUILD_PLATFORM),darwin)
1728TEMPLATE_VBOXBLDPROG_TOOL = GCC4MACHO
1729TEMPLATE_VBOXBLDPROG_LIBS =
1730 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_PLATFORM)),)
1731TEMPLATE_VBOXBLDPROG_TOOL = GCC3
1732TEMPLATE_VBOXBLDPROG_LIBS =
1733 else ifeq ($(BUILD_PLATFORM),solaris)
1734$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
1735TEMPLATE_VBOXBLDPROG_TOOL = GCC3PLAIN
1736TEMPLATE_VBOXBLDPROG_LIBS = rt
1737 else
1738$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
1739 endif
1740
1741endif # !win
1742
1743
1744
1745#
1746# Template for building R3 win32 guest additions.
1747#
1748TEMPLATE_VBOXW32GUESTR3 = VBox Win32 Guest Program
1749TEMPLATE_VBOXW32GUESTR3_INST = $(INST_ADDITIONS)
1750TEMPLATE_VBOXW32GUESTR3_BLD_TRG = win
1751TEMPLATE_VBOXW32GUESTR3_BLD_TRG_ARCH = x86
1752TEMPLATE_VBOXW32GUESTR3_BLD_TRG_CPU = i386
1753TEMPLATE_VBOXW32GUESTR3_DEFS = IN_GUEST IN_GUEST_R3 IN_RT_R3 IN_RING3 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
1754TEMPLATE_VBOXW32GUESTR3_RCDEFS = \
1755 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1756 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1757 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1758 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1759 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1760 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1761TEMPLATE_VBOXW32GUESTR3_ASTOOL = YASM
1762TEMPLATE_VBOXW32GUESTR3_ASFLAGS = -f win -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
1763TEMPLATE_VBOXW32GUESTR3_DLLSUFF = .dll
1764TEMPLATE_VBOXW32GUESTR3_EXESUFF = .exe
1765TEMPLATE_VBOXW32GUESTR3_LIBSUFF = .lib
1766TEMPLATE_VBOXW32GUESTR3_ARLIBSUFF = .lib
1767TEMPLATE_VBOXW32GUESTR3_SDKS = WIN32SDK W2K3DDKX86
1768ifdef VBOX_USE_VCC80
1769 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC80X86
1770 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
1771 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -RTCsu
1772 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -O2 -Oy- -GS-
1773else
1774 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC70
1775 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -U__LINUX__ -U__OS2__ -W3
1776 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -GZ
1777 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -Ogitb2 -Oy-
1778endif
1779TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
1780TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
1781TEMPLATE_VBOXW32GUESTR3_CFLAGS = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS)
1782TEMPLATE_VBOXW32GUESTR3_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug)
1783TEMPLATE_VBOXW32GUESTR3_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
1784TEMPLATE_VBOXW32GUESTR3_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile)
1785TEMPLATE_VBOXW32GUESTR3_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile)
1786TEMPLATE_VBOXW32GUESTR3_INCS = \
1787 $(PATH_BIN)/sdk/include
1788TEMPLATE_VBOXW32GUESTR3_LDFLAGS = \
1789 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE \
1790 /DISALLOWLIB:libc.lib \
1791 /DISALLOWLIB:libcd.lib \
1792 /DISALLOWLIB:msvcrt.lib \
1793 /DISALLOWLIB:libcmtd.lib \
1794 /DISALLOWLIB:msvcrtd.lib
1795ifdef VBOX_USE_VCC80
1796 TEMPLATE_VBOXW32GUESTR3_LIBS = \
1797 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib \
1798 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
1799 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
1800else
1801 TEMPLATE_VBOXW32GUESTR3_LIBS = \
1802 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \
1803 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
1804 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
1805endif
1806
1807#
1808# R3 win32 guest libraries
1809#
1810TEMPLATE_VBOXW32GUESTR3LIB = VBox Win32 Guest User Libraries
1811TEMPLATE_VBOXW32GUESTR3LIB_EXTENDS = VBOXW32GUESTR3
1812TEMPLATE_VBOXW32GUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
1813
1814
1815#
1816# Template for building R0 win32 guest tools.
1817#
1818TEMPLATE_VBOXW32GUESTR0 = VBox Win32 Guest Driver
1819TEMPLATE_VBOXW32GUESTR0_INST = $(INST_ADDITIONS)
1820TEMPLATE_VBOXW32GUESTR0_BLD_TRG = win
1821TEMPLATE_VBOXW32GUESTR0_BLD_TRG_ARCH = x86
1822TEMPLATE_VBOXW32GUESTR0_BLD_TRG_CPU = i386
1823TEMPLATE_VBOXW32GUESTR0_DEFS = IN_RING0 _X86_ IN_GUEST_R0 IN_RT_R0 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
1824TEMPLATE_VBOXW32GUESTR0_RCDEFS = \
1825 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1826 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1827 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1828 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1829 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1830 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1831TEMPLATE_VBOXW32GUESTR0_ASTOOL = YASM
1832TEMPLATE_VBOXW32GUESTR0_ASFLAGS = -f win32 -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
1833TEMPLATE_VBOXW32GUESTR0_SYSSUFF = .sys
1834ifdef VBOX_USE_VCC80
1835 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC80X86
1836 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
1837 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -EHs-c- -Zl
1838 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -O2 -Oy-
1839else
1840 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC70
1841 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -U__LINUX__ -U__OS2__ -W3
1842 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -GX- -Zl
1843 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -Ogitb2 -Oy-
1844endif
1845TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
1846TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
1847TEMPLATE_VBOXW32GUESTR0_CFLAGS = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS)
1848TEMPLATE_VBOXW32GUESTR0_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug)
1849TEMPLATE_VBOXW32GUESTR0_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
1850TEMPLATE_VBOXW32GUESTR0_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile)
1851TEMPLATE_VBOXW32GUESTR0_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile)
1852TEMPLATE_VBOXW32GUESTR0_LDFLAGS = \
1853 -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Machine:X86 -Debug \
1854 /DISALLOWLIB:libcd.lib \
1855 /DISALLOWLIB:msvcrt.lib \
1856 /DISALLOWLIB:msvcrtd.lib \
1857 /DISALLOWLIB:libcmtd.lib
1858
1859#
1860# R0 win32 guest libraries
1861#
1862TEMPLATE_VBOXW32GUESTR0LIB = VBox Win32 Guest Driver
1863TEMPLATE_VBOXW32GUESTR0LIB_EXTENDS = VBOXW32GUESTR0
1864TEMPLATE_VBOXW32GUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
1865
1866
1867#
1868# Windows rc workaround for crosscompiling.
1869# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
1870#
1871ifneq ($(BUILD_PLATFORM),win)
1872 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
1873 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
1874 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
1875 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
1876else
1877 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
1878 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
1879 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
1880 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
1881 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
1882 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
1883 ) Sorry_Cannot_find_mc_in_the_PSDK)
1884endif
1885
1886
1887#
1888# Template for syntax checking the linux guest additions.
1889# Not properly realized yet.
1890#
1891TEMPLATE_VBOXLNX32GUESTR0 = Template for *syntax checking* linux guest additions kernel modules
1892TEMPLATE_VBOXLNX32GUESTR0_TOOL = $(VBOX_GCC_TOOL)
1893TEMPLATE_VBOXLNX32GUESTR0_BLD_TRG = linux
1894TEMPLATE_VBOXLNX32GUESTR0_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0 IN_GUEST_R0
1895TEMPLATE_VBOXLNX32GUESTR0_INCS = $(VBOX_LINUX_INCS)
1896TEMPLATE_VBOXLNX32GUESTR0_CFLAGS = -nostdinc -iwithprefix include \
1897 -O2 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1898 $(VBOX_GCC_fno-stack-protector) -fno-strict-aliasing -fno-common \
1899 -mpreferred-stack-boundary=2 -msoft-float
1900TEMPLATE_VBOXLNX32GUESTR0_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXLNX32GUESTR0_CFLAGS)) -fno-exceptions -fno-rtti
1901ifndef VBOX_LINUX_VERSION_2_4
1902# 2.6
1903TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .ko
1904TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -m elf_i386 -r
1905else
1906# 2.4
1907TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .o
1908TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -r -s
1909endif
1910
1911
1912#
1913# Tools and templates for building 32-bit linux guest additions.
1914#
1915TOOL_VBOXLNX32NOCPPLD = Linker tool replacing the VBOX_GCC32_TOOL linker (g++).
1916TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_OUTPUT = $(outbase).map
1917TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1918TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_DEPORD =
1919define TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_CMDS
1920 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_CC) $(flags) -o $(out) $(objs)\
1921 $(foreach p,$(libpath), -L$(p))\
1922 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
1923 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_MAP,$(outbase).map)
1924endef
1925TOOL_VBOXLNX32NOCPPLD_LINK_DLL_OUTPUT = $(outbase).map
1926TOOL_VBOXLNX32NOCPPLD_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1927TOOL_VBOXLNX32NOCPPLD_LINK_DLL_DEPORD =
1928# (no SONAME for now)
1929define TOOL_VBOXLNX32NOCPPLD_LINK_DLL_CMDS
1930 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_CC) $(TOOL_$(VBOX_GCC32_TOOL)_LDFLAGS.dll) $(flags) -o $(out)\
1931 $(objs)\
1932 $(foreach p,$(libpath), -L$(p))\
1933 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
1934 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_MAP,$(outbase).map)
1935endef
1936TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_OUTPUT = $(outbase).map
1937TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1938TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_DEPORD =
1939define TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_CMDS
1940 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_LD_SYSMOD) $(TOOL_VBOXLNX32NOCPPLD_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
1941 $(foreach p,$(libpath), -L$(p))\
1942 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
1943 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_SYSMOD_MAP,$(outbase).map)
1944endef
1945
1946TEMPLATE_VBOXLNX32GUESTR3EXE = Template for building 32-bit linux guest additions programs.
1947TEMPLATE_VBOXLNX32GUESTR3EXE_INST = $(INST_ADDITIONS)
1948TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG = linux
1949TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_ARCH = x86
1950TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_CPU = i386
1951TEMPLATE_VBOXLNX32GUESTR3EXE_TOOL = $(VBOX_GCC32_TOOL)
1952TEMPLATE_VBOXLNX32GUESTR3EXE_ASTOOL = YASM
1953TEMPLATE_VBOXLNX32GUESTR3EXE_ASFLAGS = -f elf32 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels
1954TEMPLATE_VBOXLNX32GUESTR3EXE_DEFS = IN_RING3 IN_GUEST_R3 HC_ARCH_BITS=32 GC_ARCH_BITS=32
1955TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe $(VBOX_GCC_fno-stack-protector)
1956TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug = -fno-inline
1957TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
1958TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
1959TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
1960TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.release = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
1961TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug)
1962TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile)
1963TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile)
1964TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_fno-stack-protector)
1965# No LDFLAGS nor LIBS!
1966
1967TEMPLATE_VBOXLNX32GUESTR3EXENOCPP = Template for building 32-bit linux guest additions programs without any C++.
1968TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
1969TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_LDTOOL = VBOXLNX32NOCPPLD
1970# No LDFLAGS nor LIBS!
1971
1972TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP = Template for building 32-bit linux guest additions shared objects without any C++.
1973TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
1974TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDTOOL = VBOXLNX32NOCPPLD
1975TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS)
1976TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS)
1977TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDFLAGS = -fPIC
1978
1979TEMPLATE_VBOXLNX32GUESTR3LIB = Template for building 32-bit linux guest additions libraries.
1980TEMPLATE_VBOXLNX32GUESTR3LIB_EXTENDS = VBOXLNX32GUESTR3EXE
1981TEMPLATE_VBOXLNX32GUESTR3LIB_INST = $(INST_ADDITION_LIB)
1982
1983
1984#
1985# Two targets to coordinate version number changes properly. Note that the
1986# only way to get a really consistent build is to run 'kmk' in the top-level
1987# directory. If you don't run it there, you get a consistent sub-tree only.
1988#
1989VBOX_VERSION_STAMP = $(PATH_OUT)/version-stamp-$(VBOX_VERSION_MAJOR)-$(VBOX_VERSION_MINOR)-$(VBOX_VERSION_BUILD)
1990VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
1991VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
1992
1993$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
1994 $(MKDIR) -p $(@D)
1995 $(RM) -f $(filter-out $@,$(wildcard $(PATH_OUT)/version-stamp-*))
1996 $(ECHO_EXT) > $@
1997
1998$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
1999 $(MKDIR) -p $(@D)
2000 $(RM) -f $@ [email protected]
2001 $(APPEND) [email protected] "#ifndef __version_generated_h__"
2002 $(APPEND) [email protected] "#define __version_generated_h__"
2003 $(APPEND) [email protected] ""
2004 $(APPEND) [email protected] "#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)"
2005 $(APPEND) [email protected] "#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)"
2006 $(APPEND) [email protected] "#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)"
2007 $(APPEND) [email protected] '#define VBOX_VERSION_STRING "$(VBOX_VERSION)"'
2008 $(APPEND) [email protected] ""
2009 $(APPEND) [email protected] "#endif"
2010 $(MV) -f [email protected] $@
2011
2012#
2013# Used for external makefiles which cannot include Config.kmk
2014#
2015$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
2016 $(MKDIR) -p $(@D)
2017 $(RM) -f $@ [email protected]
2018 $(APPEND) [email protected] "VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)"
2019 $(APPEND) [email protected] "VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)"
2020 $(APPEND) [email protected] "VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)"
2021 $(MV) -f [email protected] $@
2022
2023
2024# Force building of the version header file as the first thing anywhere in
2025# the tree. This eliminates the need for manual dependencies on it.
2026Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2027Makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2028makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2029
2030
2031#
2032# Legacy.
2033#
2034ifneq ($(LOCALCFG),)
2035 include $(LOCALCFG)
2036endif
2037
2038
2039#
2040# Some extra goals.
2041#
2042.PHONY: up update st stat status
2043up update::
2044 svn$(HOSTSUFF_EXE) up
2045
2046st stat status:
2047 svn$(HOSTSUFF_EXE) status
2048
2049quick:
2050 $(MAKE) VBOX_QUICK=1
2051
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