VirtualBox

source: vbox/trunk/Config.kmk@ 980

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

Darwin hacking.

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