VirtualBox

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

Last change on this file since 37880 was 37692, checked in by vboxsync, 13 years ago

build fix.

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