VirtualBox

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

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

scm --update-copyright-year

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

© 2023 Oracle
ContactPrivacy policyTerms of Use