1 | # $Id: Makefile.kmk 29333 2010-05-11 10:28:57Z 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 inherting 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 | endif # win
|
---|
61 | VBoxRemPrimary_DEFS += IN_REM_R3 REM_INCLUDE_CPU_H
|
---|
62 | #VBoxRemPrimary_DEFS += REM_PHYS_ADDR_IN_TLB
|
---|
63 | #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.
|
---|
64 | #VBoxRemPrimary_DEFS += DEBUG_TMP_LOGGING # log qemu parts to "/tmp/vbox-qemu.log" - does not work with VBoxREM2.
|
---|
65 | VBoxRemPrimary_DEFS.linux = _GNU_SOURCE
|
---|
66 | ifdef VBOX_SOLARIS_10
|
---|
67 | VBoxRemPrimary_DEFS.solaris = HOST_SOLARIS=10
|
---|
68 | else
|
---|
69 | VBoxRemPrimary_DEFS.solaris = HOST_SOLARIS=11
|
---|
70 | endif
|
---|
71 | VBoxRemPrimary_DEFS.freebsd += _BSD
|
---|
72 | VBoxRemPrimary_DEFS.amd64 += __x86_64__
|
---|
73 | VBoxRemPrimary_DEFS.x86 += __i386__
|
---|
74 |
|
---|
75 | VBoxRemPrimary_INCS = \
|
---|
76 | Sun \
|
---|
77 | target-i386 \
|
---|
78 | tcg \
|
---|
79 | fpu \
|
---|
80 | $(PATH_VBoxRemPrimary) \
|
---|
81 | $(PATH_ROOT)/src/VBox/VMM \
|
---|
82 | .
|
---|
83 | VBoxRemPrimary_INCS.amd64 += tcg/x86_64
|
---|
84 | VBoxRemPrimary_INCS.x86 += tcg/i386
|
---|
85 | ifn1of ($(VBoxRemPrimary_DEFS),DEBUG_TMP_LOGGING)
|
---|
86 | VBoxRemPrimary_DEFS += LOG_USE_C99
|
---|
87 | VBoxRemPrimary_INCS <= \
|
---|
88 | Sun/crt
|
---|
89 | endif
|
---|
90 |
|
---|
91 | VBoxRemPrimary_SOURCES = \
|
---|
92 | VBoxRecompiler.c \
|
---|
93 | cpu-exec.c \
|
---|
94 | exec.c \
|
---|
95 | translate-all.c \
|
---|
96 | host-utils.c \
|
---|
97 | cutils.c \
|
---|
98 | tcg/tcg.c \
|
---|
99 | tcg/tcg-dyngen.c \
|
---|
100 | tcg/tcg-runtime.c \
|
---|
101 | fpu/softfloat-native.c \
|
---|
102 | target-i386/op_helper.c \
|
---|
103 | target-i386/helper.c \
|
---|
104 | target-i386/translate.c
|
---|
105 | VBoxRemPrimary_SOURCES.debug += \
|
---|
106 | Sun/testmath.c
|
---|
107 | VBoxRemPrimary_SOURCES.win.x86 = $(PATH_VBoxREMImp)/VBoxREMWin.def
|
---|
108 |
|
---|
109 | VBoxRemPrimary_LIBS = \
|
---|
110 | $(LIB_VMM) \
|
---|
111 | $(LIB_RUNTIME)
|
---|
112 |
|
---|
113 | VBoxRemPrimary_LDFLAGS.solaris = -mimpure-text
|
---|
114 | VBoxRemPrimary_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
|
---|
115 |
|
---|
116 |
|
---|
117 | if "$(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 |
|
---|
136 | else 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 |
|
---|
163 | else
|
---|
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
|
---|
170 | endif
|
---|
171 |
|
---|
172 |
|
---|
173 | ifdef VBOX_REM_WRAPPER
|
---|
174 | #
|
---|
175 | # VBoxREM - Wrapper for loading VBoxREM2, VBoxREM32 or VBoxREM64.
|
---|
176 | #
|
---|
177 | DLLS += VBoxREMWrapper
|
---|
178 | VBoxREMWrapper_TEMPLATE = VBOXR3
|
---|
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
|
---|
202 | endif
|
---|
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 | #
|
---|
212 | IMPORT_LIBS += VBoxREMImp
|
---|
213 | VBoxREMImp_TEMPLATE = VBOXR3
|
---|
214 | ifn1of ($(KBUILD_TARGET), os2 win)
|
---|
215 | VBoxREMImp_NAME = VBoxREM
|
---|
216 | endif
|
---|
217 | VBoxREMImp_INST = $(INST_LIB)
|
---|
218 | VBoxREMImp_SOURCES.win = $(PATH_VBoxREMImp)/VBoxREMWin.def
|
---|
219 | VBoxREMImp_CLEAN.win = $(PATH_VBoxREMImp)/VBoxREMWin.def
|
---|
220 | VBoxREMImp_SOURCES.os2 = $(PATH_VBoxREMImp)/VBoxREMOS2.def
|
---|
221 | VBoxREMImp_CLEAN.os2 = $(PATH_VBoxREMImp)/VBoxREMOS2.def
|
---|
222 | ifn1of ($(KBUILD_TARGET), os2 win)
|
---|
223 | VBoxREMImp_SOURCES = $(PATH_VBoxREMImp)/VBoxREMImp.c
|
---|
224 | VBoxREMImp_CLEAN = $(PATH_VBoxREMImp)/VBoxREMImp.c
|
---|
225 | endif
|
---|
226 | ifn1of ($(KBUILD_TARGET), darwin os2 win)
|
---|
227 | VBoxREMImp_SONAME = VBoxREM$(SUFF_DLL)
|
---|
228 | endif
|
---|
229 | ifdef VBOX_WITHOUT_REM_LDR_CYCLE
|
---|
230 | VBoxREMImp_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
|
---|
231 | else
|
---|
232 | VBoxREMImp_LDFLAGS.darwin = -install_name $(subst @rpath,@executable_path,$(VBOX_DYLD_EXECUTABLE_PATH))/VBoxREM.dylib
|
---|
233 | endif
|
---|
234 | VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
|
---|
235 |
|
---|
236 | $$(PATH_VBoxREMImp)/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 | $$(PATH_VBoxREMImp)/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 | $$(PATH_VBoxREMImp)/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.
|
---|
262 | testmath_ASFLAGS.amd64 = -m amd64
|
---|
263 | testmath_CFLAGS = -Wall -g
|
---|
264 | testmath_CFLAGS.release = -O3
|
---|
265 | testmath_LDFLAGS = -g
|
---|
266 | testmath_DEFS = MATHTEST_STANDALONE
|
---|
267 | testmath_SOURCES = Sun/testmath.c
|
---|
268 |
|
---|
269 |
|
---|
270 | endif # new stuff
|
---|
271 | include $(KBUILD_PATH)/subfooter.kmk
|
---|
272 |
|
---|