VirtualBox

source: vbox/trunk/Config.kmk@ 604

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

ld suggests -bind_at_load.

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