VirtualBox

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

Last change on this file since 37529 was 36768, checked in by vboxsync, 14 years ago

IEM: Initial commit, work in progress.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.3 KB
Line 
1# $Id: Makefile.kmk 36768 2011-04-20 18:33:29Z vboxsync $
2## @file
3# The Recompiler Sub-Makefile.
4#
5
6#
7# Copyright (C) 2006-2010 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
22ifn1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.x86 darwin.amd64 linux.amd64)
23 include $(PATH_SUB_CURRENT)/Makefile-old.kmk
24else # new stuff
25
26#
27# Globals
28#
29VBOX_PATH_RECOMPILER_SRC := $(PATH_SUB_CURRENT)
30# Workaround for darwin hell.
31ifeq ($(KBUILD_TARGET),darwin)
32 VBOX_WITHOUT_REM_LDR_CYCLE := 1
33endif
34
35
36#
37# The primary REM module definition.
38#
39# This is extended by one of the VBoxREM* modules below. Currently, this
40# isn't done by inheritance because of some obscure bug wrt inheriting from
41# unused targets that I'm not going to fix now.
42#
43ifneq ($(KBUILD_TARGET),win)
44 VBoxRemPrimary_TEMPLATE = VBOXR3NP
45 # workaround the regparm bug in gcc <= 3.3
46 VBoxRemPrimary_DEFS = $(if $(VBOX_GCC_BUGGY_REGPARM),GCC_WITH_BUGGY_REGPARM,)
47else
48 VBoxRemPrimary_TEMPLATE = DUMMY
49 VBoxRemPrimary_TOOL.win.x86 = MINGW32
50 VBoxRemPrimary_TOOL.win.amd64 = XGCCAMD64LINUX
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 DEBUG_EXEC DEBUG_FLUSH DEBUG_IOPORT DEBUG_SIGNAL DEBUG_TLB_CHECK DEBUG_TB_INVALIDATE DEBUG_TLB # Enables huge amounts of debug logging.
66#VBoxRemPrimary_DEFS += DEBUG_TMP_LOGGING # log qemu parts to "/tmp/vbox-qemu.log" - does not work with VBoxREM2.
67ifdef IEM_VERIFICATION_MODE
68 VBoxRemPrimary_DEFS += IEM_VERIFICATION_MODE
69endif
70VBoxRemPrimary_DEFS.linux = _GNU_SOURCE
71ifdef VBOX_SOLARIS_10
72 VBoxRemPrimary_DEFS.solaris = HOST_SOLARIS=10
73else
74 VBoxRemPrimary_DEFS.solaris = HOST_SOLARIS=11
75endif
76VBoxRemPrimary_DEFS.freebsd += _BSD
77VBoxRemPrimary_DEFS.amd64 += __x86_64__
78VBoxRemPrimary_DEFS.x86 += __i386__
79
80VBoxRemPrimary_INCS = \
81 Sun \
82 target-i386 \
83 tcg \
84 fpu \
85 $(VBoxRemPrimary_0_OUTDIR) \
86 $(PATH_ROOT)/src/VBox/VMM/include \
87 .
88VBoxRemPrimary_INCS.amd64 += tcg/x86_64
89VBoxRemPrimary_INCS.x86 += tcg/i386
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/tcg.c \
104 tcg/tcg-dyngen.c \
105 tcg/tcg-runtime.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
113
114VBoxRemPrimary_LIBS = \
115 $(LIB_VMM) \
116 $(LIB_RUNTIME)
117
118VBoxRemPrimary_LDFLAGS.solaris = -mimpure-text
119VBoxRemPrimary_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
120
121
122if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64"
123 #
124 # VBoxREM2/VBoxRemPrimary - Currently only used by 64-bit Windows.
125 # (e_powl-xxx.S doesn't fit in IPRT because it requires GAS and is LGPL.)
126 #
127 SYSMODS += VBoxRemPrimary
128 VBoxRemPrimary_TEMPLATE = VBOXNOCRTGAS
129 VBoxRemPrimary_NAME = VBoxREM2
130 VBoxRemPrimary_DEFS += LOG_USE_C99 $(ARCH_BITS_DEFS)
131 VBoxRemPrimary_SOURCES += \
132 Sun/e_powl-$(KBUILD_TARGET_ARCH).S
133 VBoxRemPrimary_INCS += \
134 Sun/crt
135 VBoxRemPrimary_SYSSUFF = .rel
136 VBoxRemPrimary_LIBS = \
137 $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
138 VBoxRemPrimary_POST_CMDS = $(NO_SUCH_VARIABLE)
139 VBOX_REM_WRAPPER = 2
140
141else if "$(KBUILD_TARGET_ARCH)" == "x86" && defined(VBOX_WITH_64_BITS_GUESTS)
142 #
143 # For 32-bit targets when enabled 64-bit guests we build 2 REM DLLs:
144 # with 64-bit support (slow and buggy at the moment) VBOXREM64
145 # only 32-bit support (faster, stable, but not suitable for 64-bit guests) VBOXREM32
146 # During the runtime, we load appropriate library from VBOXREM, depending on guest settings.
147 # 64-bit targets have 64-bit enabled REM by default, so is not part of this mess
148 #
149
150 #
151 # VBoxREM32/VBoxRemPrimary
152 #
153 DLLS += VBoxRemPrimary
154 VBoxRemPrimary_NAME = VBoxREM32
155 VBoxRemPrimary_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM32.dylib
156 VBOX_REM_WRAPPER = 32
157
158 #
159 # VBoxREM64
160 #
161 DLLS += VBoxREM64
162 VBoxREM64_EXTENDS = VBoxRemPrimary
163 VBoxREM64_EXTENDS_BY = appending
164 VBoxREM64_NAME = VBoxREM64
165 VBoxREM64_DEFS = VBOX_ENABLE_VBOXREM64
166 VBoxREM64_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM64.dylib
167
168else
169 #
170 # VBoxREM/VBoxRemPrimary - Normal.
171 #
172 DLLS += VBoxRemPrimary
173 VBoxRemPrimary_NAME = VBoxREM
174 VBoxRemPrimary_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM3.dylib
175endif
176
177
178ifdef VBOX_REM_WRAPPER
179 #
180 # VBoxREM - Wrapper for loading VBoxREM2, VBoxREM32 or VBoxREM64.
181 #
182 DLLS += VBoxREMWrapper
183 VBoxREMWrapper_TEMPLATE = VBoxR3DllWarnNoPic
184 VBoxREMWrapper_NAME = VBoxREM
185 VBoxREMWrapper_DEFS = IN_REM_R3
186 if "$(KBUILD_TARGET_ARCH)" == "x86" && defined(VBOX_WITH_64_BITS_GUESTS)
187 VBoxREMWrapper_DEFS += VBOX_USE_BITNESS_SELECTOR
188 endif
189 ifdef VBOX_WITHOUT_REM_LDR_CYCLE
190 VBoxREMWrapper_DEFS += VBOX_WITHOUT_REM_LDR_CYCLE
191 endif
192 VBoxREMWrapper_SOURCES = \
193 VBoxREMWrapper.cpp
194 if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64"
195 VBoxREMWrapper_SOURCES += \
196 VBoxREMWrapperA.asm
197 endif
198 VBoxREMWrapper_LIBS = \
199 $(LIB_RUNTIME)
200 ifndef VBOX_WITHOUT_REM_LDR_CYCLE
201 VBoxREMWrapper_LIBS += \
202 $(LIB_VMM)
203 VBoxREMWrapper_LIBS.darwin += \
204 $(TARGET_VBoxREMImp)
205 endif
206 VBoxREMWrapper_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
207endif
208
209
210#
211# The VBoxREM import library.
212#
213# This is a HACK to get around (a) the cyclic dependency between VBoxVMM and
214# VBoxREM during linking and (b) the recursive build ordering which means VBoxREM
215# won't be built until after all the other DLLs.
216#
217IMPORT_LIBS += VBoxREMImp
218VBoxREMImp_TEMPLATE = VBoxR3Dll
219 ifn1of ($(KBUILD_TARGET), os2 win)
220VBoxREMImp_NAME = VBoxREM
221 endif
222VBoxREMImp_INST = $(INST_LIB)
223VBoxREMImp_SOURCES.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
224VBoxREMImp_CLEAN.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
225VBoxREMImp_SOURCES.os2 = $(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def
226VBoxREMImp_CLEAN.os2 = $(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def
227 ifn1of ($(KBUILD_TARGET), os2 win)
228VBoxREMImp_SOURCES = $(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c
229VBoxREMImp_CLEAN = $(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c
230 endif
231 ifn1of ($(KBUILD_TARGET), darwin os2 win)
232VBoxREMImp_SONAME = VBoxREM$(SUFF_DLL)
233 endif
234ifdef VBOX_WITHOUT_REM_LDR_CYCLE
235 VBoxREMImp_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
236else
237 VBoxREMImp_LDFLAGS.darwin = -install_name $(subst @rpath,@executable_path,$(VBOX_DYLD_EXECUTABLE_PATH))/VBoxREM.dylib
238endif
239VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
240
241$$(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed $(MAKEFILE_CURRENT) | $$(dir $$@)
242 $(call MSG_GENERATE,,$@)
243 $(QUIET)$(APPEND) -t $@ '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN'
244 $(QUIET)$(APPEND) $@ '# define EXPORT __attribute__((visibility("default")))'
245 $(QUIET)$(APPEND) $@ '#else'
246 $(QUIET)$(APPEND) $@ '# define EXPORT'
247 $(QUIET)$(APPEND) $@ '#endif'
248 $(QUIET)$(APPEND) $@ ''
249 $(QUIET)$(SED) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed --append $@ $<
250
251$$(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
252 $(SED) \
253 -e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
254 -e 's/\.[Dd][Ll][Ll]//' \
255 -e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
256 --output $@ \
257 $<
258
259$$(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
260 $(CP) -f $< $@
261
262
263#
264# The math testcase as a standalone program for testing and debugging purposes.
265#
266## @todo This is a bit messy because of MINGW32.
267testmath_ASFLAGS.amd64 = -m amd64
268testmath_CFLAGS = -Wall -g
269testmath_CFLAGS.release = -O3
270testmath_LDFLAGS = -g
271testmath_DEFS = MATHTEST_STANDALONE
272testmath_SOURCES = Sun/testmath.c
273
274
275endif # new stuff
276include $(KBUILD_PATH)/subfooter.kmk
277
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