VirtualBox

source: vbox/trunk/Config.kmk@ 1190

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

Ported IPRT to ring-0 OS/2.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 79.0 KB
Line 
1# $Id: Config.kmk 1190 2007-03-04 20:42:13Z 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 ($(filter-out darwin os2,$(BUILD_TARGET)),)
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_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
1119TEMPLATE_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
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 -fno-rtti -fno-exceptions
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
1184TEMPLATE_VBOXR0DRV_LIBS = $(VBOX_GCC_LIBGCC)
1185# wlink thinks physdevice doesn't need fixups and should have a stack - stupid!
1186TEMPLATE_VBOXR0DRV_LDFLAGS = -Zlinker Option -Zlinker internalrelocs, -Zlinker togglerelocs
1187endif
1188
1189ifeq ($(BUILD_TARGET),darwin)
1190TEMPLATE_VBOXR0DRV_TOOL = GCC4MACHO
1191TEMPLATE_VBOXR0DRV_DEFS += KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT
1192TEMPLATE_VBOXR0DRV_INCS += \
1193 /System/Library/Frameworks/Kernel.framework/PrivateHeaders \
1194 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Kernel.framework/Headers
1195TEMPLATE_VBOXR0DRV_CXXFLAGS = \
1196 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1197 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1198 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1199 -fapple-kext -fno-rtti -fcheck-new
1200TEMPLATE_VBOXR0DRV_CXXFLAGS.release = $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fasm-blocks
1201TEMPLATE_VBOXR0DRV_CXXFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1202TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1203TEMPLATE_VBOXR0DRV_CFLAGS = \
1204 -g -Wall -Wno-long-long -Wno-trigraphs -pipe -fno-common -nostdinc -fno-builtin -finline \
1205 -fno-keep-inline-functions -force_cpusubtype_ALL -fno-exceptions -msoft-float -static \
1206 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
1207 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1208TEMPLATE_VBOXR0DRV_CFLAGS.release = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.release)
1209TEMPLATE_VBOXR0DRV_CFLAGS.profile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.profile)
1210TEMPLATE_VBOXR0DRV_CFLAGS.kprofile = $(TEMPLATE_VBOXR0DRV_CXXFLAGS.kprofile)
1211TEMPLATE_VBOXR0DRV_LDFLAGS = -static -nostdlib -r -Wl,-Y,1455 \
1212 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
1213TEMPLATE_VBOXR0DRV_LIBS = kmodc++ kmod cc_kext cpp_kext $(VBOX_GCC_LIBGCC)
1214endif
1215
1216ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),) # pure guess work just to avoid the warning below
1217TEMPLATE_VBOXR0DRV_TOOL = $(VBOX_GCC_TOOL)
1218TEMPLATE_VBOXR0DRV_DEFS = __KERNEL__ IN_RING0 IN_RT_R0
1219TEMPLATE_VBOXR0DRV_CFLAGS = \
1220 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1221 $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing -fno-common
1222TEMPLATE_VBOXR0DRV_CFLAGS.x86 = -msoft-float
1223TEMPLATE_VBOXR0DRV_CFLAGS.amd64 = -m64 -mno-red-zone -mcmodel=kernel -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
1224 -fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
1225 -Wno-sign-compare -Wdeclaration-after-statement
1226TEMPLATE_VBOXR0DRV_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXR0DRV_CFLAGS)) -fno-exceptions -fno-rtti
1227TEMPLATE_VBOXR0DRV_SYSSUFF = .ko
1228TEMPLATE_VBOXR0DRV_LDFLAGS.x86 = -m elf_i386 -r
1229TEMPLATE_VBOXR0DRV_LDFLAGS.amd64 = -m elf_x86_64 -r
1230endif
1231
1232ifdef VBOX_WITH_VBOXDRV
1233 ifndef TEMPLATE_VBOXR0DRV_TOOL
1234 $(warning Warning: VBox Build: Target $(BUILD_PLATFORM) is not officially supported!)
1235 endif
1236endif
1237
1238
1239
1240#
1241# Template for building R3 executables and static libraries which are linked into executables.
1242#
1243TEMPLATE_VBOXR3EXE = VBox Ring 3 Exe
1244TEMPLATE_VBOXR3EXE_ASTOOL = $(VBOX_ASTOOL)
1245TEMPLATE_VBOXR3EXE_ASFLAGS = $(VBOX_ASFLAGS)
1246TEMPLATE_VBOXR3EXE_DEFS = IN_RING3 $(ARCH_BITS_DEFS)
1247TEMPLATE_VBOXR3EXE_LIBS.kprofile = $(LIB_KPROFILE)
1248ifeq ($(BUILD_TARGET),win)
1249 TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_VCC_TOOL)
1250 TEMPLATE_VBOXR3EXE_RCDEFS = \
1251 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1252 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1253 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1254 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1255 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1256 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1257 TEMPLATE_VBOXR3EXE_SDKS = WINPSDK
1258 ifdef VBOX_USE_VCC80
1259 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MD -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1260 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -RTCsu
1261 else
1262 TEMPLATE_VBOXR3EXE_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MD -W3 -wd4065 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1263 TEMPLATE_VBOXR3EXE_CXXFLAGS.debug = -GZ
1264 endif
1265 TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -Gh -GH
1266 TEMPLATE_VBOXR3EXE_CFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS)
1267 TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1268 TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1269 TEMPLATE_VBOXR3EXE_LDFLAGS = \
1270 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1271 /DISALLOWLIB:libc.lib \
1272 /DISALLOWLIB:libcd.lib \
1273 /DISALLOWLIB:libcmt.lib \
1274 /DISALLOWLIB:libcmtd.lib \
1275 /DISALLOWLIB:msvcrtd.lib
1276 TEMPLATE_VBOXR3EXE_LIBS = \
1277 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1278 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1279 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib
1280
1281else # the gcc guys
1282TEMPLATE_VBOXR3EXE_TOOL = $(VBOX_GCC_TOOL)
1283TEMPLATE_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
1284# L4 currently can't handle exception handling.
1285TEMPLATE_VBOXR3EXE_CXXFLAGS.l4 = -fno-exceptions -nostdinc \
1286 $(addprefix -I,$(VBOX_L4_GCC3_INCS) $(L4_INCDIR) $(FILE_TOOL_GPP3_INCDIR)) \
1287 $(DEBUG_L4)
1288TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = -finstrument-functions
1289TEMPLATE_VBOXR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
1290TEMPLATE_VBOXR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
1291TEMPLATE_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
1292TEMPLATE_VBOXR3EXE_CFLAGS.darwin = -fno-common
1293TEMPLATE_VBOXR3EXE_CFLAGS.l4 = -nostdinc \
1294 $(addprefix -I,$(VBOX_L4_GCC3_INCS) $(L4_INCDIR)) $(DEBUG_L4)
1295TEMPLATE_VBOXR3EXE_DEFS.l4 = L4_THREAD_SAFE
1296TEMPLATE_VBOXR3EXE_LDFLAGS.l4 = \
1297 $(L4_LIBDIR)/../crt0.o \
1298 -T$(L4_LIBDIR)/../main_dyn.ld -nostdlib \
1299 -Wl,--export-dynamic,--dynamic-linker=libld-l4.s.so \
1300 -Wl,--rpath-link,$(L4_LIBDIR)
1301 ifeq ($(BUILD_TARGET),linux)
1302TEMPLATE_VBOXR3EXE_LIBS = pthread m $(LIB_UUID) rt dl
1303 else ifeq ($(BUILD_TARGET),l4)
1304TEMPLATE_VBOXR3EXE_LIBS = \
1305 $(L4_LIBDIR)/libvboxserver.s.so \
1306 $(L4_LIBDIR)/libuc++.0.s.so \
1307 supc++ gcc_eh gcc \
1308 $(L4_LIBDIR)/libdl.s.so \
1309 $(L4_LIBDIR)/libuc.0.s.so
1310 else ifeq ($(BUILD_TARGET),os2)
1311TEMPLATE_VBOXR3EXE_TOOL = GCC3OMF
1312TEMPLATE_VBOXR3EXE_LIBS = socket iconv
1313 else ifeq ($(BUILD_TARGET),darwin)
1314TEMPLATE_VBOXR3EXE_TOOL = GCC4MACHO
1315TEMPLATE_VBOXR3EXE_LIBS =
1316TEMPLATE_VBOXR3EXE_LDFLAGS = -read_only_relocs suppress
1317 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1318TEMPLATE_VBOXR3EXE_TOOL = GCC3
1319TEMPLATE_VBOXR3EXE_LIBS = pthread
1320 else ifeq ($(BUILD_TARGET),solaris)
1321$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1322TEMPLATE_VBOXR3EXE_TOOL = GCC3PLAIN
1323TEMPLATE_VBOXR3EXE_LIBS = rt
1324 else
1325$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1326TEMPLATE_VBOXR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.release)
1327TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease)
1328 endif
1329endif
1330
1331#
1332# Template for building R3 shared objects / DLLs.
1333# This is mostly identical to the VBOXR3EXE template. (Avoid PIC if possible!)
1334#
1335TEMPLATE_VBOXR3 = VBox Ring 3 SO/DLLs
1336TEMPLATE_VBOXR3_EXTENDS = VBOXR3EXE
1337TEMPLATE_VBOXR3_LDFLAGS.l4 = $(L4_LIBDIR)/../crt0.s.o -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
1338TEMPLATE_VBOXR3_DEFS.darwin = $(TEMPLATE_VBOXR3EXE_DEFS.darwin) PIC
1339ifeq ($(BUILD_TARGET_ARCH),amd64)
1340 ifneq ($(BUILD_TARGET),win)
1341 TEMPLATE_VBOXR3_DEFS = $(TEMPLATE_VBOXR3EXE_DEFS) PIC
1342 TEMPLATE_VBOXR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -fPIC
1343 TEMPLATE_VBOXR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -fPIC
1344 TEMPLATE_VBOXR3_LDFLAGS = $(TEMPLATE_VBOXR3EXE_LDFLAGS) -fPIC
1345 endif
1346endif
1347
1348#
1349# Ring-3 testcase.
1350# This is the VBOXR3EXE template only with a different install dir.
1351#
1352TEMPLATE_VBOXR3TSTEXE = VBox Ring 3 Testcase Exe
1353TEMPLATE_VBOXR3TSTEXE_EXTENDS = VBOXR3EXE
1354TEMPLATE_VBOXR3TSTEXE_INST = $(INST_TESTCASE)
1355TEMPLATE_VBOXR3TSTEXE_LIBS = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS)
1356
1357#
1358# Template for building bad C/C++ style R3 executables (no -pedantic).
1359#
1360TEMPLATE_VBOXR3NPEXE = VBox Ring 3 Non-pedantic
1361TEMPLATE_VBOXR3NPEXE_EXTENDS = VBOXR3EXE
1362ifneq ($(BUILD_TARGET),win)
1363 # (only gcc)
1364 TEMPLATE_VBOXR3NPEXE_TOOL = $(VBOX_GCC_TOOL)
1365 TEMPLATE_VBOXR3NPEXE_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
1366 TEMPLATE_VBOXR3NPEXE_CFLAGS = $(filter-out -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations ,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
1367endif
1368
1369#
1370# Template for building bad C/C++ style R3 shared libraries / Dlls (no -pedantic).
1371# This is mostly identical to the VBOXR3NPEXE template.
1372#
1373TEMPLATE_VBOXR3NP= VBox Ring 3 Non-pedantic
1374TEMPLATE_VBOXR3NP_EXTENDS = VBOXR3NPEXE
1375TEMPLATE_VBOXR3NP_LDFLAGS.l4 = \
1376 $(L4_LIBDIR)/../crt0.s.o \
1377 -T$(L4_LIBDIR)/../main_rel.ld \
1378 -nostdlib
1379ifeq ($(BUILD_TARGET_ARCH),amd64)
1380 ifneq ($(BUILD_TARGET),win)
1381 TEMPLATE_VBOXR3NP_DEFS = $(TEMPLATE_VBOXR3NPEXE_DEFS) PIC
1382 TEMPLATE_VBOXR3NP_CFLAGS = $(TEMPLATE_VBOXR3NPEXE_CFLAGS) -fPIC
1383 TEMPLATE_VBOXR3NP_CXXFLAGS = $(TEMPLATE_VBOXR3NPEXE_CXXFLAGS) -fPIC
1384 TEMPLATE_VBOXR3NP_LDFLAGS = $(TEMPLATE_VBOXR3NPEXE_LDFLAGS) -fPIC
1385 endif
1386endif
1387
1388
1389#
1390# Template for building libraries, shared libraries / modules
1391# which only depends on IPRT for crt.
1392#
1393TEMPLATE_VBOXNOCRTGCC = VBox no-crt GCC libraries and modules, yasm/nasm.
1394TEMPLATE_VBOXNOCRTGCC_DEFS = IN_RING3 IPRT_NO_CRT $(ARCH_BITS_DEFS)
1395TEMPLATE_VBOXNOCRTGCC_ASDEFS = ASM_CALL64_GCC
1396## @todo C++
1397TEMPLATE_VBOXNOCRTGCC_CFLAGS = -nostdinc -fno-strict-aliasing -fno-math-errno -Wall
1398TEMPLATE_VBOXNOCRTGCC_CFLAGS.amd64 = -mcmodel=medium -fno-common
1399#TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O0 -fno-math-errno -fno-peephole2 -fno-strict-aliasing - for win64.
1400TEMPLATE_VBOXNOCRTGCC_CFLAGS.release = -O2 -fno-strict-aliasing
1401TEMPLATE_VBOXNOCRTGCC_CFLAGS.profile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1402TEMPLATE_VBOXNOCRTGCC_CFLAGS.kprofile = $(TEMPLATE_VBOXNOCRTGCC_CFLAGS.release)
1403TEMPLATE_VBOXNOCRTGCC_CFLAGS.darwin = -mdynamic-no-pic
1404TEMPLATE_VBOXNOCRTGCC_INCS = $(PATH_ROOT)/include/iprt/nocrt
1405
1406ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.amd64)
1407 # cross compile to 64-bit ELF (linux).
1408 TEMPLATE_VBOXNOCRTGCC_TOOL = XGCCAMD64LINUX
1409 TEMPLATE_VBOXNOCRTGCC_ASTOOL = YASM
1410 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
1411 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
1412 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1413
1414else ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1415 # Use the default GCC (MinGW) with the Microsoft linker.
1416 # (Drop all '-g' options as we're unable to strip the debug info.)
1417 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1418 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1419 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1420 TEMPLATE_VBOXNOCRTGCC_LDTOOL = $(VBOX_VCC_TOOL)
1421 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -Incremental:NO -MapInfo:Exports -NoD
1422 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1423 TEMPLATE_VBOXNOCRTGCC_CFLAGS := $(filter-out -g,$(TEMPLATE_VBOXNOCRTGCC_CFLAGS)) -s
1424
1425else
1426 # Use the default GCC.
1427 # The use of --exclude-libs ALL is to avoid confusing the linux ld.so.
1428 TEMPLATE_VBOXNOCRTGCC_TOOL = $(VBOX_GCC_TOOL)
1429 TEMPLATE_VBOXNOCRTGCC_ASTOOL = $(VBOX_ASTOOL)
1430 TEMPLATE_VBOXNOCRTGCC_ASFLAGS = $(VBOX_ASFLAGS)
1431 TEMPLATE_VBOXNOCRTGCC_LDFLAGS = -nostdlib
1432 ifneq ($(filter-out os2 darwin solaris,$(BUILD_TARGET)),)
1433 ifneq ($(BUILD_TARGET_ARCH),amd64)
1434 TEMPLATE_VBOXNOCRTGCC_LDFLAGS += -Wl,--no-undefined
1435 endif
1436 endif
1437 ifneq ($(filter-out freebsd,$(BUILD_TARGET)),)
1438 TEMPLATE_VBOXNOCRTGCC_LIBS = # FIXME - has unwind mess.
1439 else
1440 TEMPLATE_VBOXNOCRTGCC_LIBS = $(VBOX_GCC_LIBGCC)
1441 endif
1442endif
1443
1444
1445#
1446# Same as VBOXNOCRTGCC only it uses GAS as the assembler instead of yasm/nasm.
1447#
1448TEMPLATE_VBOXNOCRTGAS = VBox no-crt GCC libraries and modules, gas.
1449TEMPLATE_VBOXNOCRTGAS_EXTENDS = VBOXNOCRTGCC
1450TEMPLATE_VBOXNOCRTGAS_ASTOOL = $(TEMPLATE_VBOXNOCRTGCC_TOOL)
1451ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),win.x86)
1452 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -s
1453else
1454 TEMPLATE_VBOXNOCRTGAS_ASFLAGS = -g
1455endif
1456
1457
1458#
1459# Template for building executables that is part of the VBox MAIN component.
1460#
1461TEMPLATE_VBOXMAINEXE = VBox Main Executables
1462TEMPLATE_VBOXMAINEXE_ASTOOL = $(VBOX_ASTOOL)
1463TEMPLATE_VBOXMAINEXE_ASFLAGS = $(VBOX_ASFLAGS)
1464TEMPLATE_VBOXMAINEXE_DEFS = IN_RING3 UNICODE
1465TEMPLATE_VBOXMAINEXE_LIBS.kprofile = $(LIB_KPROFILE)
1466
1467ifeq ($(BUILD_TARGET),win)
1468 TEMPLATE_VBOXMAINEXE_SDKS = WINPSDK W2K3DDK
1469 ifdef VBOX_USE_VCC80
1470 TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_VCC_TOOL)
1471 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GF- -MD -EHsc -W3 -wd4065 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1472 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -RTCsu
1473 else
1474 TEMPLATE_VBOXMAINEXE_TOOL = VCC70
1475 TEMPLATE_VBOXMAINEXE_CXXFLAGS = -Zi -Zl -GR -GX- -GF- -MD -EHsc -W3 -wd4065 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
1476 TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -GZ
1477 endif
1478 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -Gh -GH
1479 TEMPLATE_VBOXMAINEXE_CFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1480 TEMPLATE_VBOXMAINEXE_CFLAGS.debug = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
1481 TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1482 TEMPLATE_VBOXMAINEXE_INCS = \
1483 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1484 TEMPLATE_VBOXMAINEXE_LDFLAGS = \
1485 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG\
1486 /DISALLOWLIB:libc.lib \
1487 /DISALLOWLIB:libcd.lib \
1488 /DISALLOWLIB:msvcrt.lib \
1489 /DISALLOWLIB:msvcrtd.lib \
1490 /DISALLOWLIB:libcmtd.lib \
1491 /DISALLOWLIB:libcmt.lib
1492 TEMPLATE_VBOXMAINEXE_LIBS = \
1493 $(LIB_RUNTIME) \
1494 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1495 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1496 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1497 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1498
1499else # the GCC guys:
1500
1501TEMPLATE_VBOXMAINEXE_DEFS += VBOX_WITH_XPCOM
1502TEMPLATE_VBOXMAINEXE_TOOL = $(VBOX_GCC_TOOL)
1503TEMPLATE_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
1504TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug = -fno-inline
1505TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile = -finstrument-functions
1506TEMPLATE_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
1507TEMPLATE_VBOXMAINEXE_CFLAGS.debug = -fno-inline
1508TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
1509 ifeq ($(BUILD_TARGET),linux)
1510TEMPLATE_VBOXMAINEXE_LIBS = pthread m $(LIB_UUID) rt
1511 else ifeq ($(BUILD_TARGET),l4)
1512TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1513# no libs as yet in l4 target - must be added later
1514 else ifeq ($(BUILD_TARGET),os2)
1515TEMPLATE_VBOXMAINEXE_TOOL = GCC3OMF
1516TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1517 else ifeq ($(BUILD_TARGET),darwin)
1518TEMPLATE_VBOXMAINEXE_TOOL = GCC4MACHO
1519TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1520TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin = -bind_at_load -framework Carbon
1521 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_TARGET)),)
1522TEMPLATE_VBOXMAINEXE_TOOL = GCC3
1523TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME)
1524 else ifeq ($(BUILD_TARGET),solaris)
1525$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1526TEMPLATE_VBOXMAINEXE_TOOL = GCC3PLAIN
1527TEMPLATE_VBOXMAINEXE_LIBS = $(LIB_RUNTIME) rt
1528 else
1529$(warning Warning: VBOX Build: Target $(BUILD_TARGET) is not officially supported!)
1530TEMPLATE_VBOXMAINEXE_LIBS =
1531 endif
1532
1533endif # !win
1534
1535#
1536# Template for building the Main (+GUI) components
1537# This differ from VBOXMAINEXE only in PIC handling and similar DLL stuff.
1538#
1539TEMPLATE_VBOXMAIN = VBox MAIN
1540TEMPLATE_VBOXMAIN_EXTENDS = VBOXMAINEXE
1541ifeq ($(BUILD_TARGET_ARCH),amd64)
1542 ifneq ($(BUILD_TARGET),win)
1543 TEMPLATE_VBOXMAIN_DEFS = PIC $(TEMPLATE_VBOXMAINEXE_DEFS)
1544 TEMPLATE_VBOXMAIN_CFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS)
1545 TEMPLATE_VBOXMAIN_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS)
1546 TEMPLATE_VBOXMAIN_LDFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS)
1547 endif
1548endif
1549TEMPLATE_VBOXMAIN_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin))
1550
1551#
1552# Template for building executables that is part of the VBox MAIN component.
1553# This is (pretty much) identical to VBOXMAIN except for PIC handling (which will be fixed later).
1554#
1555TEMPLATE_VBOXMAIN = VBox Main
1556TEMPLATE_VBOXMAIN_EXTENDS = VBOXMAINEXE
1557
1558
1559#
1560# Template for building executables that use the VBox MAIN component (COM stuff etc.)
1561#
1562TEMPLATE_VBOXMAINCLIENT = VBox MAIN Client
1563TEMPLATE_VBOXMAINCLIENT_EXTENDS = VBOXMAINEXE
1564TEMPLATE_VBOXMAINCLIENT_INCS = $(TEMPLATE_VBOXMAINEXE_INCS) \
1565 $(VBOX_PATH_SDK)/include
1566ifdef VBOX_WITH_XPCOM
1567TEMPLATE_VBOXMAINCLIENT_INCS += \
1568 $(VBOX_XPCOM_INCS)
1569endif
1570TEMPLATE_VBOXMAINCLIENT_LIBS = $(TEMPLATE_VBOXMAINEXE_LIBS) \
1571 $(LIB_RUNTIME)
1572ifeq ($(BUILD_TARGET),win)
1573 TEMPLATE_VBOXMAINCLIENT_LIBS.win = $(TEMPLATE_VBOXMAINEXE_LIBS.win) \
1574 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
1575 $(PATH_SDK_WINPSDK_LIB)/User32.Lib \
1576 $(PATH_SDK_WINPSDK_LIB)/Shell32.Lib \
1577 $(PATH_SDK_WINPSDK_LIB)/ShLwApi.Lib \
1578 $(PATH_SDK_WINPSDK_LIB)/Ole32.Lib \
1579 $(PATH_SDK_WINPSDK_LIB)/OleAut32.Lib \
1580 $(PATH_SDK_WINPSDK_LIB)/Uuid.Lib
1581else
1582 TEMPLATE_VBOXMAINCLIENT_LIBS = $(TEMPLATE_VBOXMAINEXE_LIBS) \
1583 $(PATH_LIB)/VBoxXPCOM$(VBOX_SUFF_LIB) \
1584 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
1585 $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL) \
1586 $(LIB_RUNTIME)
1587
1588 TEMPLATE_VBOXMAINCLIENT_DEFS = $(TEMPLATE_VBOXMAINEXE_DEFS) \
1589 NDEBUG TRIMMED
1590 ## Wonder why we compile main with defaults for these two and then drops it in the client executables...
1591 TEMPLATE_VBOXMAINCLIENT_CXXFLAGS = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS) \
1592 -fno-rtti -fno-exceptions
1593 TEMPLATE_VBOXMAINCLIENT_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \
1594 -pthread
1595 TEMPLATE_VBOXMAINCLIENT_LDFLAGS.darwin = $(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin) \
1596 -bind_at_load -framework Carbon
1597endif
1598
1599
1600#
1601# Template for building Qt GUI executables.
1602#
1603TEMPLATE_VBOXQTGUIEXE = VBox Qt GUI Executable
1604TEMPLATE_VBOXQTGUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS)
1605TEMPLATE_VBOXQTGUIEXE_INCS = \
1606 $(VBOX_PATH_SDK)/include \
1607 $(VBOX_PATH_QT)/include
1608
1609ifeq ($(BUILD_TARGET),win)
1610 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_VCC_TOOL)
1611 TEMPLATE_VBOXQTGUIEXE_DEFS += _WIN32_WINNT=0x0500 UNICODE QT_DLL _CRT_SECURE_NO_DEPRECATE
1612 ## @todo VCC70 flags?
1613 ifdef VBOX_USE_VCC80
1614 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1615 -nologo -Zm200 -W3 -MD -EHsc -Zc:wchar_t-
1616 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu
1617 else
1618 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1619 -nologo -Zm200 -W3 -MD -GX
1620 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -GZ
1621 endif
1622 TEMPLATE_VBOXQTGUIEXE_INCS += \
1623 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
1624 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = \
1625 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
1626 /DELAYLOAD:oleaut32.dll
1627 TEMPLATE_VBOXQTGUIEXE_SDKS = WINPSDK
1628 TEMPLATE_VBOXQTGUIEXE_LIBS = \
1629 $(LIB_QT) \
1630 $(LIB_QTMAIN) \
1631 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
1632 $(LIB_RUNTIME) \
1633 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
1634 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
1635 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
1636 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
1637 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
1638
1639else # the gcc guys:
1640 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_GCC_TOOL)
1641 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM
1642 TEMPLATE_VBOXQTGUIEXE_DEFS.linux = _REENTRANT
1643
1644 TEMPLATE_VBOXQTGUIEXE_INCS += \
1645 $(LIB_SDL_INC) \
1646 $(VBOX_XPCOM_INCS)
1647 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \
1648 -pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
1649 -Wno-long-long -fshort-wchar -fno-strict-aliasing
1650 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -pthread
1651 ## @todo no $(LIB_QTMAIN) here?
1652 TEMPLATE_VBOXQTGUIEXE_LIBS = \
1653 $(LIB_QT) \
1654 $(LIB_SDL) \
1655 $(PATH_LIB)/VBoxXPCOM$(VBOX_SUFF_LIB) \
1656 $(LIB_RUNTIME) \
1657 $(LIB_REM) \
1658 $(LIB_VMM) \
1659 $(PATH_LIB)/VBoxXPCOMGlue$(VBOX_SUFF_LIB) \
1660 $(PATH_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
1661
1662 TEMPLATE_VBOXQTGUIEXE_LIBPATH = \
1663 $(VBOX_PATH_QT)/lib
1664
1665 ifeq ($(BUILD_TARGET),darwin)
1666 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -framework Carbon -bind_at_load
1667 TEMPLATE_VBOXQTGUIEXE_LIBS +=
1668 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
1669 else ifeq ($(BUILD_TARGET),os2)
1670 TEMPLATE_VBOXQTGUIEXE_LIBS +=
1671 TEMPLATE_VBOXQTGUIEXE_LIBPATH +=
1672 else
1673 TEMPLATE_VBOXQTGUIEXE_LIBS += \
1674 Xext \
1675 X11 \
1676 m \
1677 $(LIB_PTHREAD)
1678 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \
1679 $(VBOX_LIBPATH_X11)
1680 endif
1681
1682endif
1683
1684#
1685# Template for building Qt GUI components.
1686#
1687TEMPLATE_VBOXQTGUI = VBox Qt GUI Components
1688TEMPLATE_VBOXQTGUI_EXTENDS = VBOXQTGUIEXE
1689TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN) $(PATH_BIN)/VBoxXML$(VBOX_SUFF_DLL),$(TEMPLATE_VBOXQTGUIEXE_LIBS))
1690ifeq ($(BUILD_TARGET),darwin)
1691 TEMPLATE_VBOXQTGUI_LDFLAGS = $(filter-out -framework Carbon -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS))
1692endif
1693ifeq ($(BUILD_TARGET_ARCH),amd64)
1694 ifneq ($(BUILD_TARGET),win)
1695 TEMPLATE_VBOXQTGUI_DEFS = PIC $(TEMPLATE_VBOXQTGUIEXE_DEFS)
1696 TEMPLATE_VBOXQTGUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CFLAGS)
1697 TEMPLATE_VBOXQTGUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS)
1698 TEMPLATE_VBOXQTGUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_LDFLAGS)
1699 endif
1700endif
1701
1702
1703#
1704# Template for building build bldprogs.
1705#
1706TEMPLATE_VBOXBLDPROG = VBox Build Program
1707TEMPLATE_VBOXBLDPROG_DEFS = IN_RING3
1708ifeq ($(BUILD_PLATFORM),win)
1709 ifeq ($(BUILD_PLATFORM_ARCH),x86)
1710 ifdef VBOX_USE_VCC80
1711 TEMPLATE_VBOXBLDPROG_TOOL = VCC80X86
1712 else
1713 TEMPLATE_VBOXBLDPROG_TOOL = VCC70
1714 endif
1715 TEMPLATE_VBOXBLDPROG_SDKS = WIN32SDK
1716 else
1717 TEMPLATE_VBOXBLDPROG_TOOL = VCC80AMD64
1718 TEMPLATE_VBOXBLDPROG_SDKS = WIN64SDK
1719 endif
1720 ifneq ($(TEMPLATE_VBOXBLDPROG_TOOL),VCC70)
1721 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -W3 -wd4996 -Zc:wchar_t-
1722 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -RTCsu
1723 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -Oy- -GS-
1724 else
1725 TEMPLATE_VBOXBLDPROG_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -W3
1726 TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -GZ
1727 TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -Ogitb2 -Oy-
1728 endif
1729 TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1730 TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1731 TEMPLATE_VBOXBLDPROG_CFLAGS = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS)
1732 TEMPLATE_VBOXBLDPROG_CFLAGS.debug = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug)
1733 TEMPLATE_VBOXBLDPROG_CFLAGS.release = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1734 TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
1735 TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
1736 TEMPLATE_VBOXBLDPROG_LDFLAGS = \
1737 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE /DEBUG \
1738 /DISALLOWLIB:libcd.lib \
1739 /DISALLOWLIB:libcmtd.lib \
1740 /DISALLOWLIB:msvcrt.lib \
1741 /DISALLOWLIB:msvcrtd.lib \
1742 /DISALLOWLIB:msvcprt.lib \
1743 /DISALLOWLIB:msvcprtd.lib
1744 TEMPLATE_VBOXBLDPROG_LIBS = \
1745 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/oldnames.lib \
1746 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcmt.lib \
1747 $(PATH_TOOL_$(TEMPLATE_VBOXBLDPROG_TOOL)_LIB)/libcpmt.lib
1748
1749else
1750# (gcc of some kind )
1751TEMPLATE_VBOXBLDPROG_TOOL = GCC3
1752TEMPLATE_VBOXBLDPROG_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs $(VBOX_GCC_Wno-variadic-macros) -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
1753TEMPLATE_VBOXBLDPROG_CFLAGS.debug = -fno-inline
1754TEMPLATE_VBOXBLDPROG_CFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
1755TEMPLATE_VBOXBLDPROG_CFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile)
1756TEMPLATE_VBOXBLDPROG_CFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile)
1757TEMPLATE_VBOXBLDPROG_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe
1758TEMPLATE_VBOXBLDPROG_CXXFLAGS.debug = -fno-inline
1759TEMPLATE_VBOXBLDPROG_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
1760TEMPLATE_VBOXBLDPROG_CXXFLAGS.profile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1761TEMPLATE_VBOXBLDPROG_CXXFLAGS.kprofile = $(TEMPLATE_VBOXBLDPROG_CXXFLAGS.release)
1762 ifeq ($(BUILD_PLATFORM),linux)
1763TEMPLATE_VBOXBLDPROG_LIBS = pthread m $(LIB_UUID) rt dl
1764 else ifeq ($(BUILD_PLATFORM),os2)
1765TEMPLATE_VBOXBLDPROG_TOOL = GCC3OMF
1766TEMPLATE_VBOXBLDPROG_LIBS = socket iconv
1767 else ifeq ($(BUILD_PLATFORM),darwin)
1768TEMPLATE_VBOXBLDPROG_TOOL = GCC4MACHO
1769TEMPLATE_VBOXBLDPROG_LIBS =
1770 else ifeq ($(filter-out freebsd netbsd openbsd,$(BUILD_PLATFORM)),)
1771TEMPLATE_VBOXBLDPROG_TOOL = GCC3
1772TEMPLATE_VBOXBLDPROG_LIBS =
1773 else ifeq ($(BUILD_PLATFORM),solaris)
1774$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
1775TEMPLATE_VBOXBLDPROG_TOOL = GCC3PLAIN
1776TEMPLATE_VBOXBLDPROG_LIBS = rt
1777 else
1778$(warning Warning: VBOX Build: Target $(BUILD_PLATFORM) is not officially supported!)
1779 endif
1780
1781endif # !win
1782
1783
1784
1785#
1786# Template for building R3 win32 guest additions.
1787#
1788TEMPLATE_VBOXW32GUESTR3 = VBox Win32 Guest Program
1789TEMPLATE_VBOXW32GUESTR3_INST = $(INST_ADDITIONS)
1790TEMPLATE_VBOXW32GUESTR3_BLD_TRG = win
1791TEMPLATE_VBOXW32GUESTR3_BLD_TRG_ARCH = x86
1792TEMPLATE_VBOXW32GUESTR3_BLD_TRG_CPU = i386
1793TEMPLATE_VBOXW32GUESTR3_DEFS = IN_GUEST IN_GUEST_R3 IN_RT_R3 IN_RING3 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
1794TEMPLATE_VBOXW32GUESTR3_RCDEFS = \
1795 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1796 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1797 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1798 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1799 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1800 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1801TEMPLATE_VBOXW32GUESTR3_ASTOOL = YASM
1802TEMPLATE_VBOXW32GUESTR3_ASFLAGS = -f win -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
1803TEMPLATE_VBOXW32GUESTR3_DLLSUFF = .dll
1804TEMPLATE_VBOXW32GUESTR3_EXESUFF = .exe
1805TEMPLATE_VBOXW32GUESTR3_LIBSUFF = .lib
1806TEMPLATE_VBOXW32GUESTR3_ARLIBSUFF = .lib
1807TEMPLATE_VBOXW32GUESTR3_SDKS = WIN32SDK W2K3DDKX86
1808ifdef VBOX_USE_VCC80
1809 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC80X86
1810 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -EHs-c- -GF- -MT -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
1811 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -RTCsu
1812 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -O2 -Oy- -GS-
1813else
1814 TEMPLATE_VBOXW32GUESTR3_TOOL = VCC70
1815 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -MT -U__LINUX__ -U__OS2__ -W3
1816 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug = -GZ
1817 TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release = -Ogitb2 -Oy-
1818endif
1819TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
1820TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
1821TEMPLATE_VBOXW32GUESTR3_CFLAGS = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS)
1822TEMPLATE_VBOXW32GUESTR3_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.debug)
1823TEMPLATE_VBOXW32GUESTR3_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.release)
1824TEMPLATE_VBOXW32GUESTR3_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.profile)
1825TEMPLATE_VBOXW32GUESTR3_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR3_CXXFLAGS.kprofile)
1826TEMPLATE_VBOXW32GUESTR3_INCS = \
1827 $(VBOX_PATH_SDK)/include
1828TEMPLATE_VBOXW32GUESTR3_LDFLAGS = \
1829 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LARGEADDRESSAWARE \
1830 /DISALLOWLIB:libc.lib \
1831 /DISALLOWLIB:libcd.lib \
1832 /DISALLOWLIB:msvcrt.lib \
1833 /DISALLOWLIB:libcmtd.lib \
1834 /DISALLOWLIB:msvcrtd.lib
1835ifdef VBOX_USE_VCC80
1836 TEMPLATE_VBOXW32GUESTR3_LIBS = \
1837 $(PATH_TOOL_VCC80X86_LIB)/oldnames.lib \
1838 $(PATH_TOOL_VCC80X86_LIB)/libcmt.lib \
1839 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
1840else
1841 TEMPLATE_VBOXW32GUESTR3_LIBS = \
1842 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \
1843 $(PATH_TOOL_VCC70_LIB)/libcmt.lib \
1844 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
1845endif
1846
1847#
1848# R3 win32 guest libraries
1849#
1850TEMPLATE_VBOXW32GUESTR3LIB = VBox Win32 Guest User Libraries
1851TEMPLATE_VBOXW32GUESTR3LIB_EXTENDS = VBOXW32GUESTR3
1852TEMPLATE_VBOXW32GUESTR3LIB_INST = $(INST_ADDITIONS_LIB)
1853
1854
1855#
1856# Template for building R0 win32 guest tools.
1857#
1858TEMPLATE_VBOXW32GUESTR0 = VBox Win32 Guest Driver
1859TEMPLATE_VBOXW32GUESTR0_INST = $(INST_ADDITIONS)
1860TEMPLATE_VBOXW32GUESTR0_BLD_TRG = win
1861TEMPLATE_VBOXW32GUESTR0_BLD_TRG_ARCH = x86
1862TEMPLATE_VBOXW32GUESTR0_BLD_TRG_CPU = i386
1863TEMPLATE_VBOXW32GUESTR0_DEFS = IN_RING0 _X86_ IN_GUEST_R0 IN_RT_R0 __WIN32__ __WIN__ HC_ARCH_BITS=32 GC_ARCH_BITS=32
1864TEMPLATE_VBOXW32GUESTR0_RCDEFS = \
1865 VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
1866 VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
1867 VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
1868 VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
1869 VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
1870 VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD)
1871TEMPLATE_VBOXW32GUESTR0_ASTOOL = YASM
1872TEMPLATE_VBOXW32GUESTR0_ASFLAGS = -f win32 -DASM_FORMAT_PE -D__YASM__ -w+orphan-labels
1873TEMPLATE_VBOXW32GUESTR0_SYSSUFF = .sys
1874ifdef VBOX_USE_VCC80
1875 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC80X86
1876 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GS- -EHs-c- -GF- -Gz -U__LINUX__ -U__OS2__ -W3 -wd4996 -Zc:wchar_t-
1877 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -EHs-c- -Zl
1878 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -O2 -Oy-
1879else
1880 TEMPLATE_VBOXW32GUESTR0_TOOL = VCC70
1881 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS = -Zi -Zl -GR- -GX- -GF- -Gz -U__LINUX__ -U__OS2__ -W3
1882 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug = -GR- -GX- -Zl
1883 TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release = -Ogitb2 -Oy-
1884endif
1885TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
1886TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
1887TEMPLATE_VBOXW32GUESTR0_CFLAGS = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS)
1888TEMPLATE_VBOXW32GUESTR0_CFLAGS.debug = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.debug)
1889TEMPLATE_VBOXW32GUESTR0_CFLAGS.release = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.release)
1890TEMPLATE_VBOXW32GUESTR0_CFLAGS.profile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.profile)
1891TEMPLATE_VBOXW32GUESTR0_CFLAGS.kprofile = $(TEMPLATE_VBOXW32GUESTR0_CXXFLAGS.kprofile)
1892TEMPLATE_VBOXW32GUESTR0_LDFLAGS = \
1893 -Driver -Subsystem:NATIVE -Incremental:NO -Align:32 -MapInfo:Exports -NoD -Machine:X86 -Debug \
1894 /DISALLOWLIB:libcd.lib \
1895 /DISALLOWLIB:msvcrt.lib \
1896 /DISALLOWLIB:msvcrtd.lib \
1897 /DISALLOWLIB:libcmtd.lib
1898
1899#
1900# R0 win32 guest libraries
1901#
1902TEMPLATE_VBOXW32GUESTR0LIB = VBox Win32 Guest Driver
1903TEMPLATE_VBOXW32GUESTR0LIB_EXTENDS = VBOXW32GUESTR0
1904TEMPLATE_VBOXW32GUESTR0LIB_INST = $(INST_ADDITIONS_LIB)
1905
1906
1907#
1908# Windows rc workaround for crosscompiling.
1909# (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
1910#
1911ifneq ($(BUILD_PLATFORM),win)
1912 TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
1913 TOOL_VCC80AMD64_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
1914 TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
1915 WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
1916else
1917 WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
1918 $(PATH_SDK_WINPSDK_BIN)/MC.Exe\
1919 $(PATH_SDK_WINPSDK)/Bin/MC.Exe\
1920 $(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
1921 $(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
1922 $(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
1923 ) Sorry_Cannot_find_mc_in_the_PSDK)
1924endif
1925
1926
1927#
1928# Template for syntax checking the linux guest additions.
1929# Not properly realized yet.
1930#
1931TEMPLATE_VBOXLNX32GUESTR0 = Template for *syntax checking* linux guest additions kernel modules
1932TEMPLATE_VBOXLNX32GUESTR0_TOOL = $(VBOX_GCC_TOOL)
1933TEMPLATE_VBOXLNX32GUESTR0_BLD_TRG = linux
1934TEMPLATE_VBOXLNX32GUESTR0_DEFS = __KERNEL__ MODULE IN_RING0 IN_RT_R0 IN_GUEST_R0
1935TEMPLATE_VBOXLNX32GUESTR0_INCS = $(VBOX_LINUX_INCS)
1936TEMPLATE_VBOXLNX32GUESTR0_CFLAGS = -nostdinc -iwithprefix include \
1937 -O2 -Wall -Wstrict-prototypes -Wno-trigraphs $(VBOX_GCC_Wno-pointer-sign) \
1938 $(VBOX_GCC_fno-stack-protector) -fno-strict-aliasing -fno-common \
1939 -mpreferred-stack-boundary=2 -msoft-float
1940TEMPLATE_VBOXLNX32GUESTR0_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wno-pointer-sign,$(TEMPLATE_VBOXLNX32GUESTR0_CFLAGS)) -fno-exceptions -fno-rtti
1941ifndef VBOX_LINUX_VERSION_2_4
1942# 2.6
1943TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .ko
1944TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -m elf_i386 -r
1945else
1946# 2.4
1947TEMPLATE_VBOXLNX32GUESTR0_SYSSUFF = .o
1948TEMPLATE_VBOXLNX32GUESTR0_LDFLAGS = -r -s
1949endif
1950
1951
1952#
1953# Tools and templates for building 32-bit linux guest additions.
1954#
1955TOOL_VBOXLNX32NOCPPLD = Linker tool replacing the VBOX_GCC32_TOOL linker (g++).
1956TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_OUTPUT = $(outbase).map
1957TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1958TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_DEPORD =
1959define TOOL_VBOXLNX32NOCPPLD_LINK_PROGRAM_CMDS
1960 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_CC) $(flags) -o $(out) $(objs)\
1961 $(foreach p,$(libpath), -L$(p))\
1962 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
1963 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_MAP,$(outbase).map)
1964endef
1965TOOL_VBOXLNX32NOCPPLD_LINK_DLL_OUTPUT = $(outbase).map
1966TOOL_VBOXLNX32NOCPPLD_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1967TOOL_VBOXLNX32NOCPPLD_LINK_DLL_DEPORD =
1968# (no SONAME for now)
1969define TOOL_VBOXLNX32NOCPPLD_LINK_DLL_CMDS
1970 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_CC) $(TOOL_$(VBOX_GCC32_TOOL)_LDFLAGS.dll) $(flags) -o $(out)\
1971 $(objs)\
1972 $(foreach p,$(libpath), -L$(p))\
1973 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
1974 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_MAP,$(outbase).map)
1975endef
1976TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_OUTPUT = $(outbase).map
1977TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
1978TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_DEPORD =
1979define TOOL_VBOXLNX32NOCPPLD_LINK_SYSMOD_CMDS
1980 $(QUIET)$(TOOL_$(VBOX_GCC32_TOOL)_LD_SYSMOD) $(TOOL_VBOXLNX32NOCPPLD_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
1981 $(foreach p,$(libpath), -L$(p))\
1982 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
1983 $(call TOOL_$(VBOX_GCC32_TOOL)_LD_SYSMOD_MAP,$(outbase).map)
1984endef
1985
1986TEMPLATE_VBOXLNX32GUESTR3EXE = Template for building 32-bit linux guest additions programs.
1987TEMPLATE_VBOXLNX32GUESTR3EXE_INST = $(INST_ADDITIONS)
1988TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG = linux
1989TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_ARCH = x86
1990TEMPLATE_VBOXLNX32GUESTR3EXE_BLD_TRG_CPU = i386
1991TEMPLATE_VBOXLNX32GUESTR3EXE_TOOL = $(VBOX_GCC32_TOOL)
1992TEMPLATE_VBOXLNX32GUESTR3EXE_ASTOOL = YASM
1993TEMPLATE_VBOXLNX32GUESTR3EXE_ASFLAGS = -f elf32 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels
1994TEMPLATE_VBOXLNX32GUESTR3EXE_DEFS = IN_RING3 IN_GUEST_R3 HC_ARCH_BITS=32 GC_ARCH_BITS=32
1995TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe $(VBOX_GCC_fno-stack-protector)
1996TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug = -fno-inline
1997TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release = -O2 -fno-omit-frame-pointer -fno-strict-aliasing
1998TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
1999TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2000TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.release = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.release)
2001TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.debug = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.debug)
2002TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.profile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.profile)
2003TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS.kprofile = $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS.kprofile)
2004TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS = -g -Wall -pedantic -Wno-long-long -Wno-trigraphs -pipe -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations $(VBOX_GCC_fno-stack-protector)
2005# No LDFLAGS nor LIBS!
2006
2007TEMPLATE_VBOXLNX32GUESTR3EXENOCPP = Template for building 32-bit linux guest additions programs without any C++.
2008TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2009TEMPLATE_VBOXLNX32GUESTR3EXENOCPP_LDTOOL = VBOXLNX32NOCPPLD
2010# No LDFLAGS nor LIBS!
2011
2012TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP = Template for building 32-bit linux guest additions shared objects without any C++.
2013TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_EXTENDS = VBOXLNX32GUESTR3EXE
2014TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDTOOL = VBOXLNX32NOCPPLD
2015TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CFLAGS)
2016TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXLNX32GUESTR3EXE_CXXFLAGS)
2017TEMPLATE_VBOXLNX32GUESTR3DLLNOCPP_LDFLAGS = -fPIC
2018
2019TEMPLATE_VBOXLNX32GUESTR3LIB = Template for building 32-bit linux guest additions libraries.
2020TEMPLATE_VBOXLNX32GUESTR3LIB_EXTENDS = VBOXLNX32GUESTR3EXE
2021TEMPLATE_VBOXLNX32GUESTR3LIB_INST = $(INST_ADDITION_LIB)
2022
2023
2024#
2025# Two targets to coordinate version number changes properly. Note that the
2026# only way to get a really consistent build is to run 'kmk' in the top-level
2027# directory. If you don't run it there, you get a consistent sub-tree only.
2028#
2029VBOX_VERSION_STAMP = $(PATH_OUT)/version-stamp-$(VBOX_VERSION_MAJOR)-$(VBOX_VERSION_MINOR)-$(VBOX_VERSION_BUILD)
2030VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
2031VBOX_VERSION_MK = $(PATH_OUT)/version-generated.mk
2032
2033$(VBOX_VERSION_STAMP): | $(PATH_ROOT)/Config.kmk
2034 $(MKDIR) -p $(@D)
2035 $(RM) -f $(filter-out $@,$(wildcard $(PATH_OUT)/version-stamp-*))
2036 $(ECHO_EXT) > $@
2037
2038$(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
2039 $(MKDIR) -p $(@D)
2040 $(RM) -f $@ $@.tmp
2041 $(APPEND) $@.tmp "#ifndef __version_generated_h__"
2042 $(APPEND) $@.tmp "#define __version_generated_h__"
2043 $(APPEND) $@.tmp ""
2044 $(APPEND) $@.tmp "#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)"
2045 $(APPEND) $@.tmp "#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)"
2046 $(APPEND) $@.tmp "#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)"
2047 $(APPEND) $@.tmp '#define VBOX_VERSION_STRING "$(VBOX_VERSION)"'
2048 $(APPEND) $@.tmp ""
2049 $(APPEND) $@.tmp "#endif"
2050 $(MV) -f $@.tmp $@
2051
2052#
2053# Used for external makefiles which cannot include Config.kmk
2054#
2055$(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
2056 $(MKDIR) -p $(@D)
2057 $(RM) -f $@ $@.tmp
2058 $(APPEND) $@.tmp "VBOX_VERSION_MAJOR = $(VBOX_VERSION_MAJOR)"
2059 $(APPEND) $@.tmp "VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)"
2060 $(APPEND) $@.tmp "VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)"
2061 $(MV) -f $@.tmp $@
2062
2063
2064# Force building of the version header file as the first thing anywhere in
2065# the tree. This eliminates the need for manual dependencies on it.
2066Makefile.kmk: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2067Makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2068makefile: | $(VBOX_VERSION_HEADER) $(VBOX_VERSION_MK)
2069
2070
2071#
2072# Legacy.
2073#
2074ifneq ($(LOCALCFG),)
2075 include $(LOCALCFG)
2076endif
2077
2078
2079#
2080# Some extra goals.
2081#
2082.PHONY: up update st stat status
2083up update::
2084 svn$(HOSTSUFF_EXE) up
2085
2086st stat status:
2087 svn$(HOSTSUFF_EXE) status
2088
2089quick:
2090 $(MAKE) VBOX_QUICK=1
2091
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