VirtualBox

source: vbox/trunk/src/recompiler_new/Makefile.kmk@ 15310

Last change on this file since 15310 was 15310, checked in by vboxsync, 16 years ago

REM: Darwin compilation fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.4 KB
Line 
1# $Id: Makefile.kmk 15310 2008-12-11 15:55:38Z 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
35if1of (x86, $(KBUILD_TARGET_ARCH))
36 ifdef VBOX_WITH_64_BITS_GUESTS
37 VBOX_USE_REM64 := 1
38 endif
39endif
40
41
42TEMPLATE_DUMMY = dummy template (move to kBuild) ## @todo Will be there in the next update, remove this.
43
44if 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
62endif
63
64# For 64-bit Windows we currently use gcc (due to MSVC unaware of such a novel
65# thing as C99, a lot of GCC extensions deployed by QEMU and calling convention
66# differences) to cross-compile code to Linux/ELF and dynamically generate invocation wrappers.
67if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), win.amd64)
68 REM_MOD := VBoxREM2
69else
70 REM_MOD := VBoxREM
71endif
72
73#
74# Target lists (some of them anyways).
75#
76ifeq ($(REM_MOD),VBoxREM2)
77 SYSMODS += VBoxREM2
78endif
79
80ifndef VBOX_USE_REM64
81 ifeq ($(KBUILD_TARGET),win)
82 DLLS += VBoxREM
83 else
84 ## @todo this is wrong, proper DLLS are DLLS not IMPORT_LIBS. nice try ;-)
85 IMPORT_LIBS += VBoxREM
86 endif
87endif
88
89
90#
91# The VBoxREM.[dll|so|..] or VBoxREM2.rel.
92#
93ifeq ($(KBUILD_TARGET),win)
94$(REM_MOD)_TEMPLATE = DUMMY
95$(REM_MOD)_TOOL.win.x86 = MINGW32
96$(REM_MOD)_TOOL.win.amd64 = XGCCAMD64LINUX
97$(REM_MOD)_SDKS.win.x86 = W32API
98$(REM_MOD)_ASFLAGS = -x assembler-with-cpp
99$(REM_MOD)_CFLAGS = -Wall -g -fno-omit-frame-pointer -fno-strict-aliasing
100$(REM_MOD)_CFLAGS.debug = -O0
101$(REM_MOD)_CFLAGS.release += -fno-gcse -O2
102$(REM_MOD)_CFLAGS.profile = $($(REM_MOD)_CFLAGS.release)
103VBoxREM_LIBS = \
104 $(LIB_VMM) \
105 $(LIB_RUNTIME)
106$(REM_MOD)_DEFS += IN_RING3 $(ARCH_BITS_DEFS)
107# Temporary hack, to allow running with oldish GCC
108$(REM_MOD)_DEFS.win.x86 += GCC_WITH_BUGGY_REGPARM
109else # !win
110$(REM_MOD)_TEMPLATE = VBOXR3NP
111$(REM_MOD)_DEFS =
112endif # !win
113$(REM_MOD)_DEFS += IN_REM_R3 REM_INCLUDE_CPU_H
114$(REM_MOD)_DEFS += REM_PHYS_ADDR_IN_TLB
115$(REM_MOD)_DEFS += VBOX_WITH_NEW_RECOMPILER
116#$(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.
117$(REM_MOD)_DEFS.linux = _GNU_SOURCE
118ifdef VBOX_SOLARIS_10
119 $(REM_MOD)_DEFS.solaris = HOST_SOLARIS=10
120else
121 $(REM_MOD)_DEFS.solaris = HOST_SOLARIS=11
122endif
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 .
132
133$(REM_MOD)_SOURCES = \
134 VBoxRecompiler.c \
135 cpu-exec.c \
136 exec.c \
137 translate-all.c \
138 host-utils.c \
139 cutils.c \
140 tcg/tcg.c \
141 tcg/tcg-dyngen.c \
142 tcg/tcg-runtime.c \
143 fpu/softfloat-native.c \
144 target-i386/op_helper.c \
145 target-i386/helper.c \
146 target-i386/translate.c
147
148ifeq ($(KBUILD_TARGET_ARCH),amd64)
149 $(REM_MOD)_DEFS += __x86_64__
150 $(REM_MOD)_INCS += tcg/x86_64
151else
152 $(REM_MOD)_DEFS += __i386__
153 $(REM_MOD)_INCS += tcg/i386
154endif
155
156$(REM_MOD)_SOURCES.debug += \
157 Sun/testmath.c
158$(REM_MOD)_SOURCES.win.x86 = $(REM_MOD).def
159ifneq ($(REM_MOD),VBoxREM2)
160 $(REM_MOD)_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
161endif
162ifeq ($(REM_MOD),VBoxREM2)
163## @todo spread out where it belongs.
164$(REM_MOD)_TEMPLATE = VBOXNOCRTGAS
165$(REM_MOD)_DEFS += LOG_USE_C99 $(ARCH_BITS_DEFS)
166
167# This doesn't fit in IPRT because it requires GAS and is LGPL.
168$(REM_MOD)_SOURCES += \
169 Sun/e_powl-$(KBUILD_TARGET_ARCH).S
170
171$(REM_MOD)_INCS += \
172 Sun/crt
173$(REM_MOD)_LIBS = \
174 $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
175$(REM_MOD)_SYSSUFF = .rel
176endif
177
178## @todo clean up this, there are some duplicates with the template here I think.
179$(REM_MOD)_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/$(REM_MOD).dylib -undefined dynamic_lookup
180$(REM_MOD)_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib -Wl,--no-undefined
181$(REM_MOD)_LDFLAGS.linux = $(VBOX_LD_as_needed)
182$(REM_MOD)_LDFLAGS.os2 = -Zomf
183$(REM_MOD)_LDFLAGS.debug = -g
184$(REM_MOD)_LDFLAGS.solaris = -mimpure-text
185
186
187ifeq ($(REM_MOD),VBoxREM2)
188#
189# The VBoxREM2 wrapper.
190#
191VBoxREM_TEMPLATE = VBOXR3
192VBoxREM_DEFS = IN_REM_R3 $(if $(VBOX_WITH_VMI),VBOX_WITH_VMI,)
193VBoxREM_DEFS += VBOX_WITH_NEW_RECOMPILER
194VBoxREM_SOURCES = \
195 VBoxREMWrapper.cpp \
196 VBoxREMWrapperA.asm
197endif
198
199
200ifdef VBOX_USE_REM64
201 # kmk doesn't work the way it should wrt EXTENDS and variable value evaluation
202 VBoxREM32_EXTENDS := $(REM_MOD)
203 VBoxREM32_EXTEND_BY := appending
204 VBoxREM32_TEMPLATE := $(VBoxREM_TEMPLATE)
205 VBoxREM32_DEFS := $($(REM_MOD)_DEFS)
206 VBoxREM32_INCS := $($(REM_MOD)_INCS)
207 VBoxREM32_SOURCES := $($(REM_MOD)_SOURCES)
208 VBoxREM32_LIBS := $($(REM_MOD)_LIBS)
209
210 VBoxREM64_EXTENDS = $(REM_MOD)
211 VBoxREM64_EXTEND_BY = appending
212 VBoxREM64_TEMPLATE := $(VBoxREM_TEMPLATE)
213 VBoxREM64_DEFS := $($(REM_MOD)_DEFS) VBOX_ENABLE_VBOXREM64
214 VBoxREM64_INCS := $($(REM_MOD)_INCS)
215 VBoxREM64_SOURCES := $($(REM_MOD)_SOURCES)
216 VBoxREM64_LIBS := $($(REM_MOD)_LIBS)
217
218 VBoxREMSel_TEMPLATE = VBOXR3
219 VBoxREMSel_NAME = VBoxREM
220 VBoxREMSel_DEFS = IN_REM_R3 $(if $(VBOX_WITH_VMI),VBOX_WITH_VMI,) \
221 VBOX_WITH_NEW_RECOMPILER VBOX_USE_BITNESS_SELECTOR
222 VBoxREMSel_SOURCES = VBoxREMWrapper.cpp
223 VBoxREMSel_LDFLAGS.darwin = -undefined dynamic_lookup
224
225 ifeq ($(KBUILD_TARGET), win)
226 DLL += VBoxREM32 VBoxREM64 VBoxREMSel
227 else
228 IMPORT_LIBS += VBoxREM32 VBoxREM64 VBoxREMSel
229 endif
230
231endif # USE_VBOXREM64
232
233
234if1of ($(KBUILD_TARGET), os2 win)
235#
236# The VBoxREM import library.
237#
238# This is a HACK to get around (a) the cyclic dependency between VBoxVMM and
239# VBoxREM during linking and (b) the recursive build ordering which means VBoxREM
240# won't be built until after all the other DLLs.
241#
242IMPORT_LIBS += VBoxREMImp
243VBoxREMImp_TEMPLATE = VBOXR3
244 if1of ($(KBUILD_TARGET), os2 win)
245VBoxREMImp_INST = $(INST_LIB)
246 else
247VBoxREMImp_NAME = VBoxREM
248VBoxREMImp_INST = $(INST_LIB)
249 endif
250VBoxREMImp_SOURCES.win = VBoxREM.def
251VBoxREMImp_SOURCES.os2 = $(PATH_VBoxREMImp)/VBoxREMOS2.def
252 ifeq ($(filter win os2,$(KBUILD_TARGET)),)
253VBoxREMImp_SOURCES = $(PATH_VBoxREMImp)/VBoxREMImp.c
254VBoxREMImp_CLEAN = $(PATH_VBoxREMImp)/VBoxREMImp.c
255 endif
256 ifneq ($(filter-out darwin os2 win,$(KBUILD_TARGET)),)
257VBoxREMImp_SONAME = VBoxREM$(SUFF_DLL)
258 endif
259VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
260
261$$(PATH_VBoxREMImp)/VBoxREMImp.c: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed $(MAKEFILE_CURRENT) | $$(dir $$@)
262 $(call MSG_GENERATE,,$@)
263 $(QUIET)$(APPEND) -t $@ '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN'
264 $(QUIET)$(APPEND) $@ '# define EXPORT __attribute__((visibility("default")))'
265 $(QUIET)$(APPEND) $@ '#else'
266 $(QUIET)$(APPEND) $@ '# define EXPORT'
267 $(QUIET)$(APPEND) $@ '#endif'
268 $(QUIET)$(APPEND) $@ ''
269 $(QUIET)$(SED) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed --append $@ $<
270
271$$(PATH_VBoxREMImp)/VBoxREMOS2.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
272 $(SED) \
273 -e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
274 -e 's/\.[Dd][Ll][Ll]//' \
275 -e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
276 --output $@ \
277 $<
278endif # USE_REM_IMP
279
280
281#
282# The math testcase as a standalone program for testing and debugging purposes.
283#
284## @todo This is a bit messy because of MINGW32.
285testmath_ASFLAGS.amd64 = -m amd64
286testmath_CFLAGS = -Wall -g
287testmath_CFLAGS.release = -O3
288testmath_LDFLAGS = -g
289testmath_DEFS = MATHTEST_STANDALONE
290testmath_DEFS += VBOX_WITH_NEW_RECOMPILER
291testmath_SOURCES = Sun/testmath.c
292#testmath_SOURCES += $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
293
294
295include $(KBUILD_PATH)/subfooter.kmk
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