VirtualBox

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

Last change on this file since 45940 was 45561, checked in by vboxsync, 12 years ago

recompiler/Makefile.kmk: Must define VBOX_WITH_RAW_MODE. Regression from r85008.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.9 KB
Line 
1# $Id: Makefile.kmk 45561 2013-04-16 08:33:21Z 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
19SUB_DEPTH = ../..
20include $(KBUILD_PATH)/subheader.kmk
21
22#
23# Globals
24#
25VBOX_PATH_RECOMPILER_SRC := $(PATH_SUB_CURRENT)
26# Workaround for darwin hell.
27ifeq ($(KBUILD_TARGET),darwin)
28 VBOX_WITHOUT_REM_LDR_CYCLE := 1
29endif
30ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
31 VBOX_USE_MINGWW64 = 1
32endif
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#
42ifneq ($(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,)
46else
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__
65endif # win
66VBoxRemPrimary_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.
70ifdef IEM_VERIFICATION_MODE
71 VBoxRemPrimary_DEFS += IEM_VERIFICATION_MODE
72endif
73ifdef VBOX_WITH_RAW_MODE
74 VBoxRemPrimary_DEFS += VBOX_WITH_RAW_MODE
75endif
76ifdef VBOX_WITH_RAW_RING1
77 VBoxRemPrimary_DEFS += VBOX_WITH_RAW_RING1
78endif
79VBoxRemPrimary_DEFS.linux = _GNU_SOURCE
80ifdef VBOX_SOLARIS_10
81 VBoxRemPrimary_DEFS.solaris = CONFIG_SOLARIS_VERSION=10
82else
83 VBoxRemPrimary_DEFS.solaris = CONFIG_SOLARIS_VERSION=11
84endif
85VBoxRemPrimary_DEFS.freebsd += _BSD
86VBoxRemPrimary_DEFS.amd64 += __x86_64__
87VBoxRemPrimary_DEFS.x86 += __i386__
88
89VBoxRemPrimary_INCS = \
90 Sun \
91 target-i386 \
92 tcg \
93 fpu \
94 $(VBoxRemPrimary_0_OUTDIR) \
95 $(PATH_ROOT)/src/VBox/VMM/include \
96 tcg/i386 \
97 .
98ifn1of ($(VBoxRemPrimary_DEFS),DEBUG_TMP_LOGGING)
99 VBoxRemPrimary_DEFS += LOG_USE_C99
100 VBoxRemPrimary_INCS <= \
101 Sun/crt
102endif
103
104VBoxRemPrimary_SOURCES = \
105 VBoxRecompiler.c \
106 cpu-exec.c \
107 exec.c \
108 translate-all.c \
109 host-utils.c \
110 cutils.c \
111 tcg-runtime.c \
112 tcg/tcg.c \
113 tcg/tcg-dyngen.c \
114 fpu/softfloat-native.c \
115 target-i386/op_helper.c \
116 target-i386/helper.c \
117 target-i386/translate.c
118VBoxRemPrimary_SOURCES.debug += \
119 Sun/testmath.c
120VBoxRemPrimary_SOURCES.win.x86 = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
121ifdef VBOX_USE_MINGWW64
122 if 0 # exporting all helps when windbg pops up on crashes
123 VBoxRemPrimary_SOURCES.win.amd64 = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
124 else
125 VBoxRemPrimary_LDFLAGS.win.amd64 = --export-all
126 endif
127endif
128
129ifndef VBOX_USE_MINGWW64
130VBoxRemPrimary_LIBS = \
131 $(LIB_VMM) \
132 $(LIB_RUNTIME)
133else
134VBoxRemPrimary_LIBS = \
135 $(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.a \
136 $(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.a
137VBoxRemPrimary_CLEAN = \
138 $(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.a \
139 $(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.def \
140 $(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.a \
141 $(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.def
142endif
143
144VBoxRemPrimary_LDFLAGS.solaris = -mimpure-text
145VBoxRemPrimary_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
146
147
148if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64" && !defined(VBOX_USE_MINGWW64)
149 #
150 # VBoxREM2/VBoxRemPrimary - Currently only used by 64-bit Windows.
151 # (e_powl-xxx.S doesn't fit in IPRT because it requires GAS and is LGPL.)
152 #
153 SYSMODS += VBoxRemPrimary
154 VBoxRemPrimary_TEMPLATE = VBOXNOCRTGAS
155 VBoxRemPrimary_NAME = VBoxREM2
156 VBoxRemPrimary_DEFS += LOG_USE_C99 $(ARCH_BITS_DEFS)
157 VBoxRemPrimary_SOURCES += \
158 Sun/e_powl-$(KBUILD_TARGET_ARCH).S
159 VBoxRemPrimary_INCS += \
160 Sun/crt
161 VBoxRemPrimary_SYSSUFF = .rel
162 VBoxRemPrimary_LIBS = \
163 $(PATH_STAGE_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
164 VBoxRemPrimary_POST_CMDS = $(NO_SUCH_VARIABLE)
165 VBOX_REM_WRAPPER = 2
166
167else if "$(KBUILD_TARGET_ARCH)" == "x86" && defined(VBOX_WITH_64_BITS_GUESTS)
168 #
169 # For 32-bit targets when enabled 64-bit guests we build 2 REM DLLs:
170 # with 64-bit support (slow and buggy at the moment) VBOXREM64
171 # only 32-bit support (faster, stable, but not suitable for 64-bit guests) VBOXREM32
172 # During the runtime, we load appropriate library from VBOXREM, depending on guest settings.
173 # 64-bit targets have 64-bit enabled REM by default, so is not part of this mess
174 #
175
176 #
177 # VBoxREM32/VBoxRemPrimary
178 #
179 DLLS += VBoxRemPrimary
180 VBoxRemPrimary_NAME = VBoxREM32
181 VBoxRemPrimary_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM32.dylib
182 VBOX_REM_WRAPPER = 32
183
184 #
185 # VBoxREM64
186 #
187 DLLS += VBoxREM64
188 VBoxREM64_EXTENDS = VBoxRemPrimary
189 VBoxREM64_EXTENDS_BY = appending
190 VBoxREM64_NAME = VBoxREM64
191 VBoxREM64_DEFS = VBOX_ENABLE_VBOXREM64
192 VBoxREM64_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM64.dylib
193
194else
195 #
196 # VBoxREM/VBoxRemPrimary - Normal.
197 #
198 DLLS += VBoxRemPrimary
199 VBoxRemPrimary_NAME = VBoxREM
200 VBoxRemPrimary_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM3.dylib
201
202 ifdef VBOX_USE_MINGWW64
203 # GNU ld (rubenvb-4.5.4) 2.22.52.20120716 doesn't fix up rip relative
204 # addressing in the import libraries generated by microsoft link.exe. So, we
205 # have to regenerate these.
206 $$(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.a \
207 $$(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.a : $$(VBoxRemPrimary_0_OUTDIR)/$$(notdir $$(basename $$@)).def
208 $(TOOL_MINGWW64_DLLTOOL) --output-lib "$@" --input-def "$<" --dllname "$(patsubst %Imp.a,%.dll,$(notdir $@))"
209
210 $$(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.def \
211 $$(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.def : \
212 $(PATH_STAGE_BIN)/$$(patsubst %Imp.def,%.dll,$$(notdir $$@)) \
213 | $$(dir $$@)
214 $(APPEND) -nt $@ "LIBRARY $(notdir $<)" "EXPORTS"
215 $(TOOL_$(VBOX_VCC_TOOL)_DUMPBIN) /EXPORTS "$<" \
216 | $(SED) -e '/ = /!d' \
217 -e 's/^.* \([^ ][^ ]*\) = .*$(DOLLAR)/ \"\1\"/' \
218 --append $@
219 endif # VBOX_USE_MINGWW64
220
221endif
222
223
224ifdef VBOX_REM_WRAPPER
225 #
226 # VBoxREM - Wrapper for loading VBoxREM2, VBoxREM32 or VBoxREM64.
227 #
228 DLLS += VBoxREMWrapper
229 VBoxREMWrapper_TEMPLATE = VBoxR3DllWarnNoPic
230 VBoxREMWrapper_NAME = VBoxREM
231 VBoxREMWrapper_DEFS = IN_REM_R3
232 if "$(KBUILD_TARGET_ARCH)" == "x86" && defined(VBOX_WITH_64_BITS_GUESTS)
233 VBoxREMWrapper_DEFS += VBOX_USE_BITNESS_SELECTOR
234 endif
235 ifdef VBOX_WITHOUT_REM_LDR_CYCLE
236 VBoxREMWrapper_DEFS += VBOX_WITHOUT_REM_LDR_CYCLE
237 endif
238 VBoxREMWrapper_SOURCES = \
239 VBoxREMWrapper.cpp
240 if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64" && !defined(VBOX_USE_MINGWW64)
241 VBoxREMWrapper_SOURCES += \
242 VBoxREMWrapperA.asm
243 endif
244 VBoxREMWrapper_LIBS = \
245 $(LIB_RUNTIME)
246 ifndef VBOX_WITHOUT_REM_LDR_CYCLE
247 VBoxREMWrapper_LIBS += \
248 $(LIB_VMM)
249 VBoxREMWrapper_LIBS.darwin += \
250 $(TARGET_VBoxREMImp)
251 endif
252 VBoxREMWrapper_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
253endif
254
255
256#
257# The VBoxREM import library.
258#
259# This is a HACK to get around (a) the cyclic dependency between VBoxVMM and
260# VBoxREM during linking and (b) the recursive build ordering which means VBoxREM
261# won't be built until after all the other DLLs.
262#
263IMPORT_LIBS += VBoxREMImp
264VBoxREMImp_TEMPLATE = VBoxR3Dll
265 ifn1of ($(KBUILD_TARGET), os2 win)
266VBoxREMImp_NAME = VBoxREM
267 endif
268VBoxREMImp_INST = $(INST_LIB)
269VBoxREMImp_SOURCES.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
270VBoxREMImp_CLEAN.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
271VBoxREMImp_SOURCES.os2 = $(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def
272VBoxREMImp_CLEAN.os2 = $(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def
273 ifn1of ($(KBUILD_TARGET), os2 win)
274VBoxREMImp_SOURCES = $(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c
275VBoxREMImp_CLEAN = $(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c
276 endif
277 ifn1of ($(KBUILD_TARGET), darwin os2 win)
278VBoxREMImp_SONAME = VBoxREM$(SUFF_DLL)
279 endif
280ifdef VBOX_WITHOUT_REM_LDR_CYCLE
281 VBoxREMImp_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
282else
283 VBoxREMImp_LDFLAGS.darwin = -install_name $(subst @rpath,@executable_path,$(VBOX_DYLD_EXECUTABLE_PATH))/VBoxREM.dylib
284endif
285VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
286
287$$(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed $(MAKEFILE_CURRENT) | $$(dir $$@)
288 $(call MSG_GENERATE,,$@)
289 $(QUIET)$(APPEND) -t $@ '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN'
290 $(QUIET)$(APPEND) $@ '# define EXPORT __attribute__((visibility("default")))'
291 $(QUIET)$(APPEND) $@ '#else'
292 $(QUIET)$(APPEND) $@ '# define EXPORT'
293 $(QUIET)$(APPEND) $@ '#endif'
294 $(QUIET)$(APPEND) $@ ''
295 $(QUIET)$(SED) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed --append $@ $<
296
297$$(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
298 $(SED) \
299 -e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
300 -e 's/\.[Dd][Ll][Ll]//' \
301 -e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
302 --output $@ \
303 $<
304
305$$(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
306 $(CP) -f $< $@
307
308
309#
310# The math testcase as a standalone program for testing and debugging purposes.
311#
312## @todo This is a bit messy because of MINGW32.
313testmath_ASFLAGS.amd64 = -m amd64
314testmath_CFLAGS = -Wall -g
315testmath_CFLAGS.release = -O3
316testmath_LDFLAGS = -g
317testmath_DEFS = MATHTEST_STANDALONE
318testmath_SOURCES = Sun/testmath.c
319
320
321include $(FILE_KBUILD_SUB_FOOTER)
322
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