1 | # $Id: Makefile-old.kmk 35340 2010-12-27 13:45:49Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # The OLD Recompiler Sub-Makefile body.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2007 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 |
|
---|
20 | #
|
---|
21 | # Globals
|
---|
22 | #
|
---|
23 | VBOX_PATH_RECOMPILER_SRC := $(PATH_SUB_CURRENT)
|
---|
24 |
|
---|
25 | # For 32-bit targets when enabled 64-bit guests we build 2 REM DLLs:
|
---|
26 | # with 64-bit support (slow and buggy at the moment) VBOXREM64
|
---|
27 | # only 32-bit support (faster, stable, but not suitable for 64-bit guests) VBOXREM32
|
---|
28 | # During the runtime, we load appropriate library from VBOXREM, depending on guest settings.
|
---|
29 | # 64-bit targets have 64-bit enabled REM by default, so is not part of this mess
|
---|
30 | ifeq ($(KBUILD_TARGET_ARCH),x86)
|
---|
31 | ifdef VBOX_WITH_64_BITS_GUESTS
|
---|
32 | VBOX_USE_REM64 := 1
|
---|
33 | endif
|
---|
34 | endif
|
---|
35 |
|
---|
36 | # Workaround for darwin hell.
|
---|
37 | ifeq ($(KBUILD_TARGET),darwin)
|
---|
38 | VBOX_WITHOUT_REM_LDR_CYCLE = 1
|
---|
39 | endif
|
---|
40 |
|
---|
41 |
|
---|
42 | TEMPLATE_DUMMY = dummy template (move to kBuild) ## @todo Will be there in the next update, remove this.
|
---|
43 |
|
---|
44 | if 0
|
---|
45 | #
|
---|
46 | # Template useful for forcing a specific gcc version in case it comes in handy.
|
---|
47 | #
|
---|
48 | TOOL_MYGCC = description
|
---|
49 | TOOL_MYGCC_EXTENDS = GCC3
|
---|
50 | TOOL_MYGCC_CC = $(firstword $(which gcc-4.2 gcc-4.1 gcc-3.4 gcc-3.4.6 gcc-3.3 gcc-3.3.6 gcc-3.2))
|
---|
51 | TOOL_MYGCC_COMPILE_C_DEPEND =
|
---|
52 | TOOL_MYGCC_COMPILE_C_DEPORD =
|
---|
53 | TOOL_MYGCC_COMPILE_C_OUTPUT =
|
---|
54 | define TOOL_MYGCC_COMPILE_C_CMDS
|
---|
55 | $(QUIET)$(TOOL_MYGCC_CC) -c\
|
---|
56 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
57 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
58 | -o $(obj)\
|
---|
59 | $(abspath $(source))
|
---|
60 | endef
|
---|
61 | #Usage: target-i386/op_helper.c_TOOL = MYGCC
|
---|
62 | endif
|
---|
63 |
|
---|
64 | ## @todo Note to self (bird): Convert this mess to use NAME (that property didn't exist when the REM_MOD hack was first made I think).
|
---|
65 |
|
---|
66 | # For 64-bit Windows we currently use gcc (due to MSVC unaware of such a novel
|
---|
67 | # thing as C99, a lot of GCC extensions deployed by QEMU and calling convention
|
---|
68 | # differences) to cross-compile code to Linux/ELF and dynamically generate invocation wrappers.
|
---|
69 | if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), win.amd64)
|
---|
70 | VBOX_USE_REM2 = 1
|
---|
71 | REM_MOD := VBoxREM2
|
---|
72 | else
|
---|
73 | REM_MOD := VBoxREM
|
---|
74 | endif
|
---|
75 |
|
---|
76 | #
|
---|
77 | # Target lists (some of them anyways).
|
---|
78 | #
|
---|
79 | ifdef VBOX_USE_REM2
|
---|
80 | SYSMODS += VBoxREM2
|
---|
81 | else ifndef VBOX_USE_REM64
|
---|
82 | DLLS += VBoxREM
|
---|
83 | endif
|
---|
84 |
|
---|
85 |
|
---|
86 | #
|
---|
87 | # The VBoxREM.[dll|so|..] or VBoxREM2.rel.
|
---|
88 | #
|
---|
89 | ifeq ($(KBUILD_TARGET),win)
|
---|
90 | $(REM_MOD)_TEMPLATE = DUMMY
|
---|
91 | $(REM_MOD)_TOOL.win.x86 = MINGW32
|
---|
92 | $(REM_MOD)_TOOL.win.amd64 = XGCCAMD64LINUX
|
---|
93 | $(REM_MOD)_SDKS.win.x86 = W32API
|
---|
94 | $(REM_MOD)_ASFLAGS = -x assembler-with-cpp
|
---|
95 | $(REM_MOD)_CFLAGS = -Wall -g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-shadow
|
---|
96 | $(REM_MOD)_CFLAGS.debug = -O0
|
---|
97 | $(REM_MOD)_CFLAGS.release += -fno-gcse -O2
|
---|
98 | $(REM_MOD)_CFLAGS.profile = $($(REM_MOD)_CFLAGS.release)
|
---|
99 | $(REM_MOD)_DEFS += IN_RING3 $(ARCH_BITS_DEFS)
|
---|
100 | # workaround the regparm bug in gcc <= 3.3
|
---|
101 | $(REM_MOD)_DEFS.win.x86 += GCC_WITH_BUGGY_REGPARM
|
---|
102 | else # !win
|
---|
103 | $(REM_MOD)_TEMPLATE = VBOXR3NP
|
---|
104 | # workaround the regparm bug in gcc <= 3.3
|
---|
105 | $(REM_MOD)_DEFS = $(if $(VBOX_GCC_BUGGY_REGPARM),GCC_WITH_BUGGY_REGPARM,)
|
---|
106 | endif # !win
|
---|
107 | $(REM_MOD)_DEFS += IN_REM_R3 REM_INCLUDE_CPU_H
|
---|
108 | #$(REM_MOD)_DEFS += REM_PHYS_ADDR_IN_TLB
|
---|
109 | #$(REM_MOD)_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.
|
---|
110 | #$(REM_MOD)_DEFS += DEBUG_TMP_LOGGING # log qemu parts to "/tmp/vbox-qemu.log" - does not work with VBoxREM2.
|
---|
111 | $(REM_MOD)_DEFS.linux = _GNU_SOURCE
|
---|
112 | ifdef VBOX_SOLARIS_10
|
---|
113 | $(REM_MOD)_DEFS.solaris = HOST_SOLARIS=10
|
---|
114 | else
|
---|
115 | $(REM_MOD)_DEFS.solaris = HOST_SOLARIS=11
|
---|
116 | endif
|
---|
117 | # Missing fpclassify. Is there a better define or flag for this?
|
---|
118 | $(REM_MOD)_DEFS.solaris += __C99FEATURES__
|
---|
119 | $(REM_MOD)_DEFS.freebsd += _BSD
|
---|
120 |
|
---|
121 | $(REM_MOD)_INCS = \
|
---|
122 | Sun \
|
---|
123 | target-i386 \
|
---|
124 | tcg \
|
---|
125 | fpu \
|
---|
126 | $(PATH_$(REM_MOD)) \
|
---|
127 | $(PATH_ROOT)/src/VBox/VMM/include \
|
---|
128 | .
|
---|
129 | ifn1of ($($(REM_MOD)_DEFS),DEBUG_TMP_LOGGING)
|
---|
130 | $(REM_MOD)_DEFS += LOG_USE_C99
|
---|
131 | $(REM_MOD)_INCS <= \
|
---|
132 | Sun/crt
|
---|
133 | endif
|
---|
134 |
|
---|
135 | $(REM_MOD)_SOURCES = \
|
---|
136 | VBoxRecompiler.c \
|
---|
137 | cpu-exec.c \
|
---|
138 | exec.c \
|
---|
139 | translate-all.c \
|
---|
140 | host-utils.c \
|
---|
141 | cutils.c \
|
---|
142 | tcg/tcg.c \
|
---|
143 | tcg/tcg-dyngen.c \
|
---|
144 | tcg/tcg-runtime.c \
|
---|
145 | fpu/softfloat-native.c \
|
---|
146 | target-i386/op_helper.c \
|
---|
147 | target-i386/helper.c \
|
---|
148 | target-i386/translate.c
|
---|
149 |
|
---|
150 | ifeq ($(KBUILD_TARGET_ARCH),amd64)
|
---|
151 | $(REM_MOD)_DEFS += __x86_64__
|
---|
152 | $(REM_MOD)_INCS += tcg/x86_64
|
---|
153 | else
|
---|
154 | $(REM_MOD)_DEFS += __i386__
|
---|
155 | $(REM_MOD)_INCS += tcg/i386
|
---|
156 | endif
|
---|
157 |
|
---|
158 | ifneq ($(KBUILD_TARGET),freebsd)
|
---|
159 | $(REM_MOD)_SOURCES.debug += \
|
---|
160 | Sun/testmath.c
|
---|
161 | endif
|
---|
162 | $(REM_MOD)_SOURCES.win.x86 = $(PATH_VBoxREMImp)/VBoxREMWin.def
|
---|
163 | ifndef VBOX_USE_REM2
|
---|
164 | $(REM_MOD)_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
|
---|
165 | endif
|
---|
166 | ifdef VBOX_USE_REM2
|
---|
167 | ## @todo spread out where it belongs.
|
---|
168 | $(REM_MOD)_TEMPLATE = VBOXNOCRTGAS
|
---|
169 | $(REM_MOD)_DEFS += LOG_USE_C99 $(ARCH_BITS_DEFS)
|
---|
170 |
|
---|
171 | # This doesn't fit in IPRT because it requires GAS and is LGPL.
|
---|
172 | $(REM_MOD)_SOURCES += \
|
---|
173 | Sun/e_powl-$(KBUILD_TARGET_ARCH).S
|
---|
174 |
|
---|
175 | $(REM_MOD)_INCS += \
|
---|
176 | Sun/crt
|
---|
177 | $(REM_MOD)_SYSSUFF = .rel
|
---|
178 | endif
|
---|
179 | ifdef VBOX_USE_REM2
|
---|
180 | $(REM_MOD)_LIBS = \
|
---|
181 | $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
|
---|
182 | else
|
---|
183 | $(REM_MOD)_LIBS = \
|
---|
184 | $(LIB_VMM) \
|
---|
185 | $(LIB_RUNTIME)
|
---|
186 | $(REM_MOD)_LIBS.darwin = \
|
---|
187 | $(TARGET_VBoxREMImp)
|
---|
188 | endif
|
---|
189 |
|
---|
190 | ## @todo clean up this, there are some duplicates with the template here I think.
|
---|
191 | $(REM_MOD)_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/$(REM_MOD).dylib
|
---|
192 | $(REM_MOD)_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib -Wl,--no-undefined
|
---|
193 | $(REM_MOD)_LDFLAGS.linux = $(VBOX_LD_as_needed)
|
---|
194 | $(REM_MOD)_LDFLAGS.os2 = -Zomf
|
---|
195 | $(REM_MOD)_LDFLAGS.debug = -g
|
---|
196 | $(REM_MOD)_LDFLAGS.solaris = -mimpure-text
|
---|
197 |
|
---|
198 |
|
---|
199 | if defined(VBOX_USE_REM2) || defined(VBOX_USE_REM64)
|
---|
200 | #
|
---|
201 | # The VBoxREM2, VBoxREM32 and VBoxREM64 wrapper.
|
---|
202 | #
|
---|
203 | DLLS += VBoxREMWrapper
|
---|
204 | VBoxREMWrapper_TEMPLATE = VBOXR3
|
---|
205 | VBoxREMWrapper_NAME = VBoxREM
|
---|
206 | VBoxREMWrapper_DEFS = IN_REM_R3
|
---|
207 | ifdef VBOX_USE_REM64
|
---|
208 | VBoxREMWrapper_DEFS += VBOX_USE_BITNESS_SELECTOR
|
---|
209 | endif
|
---|
210 | ifdef VBOX_WITHOUT_REM_LDR_CYCLE
|
---|
211 | VBoxREMWrapper_DEFS += VBOX_WITHOUT_REM_LDR_CYCLE
|
---|
212 | endif
|
---|
213 | VBoxREMWrapper_SOURCES = \
|
---|
214 | VBoxREMWrapper.cpp
|
---|
215 | ifdef VBOX_USE_REM2
|
---|
216 | VBoxREMWrapper_SOURCES += \
|
---|
217 | VBoxREMWrapperA.asm
|
---|
218 | endif
|
---|
219 | VBoxREMWrapper_LIBS = \
|
---|
220 | $(LIB_RUNTIME)
|
---|
221 | ifndef VBOX_WITHOUT_REM_LDR_CYCLE
|
---|
222 | VBoxREMWrapper_LIBS += \
|
---|
223 | $(LIB_VMM)
|
---|
224 | VBoxREMWrapper_LIBS.darwin += \
|
---|
225 | $(TARGET_VBoxREMImp)
|
---|
226 | else
|
---|
227 | VBoxREMWrapper_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
|
---|
228 | endif
|
---|
229 | endif
|
---|
230 |
|
---|
231 |
|
---|
232 | ifdef VBOX_USE_REM64
|
---|
233 | DLLS += VBoxREM32
|
---|
234 | VBoxREM32_EXTENDS = VBoxREM
|
---|
235 | VBoxREM32_EXTENDS_BY = appending
|
---|
236 | VBoxREM32_TEMPLATE = $(VBoxREM_TEMPLATE)
|
---|
237 | VBoxREM32_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM32.dylib
|
---|
238 | VBoxREM32_LIBS.darwin = $(LIB_REM)
|
---|
239 |
|
---|
240 | DLLS += VBoxREM64
|
---|
241 | VBoxREM64_EXTENDS = VBoxREM
|
---|
242 | VBoxREM64_EXTENDS_BY = appending
|
---|
243 | VBoxREM64_TEMPLATE = $(VBoxREM_TEMPLATE)
|
---|
244 | VBoxREM64_DEFS = VBOX_ENABLE_VBOXREM64
|
---|
245 | VBoxREM64_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM64.dylib
|
---|
246 | VBoxREM64_LIBS.darwin = $(LIB_REM)
|
---|
247 |
|
---|
248 | endif # USE_VBOXREM64
|
---|
249 |
|
---|
250 |
|
---|
251 | #
|
---|
252 | # The VBoxREM import library.
|
---|
253 | #
|
---|
254 | # This is a HACK to get around (a) the cyclic dependency between VBoxVMM and
|
---|
255 | # VBoxREM during linking and (b) the recursive build ordering which means VBoxREM
|
---|
256 | # won't be built until after all the other DLLs.
|
---|
257 | #
|
---|
258 | IMPORT_LIBS += VBoxREMImp
|
---|
259 | VBoxREMImp_TEMPLATE = VBOXR3
|
---|
260 | ifn1of ($(KBUILD_TARGET), os2 win)
|
---|
261 | VBoxREMImp_NAME = VBoxREM
|
---|
262 | endif
|
---|
263 | VBoxREMImp_INST = $(INST_LIB)
|
---|
264 | VBoxREMImp_SOURCES.win = $(PATH_VBoxREMImp)/VBoxREMWin.def
|
---|
265 | VBoxREMImp_CLEAN.win = $(PATH_VBoxREMImp)/VBoxREMWin.def
|
---|
266 | VBoxREMImp_SOURCES.os2 = $(PATH_VBoxREMImp)/VBoxREMOS2.def
|
---|
267 | VBoxREMImp_CLEAN.os2 = $(PATH_VBoxREMImp)/VBoxREMOS2.def
|
---|
268 | ifn1of ($(KBUILD_TARGET), os2 win)
|
---|
269 | VBoxREMImp_SOURCES = $(PATH_VBoxREMImp)/VBoxREMImp.c
|
---|
270 | VBoxREMImp_CLEAN = $(PATH_VBoxREMImp)/VBoxREMImp.c
|
---|
271 | endif
|
---|
272 | ifn1of ($(KBUILD_TARGET), darwin os2 win)
|
---|
273 | VBoxREMImp_SONAME = VBoxREM$(SUFF_DLL)
|
---|
274 | endif
|
---|
275 | ifdef VBOX_WITHOUT_REM_LDR_CYCLE
|
---|
276 | VBoxREMImp_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
|
---|
277 | else
|
---|
278 | VBoxREMImp_LDFLAGS.darwin = -install_name $(subst @rpath,@executable_path,$(VBOX_DYLD_EXECUTABLE_PATH))/VBoxREM.dylib
|
---|
279 | endif
|
---|
280 | VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
|
---|
281 |
|
---|
282 | $$(PATH_VBoxREMImp)/VBoxREMImp.c: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
283 | $(call MSG_GENERATE,,$@)
|
---|
284 | $(QUIET)$(APPEND) -t $@ '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN'
|
---|
285 | $(QUIET)$(APPEND) $@ '# define EXPORT __attribute__((visibility("default")))'
|
---|
286 | $(QUIET)$(APPEND) $@ '#else'
|
---|
287 | $(QUIET)$(APPEND) $@ '# define EXPORT'
|
---|
288 | $(QUIET)$(APPEND) $@ '#endif'
|
---|
289 | $(QUIET)$(APPEND) $@ ''
|
---|
290 | $(QUIET)$(SED) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed --append $@ $<
|
---|
291 |
|
---|
292 | $$(PATH_VBoxREMImp)/VBoxREMOS2.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
293 | $(SED) \
|
---|
294 | -e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
|
---|
295 | -e 's/\.[Dd][Ll][Ll]//' \
|
---|
296 | -e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
|
---|
297 | --output $@ \
|
---|
298 | $<
|
---|
299 |
|
---|
300 | $$(PATH_VBoxREMImp)/VBoxREMWin.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
301 | $(CP) -f $< $@
|
---|
302 |
|
---|
303 |
|
---|
304 | #
|
---|
305 | # The math testcase as a standalone program for testing and debugging purposes.
|
---|
306 | #
|
---|
307 | ## @todo This is a bit messy because of MINGW32.
|
---|
308 | testmath_ASFLAGS.amd64 = -m amd64
|
---|
309 | testmath_CFLAGS = -Wall -g
|
---|
310 | testmath_CFLAGS.release = -O3
|
---|
311 | testmath_LDFLAGS = -g
|
---|
312 | testmath_DEFS = MATHTEST_STANDALONE
|
---|
313 | testmath_SOURCES = Sun/testmath.c
|
---|
314 |
|
---|