1 | # $Id: Makefile.kmk 14640 2008-11-26 13:31:13Z 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 |
|
---|
22 | SUB_DEPTH = ../..
|
---|
23 | include $(KBUILD_PATH)/subheader.kmk
|
---|
24 |
|
---|
25 | # For 64-bit Windows we currently use gcc (due to MSVC unaware of such a novel
|
---|
26 | # thing as C99, a lot of GCC extensions deployed by QEMU and calling convention
|
---|
27 | # differences) to cross-compile code to Linux/ELF and dynamically generate invocation wrappers.
|
---|
28 | if1of (win.amd64, $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
|
---|
29 | REM_MOD += VBoxREM2
|
---|
30 | SYSMODS += VBoxREM2
|
---|
31 | else
|
---|
32 | REM_MOD += VBoxREM
|
---|
33 | endif
|
---|
34 |
|
---|
35 | ifeq ($(KBUILD_TARGET), win)
|
---|
36 | TEMPLATE_DUMMY = dummy template (move to kBuild)
|
---|
37 | $(REM_MOD)_TOOL.win.x86 = MINGW32
|
---|
38 | $(REM_MOD)_TOOL.win.amd64 = XGCCAMD64LINUX
|
---|
39 | $(REM_MOD)_TEMPLATE = DUMMY
|
---|
40 | $(REM_MOD)_SDKS.win.x86 = W32API
|
---|
41 | $(REM_MOD)_ASFLAGS = -x assembler-with-cpp
|
---|
42 | $(REM_MOD)_CFLAGS = -Wall -g
|
---|
43 | $(REM_MOD)_CFLAGS.debug = -O0
|
---|
44 | $(REM_MOD)_CFLAGS.release += -fno-gcse -O2
|
---|
45 | $(REM_MOD)_CFLAGS.profile = $($(REM_MOD)_CFLAGS.release)
|
---|
46 | $(REM_MOD)_CFLAGS.kprofile = $($(REM_MOD)_CFLAGS.release)
|
---|
47 |
|
---|
48 | IMPORT_LIBS += VBoxREMImp
|
---|
49 | DLLS += VBoxREM
|
---|
50 |
|
---|
51 | VBoxREM_LIBS = \
|
---|
52 | $(LIB_VMM) \
|
---|
53 | $(LIB_RUNTIME)
|
---|
54 |
|
---|
55 | USE_REM_IMP = 1
|
---|
56 | else
|
---|
57 | $(REM_MOD)_TEMPLATE = VBOXR3NP
|
---|
58 |
|
---|
59 | IMPORT_LIBS += VBoxREM
|
---|
60 | endif
|
---|
61 |
|
---|
62 | OTHER_CLEAN +=
|
---|
63 |
|
---|
64 | #
|
---|
65 | # Globals
|
---|
66 | #
|
---|
67 | VBOX_PATH_RECOMPILER_SRC := $(PATH_SUB_CURRENT)
|
---|
68 |
|
---|
69 | # The VBoxREM.[dll|so|..] or VBoxREM2.rel.
|
---|
70 | #
|
---|
71 | $(REM_MOD)_DEFS = IN_REM_R3 REM_INCLUDE_CPU_H
|
---|
72 | #$(REM_MOD)_DEFS += REM_PHYS_ADDR_IN_TLB
|
---|
73 | #$(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.
|
---|
74 | $(REM_MOD)_DEFS.linux = _GNU_SOURCE
|
---|
75 | ifdef VBOX_SOLARIS_10
|
---|
76 | $(REM_MOD)_DEFS.solaris = HOST_SOLARIS=10
|
---|
77 | else
|
---|
78 | $(REM_MOD)_DEFS.solaris = HOST_SOLARIS=11
|
---|
79 | endif
|
---|
80 |
|
---|
81 | $(REM_MOD)_INCS = \
|
---|
82 | Sun \
|
---|
83 | target-i386 \
|
---|
84 | tcg \
|
---|
85 | fpu \
|
---|
86 | $(PATH_$(REM_MOD)) \
|
---|
87 | $(PATH_ROOT)/src/VBox/VMM \
|
---|
88 | .
|
---|
89 |
|
---|
90 | $(REM_MOD)_SOURCES = \
|
---|
91 | VBoxRecompiler.c \
|
---|
92 | cpu-exec.c \
|
---|
93 | exec.c \
|
---|
94 | translate-all.c \
|
---|
95 | host-utils.c \
|
---|
96 | cutils.c \
|
---|
97 | tcg/tcg.c \
|
---|
98 | tcg/tcg-dyngen.c \
|
---|
99 | tcg/tcg-runtime.c \
|
---|
100 | fpu/softfloat-native.c \
|
---|
101 | target-i386/op_helper.c \
|
---|
102 | target-i386/helper.c \
|
---|
103 | target-i386/translate.c
|
---|
104 |
|
---|
105 | ifeq ($(KBUILD_TARGET_ARCH),amd64)
|
---|
106 | $(REM_MOD)_DEFS += __x86_64__
|
---|
107 | $(REM_MOD)_INCS += tcg/x86_64
|
---|
108 | else
|
---|
109 | $(REM_MOD)_DEFS += __i386__
|
---|
110 | $(REM_MOD)_INCS += tcg/i386
|
---|
111 | endif
|
---|
112 |
|
---|
113 | $(REM_MOD)_SOURCES.debug += \
|
---|
114 | Sun/testmath.c
|
---|
115 | $(REM_MOD)_SOURCES.win.x86 = $(REM_MOD).def
|
---|
116 | ifneq ($(REM_MOD),VBoxREM2)
|
---|
117 | $(REM_MOD)_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
|
---|
118 | endif
|
---|
119 |
|
---|
120 | ifeq ($(REM_MOD),VBoxREM2)
|
---|
121 | #
|
---|
122 | # The VBoxREM2 wrapper.
|
---|
123 | #
|
---|
124 | VBoxREM_TEMPLATE = VBOXR3
|
---|
125 | VBoxREM_DEFS = IN_REM_R3 $(if $(VBOX_WITH_VMI),VBOX_WITH_VMI,)
|
---|
126 | VBoxREM_SOURCES = \
|
---|
127 | VBoxREMWrapper.cpp \
|
---|
128 | VBoxREMWrapperA.asm
|
---|
129 |
|
---|
130 | $(REM_MOD)_TEMPLATE = VBOXNOCRTGAS
|
---|
131 | $(REM_MOD)_DEFS += LOG_USE_C99 $(ARCH_BITS_DEFS)
|
---|
132 |
|
---|
133 | # This doesn't fit in IPRT because it requires GAS and is LGPL.
|
---|
134 | $(REM_MOD)_SOURCES += \
|
---|
135 | Sun/e_powl-$(KBUILD_TARGET_ARCH).S
|
---|
136 |
|
---|
137 | $(REM_MOD)_INCS += \
|
---|
138 | Sun/crt
|
---|
139 | $(REM_MOD)_LIBS = \
|
---|
140 | $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
|
---|
141 | $(REM_MOD)_SYSSUFF = .rel
|
---|
142 |
|
---|
143 | endif
|
---|
144 |
|
---|
145 | $(REM_MOD)_CFLAGS.profile = $($(REM_MOD)_CFLAGS.release)
|
---|
146 | $(REM_MOD)_CFLAGS.kprofile = $($(REM_MOD)_CFLAGS.release)
|
---|
147 |
|
---|
148 | $(REM_MOD)_DEFS += IN_RING3 $(ARCH_BITS_DEFS)
|
---|
149 | #$(REM_MOD)_DEFS += 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.
|
---|
150 |
|
---|
151 | $(REM_MOD)_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/$(REM_MOD).dylib -undefined dynamic_lookup
|
---|
152 | $(REM_MOD)_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib -Wl,--no-undefined
|
---|
153 | $(REM_MOD)_LDFLAGS.linux = $(VBOX_LD_as_needed)
|
---|
154 | $(REM_MOD)_LDFLAGS.os2 = -Zomf
|
---|
155 | $(REM_MOD)_LDFLAGS.debug = -g
|
---|
156 | $(REM_MOD)_LDFLAGS.solaris = -mimpure-text
|
---|
157 |
|
---|
158 | # Temporary hack, to allow running with oldish GCC
|
---|
159 | $(REM_MOD)_DEFS.win.x86 += GCC_WITH_BUGGY_REGPARM
|
---|
160 |
|
---|
161 |
|
---|
162 | ifdef USE_REM_IMP
|
---|
163 | #
|
---|
164 | # The VBoxREM import library.
|
---|
165 | #
|
---|
166 | # This is a HACK to get around (a) the cyclic dependency between VBoxVMM and
|
---|
167 | # VBoxREM during linking and (b) the recursive build ordering which means VBoxREM
|
---|
168 | # won't be built until after all the other DLLs.
|
---|
169 | #
|
---|
170 | VBoxREMImp_TEMPLATE = VBOXR3
|
---|
171 | if1of ($(KBUILD_TARGET), os2 win)
|
---|
172 | VBoxREMImp_INST = $(INST_LIB)
|
---|
173 | else
|
---|
174 | VBoxREMImp_NAME = VBoxREM
|
---|
175 | VBoxREMImp_INST = $(INST_LIB)
|
---|
176 | endif
|
---|
177 | VBoxREMImp_SOURCES.win = VBoxREM.def
|
---|
178 | VBoxREMImp_SOURCES.os2 = $(PATH_VBoxREMImp)/VBoxREMOS2.def
|
---|
179 | ifeq ($(filter win os2,$(KBUILD_TARGET)),)
|
---|
180 | VBoxREMImp_SOURCES = $(PATH_VBoxREMImp)/VBoxREMImp.c
|
---|
181 | VBoxREMImp_CLEAN = $(PATH_VBoxREMImp)/VBoxREMImp.c
|
---|
182 | endif
|
---|
183 | ifneq ($(filter-out darwin os2 win,$(KBUILD_TARGET)),)
|
---|
184 | VBoxREMImp_SONAME = VBoxREM$(SUFF_DLL)
|
---|
185 | endif
|
---|
186 | VBoxREMImp_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
|
---|
187 | VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
|
---|
188 |
|
---|
189 | $$(PATH_VBoxREMImp)/VBoxREMImp.c: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
190 | $(call MSG_GENERATE,,$@)
|
---|
191 | $(QUIET)$(APPEND) -t $@ '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN'
|
---|
192 | $(QUIET)$(APPEND) $@ '# define EXPORT __attribute__((visibility("default")))'
|
---|
193 | $(QUIET)$(APPEND) $@ '#else'
|
---|
194 | $(QUIET)$(APPEND) $@ '# define EXPORT'
|
---|
195 | $(QUIET)$(APPEND) $@ '#endif'
|
---|
196 | $(QUIET)$(APPEND) $@ ''
|
---|
197 | $(QUIET)$(SED) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed --append $@ $<
|
---|
198 |
|
---|
199 | $$(PATH_VBoxREMImp)/VBoxREMOS2.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
200 | $(SED) \
|
---|
201 | -e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
|
---|
202 | -e 's/\.[Dd][Ll][Ll]//' \
|
---|
203 | -e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
|
---|
204 | --output $@ \
|
---|
205 | $<
|
---|
206 | endif # USE_REM_IMP
|
---|
207 |
|
---|
208 | #
|
---|
209 | # The math testcase as a standalone program for testing and debugging purposes.
|
---|
210 | #
|
---|
211 | ## @todo This is a bit messy because of MINGW32.
|
---|
212 | testmath_ASFLAGS.amd64 = -m amd64
|
---|
213 | testmath_CFLAGS = -Wall -g
|
---|
214 | testmath_CFLAGS.release = -O3
|
---|
215 | testmath_LDFLAGS = -g
|
---|
216 | testmath_DEFS = MATHTEST_STANDALONE
|
---|
217 | testmath_SOURCES = Sun/testmath.c
|
---|
218 | #testmath_SOURCES += $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
|
---|
219 |
|
---|
220 |
|
---|
221 | include $(KBUILD_PATH)/subfooter.kmk
|
---|