VirtualBox

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

Last change on this file since 80990 was 80305, checked in by vboxsync, 5 years ago

REM,VMM,tstInt,Devices: Use VMM_COMMON_DEFS when including vm.h so the layout is always right. bugref:9217

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.0 KB
Line 
1# $Id: Makefile.kmk 80305 2019-08-15 17:35:00Z vboxsync $
2## @file
3# The Recompiler Sub-Makefile.
4#
5
6#
7# Copyright (C) 2006-2019 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# We need the VMM/Config.kmk one for the VMM_COMMON_DEFS variable.
23ifndef VBOX_VMM_CONFIG_KMK_INCLUDED
24 include $(PATH_ROOT)/src/VBox/VMM/Config.kmk
25endif
26
27#
28# Globals
29#
30VBOX_PATH_RECOMPILER_SRC := $(PATH_SUB_CURRENT)
31# Workaround for darwin hell.
32ifeq ($(KBUILD_TARGET),darwin)
33 VBOX_WITHOUT_REM_LDR_CYCLE := 1
34endif
35ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
36 VBOX_USE_MINGWW64 = 1
37endif
38
39
40#
41# The primary REM module definition.
42#
43# This is extended by one of the VBoxREM* modules below. Currently, this
44# isn't done by inheritance because of some obscure bug wrt inheriting from
45# unused targets that I'm not going to fix now.
46#
47ifneq ($(KBUILD_TARGET),win)
48 VBoxRemPrimary_TEMPLATE = VBOXR3NP
49 # workaround the regparm bug in gcc <= 3.3
50 VBoxRemPrimary_DEFS = $(if $(VBOX_GCC_BUGGY_REGPARM),GCC_WITH_BUGGY_REGPARM,)
51else
52 VBoxRemPrimary_TEMPLATE = DUMMY
53 VBoxRemPrimary_TOOL.win.x86 = MINGW32
54 ifdef VBOX_USE_MINGWW64
55 VBoxRemPrimary_TOOL.win.amd64 = MINGWW64
56 else
57 VBoxRemPrimary_TOOL.win.amd64 = XGCCAMD64LINUX
58 endif
59 VBoxRemPrimary_SDKS.win.x86 = W32API
60 VBoxRemPrimary_ASFLAGS = -x assembler-with-cpp
61 VBoxRemPrimary_CFLAGS = -Wall -g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-shadow
62 VBoxRemPrimary_CFLAGS.debug = -O0
63 VBoxRemPrimary_CFLAGS.release += -fno-gcse -O2
64 VBoxRemPrimary_CFLAGS.profile = $(VBoxRemPrimary_CFLAGS.release)
65 VBoxRemPrimary_DEFS += IN_RING3 $(ARCH_BITS_DEFS)
66 # Workaround the regparm bug in gcc <= 3.3.
67 VBoxRemPrimary_DEFS.win.x86 += GCC_WITH_BUGGY_REGPARM
68 # Missing fpclassify. Is there a better define or flag for this?
69 VBoxRemPrimary_DEFS.solaris += __C99FEATURES__
70endif # win
71VBoxRemPrimary_DEFS += IN_REM_R3 REM_INCLUDE_CPU_H NEED_CPU_H $(VMM_COMMON_DEFS)
72#VBoxRemPrimary_DEFS += REM_PHYS_ADDR_IN_TLB
73#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.
74#VBoxRemPrimary_DEFS += 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.
75ifdef VBOX_WITH_RAW_MODE
76 VBoxRemPrimary_DEFS += VBOX_WITH_RAW_MODE
77endif
78VBoxRemPrimary_DEFS.linux = _GNU_SOURCE
79ifdef VBOX_SOLARIS_10
80 VBoxRemPrimary_DEFS.solaris = CONFIG_SOLARIS_VERSION=10
81else
82 VBoxRemPrimary_DEFS.solaris = CONFIG_SOLARIS_VERSION=11
83endif
84VBoxRemPrimary_DEFS.freebsd += _BSD
85VBoxRemPrimary_DEFS.amd64 += __x86_64__
86VBoxRemPrimary_DEFS.x86 += __i386__
87
88VBoxRemPrimary_INCS = \
89 Sun \
90 target-i386 \
91 tcg \
92 fpu \
93 $(VBoxRemPrimary_0_OUTDIR) \
94 $(PATH_ROOT)/src/VBox/VMM/include \
95 tcg/i386 \
96 .
97ifn1of ($(VBoxRemPrimary_DEFS),DEBUG_TMP_LOGGING)
98 VBoxRemPrimary_DEFS += LOG_USE_C99
99 VBoxRemPrimary_INCS <= \
100 Sun/crt
101endif
102
103VBoxRemPrimary_SOURCES = \
104 VBoxRecompiler.c \
105 cpu-exec.c \
106 exec.c \
107 translate-all.c \
108 host-utils.c \
109 cutils.c \
110 tcg-runtime.c \
111 tcg/tcg.c \
112 tcg/tcg-dyngen.c \
113 fpu/softfloat-native.c \
114 target-i386/op_helper.c \
115 target-i386/helper.c \
116 target-i386/translate.c
117VBoxRemPrimary_SOURCES.debug += \
118 Sun/testmath.c
119VBoxRemPrimary_SOURCES.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMRes.o
120VBoxRemPrimary_SOURCES.win.x86 = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
121ifdef VBOX_USE_MINGWW64
122 if 0 # exporting all helps when windbg pops up on crashes
123 VBoxRemPrimary_SOURCES.win.amd64 = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
124 else
125 VBoxRemPrimary_LDFLAGS.win.amd64 = --export-all
126 endif
127endif
128
129ifndef VBOX_USE_MINGWW64
130VBoxRemPrimary_LIBS = \
131 $(LIB_VMM) \
132 $(LIB_RUNTIME)
133else
134VBoxRemPrimary_LIBS = \
135 $(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.a \
136 $(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.a
137VBoxRemPrimary_CLEAN = \
138 $(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.a \
139 $(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.def \
140 $(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.a \
141 $(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.def
142endif
143
144VBoxRemPrimary_LDFLAGS.solaris = -mimpure-text
145if defined(VBOX_WITH_HARDENING) && "$(KBUILD_TARGET)" == "win"
146 VBoxRemPrimary_POST_CMDS = \
147 $(VBOX_VCC_EDITBIN) /LargeAddressAware /DynamicBase /NxCompat /Release /IntegrityCheck \
148 /Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) "$(out)" \
149 $$(NLTAB)$(VBOX_SIGN_IMAGE_CMDS)
150else
151 VBoxRemPrimary_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
152endif
153
154
155if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64" && !defined(VBOX_USE_MINGWW64)
156 #
157 # VBoxREM2/VBoxRemPrimary - Currently only used by 64-bit Windows.
158 # (e_powl-xxx.S doesn't fit in IPRT because it requires GAS and is LGPL.)
159 #
160 SYSMODS += VBoxRemPrimary
161 VBoxRemPrimary_TEMPLATE = VBOXNOCRTGAS
162 VBoxRemPrimary_NAME = VBoxREM2
163 VBoxRemPrimary_DEFS += LOG_USE_C99 $(ARCH_BITS_DEFS)
164 VBoxRemPrimary_SOURCES += \
165 Sun/e_powl-$(KBUILD_TARGET_ARCH).S
166 VBoxRemPrimary_INCS += \
167 Sun/crt
168 VBoxRemPrimary_SYSSUFF = .rel
169 VBoxRemPrimary_LIBS = \
170 $(PATH_STAGE_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
171 VBoxRemPrimary_POST_CMDS = $(NO_SUCH_VARIABLE)
172 VBOX_REM_WRAPPER = 2
173
174else if "$(KBUILD_TARGET_ARCH)" == "x86" && defined(VBOX_WITH_64_BITS_GUESTS)
175 #
176 # For 32-bit targets when enabled 64-bit guests we build 2 REM DLLs:
177 # with 64-bit support (slow and buggy at the moment) VBOXREM64
178 # only 32-bit support (faster, stable, but not suitable for 64-bit guests) VBOXREM32
179 # During the runtime, we load appropriate library from VBOXREM, depending on guest settings.
180 # 64-bit targets have 64-bit enabled REM by default, so is not part of this mess
181 #
182
183 #
184 # VBoxREM32/VBoxRemPrimary
185 #
186 DLLS += VBoxRemPrimary
187 VBoxRemPrimary_NAME = VBoxREM32
188 VBoxRemPrimary_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM32.dylib
189 VBOX_REM_WRAPPER = 32
190
191 #
192 # VBoxREM64
193 #
194 DLLS += VBoxREM64
195 VBoxREM64_EXTENDS = VBoxRemPrimary
196 VBoxREM64_EXTENDS_BY = appending
197 VBoxREM64_NAME = VBoxREM64
198 VBoxREM64_DEFS = VBOX_ENABLE_VBOXREM64
199 VBoxREM64_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM64.dylib
200
201else
202 #
203 # VBoxREM/VBoxRemPrimary - Normal.
204 #
205 DLLS += VBoxRemPrimary
206 VBoxRemPrimary_NAME = VBoxREM
207 VBoxRemPrimary_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM3.dylib
208
209 ifdef VBOX_USE_MINGWW64
210 # GNU ld (rubenvb-4.5.4) 2.22.52.20120716 doesn't fix up rip relative
211 # addressing in the import libraries generated by microsoft link.exe. So, we
212 # have to regenerate these.
213 # Note! The chdir to the output directory is because dlltool writes temporary files to the current directory.
214 $$(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.a \
215 $$(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.a : $$(VBoxRemPrimary_0_OUTDIR)/$$(notdir $$(basename $$@)).def
216 $(REDIRECT) -C "$(dir $@)" -- $(TOOL_MINGWW64_DLLTOOL) \
217 --output-lib "$@" \
218 --input-def "$<" \
219 --dllname "$(patsubst %Imp.a,%.dll,$(notdir $@))"
220
221 $$(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.def \
222 $$(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.def : \
223 $(PATH_STAGE_BIN)/$$(patsubst %Imp.def,%.dll,$$(notdir $$@)) \
224 | $$(dir $$@)
225 $(APPEND) -nt $@ "LIBRARY $(notdir $<)" "EXPORTS"
226 $(TOOL_$(VBOX_VCC_TOOL)_DUMPBIN) /EXPORTS "$<" \
227 | $(SED) -e '/ = /!d' \
228 -e 's/^.* \([^ ][^ ]*\) = .*$(DOLLAR)/ \"\1\"/' \
229 --append $@
230 endif # VBOX_USE_MINGWW64
231
232endif
233
234
235ifdef VBOX_REM_WRAPPER
236 #
237 # VBoxREM - Wrapper for loading VBoxREM2, VBoxREM32 or VBoxREM64.
238 #
239 DLLS += VBoxREMWrapper
240 VBoxREMWrapper_TEMPLATE = VBoxR3DllWarnNoPic
241 VBoxREMWrapper_NAME = VBoxREM
242 VBoxREMWrapper_DEFS = IN_REM_R3
243 if "$(KBUILD_TARGET_ARCH)" == "x86" && defined(VBOX_WITH_64_BITS_GUESTS)
244 VBoxREMWrapper_DEFS += VBOX_USE_BITNESS_SELECTOR
245 endif
246 ifdef VBOX_WITHOUT_REM_LDR_CYCLE
247 VBoxREMWrapper_DEFS += VBOX_WITHOUT_REM_LDR_CYCLE
248 endif
249 VBoxREMWrapper_SOURCES = \
250 VBoxREMWrapper.cpp
251 VBoxREMWrapper_SOURCES.win = VBoxREM.rc
252 if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64" && !defined(VBOX_USE_MINGWW64)
253 VBoxREMWrapper_SOURCES += \
254 VBoxREMWrapperA.asm
255 endif
256 VBoxREMWrapper_LIBS = \
257 $(LIB_RUNTIME)
258 ifndef VBOX_WITHOUT_REM_LDR_CYCLE
259 VBoxREMWrapper_LIBS += \
260 $(LIB_VMM)
261 VBoxREMWrapper_LIBS.darwin += \
262 $(TARGET_VBoxREMImp)
263 endif
264 VBoxREMWrapper_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
265endif
266
267
268#
269# The VBoxREM import library.
270#
271# This is a HACK to get around (a) the cyclic dependency between VBoxVMM and
272# VBoxREM during linking and (b) the recursive build ordering which means VBoxREM
273# won't be built until after all the other DLLs.
274#
275IMPORT_LIBS += VBoxREMImp
276VBoxREMImp_TEMPLATE = VBoxR3Dll
277 ifn1of ($(KBUILD_TARGET), os2 win)
278VBoxREMImp_NAME = VBoxREM
279 endif
280VBoxREMImp_INST = $(INST_LIB)
281VBoxREMImp_SOURCES.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
282VBoxREMImp_CLEAN.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
283VBoxREMImp_SOURCES.os2 = $(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def
284VBoxREMImp_CLEAN.os2 = $(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def
285 ifn1of ($(KBUILD_TARGET), os2 win)
286VBoxREMImp_SOURCES = $(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c
287VBoxREMImp_CLEAN = $(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c
288 endif
289 ifn1of ($(KBUILD_TARGET), darwin os2 win)
290VBoxREMImp_SONAME = VBoxREM$(SUFF_DLL)
291 endif
292ifdef VBOX_WITHOUT_REM_LDR_CYCLE
293 VBoxREMImp_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
294else
295 VBoxREMImp_LDFLAGS.darwin = -install_name $(subst @rpath,@executable_path,$(VBOX_DYLD_EXECUTABLE_PATH))/VBoxREM.dylib
296endif
297VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
298
299$$(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed $(MAKEFILE_CURRENT) | $$(dir $$@)
300 $(call MSG_GENERATE,,$@)
301 $(QUIET)$(APPEND) -t $@ '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN'
302 $(QUIET)$(APPEND) $@ '# define EXPORT __attribute__((visibility("default")))'
303 $(QUIET)$(APPEND) $@ '#else'
304 $(QUIET)$(APPEND) $@ '# define EXPORT'
305 $(QUIET)$(APPEND) $@ '#endif'
306 $(QUIET)$(APPEND) $@ ''
307 $(QUIET)$(SED) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed --append $@ $<
308
309$$(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
310 $(SED) \
311 -e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
312 -e 's/\.[Dd][Ll][Ll]//' \
313 -e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
314 --output $@ \
315 $<
316
317$$(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
318 $(CP) -f $< $@
319
320$$(VBoxREMImp_0_OUTDIR)/VBoxREMRes.o: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.rc $(MAKEFILE_CURRENT) $(VBOX_VERSION_MK) | $$(dir $$@)
321 $(call MSG_GENERATE,,$@)
322 $(QUIET)$(REDIRECT) -E 'COMSPEC=$(VBOX_GOOD_COMSPEC_BS)' \
323 -- $(TOOL_$(VBoxRemPrimary_TOOL.win.$(KBUILD_TARGET_ARCH))_PREFIX)windres \
324 $(addprefix -I,$(INCS) $(PATH_SDK_$(VBOX_WINPSDK)_INC) $(PATH_TOOL_$(VBOX_VCC_TOOL)_INC)) \
325 -DVBOX_SVN_REV=$(VBOX_SVN_REV) \
326 -DVBOX_SVN_REV_MOD_5K=$(expr $(VBOX_SVN_REV) % 50000) \
327 $< $@
328
329#
330# The math testcase as a standalone program for testing and debugging purposes.
331#
332## @todo This is a bit messy because of MINGW32.
333testmath_ASFLAGS.amd64 = -m amd64
334testmath_CFLAGS = -Wall -g
335testmath_CFLAGS.release = -O3
336testmath_LDFLAGS = -g
337testmath_DEFS = MATHTEST_STANDALONE
338testmath_SOURCES = Sun/testmath.c
339
340
341include $(FILE_KBUILD_SUB_FOOTER)
342
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