VirtualBox

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

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

Try use MinGW-W64; this changes kBuild from 2609 to 2624.

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