1 | # $Id: Makefile.kmk 16059 2009-01-19 19:38:17Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # The Recompiler Sub-Makefile.
|
---|
4 | #
|
---|
5 | #
|
---|
6 | # Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
17 | # Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
18 | # additional information or have any questions.
|
---|
19 | #
|
---|
20 |
|
---|
21 |
|
---|
22 | SUB_DEPTH = ../..
|
---|
23 | include $(KBUILD_PATH)/subheader.kmk
|
---|
24 |
|
---|
25 | #
|
---|
26 | # Globals
|
---|
27 | #
|
---|
28 | VBOX_PATH_RECOMPILER_SRC := $(PATH_SUB_CURRENT)
|
---|
29 |
|
---|
30 | # For 32-bit targets when enabled 64-bit guests we build 2 REM DLLs:
|
---|
31 | # with 64-bit support (slow and buggy at the moment) VBOXREM64
|
---|
32 | # only 32-bit support (faster, stable, but not suitable for 64-bit guests) VBOXREM32
|
---|
33 | # During the runtime, we load appropriate library from VBOXREM, depending on guest settings.
|
---|
34 | # 64-bit targets have 64-bit enabled REM by default, so is not part of this mess
|
---|
35 | ifeq ($(KBUILD_TARGET_ARCH),x86)
|
---|
36 | ifdef VBOX_WITH_64_BITS_GUESTS
|
---|
37 | VBOX_USE_REM64 := 1
|
---|
38 | endif
|
---|
39 | endif
|
---|
40 |
|
---|
41 |
|
---|
42 | TEMPLATE_DUMMY = dummy template (move to kBuild) ## @todo Will be there in the next update, remove this.
|
---|
43 |
|
---|
44 | if 0
|
---|
45 | #
|
---|
46 | # Template useful for forcing a specific gcc version in case it comes in handy.
|
---|
47 | #
|
---|
48 | TOOL_MYGCC = description
|
---|
49 | TOOL_MYGCC_EXTENDS = GCC3
|
---|
50 | 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))
|
---|
51 | TOOL_MYGCC_COMPILE_C_DEPEND =
|
---|
52 | TOOL_MYGCC_COMPILE_C_DEPORD =
|
---|
53 | TOOL_MYGCC_COMPILE_C_OUTPUT =
|
---|
54 | define TOOL_MYGCC_COMPILE_C_CMDS
|
---|
55 | $(QUIET)$(TOOL_MYGCC_CC) -c\
|
---|
56 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
57 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
58 | -o $(obj)\
|
---|
59 | $(abspath $(source))
|
---|
60 | endef
|
---|
61 | #Usage: target-i386/op_helper.c_TOOL = MYGCC
|
---|
62 | endif
|
---|
63 |
|
---|
64 | ## @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).
|
---|
65 |
|
---|
66 | # For 64-bit Windows we currently use gcc (due to MSVC unaware of such a novel
|
---|
67 | # thing as C99, a lot of GCC extensions deployed by QEMU and calling convention
|
---|
68 | # differences) to cross-compile code to Linux/ELF and dynamically generate invocation wrappers.
|
---|
69 | if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), win.amd64)
|
---|
70 | VBOX_USE_REM2 = 1
|
---|
71 | REM_MOD := VBoxREM2
|
---|
72 | else
|
---|
73 | REM_MOD := VBoxREM
|
---|
74 | endif
|
---|
75 |
|
---|
76 | #
|
---|
77 | # Target lists (some of them anyways).
|
---|
78 | #
|
---|
79 | ifdef VBOX_USE_REM2
|
---|
80 | SYSMODS += VBoxREM2
|
---|
81 | else
|
---|
82 | ifndef VBOX_USE_REM64
|
---|
83 | DLLS += VBoxREM
|
---|
84 | endif
|
---|
85 | endif
|
---|
86 |
|
---|
87 |
|
---|
88 | #
|
---|
89 | # The VBoxREM.[dll|so|..] or VBoxREM2.rel.
|
---|
90 | #
|
---|
91 | ifeq ($(KBUILD_TARGET),win)
|
---|
92 | $(REM_MOD)_TEMPLATE = DUMMY
|
---|
93 | $(REM_MOD)_TOOL.win.x86 = MINGW32
|
---|
94 | $(REM_MOD)_TOOL.win.amd64 = XGCCAMD64LINUX
|
---|
95 | $(REM_MOD)_SDKS.win.x86 = W32API
|
---|
96 | $(REM_MOD)_ASFLAGS = -x assembler-with-cpp
|
---|
97 | $(REM_MOD)_CFLAGS = -Wall -g -fno-omit-frame-pointer -fno-strict-aliasing
|
---|
98 | $(REM_MOD)_CFLAGS.debug = -O0
|
---|
99 | $(REM_MOD)_CFLAGS.release += -fno-gcse -O2
|
---|
100 | $(REM_MOD)_CFLAGS.profile = $($(REM_MOD)_CFLAGS.release)
|
---|
101 | $(REM_MOD)_DEFS += IN_RING3 $(ARCH_BITS_DEFS)
|
---|
102 | # Temporary hack, to allow running with oldish GCC
|
---|
103 | $(REM_MOD)_DEFS.win.x86 += GCC_WITH_BUGGY_REGPARM
|
---|
104 | else # !win
|
---|
105 | $(REM_MOD)_TEMPLATE = VBOXR3NP
|
---|
106 | $(REM_MOD)_DEFS =
|
---|
107 | endif # !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 += VBOX_WITH_NEW_RECOMPILER
|
---|
111 | #$(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.
|
---|
112 | #$(REM_MOD)_DEFS += DEBUG_TMP_LOGGING # log qemu parts to "/tmp/vbox-qemu.log" - does not work with VBoxREM2.
|
---|
113 | $(REM_MOD)_DEFS.linux = _GNU_SOURCE
|
---|
114 | ifdef VBOX_SOLARIS_10
|
---|
115 | $(REM_MOD)_DEFS.solaris = HOST_SOLARIS=10
|
---|
116 | else
|
---|
117 | $(REM_MOD)_DEFS.solaris = HOST_SOLARIS=11
|
---|
118 | endif
|
---|
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 | .
|
---|
128 | ifn1of ($($(REM_MOD)_DEFS),DEBUG_TMP_LOGGING)
|
---|
129 | $(REM_MOD)_DEFS += LOG_USE_C99
|
---|
130 | $(REM_MOD)_INCS <= \
|
---|
131 | Sun/crt
|
---|
132 | endif
|
---|
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 |
|
---|
149 | ifeq ($(KBUILD_TARGET_ARCH),amd64)
|
---|
150 | $(REM_MOD)_DEFS += __x86_64__
|
---|
151 | $(REM_MOD)_INCS += tcg/x86_64
|
---|
152 | else
|
---|
153 | $(REM_MOD)_DEFS += __i386__
|
---|
154 | $(REM_MOD)_INCS += tcg/i386
|
---|
155 | endif
|
---|
156 |
|
---|
157 | $(REM_MOD)_SOURCES.debug += \
|
---|
158 | Sun/testmath.c
|
---|
159 | $(REM_MOD)_SOURCES.win.x86 = $(REM_MOD).def
|
---|
160 | ifndef VBOX_USE_REM2
|
---|
161 | $(REM_MOD)_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
|
---|
162 | endif
|
---|
163 | ifdef VBOX_USE_REM2
|
---|
164 | ## @todo spread out where it belongs.
|
---|
165 | $(REM_MOD)_TEMPLATE = VBOXNOCRTGAS
|
---|
166 | $(REM_MOD)_DEFS += LOG_USE_C99 $(ARCH_BITS_DEFS)
|
---|
167 |
|
---|
168 | # This doesn't fit in IPRT because it requires GAS and is LGPL.
|
---|
169 | $(REM_MOD)_SOURCES += \
|
---|
170 | Sun/e_powl-$(KBUILD_TARGET_ARCH).S
|
---|
171 |
|
---|
172 | $(REM_MOD)_INCS += \
|
---|
173 | Sun/crt
|
---|
174 | $(REM_MOD)_SYSSUFF = .rel
|
---|
175 | endif
|
---|
176 | ifdef VBOX_USE_REM2
|
---|
177 | $(REM_MOD)_LIBS = \
|
---|
178 | $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
|
---|
179 | else
|
---|
180 | $(REM_MOD)_LIBS = \
|
---|
181 | $(LIB_VMM) \
|
---|
182 | $(LIB_RUNTIME)
|
---|
183 | $(REM_MOD)_LIBS.darwin = \
|
---|
184 | $(TARGET_VBoxREMImp)
|
---|
185 | endif
|
---|
186 |
|
---|
187 | ## @todo clean up this, there are some duplicates with the template here I think.
|
---|
188 | $(REM_MOD)_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/$(REM_MOD).dylib
|
---|
189 | $(REM_MOD)_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib -Wl,--no-undefined
|
---|
190 | $(REM_MOD)_LDFLAGS.linux = $(VBOX_LD_as_needed)
|
---|
191 | $(REM_MOD)_LDFLAGS.os2 = -Zomf
|
---|
192 | $(REM_MOD)_LDFLAGS.debug = -g
|
---|
193 | $(REM_MOD)_LDFLAGS.solaris = -mimpure-text
|
---|
194 |
|
---|
195 |
|
---|
196 | if defined(VBOX_USE_REM2) || defined(VBOX_USE_REM64)
|
---|
197 | #
|
---|
198 | # The VBoxREM2 wrapper.
|
---|
199 | #
|
---|
200 | DLLS += VBoxREMWrapper
|
---|
201 | VBoxREMWrapper_TEMPLATE = VBOXR3
|
---|
202 | VBoxREMWrapper_NAME = VBoxREM
|
---|
203 | VBoxREMWrapper_DEFS = IN_REM_R3 $(if $(VBOX_WITH_VMI),VBOX_WITH_VMI,)
|
---|
204 | VBoxREMWrapper_DEFS += VBOX_WITH_NEW_RECOMPILER
|
---|
205 | ifdef VBOX_USE_REM64
|
---|
206 | VBoxREMWrapper_DEFS += VBOX_USE_BITNESS_SELECTOR
|
---|
207 | endif
|
---|
208 | VBoxREMWrapper_SOURCES = \
|
---|
209 | VBoxREMWrapper.cpp \
|
---|
210 | $(if $(VBOX_USE_REM2),VBoxREMWrapperA.asm)
|
---|
211 | VBoxREMWrapper_LIBS = \
|
---|
212 | $(LIB_VMM) \
|
---|
213 | $(LIB_RUNTIME)
|
---|
214 | VBoxREMWrapper_LIBS.darwin += \
|
---|
215 | $(TARGET_VBoxREMImp)
|
---|
216 | #VBoxREMWrapper_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
|
---|
217 | endif
|
---|
218 |
|
---|
219 |
|
---|
220 | ifdef VBOX_USE_REM64
|
---|
221 | DLLS += VBoxREM32
|
---|
222 | VBoxREM32_EXTENDS = VBoxREM
|
---|
223 | VBoxREM32_EXTENDS_BY = appending
|
---|
224 | VBoxREM32_TEMPLATE = $(VBoxREM_TEMPLATE)
|
---|
225 | VBoxREM32_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM32.dylib
|
---|
226 | VBoxREM32_LIBS.darwin = $(LIB_REM)
|
---|
227 |
|
---|
228 | DLLS += VBoxREM64
|
---|
229 | VBoxREM64_EXTENDS = VBoxREM
|
---|
230 | VBoxREM64_EXTENDS_BY = appending
|
---|
231 | VBoxREM64_TEMPLATE = $(VBoxREM_TEMPLATE)
|
---|
232 | VBoxREM64_DEFS = VBOX_ENABLE_VBOXREM64
|
---|
233 | VBoxREM64_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM64.dylib
|
---|
234 | VBoxREM64_LIBS.darwin = $(LIB_REM)
|
---|
235 |
|
---|
236 | endif # USE_VBOXREM64
|
---|
237 |
|
---|
238 |
|
---|
239 | #
|
---|
240 | # The VBoxREM import library.
|
---|
241 | #
|
---|
242 | # This is a HACK to get around (a) the cyclic dependency between VBoxVMM and
|
---|
243 | # VBoxREM during linking and (b) the recursive build ordering which means VBoxREM
|
---|
244 | # won't be built until after all the other DLLs.
|
---|
245 | #
|
---|
246 | IMPORT_LIBS += VBoxREMImp
|
---|
247 | VBoxREMImp_TEMPLATE = VBOXR3
|
---|
248 | ifn1of ($(KBUILD_TARGET), os2 win)
|
---|
249 | VBoxREMImp_NAME = VBoxREM
|
---|
250 | endif
|
---|
251 | VBoxREMImp_INST = $(INST_LIB)
|
---|
252 | VBoxREMImp_SOURCES.win = VBoxREM.def
|
---|
253 | VBoxREMImp_SOURCES.os2 = $(PATH_VBoxREMImp)/VBoxREMOS2.def
|
---|
254 | ifn1of ($(KBUILD_TARGET), os2 win)
|
---|
255 | VBoxREMImp_SOURCES = $(PATH_VBoxREMImp)/VBoxREMImp.c
|
---|
256 | VBoxREMImp_CLEAN = $(PATH_VBoxREMImp)/VBoxREMImp.c
|
---|
257 | endif
|
---|
258 | ifn1of ($(KBUILD_TARGET), darwin os2 win)
|
---|
259 | VBoxREMImp_SONAME = VBoxREM$(SUFF_DLL)
|
---|
260 | endif
|
---|
261 | VBoxREMImp_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
|
---|
262 | VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
|
---|
263 |
|
---|
264 | $$(PATH_VBoxREMImp)/VBoxREMImp.c: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
265 | $(call MSG_GENERATE,,$@)
|
---|
266 | $(QUIET)$(APPEND) -t $@ '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN'
|
---|
267 | $(QUIET)$(APPEND) $@ '# define EXPORT __attribute__((visibility("default")))'
|
---|
268 | $(QUIET)$(APPEND) $@ '#else'
|
---|
269 | $(QUIET)$(APPEND) $@ '# define EXPORT'
|
---|
270 | $(QUIET)$(APPEND) $@ '#endif'
|
---|
271 | $(QUIET)$(APPEND) $@ ''
|
---|
272 | $(QUIET)$(SED) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed --append $@ $<
|
---|
273 |
|
---|
274 | $$(PATH_VBoxREMImp)/VBoxREMOS2.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
275 | $(SED) \
|
---|
276 | -e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
|
---|
277 | -e 's/\.[Dd][Ll][Ll]//' \
|
---|
278 | -e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
|
---|
279 | --output $@ \
|
---|
280 | $<
|
---|
281 |
|
---|
282 |
|
---|
283 | #
|
---|
284 | # The math testcase as a standalone program for testing and debugging purposes.
|
---|
285 | #
|
---|
286 | ## @todo This is a bit messy because of MINGW32.
|
---|
287 | testmath_ASFLAGS.amd64 = -m amd64
|
---|
288 | testmath_CFLAGS = -Wall -g
|
---|
289 | testmath_CFLAGS.release = -O3
|
---|
290 | testmath_LDFLAGS = -g
|
---|
291 | testmath_DEFS = MATHTEST_STANDALONE
|
---|
292 | testmath_DEFS += VBOX_WITH_NEW_RECOMPILER
|
---|
293 | testmath_SOURCES = Sun/testmath.c
|
---|
294 |
|
---|
295 |
|
---|
296 | include $(KBUILD_PATH)/subfooter.kmk
|
---|