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