VirtualBox

source: vbox/trunk/Config.kmk@ 1130

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

introduced VBOX_WITH_WINMM; fixed comment

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