VirtualBox

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

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

REM/Makefile.kmk: MinGW-W64 experiments.

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