VirtualBox

source: vbox/trunk/Config.kmk@ 1

Last change on this file since 1 was 1, checked in by vboxsync, 55 years ago

import

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