VirtualBox

source: vbox/trunk/src/recompiler/Makefile.kmk@ 28923

Last change on this file since 28923 was 28923, checked in by vboxsync, 15 years ago

reverted, incorrect

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.0 KB
Line 
1# $Id: Makefile.kmk 28923 2010-04-30 08:38:57Z vboxsync $
2## @file
3# The Recompiler Sub-Makefile.
4#
5#
6# Copyright (C) 2006-2007 Oracle Corporation
7#
8# This file is part of VirtualBox Open Source Edition (OSE), as
9# available from http://www.virtualbox.org. This file is free software;
10# you can redistribute it and/or modify it under the terms of the GNU
11# General Public License (GPL) as published by the Free Software
12# Foundation, in version 2 as it comes in the "COPYING" file of the
13# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15#
16
17
18SUB_DEPTH = ../..
19include $(KBUILD_PATH)/subheader.kmk
20
21#
22# Globals
23#
24VBOX_PATH_RECOMPILER_SRC := $(PATH_SUB_CURRENT)
25
26# For 32-bit targets when enabled 64-bit guests we build 2 REM DLLs:
27# with 64-bit support (slow and buggy at the moment) VBOXREM64
28# only 32-bit support (faster, stable, but not suitable for 64-bit guests) VBOXREM32
29# During the runtime, we load appropriate library from VBOXREM, depending on guest settings.
30# 64-bit targets have 64-bit enabled REM by default, so is not part of this mess
31ifeq ($(KBUILD_TARGET_ARCH),x86)
32 ifdef VBOX_WITH_64_BITS_GUESTS
33 VBOX_USE_REM64 := 1
34 endif
35endif
36
37# Workaround for darwin hell.
38ifeq ($(KBUILD_TARGET),darwin)
39 VBOX_WITHOUT_REM_LDR_CYCLE = 1
40endif
41
42
43TEMPLATE_DUMMY = dummy template (move to kBuild) ## @todo Will be there in the next update, remove this.
44
45if 0
46 #
47 # Template useful for forcing a specific gcc version in case it comes in handy.
48 #
49 TOOL_MYGCC = description
50 TOOL_MYGCC_EXTENDS = GCC3
51 TOOL_MYGCC_CC = $(firstword $(which gcc-4.2 gcc-4.1 gcc-3.4 gcc-3.4.6 gcc-3.3 gcc-3.3.6 gcc-3.2))
52 TOOL_MYGCC_COMPILE_C_DEPEND =
53 TOOL_MYGCC_COMPILE_C_DEPORD =
54 TOOL_MYGCC_COMPILE_C_OUTPUT =
55 define TOOL_MYGCC_COMPILE_C_CMDS
56 $(QUIET)$(TOOL_MYGCC_CC) -c\
57 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
58 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
59 -o $(obj)\
60 $(abspath $(source))
61 endef
62 #Usage: target-i386/op_helper.c_TOOL = MYGCC
63endif
64
65## @todo Note to self (bird): Convert this mess to use NAME (that property didn't exist when the REM_MOD hack was first made I think).
66
67# For 64-bit Windows we currently use gcc (due to MSVC unaware of such a novel
68# thing as C99, a lot of GCC extensions deployed by QEMU and calling convention
69# differences) to cross-compile code to Linux/ELF and dynamically generate invocation wrappers.
70if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), win.amd64)
71 VBOX_USE_REM2 = 1
72 REM_MOD := VBoxREM2
73else
74 REM_MOD := VBoxREM
75endif
76
77#
78# Target lists (some of them anyways).
79#
80ifdef VBOX_USE_REM2
81 SYSMODS += VBoxREM2
82else ifndef VBOX_USE_REM64
83 DLLS += VBoxREM
84endif
85
86
87#
88# The VBoxREM.[dll|so|..] or VBoxREM2.rel.
89#
90ifeq ($(KBUILD_TARGET),win)
91$(REM_MOD)_TEMPLATE = DUMMY
92$(REM_MOD)_TOOL.win.x86 = MINGW32
93$(REM_MOD)_TOOL.win.amd64 = XGCCAMD64LINUX
94$(REM_MOD)_SDKS.win.x86 = W32API
95$(REM_MOD)_ASFLAGS = -x assembler-with-cpp
96$(REM_MOD)_CFLAGS = -Wall -g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-shadow
97$(REM_MOD)_CFLAGS.debug = -O0
98$(REM_MOD)_CFLAGS.release += -fno-gcse -O2
99$(REM_MOD)_CFLAGS.profile = $($(REM_MOD)_CFLAGS.release)
100$(REM_MOD)_DEFS += IN_RING3 $(ARCH_BITS_DEFS)
101# workaround the regparm bug in gcc <= 3.3
102$(REM_MOD)_DEFS.win.x86 += GCC_WITH_BUGGY_REGPARM
103else # !win
104$(REM_MOD)_TEMPLATE = VBOXR3NP
105# workaround the regparm bug in gcc <= 3.3
106$(REM_MOD)_DEFS = $(if $(VBOX_GCC_BUGGY_REGPARM),GCC_WITH_BUGGY_REGPARM,)
107endif # !win
108$(REM_MOD)_DEFS += IN_REM_R3 REM_INCLUDE_CPU_H
109#$(REM_MOD)_DEFS += REM_PHYS_ADDR_IN_TLB
110#$(REM_MOD)_DEFS += DEBUG_ALL_LOGGING DEBUG_DISAS DEBUG_PCALL DEBUG_EXEC DEBUG_FLUSH DEBUG_IOPORT DEBUG_SIGNAL DEBUG_TLB_CHECK DEBUG_TB_INVALIDATE DEBUG_TLB # Enables huge amounts of debug logging.
111#$(REM_MOD)_DEFS += DEBUG_TMP_LOGGING # log qemu parts to "/tmp/vbox-qemu.log" - does not work with VBoxREM2.
112$(REM_MOD)_DEFS.linux = _GNU_SOURCE
113ifdef VBOX_SOLARIS_10
114 $(REM_MOD)_DEFS.solaris = HOST_SOLARIS=10
115else
116 $(REM_MOD)_DEFS.solaris = HOST_SOLARIS=11
117endif
118$(REM_MOD)_DEFS.freebsd += _BSD
119
120$(REM_MOD)_INCS = \
121 Sun \
122 target-i386 \
123 tcg \
124 fpu \
125 $(PATH_$(REM_MOD)) \
126 $(PATH_ROOT)/src/VBox/VMM \
127 .
128ifn1of ($($(REM_MOD)_DEFS),DEBUG_TMP_LOGGING)
129$(REM_MOD)_DEFS += LOG_USE_C99
130$(REM_MOD)_INCS <= \
131 Sun/crt
132endif
133
134$(REM_MOD)_SOURCES = \
135 VBoxRecompiler.c \
136 cpu-exec.c \
137 exec.c \
138 translate-all.c \
139 host-utils.c \
140 cutils.c \
141 tcg/tcg.c \
142 tcg/tcg-dyngen.c \
143 tcg/tcg-runtime.c \
144 fpu/softfloat-native.c \
145 target-i386/op_helper.c \
146 target-i386/helper.c \
147 target-i386/translate.c
148
149ifeq ($(KBUILD_TARGET_ARCH),amd64)
150 $(REM_MOD)_DEFS += __x86_64__
151 $(REM_MOD)_INCS += tcg/x86_64
152else
153 $(REM_MOD)_DEFS += __i386__
154 $(REM_MOD)_INCS += tcg/i386
155endif
156
157ifneq ($(KBUILD_TARGET),freebsd)
158$(REM_MOD)_SOURCES.debug += \
159 Sun/testmath.c
160endif
161$(REM_MOD)_SOURCES.win.x86 = $(PATH_VBoxREMImp)/VBoxREMWin.def
162ifndef VBOX_USE_REM2
163 $(REM_MOD)_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
164endif
165ifdef VBOX_USE_REM2
166## @todo spread out where it belongs.
167$(REM_MOD)_TEMPLATE = VBOXNOCRTGAS
168$(REM_MOD)_DEFS += LOG_USE_C99 $(ARCH_BITS_DEFS)
169
170# This doesn't fit in IPRT because it requires GAS and is LGPL.
171$(REM_MOD)_SOURCES += \
172 Sun/e_powl-$(KBUILD_TARGET_ARCH).S
173
174$(REM_MOD)_INCS += \
175 Sun/crt
176$(REM_MOD)_SYSSUFF = .rel
177endif
178ifdef VBOX_USE_REM2
179$(REM_MOD)_LIBS = \
180 $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
181else
182$(REM_MOD)_LIBS = \
183 $(LIB_VMM) \
184 $(LIB_RUNTIME)
185$(REM_MOD)_LIBS.darwin = \
186 $(TARGET_VBoxREMImp)
187endif
188
189## @todo clean up this, there are some duplicates with the template here I think.
190$(REM_MOD)_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/$(REM_MOD).dylib
191$(REM_MOD)_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib -Wl,--no-undefined
192$(REM_MOD)_LDFLAGS.linux = $(VBOX_LD_as_needed)
193$(REM_MOD)_LDFLAGS.os2 = -Zomf
194$(REM_MOD)_LDFLAGS.debug = -g
195$(REM_MOD)_LDFLAGS.solaris = -mimpure-text
196
197
198if defined(VBOX_USE_REM2) || defined(VBOX_USE_REM64)
199#
200# The VBoxREM2, VBoxREM32 and VBoxREM64 wrapper.
201#
202DLLS += VBoxREMWrapper
203VBoxREMWrapper_TEMPLATE = VBOXR3
204VBoxREMWrapper_NAME = VBoxREM
205VBoxREMWrapper_DEFS = IN_REM_R3 $(if $(VBOX_WITH_VMI),VBOX_WITH_VMI,)
206 ifdef VBOX_USE_REM64
207VBoxREMWrapper_DEFS += VBOX_USE_BITNESS_SELECTOR
208 endif
209 ifdef VBOX_WITHOUT_REM_LDR_CYCLE
210VBoxREMWrapper_DEFS += VBOX_WITHOUT_REM_LDR_CYCLE
211 endif
212VBoxREMWrapper_SOURCES = \
213 VBoxREMWrapper.cpp
214 ifdef VBOX_USE_REM2
215VBoxREMWrapper_SOURCES += \
216 VBoxREMWrapperA.asm
217 endif
218VBoxREMWrapper_LIBS = \
219 $(LIB_RUNTIME)
220 ifndef VBOX_WITHOUT_REM_LDR_CYCLE
221VBoxREMWrapper_LIBS += \
222 $(LIB_VMM)
223VBoxREMWrapper_LIBS.darwin += \
224 $(TARGET_VBoxREMImp)
225 else
226VBoxREMWrapper_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
227 endif
228endif
229
230
231ifdef VBOX_USE_REM64
232 DLLS += VBoxREM32
233 VBoxREM32_EXTENDS = VBoxREM
234 VBoxREM32_EXTENDS_BY = appending
235 VBoxREM32_TEMPLATE = $(VBoxREM_TEMPLATE)
236 VBoxREM32_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM32.dylib
237 VBoxREM32_LIBS.darwin = $(LIB_REM)
238
239 DLLS += VBoxREM64
240 VBoxREM64_EXTENDS = VBoxREM
241 VBoxREM64_EXTENDS_BY = appending
242 VBoxREM64_TEMPLATE = $(VBoxREM_TEMPLATE)
243 VBoxREM64_DEFS = VBOX_ENABLE_VBOXREM64
244 VBoxREM64_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM64.dylib
245 VBoxREM64_LIBS.darwin = $(LIB_REM)
246
247endif # USE_VBOXREM64
248
249
250#
251# The VBoxREM import library.
252#
253# This is a HACK to get around (a) the cyclic dependency between VBoxVMM and
254# VBoxREM during linking and (b) the recursive build ordering which means VBoxREM
255# won't be built until after all the other DLLs.
256#
257IMPORT_LIBS += VBoxREMImp
258VBoxREMImp_TEMPLATE = VBOXR3
259 ifn1of ($(KBUILD_TARGET), os2 win)
260VBoxREMImp_NAME = VBoxREM
261 endif
262VBoxREMImp_INST = $(INST_LIB)
263VBoxREMImp_SOURCES.win = $(PATH_VBoxREMImp)/VBoxREMWin.def
264VBoxREMImp_CLEAN.win = $(PATH_VBoxREMImp)/VBoxREMWin.def
265VBoxREMImp_SOURCES.os2 = $(PATH_VBoxREMImp)/VBoxREMOS2.def
266VBoxREMImp_CLEAN.os2 = $(PATH_VBoxREMImp)/VBoxREMOS2.def
267 ifn1of ($(KBUILD_TARGET), os2 win)
268VBoxREMImp_SOURCES = $(PATH_VBoxREMImp)/VBoxREMImp.c
269VBoxREMImp_CLEAN = $(PATH_VBoxREMImp)/VBoxREMImp.c
270 endif
271 ifn1of ($(KBUILD_TARGET), darwin os2 win)
272VBoxREMImp_SONAME = VBoxREM$(SUFF_DLL)
273 endif
274ifdef VBOX_WITHOUT_REM_LDR_CYCLE
275 VBoxREMImp_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
276else
277 VBoxREMImp_LDFLAGS.darwin = -install_name $(subst @rpath,@executable_path,$(VBOX_DYLD_EXECUTABLE_PATH))/VBoxREM.dylib
278endif
279VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
280
281$$(PATH_VBoxREMImp)/VBoxREMImp.c: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed $(MAKEFILE_CURRENT) | $$(dir $$@)
282 $(call MSG_GENERATE,,$@)
283 $(QUIET)$(APPEND) -t $@ '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN'
284 $(QUIET)$(APPEND) $@ '# define EXPORT __attribute__((visibility("default")))'
285 $(QUIET)$(APPEND) $@ '#else'
286 $(QUIET)$(APPEND) $@ '# define EXPORT'
287 $(QUIET)$(APPEND) $@ '#endif'
288 $(QUIET)$(APPEND) $@ ''
289 $(QUIET)$(SED) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed --append $@ $<
290
291$$(PATH_VBoxREMImp)/VBoxREMOS2.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
292 $(SED) \
293 -e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
294 -e 's/\.[Dd][Ll][Ll]//' \
295 -e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
296 --output $@ \
297 $<
298
299$$(PATH_VBoxREMImp)/VBoxREMWin.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
300 $(CP) -f $< $@
301
302
303#
304# The math testcase as a standalone program for testing and debugging purposes.
305#
306## @todo This is a bit messy because of MINGW32.
307testmath_ASFLAGS.amd64 = -m amd64
308testmath_CFLAGS = -Wall -g
309testmath_CFLAGS.release = -O3
310testmath_LDFLAGS = -g
311testmath_DEFS = MATHTEST_STANDALONE
312testmath_SOURCES = Sun/testmath.c
313
314
315include $(KBUILD_PATH)/subfooter.kmk
316
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