VirtualBox

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

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

rem: Synced with v0.12.5.

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