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