Makefile.kmk revision bbc0a3fc49446bf8fa1fcfe669c10875701692bc
# $Id$
## @file
# The Recompiler Sub-Makefile.
#
#
# Copyright (C) 2006-2010 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
SUB_DEPTH = ../..
include $(KBUILD_PATH)/subheader.kmk
ifn1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.x86 darwin.amd64 linux.amd64)
include $(PATH_SUB_CURRENT)/Makefile-old.kmk
else # new stuff
#
# Globals
#
VBOX_PATH_RECOMPILER_SRC := $(PATH_SUB_CURRENT)
# Workaround for darwin hell.
ifeq ($(KBUILD_TARGET),darwin)
VBOX_WITHOUT_REM_LDR_CYCLE := 1
endif
#
# The primary REM module definition.
#
# This is extended by one of the VBoxREM* modules below. Currently, this
# isn't done by inheritance because of some obscure bug wrt inheriting from
# unused targets that I'm not going to fix now.
#
ifneq ($(KBUILD_TARGET),win)
VBoxRemPrimary_TEMPLATE = VBOXR3NP
# workaround the regparm bug in gcc <= 3.3
VBoxRemPrimary_DEFS = $(if $(VBOX_GCC_BUGGY_REGPARM),GCC_WITH_BUGGY_REGPARM,)
else
VBoxRemPrimary_TEMPLATE = DUMMY
VBoxRemPrimary_TOOL.win.x86 = MINGW32
VBoxRemPrimary_TOOL.win.amd64 = XGCCAMD64LINUX
VBoxRemPrimary_SDKS.win.x86 = W32API
VBoxRemPrimary_ASFLAGS = -x assembler-with-cpp
VBoxRemPrimary_CFLAGS = -Wall -g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-shadow
VBoxRemPrimary_CFLAGS.debug = -O0
VBoxRemPrimary_CFLAGS.release += -fno-gcse -O2
VBoxRemPrimary_CFLAGS.profile = $(VBoxRemPrimary_CFLAGS.release)
VBoxRemPrimary_DEFS += IN_RING3 $(ARCH_BITS_DEFS)
# Workaround the regparm bug in gcc <= 3.3.
VBoxRemPrimary_DEFS.win.x86 += GCC_WITH_BUGGY_REGPARM
# Missing fpclassify. Is there a better define or flag for this?
VBoxRemPrimary_DEFS.solaris += __C99FEATURES__
endif # win
VBoxRemPrimary_DEFS += IN_REM_R3 REM_INCLUDE_CPU_H
#VBoxRemPrimary_DEFS += REM_PHYS_ADDR_IN_TLB
#VBoxRemPrimary_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.
#VBoxRemPrimary_DEFS += DEBUG_TMP_LOGGING # log qemu parts to "/tmp/vbox-qemu.log" - does not work with VBoxREM2.
VBoxRemPrimary_DEFS.linux = _GNU_SOURCE
ifdef VBOX_SOLARIS_10
VBoxRemPrimary_DEFS.solaris = HOST_SOLARIS=10
else
VBoxRemPrimary_DEFS.solaris = HOST_SOLARIS=11
endif
VBoxRemPrimary_DEFS.freebsd += _BSD
VBoxRemPrimary_DEFS.amd64 += __x86_64__
VBoxRemPrimary_DEFS.x86 += __i386__
VBoxRemPrimary_INCS = \
Sun \
target-i386 \
tcg \
fpu \
$(VBoxRemPrimary_0_OUTDIR) \
$(PATH_ROOT)/src/VBox/VMM/include \
.
VBoxRemPrimary_INCS.amd64 += tcg/x86_64
VBoxRemPrimary_INCS.x86 += tcg/i386
ifn1of ($(VBoxRemPrimary_DEFS),DEBUG_TMP_LOGGING)
VBoxRemPrimary_DEFS += LOG_USE_C99
VBoxRemPrimary_INCS <= \
Sun/crt
endif
VBoxRemPrimary_SOURCES = \
VBoxRecompiler.c \
cpu-exec.c \
exec.c \
translate-all.c \
host-utils.c \
cutils.c \
tcg/tcg.c \
tcg/tcg-dyngen.c \
tcg/tcg-runtime.c \
fpu/softfloat-native.c \
target-i386/op_helper.c \
target-i386/helper.c \
target-i386/translate.c
VBoxRemPrimary_SOURCES.debug += \
Sun/testmath.c
VBoxRemPrimary_SOURCES.win.x86 = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
VBoxRemPrimary_LIBS = \
$(LIB_VMM) \
$(LIB_RUNTIME)
VBoxRemPrimary_LDFLAGS.solaris = -mimpure-text
VBoxRemPrimary_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64"
#
# VBoxREM2/VBoxRemPrimary - Currently only used by 64-bit Windows.
# (e_powl-xxx.S doesn't fit in IPRT because it requires GAS and is LGPL.)
#
SYSMODS += VBoxRemPrimary
VBoxRemPrimary_TEMPLATE = VBOXNOCRTGAS
VBoxRemPrimary_NAME = VBoxREM2
VBoxRemPrimary_DEFS += LOG_USE_C99 $(ARCH_BITS_DEFS)
VBoxRemPrimary_SOURCES += \
Sun/e_powl-$(KBUILD_TARGET_ARCH).S
VBoxRemPrimary_INCS += \
Sun/crt
VBoxRemPrimary_SYSSUFF = .rel
VBoxRemPrimary_LIBS = \
$(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
VBoxRemPrimary_POST_CMDS = $(NO_SUCH_VARIABLE)
VBOX_REM_WRAPPER = 2
else if "$(KBUILD_TARGET_ARCH)" == "x86" && defined(VBOX_WITH_64_BITS_GUESTS)
#
# For 32-bit targets when enabled 64-bit guests we build 2 REM DLLs:
# with 64-bit support (slow and buggy at the moment) VBOXREM64
# only 32-bit support (faster, stable, but not suitable for 64-bit guests) VBOXREM32
# During the runtime, we load appropriate library from VBOXREM, depending on guest settings.
# 64-bit targets have 64-bit enabled REM by default, so is not part of this mess
#
#
# VBoxREM32/VBoxRemPrimary
#
DLLS += VBoxRemPrimary
VBoxRemPrimary_NAME = VBoxREM32
VBoxRemPrimary_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM32.dylib
VBOX_REM_WRAPPER = 32
#
# VBoxREM64
#
DLLS += VBoxREM64
VBoxREM64_EXTENDS = VBoxRemPrimary
VBoxREM64_EXTENDS_BY = appending
VBoxREM64_NAME = VBoxREM64
VBoxREM64_DEFS = VBOX_ENABLE_VBOXREM64
VBoxREM64_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM64.dylib
else
#
# VBoxREM/VBoxRemPrimary - Normal.
#
DLLS += VBoxRemPrimary
VBoxRemPrimary_NAME = VBoxREM
VBoxRemPrimary_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM3.dylib
endif
ifdef VBOX_REM_WRAPPER
#
# VBoxREM - Wrapper for loading VBoxREM2, VBoxREM32 or VBoxREM64.
#
DLLS += VBoxREMWrapper
VBoxREMWrapper_TEMPLATE = VBOXR3
VBoxREMWrapper_NAME = VBoxREM
VBoxREMWrapper_DEFS = IN_REM_R3
if "$(KBUILD_TARGET_ARCH)" == "x86" && defined(VBOX_WITH_64_BITS_GUESTS)
VBoxREMWrapper_DEFS += VBOX_USE_BITNESS_SELECTOR
endif
ifdef VBOX_WITHOUT_REM_LDR_CYCLE
VBoxREMWrapper_DEFS += VBOX_WITHOUT_REM_LDR_CYCLE
endif
VBoxREMWrapper_SOURCES = \
VBoxREMWrapper.cpp
if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64"
VBoxREMWrapper_SOURCES += \
VBoxREMWrapperA.asm
endif
VBoxREMWrapper_LIBS = \
$(LIB_RUNTIME)
ifndef VBOX_WITHOUT_REM_LDR_CYCLE
VBoxREMWrapper_LIBS += \
$(LIB_VMM)
VBoxREMWrapper_LIBS.darwin += \
$(TARGET_VBoxREMImp)
endif
VBoxREMWrapper_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
endif
#
# The VBoxREM import library.
#
# This is a HACK to get around (a) the cyclic dependency between VBoxVMM and
# VBoxREM during linking and (b) the recursive build ordering which means VBoxREM
# won't be built until after all the other DLLs.
#
IMPORT_LIBS += VBoxREMImp
VBoxREMImp_TEMPLATE = VBOXR3
ifn1of ($(KBUILD_TARGET), os2 win)
VBoxREMImp_NAME = VBoxREM
endif
VBoxREMImp_INST = $(INST_LIB)
VBoxREMImp_SOURCES.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
VBoxREMImp_CLEAN.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
VBoxREMImp_SOURCES.os2 = $(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def
VBoxREMImp_CLEAN.os2 = $(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def
ifn1of ($(KBUILD_TARGET), os2 win)
VBoxREMImp_SOURCES = $(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c
VBoxREMImp_CLEAN = $(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c
endif
ifn1of ($(KBUILD_TARGET), darwin os2 win)
VBoxREMImp_SONAME = VBoxREM$(SUFF_DLL)
endif
ifdef VBOX_WITHOUT_REM_LDR_CYCLE
VBoxREMImp_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
else
VBoxREMImp_LDFLAGS.darwin = -install_name $(subst @rpath,@executable_path,$(VBOX_DYLD_EXECUTABLE_PATH))/VBoxREM.dylib
endif
VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
$$(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed $(MAKEFILE_CURRENT) | $$(dir $$@)
$(call MSG_GENERATE,,$@)
$(QUIET)$(APPEND) -t $@ '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN'
$(QUIET)$(APPEND) $@ '# define EXPORT __attribute__((visibility("default")))'
$(QUIET)$(APPEND) $@ '#else'
$(QUIET)$(APPEND) $@ '# define EXPORT'
$(QUIET)$(APPEND) $@ '#endif'
$(QUIET)$(APPEND) $@ ''
$(QUIET)$(SED) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed --append $@ $<
$$(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
$(SED) \
-e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
-e 's/\.[Dd][Ll][Ll]//' \
-e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
--output $@ \
$<
$$(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
$(CP) -f $< $@
#
# The math testcase as a standalone program for testing and debugging purposes.
#
## @todo This is a bit messy because of MINGW32.
testmath_ASFLAGS.amd64 = -m amd64
testmath_CFLAGS = -Wall -g
testmath_CFLAGS.release = -O3
testmath_LDFLAGS = -g
testmath_DEFS = MATHTEST_STANDALONE
testmath_SOURCES = Sun/testmath.c
endif # new stuff
include $(KBUILD_PATH)/subfooter.kmk