VirtualBox

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

Last change on this file since 27139 was 27139, checked in by vboxsync, 15 years ago

Config.kmk,recompiler,xpcom18a4/Makefile.kmk: Drop the trailing slash from VBOX_WITH_RELATIVE_RUNPATH usage, the double slash for components/*.dylib shouldn't matter. Drop the VBoxREM <-> VBoxVMM loader cycle on darwin since it prevents @rpath from working.

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