VirtualBox

source: vbox/trunk/Config.kmk@ 788

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

made ALSA work again

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