1 | # $Id: Makefile.kmk 45276 2013-04-02 08:17:11Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # The Recompiler Sub-Makefile.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2012 Oracle Corporation
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | # available from http://www.virtualbox.org. This file is free software;
|
---|
11 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | # General Public License (GPL) as published by the Free Software
|
---|
13 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | #
|
---|
17 |
|
---|
18 |
|
---|
19 | SUB_DEPTH = ../..
|
---|
20 | include $(KBUILD_PATH)/subheader.kmk
|
---|
21 |
|
---|
22 | #
|
---|
23 | # Globals
|
---|
24 | #
|
---|
25 | VBOX_PATH_RECOMPILER_SRC := $(PATH_SUB_CURRENT)
|
---|
26 | # Workaround for darwin hell.
|
---|
27 | ifeq ($(KBUILD_TARGET),darwin)
|
---|
28 | VBOX_WITHOUT_REM_LDR_CYCLE := 1
|
---|
29 | endif
|
---|
30 | ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
|
---|
31 | VBOX_USE_MINGWW64 = 1
|
---|
32 | endif
|
---|
33 |
|
---|
34 |
|
---|
35 | #
|
---|
36 | # The primary REM module definition.
|
---|
37 | #
|
---|
38 | # This is extended by one of the VBoxREM* modules below. Currently, this
|
---|
39 | # isn't done by inheritance because of some obscure bug wrt inheriting from
|
---|
40 | # unused targets that I'm not going to fix now.
|
---|
41 | #
|
---|
42 | ifneq ($(KBUILD_TARGET),win)
|
---|
43 | VBoxRemPrimary_TEMPLATE = VBOXR3NP
|
---|
44 | # workaround the regparm bug in gcc <= 3.3
|
---|
45 | VBoxRemPrimary_DEFS = $(if $(VBOX_GCC_BUGGY_REGPARM),GCC_WITH_BUGGY_REGPARM,)
|
---|
46 | else
|
---|
47 | VBoxRemPrimary_TEMPLATE = DUMMY
|
---|
48 | VBoxRemPrimary_TOOL.win.x86 = MINGW32
|
---|
49 | ifdef VBOX_USE_MINGWW64
|
---|
50 | VBoxRemPrimary_TOOL.win.amd64 = MINGWW64
|
---|
51 | else
|
---|
52 | VBoxRemPrimary_TOOL.win.amd64 = XGCCAMD64LINUX
|
---|
53 | endif
|
---|
54 | VBoxRemPrimary_SDKS.win.x86 = W32API
|
---|
55 | VBoxRemPrimary_ASFLAGS = -x assembler-with-cpp
|
---|
56 | VBoxRemPrimary_CFLAGS = -Wall -g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-shadow
|
---|
57 | VBoxRemPrimary_CFLAGS.debug = -O0
|
---|
58 | VBoxRemPrimary_CFLAGS.release += -fno-gcse -O2
|
---|
59 | VBoxRemPrimary_CFLAGS.profile = $(VBoxRemPrimary_CFLAGS.release)
|
---|
60 | VBoxRemPrimary_DEFS += IN_RING3 $(ARCH_BITS_DEFS)
|
---|
61 | # Workaround the regparm bug in gcc <= 3.3.
|
---|
62 | VBoxRemPrimary_DEFS.win.x86 += GCC_WITH_BUGGY_REGPARM
|
---|
63 | # Missing fpclassify. Is there a better define or flag for this?
|
---|
64 | VBoxRemPrimary_DEFS.solaris += __C99FEATURES__
|
---|
65 | endif # win
|
---|
66 | VBoxRemPrimary_DEFS += IN_REM_R3 REM_INCLUDE_CPU_H NEED_CPU_H
|
---|
67 | #VBoxRemPrimary_DEFS += REM_PHYS_ADDR_IN_TLB
|
---|
68 | #VBoxRemPrimary_DEFS += DEBUG_ALL_LOGGING DEBUG_DISAS DEBUG_PCALL CONFIG_DEBUG_EXEC DEBUG_FLUSH DEBUG_IOPORT DEBUG_SIGNAL DEBUG_TLB_CHECK DEBUG_TB_INVALIDATE DEBUG_TLB # Enables huge amounts of debug logging.
|
---|
69 | #VBoxRemPrimary_DEFS += DEBUG_DISAS DEBUG_PCALL CONFIG_DEBUG_EXEC DEBUG_FLUSH DEBUG_IOPORT DEBUG_SIGNAL DEBUG_TLB_CHECK DEBUG_TB_INVALIDATE DEBUG_TLB # Enables huge amounts of debug logging.
|
---|
70 | ifdef IEM_VERIFICATION_MODE
|
---|
71 | VBoxRemPrimary_DEFS += IEM_VERIFICATION_MODE
|
---|
72 | endif
|
---|
73 | ifdef VBOX_WITH_RAW_RING1
|
---|
74 | VBoxRemPrimary_DEFS += VBOX_WITH_RAW_RING1
|
---|
75 | endif
|
---|
76 | VBoxRemPrimary_DEFS.linux = _GNU_SOURCE
|
---|
77 | ifdef VBOX_SOLARIS_10
|
---|
78 | VBoxRemPrimary_DEFS.solaris = CONFIG_SOLARIS_VERSION=10
|
---|
79 | else
|
---|
80 | VBoxRemPrimary_DEFS.solaris = CONFIG_SOLARIS_VERSION=11
|
---|
81 | endif
|
---|
82 | VBoxRemPrimary_DEFS.freebsd += _BSD
|
---|
83 | VBoxRemPrimary_DEFS.amd64 += __x86_64__
|
---|
84 | VBoxRemPrimary_DEFS.x86 += __i386__
|
---|
85 |
|
---|
86 | VBoxRemPrimary_INCS = \
|
---|
87 | Sun \
|
---|
88 | target-i386 \
|
---|
89 | tcg \
|
---|
90 | fpu \
|
---|
91 | $(VBoxRemPrimary_0_OUTDIR) \
|
---|
92 | $(PATH_ROOT)/src/VBox/VMM/include \
|
---|
93 | tcg/i386 \
|
---|
94 | .
|
---|
95 | ifn1of ($(VBoxRemPrimary_DEFS),DEBUG_TMP_LOGGING)
|
---|
96 | VBoxRemPrimary_DEFS += LOG_USE_C99
|
---|
97 | VBoxRemPrimary_INCS <= \
|
---|
98 | Sun/crt
|
---|
99 | endif
|
---|
100 |
|
---|
101 | VBoxRemPrimary_SOURCES = \
|
---|
102 | VBoxRecompiler.c \
|
---|
103 | cpu-exec.c \
|
---|
104 | exec.c \
|
---|
105 | translate-all.c \
|
---|
106 | host-utils.c \
|
---|
107 | cutils.c \
|
---|
108 | tcg-runtime.c \
|
---|
109 | tcg/tcg.c \
|
---|
110 | tcg/tcg-dyngen.c \
|
---|
111 | fpu/softfloat-native.c \
|
---|
112 | target-i386/op_helper.c \
|
---|
113 | target-i386/helper.c \
|
---|
114 | target-i386/translate.c
|
---|
115 | VBoxRemPrimary_SOURCES.debug += \
|
---|
116 | Sun/testmath.c
|
---|
117 | VBoxRemPrimary_SOURCES.win.x86 = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
|
---|
118 | ifdef VBOX_USE_MINGWW64
|
---|
119 | if 0 # exporting all helps when windbg pops up on crashes
|
---|
120 | VBoxRemPrimary_SOURCES.win.amd64 = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
|
---|
121 | else
|
---|
122 | VBoxRemPrimary_LDFLAGS.win.amd64 = --export-all
|
---|
123 | endif
|
---|
124 | endif
|
---|
125 |
|
---|
126 | ifndef VBOX_USE_MINGWW64
|
---|
127 | VBoxRemPrimary_LIBS = \
|
---|
128 | $(LIB_VMM) \
|
---|
129 | $(LIB_RUNTIME)
|
---|
130 | else
|
---|
131 | VBoxRemPrimary_LIBS = \
|
---|
132 | $(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.a \
|
---|
133 | $(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.a
|
---|
134 | VBoxRemPrimary_CLEAN = \
|
---|
135 | $(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.a \
|
---|
136 | $(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.def \
|
---|
137 | $(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.a \
|
---|
138 | $(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.def
|
---|
139 | endif
|
---|
140 |
|
---|
141 | VBoxRemPrimary_LDFLAGS.solaris = -mimpure-text
|
---|
142 | VBoxRemPrimary_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
|
---|
143 |
|
---|
144 |
|
---|
145 | if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64" && !defined(VBOX_USE_MINGWW64)
|
---|
146 | #
|
---|
147 | # VBoxREM2/VBoxRemPrimary - Currently only used by 64-bit Windows.
|
---|
148 | # (e_powl-xxx.S doesn't fit in IPRT because it requires GAS and is LGPL.)
|
---|
149 | #
|
---|
150 | SYSMODS += VBoxRemPrimary
|
---|
151 | VBoxRemPrimary_TEMPLATE = VBOXNOCRTGAS
|
---|
152 | VBoxRemPrimary_NAME = VBoxREM2
|
---|
153 | VBoxRemPrimary_DEFS += LOG_USE_C99 $(ARCH_BITS_DEFS)
|
---|
154 | VBoxRemPrimary_SOURCES += \
|
---|
155 | Sun/e_powl-$(KBUILD_TARGET_ARCH).S
|
---|
156 | VBoxRemPrimary_INCS += \
|
---|
157 | Sun/crt
|
---|
158 | VBoxRemPrimary_SYSSUFF = .rel
|
---|
159 | VBoxRemPrimary_LIBS = \
|
---|
160 | $(PATH_STAGE_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
|
---|
161 | VBoxRemPrimary_POST_CMDS = $(NO_SUCH_VARIABLE)
|
---|
162 | VBOX_REM_WRAPPER = 2
|
---|
163 |
|
---|
164 | else if "$(KBUILD_TARGET_ARCH)" == "x86" && defined(VBOX_WITH_64_BITS_GUESTS)
|
---|
165 | #
|
---|
166 | # For 32-bit targets when enabled 64-bit guests we build 2 REM DLLs:
|
---|
167 | # with 64-bit support (slow and buggy at the moment) VBOXREM64
|
---|
168 | # only 32-bit support (faster, stable, but not suitable for 64-bit guests) VBOXREM32
|
---|
169 | # During the runtime, we load appropriate library from VBOXREM, depending on guest settings.
|
---|
170 | # 64-bit targets have 64-bit enabled REM by default, so is not part of this mess
|
---|
171 | #
|
---|
172 |
|
---|
173 | #
|
---|
174 | # VBoxREM32/VBoxRemPrimary
|
---|
175 | #
|
---|
176 | DLLS += VBoxRemPrimary
|
---|
177 | VBoxRemPrimary_NAME = VBoxREM32
|
---|
178 | VBoxRemPrimary_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM32.dylib
|
---|
179 | VBOX_REM_WRAPPER = 32
|
---|
180 |
|
---|
181 | #
|
---|
182 | # VBoxREM64
|
---|
183 | #
|
---|
184 | DLLS += VBoxREM64
|
---|
185 | VBoxREM64_EXTENDS = VBoxRemPrimary
|
---|
186 | VBoxREM64_EXTENDS_BY = appending
|
---|
187 | VBoxREM64_NAME = VBoxREM64
|
---|
188 | VBoxREM64_DEFS = VBOX_ENABLE_VBOXREM64
|
---|
189 | VBoxREM64_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM64.dylib
|
---|
190 |
|
---|
191 | else
|
---|
192 | #
|
---|
193 | # VBoxREM/VBoxRemPrimary - Normal.
|
---|
194 | #
|
---|
195 | DLLS += VBoxRemPrimary
|
---|
196 | VBoxRemPrimary_NAME = VBoxREM
|
---|
197 | VBoxRemPrimary_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM3.dylib
|
---|
198 |
|
---|
199 | ifdef VBOX_USE_MINGWW64
|
---|
200 | # GNU ld (rubenvb-4.5.4) 2.22.52.20120716 doesn't fix up rip relative
|
---|
201 | # addressing in the import libraries generated by microsoft link.exe. So, we
|
---|
202 | # have to regenerate these.
|
---|
203 | $$(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.a \
|
---|
204 | $$(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.a : $$(VBoxRemPrimary_0_OUTDIR)/$$(notdir $$(basename $$@)).def
|
---|
205 | $(TOOL_MINGWW64_DLLTOOL) --output-lib "$@" --input-def "$<" --dllname "$(patsubst %Imp.a,%.dll,$(notdir $@))"
|
---|
206 |
|
---|
207 | $$(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.def \
|
---|
208 | $$(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.def : \
|
---|
209 | $(PATH_STAGE_BIN)/$$(patsubst %Imp.def,%.dll,$$(notdir $$@)) \
|
---|
210 | | $$(dir $$@)
|
---|
211 | $(APPEND) -nt $@ "LIBRARY $(notdir $<)" "EXPORTS"
|
---|
212 | $(TOOL_$(VBOX_VCC_TOOL)_DUMPBIN) /EXPORTS "$<" \
|
---|
213 | | $(SED) -e '/ = /!d' \
|
---|
214 | -e 's/^.* \([^ ][^ ]*\) = .*$(DOLLAR)/ \"\1\"/' \
|
---|
215 | --append $@
|
---|
216 | endif # VBOX_USE_MINGWW64
|
---|
217 |
|
---|
218 | endif
|
---|
219 |
|
---|
220 |
|
---|
221 | ifdef VBOX_REM_WRAPPER
|
---|
222 | #
|
---|
223 | # VBoxREM - Wrapper for loading VBoxREM2, VBoxREM32 or VBoxREM64.
|
---|
224 | #
|
---|
225 | DLLS += VBoxREMWrapper
|
---|
226 | VBoxREMWrapper_TEMPLATE = VBoxR3DllWarnNoPic
|
---|
227 | VBoxREMWrapper_NAME = VBoxREM
|
---|
228 | VBoxREMWrapper_DEFS = IN_REM_R3
|
---|
229 | if "$(KBUILD_TARGET_ARCH)" == "x86" && defined(VBOX_WITH_64_BITS_GUESTS)
|
---|
230 | VBoxREMWrapper_DEFS += VBOX_USE_BITNESS_SELECTOR
|
---|
231 | endif
|
---|
232 | ifdef VBOX_WITHOUT_REM_LDR_CYCLE
|
---|
233 | VBoxREMWrapper_DEFS += VBOX_WITHOUT_REM_LDR_CYCLE
|
---|
234 | endif
|
---|
235 | VBoxREMWrapper_SOURCES = \
|
---|
236 | VBoxREMWrapper.cpp
|
---|
237 | if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64" && !defined(VBOX_USE_MINGWW64)
|
---|
238 | VBoxREMWrapper_SOURCES += \
|
---|
239 | VBoxREMWrapperA.asm
|
---|
240 | endif
|
---|
241 | VBoxREMWrapper_LIBS = \
|
---|
242 | $(LIB_RUNTIME)
|
---|
243 | ifndef VBOX_WITHOUT_REM_LDR_CYCLE
|
---|
244 | VBoxREMWrapper_LIBS += \
|
---|
245 | $(LIB_VMM)
|
---|
246 | VBoxREMWrapper_LIBS.darwin += \
|
---|
247 | $(TARGET_VBoxREMImp)
|
---|
248 | endif
|
---|
249 | VBoxREMWrapper_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
|
---|
250 | endif
|
---|
251 |
|
---|
252 |
|
---|
253 | #
|
---|
254 | # The VBoxREM import library.
|
---|
255 | #
|
---|
256 | # This is a HACK to get around (a) the cyclic dependency between VBoxVMM and
|
---|
257 | # VBoxREM during linking and (b) the recursive build ordering which means VBoxREM
|
---|
258 | # won't be built until after all the other DLLs.
|
---|
259 | #
|
---|
260 | IMPORT_LIBS += VBoxREMImp
|
---|
261 | VBoxREMImp_TEMPLATE = VBoxR3Dll
|
---|
262 | ifn1of ($(KBUILD_TARGET), os2 win)
|
---|
263 | VBoxREMImp_NAME = VBoxREM
|
---|
264 | endif
|
---|
265 | VBoxREMImp_INST = $(INST_LIB)
|
---|
266 | VBoxREMImp_SOURCES.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
|
---|
267 | VBoxREMImp_CLEAN.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
|
---|
268 | VBoxREMImp_SOURCES.os2 = $(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def
|
---|
269 | VBoxREMImp_CLEAN.os2 = $(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def
|
---|
270 | ifn1of ($(KBUILD_TARGET), os2 win)
|
---|
271 | VBoxREMImp_SOURCES = $(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c
|
---|
272 | VBoxREMImp_CLEAN = $(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c
|
---|
273 | endif
|
---|
274 | ifn1of ($(KBUILD_TARGET), darwin os2 win)
|
---|
275 | VBoxREMImp_SONAME = VBoxREM$(SUFF_DLL)
|
---|
276 | endif
|
---|
277 | ifdef VBOX_WITHOUT_REM_LDR_CYCLE
|
---|
278 | VBoxREMImp_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
|
---|
279 | else
|
---|
280 | VBoxREMImp_LDFLAGS.darwin = -install_name $(subst @rpath,@executable_path,$(VBOX_DYLD_EXECUTABLE_PATH))/VBoxREM.dylib
|
---|
281 | endif
|
---|
282 | VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
|
---|
283 |
|
---|
284 | $$(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
285 | $(call MSG_GENERATE,,$@)
|
---|
286 | $(QUIET)$(APPEND) -t $@ '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN'
|
---|
287 | $(QUIET)$(APPEND) $@ '# define EXPORT __attribute__((visibility("default")))'
|
---|
288 | $(QUIET)$(APPEND) $@ '#else'
|
---|
289 | $(QUIET)$(APPEND) $@ '# define EXPORT'
|
---|
290 | $(QUIET)$(APPEND) $@ '#endif'
|
---|
291 | $(QUIET)$(APPEND) $@ ''
|
---|
292 | $(QUIET)$(SED) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed --append $@ $<
|
---|
293 |
|
---|
294 | $$(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
295 | $(SED) \
|
---|
296 | -e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
|
---|
297 | -e 's/\.[Dd][Ll][Ll]//' \
|
---|
298 | -e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
|
---|
299 | --output $@ \
|
---|
300 | $<
|
---|
301 |
|
---|
302 | $$(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
303 | $(CP) -f $< $@
|
---|
304 |
|
---|
305 |
|
---|
306 | #
|
---|
307 | # The math testcase as a standalone program for testing and debugging purposes.
|
---|
308 | #
|
---|
309 | ## @todo This is a bit messy because of MINGW32.
|
---|
310 | testmath_ASFLAGS.amd64 = -m amd64
|
---|
311 | testmath_CFLAGS = -Wall -g
|
---|
312 | testmath_CFLAGS.release = -O3
|
---|
313 | testmath_LDFLAGS = -g
|
---|
314 | testmath_DEFS = MATHTEST_STANDALONE
|
---|
315 | testmath_SOURCES = Sun/testmath.c
|
---|
316 |
|
---|
317 |
|
---|
318 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
319 |
|
---|