VirtualBox

source: vbox/trunk/Config.kmk@ 995

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

join x86 and amd64 since are identical here.

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