Makefile.kmk revision 27537ffef7291d0bb3a24e459a6b94c65586defe
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# $Id$
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync## @file
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# The Recompiler Makefile.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# There are a few of complicating factors here, esp. on AMD64 systems:
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# * op.c doesn't compile work correctly with gcc 4. For this we've
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# checked in op.S, which is the reason why we don't compile op.c
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# directly but always compile via the assembly file.s
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# * On 64-bit Windows we lack a compiler and have to resort to a
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# linux cross compiler building an ELF relocatable module which
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# we then load using a wrapper module. Thus the REM_MOD mess.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# * On platforms using the 64-bit GCC ABI, we're not allowed to
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# generate non-PIC shared objects, and op.c requires the code
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# to be non-PIC. We apply the same trick as we developed for
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# 64-bit windows.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Copyright (C) 2006-2007 Sun Microsystems, Inc.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# available from http://www.virtualbox.org. This file is free software;
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# you can redistribute it and/or modify it under the terms of the GNU
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# General Public License (GPL) as published by the Free Software
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Clara, CA 95054 USA or visit http://www.sun.com if you need
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# additional information or have any questions.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncDEPTH = ../..
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncinclude $(KBUILD_PATH)/header.kmk
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncBLDPROGS = dyngen
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifneq ($(or $(eq $(KBUILD_TARGET_ARCH),amd64) , $(VBOX_TARGET_MAC_OS_X_VERSION_10_5)),)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync SYSMODS = VBoxREM2
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync REM_MOD = VBoxREM2
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncelse
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync REM_MOD = VBoxREM
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncDLLS = VBoxREM
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncIMPORT_LIBS = VBoxREMImp
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncOTHER_CLEAN = \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(PATH_$(REM_MOD))/op.h \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(PATH_$(REM_MOD))/opc.h \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(PATH_$(REM_MOD))/gen-op.h \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(PATH_$(REM_MOD))/opc.h
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncDEFS += REM_PHYS_ADDR_IN_TLB
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# L4 must use the no-crt path because it's lacking math stuff it seems...
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Darwin must use the non-crt path because it can't compile op.c nativly.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# All the AMD64 target must use the no-crt path because ELF doesn't like op.c
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# when stuffed into a shared library and windows doesn't have 64-bit gcc (yet).
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifeq ($(filter-out l4 darwin freebsd,$(KBUILD_TARGET)),)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync REM_USE_NOCRT := 1
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifeq ($(REM_MOD),VBoxREM2)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync REM_USE_NOCRT := 1
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# The dyngen build tool.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifeq ($(KBUILD_HOST),win)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync dyngen_TOOL = MINGW32
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync dyngen_SDKS = W32API
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync # On 64-bit Windows we pretend to be 32-bit.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync dyngen_BLD_TRG_ARCH = x86
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync dyngen_BLD_TRG_CPU = i386
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync dyngen_CFLAGS = -Wall -g -fno-strict-aliasing
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncelse
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync dyngen_TEMPLATE = VBOXBLDPROG
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifeq ($(KBUILD_TARGET_ARCH),amd64)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync dyngen_DEFS += HOST_X86_64=1
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncdyngen_CFLAGS += -Wno-missing-prototypes -Wno-missing-declarations
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncdyngen_INCS := \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync Sun \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync target-i386 \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync fpu \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(PATH_SUB_CURRENT)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncdyngen_SOURCES = dyngen.c
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# The VBoxREM.[dll|so|..] or VBoxREM2.rel.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync$(REM_MOD)_DEFS = IN_REM_R3 REM_INCLUDE_CPU_H
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#$(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.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync$(REM_MOD)_INCS = \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync Sun \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync Sun/crt\
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync target-i386 \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync fpu \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(PATH_$(REM_MOD)) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(PATH_ROOT)/src/VBox/VMM \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(PATH_CURRENT)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync$(REM_MOD)_SOURCES = \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync VBoxRecompiler.c \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync cpu-exec.c \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync exec.c \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync translate-all.c \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync translate-op.c \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync fpu/softfloat-native.c \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync target-i386/helper.c \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync target-i386/helper2.c \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync target-i386/translate.c
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync$(REM_MOD)_SOURCES.debug = \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync Sun/testmath.c
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifeq ($(filter-out win os2,$(KBUILD_TARGET)),)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_SOURCES += target-i386/op.c
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync FILE_OP_OBJ = $(PATH_$(REM_MOD)_target-i386/op.c)/op.o
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncelse # The remaining targets can be using gcc-4 and needs checking.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_SOURCES += $(PATH_$(REM_MOD))/op.S
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync FILE_OP_OBJ = $(PATH_$(REM_MOD)_$(PATH_$(REM_MOD))/op.S)/op.o
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_CLEAN = $(FILE_OP_OBJ) $(PATH_$(REM_MOD))/op.S.dep
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync$(REM_MOD)_SOURCES.win.x86 = $(REM_MOD).def
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifneq ($(REM_MOD),VBoxREM2)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifdef REM_USE_NOCRT
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_TEMPLATE = VBOXNOCRTGAS
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_DEFS += LOG_USE_C99
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_CFLAGS.amd64 = -O2
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_CFLAGS.debug = -O0
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync ifdef ($(KBUILD_TARGET_ARCH),x86)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_CFLAGS.release+= -fomit-frame-pointer -fno-gcse
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync endif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync # This doesn't fit in IPRT because it requires GAS and is LGPL.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_SOURCES += \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync Sun/e_powl-$(KBUILD_TARGET_ARCH).S
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync ifeq ($(REM_MOD),VBoxREM)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LIBS = \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(LIB_VMM) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(LIB_RUNTIME)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync ifeq ($(KBUILD_TARGET),l4)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LIBS += \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(L4_LIBDIR)/libuc.0.s.so
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync endif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LIBS.darwin = \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(TARGET_VBoxREMImp)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LDFLAGS.darwin = -read_only_relocs suppress -multiply_defined warning #-install_name @executable_path/$(REM_MOD).dylib#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_CFLAGS.darwin = -fno-common -mdynamic-no-pic
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync else
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LIBS = \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_SYSSUFF = .rel
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LDFLAGS.darwin = -nostdlib -static
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_CFLAGS.darwin = -fno-common -static -mno-dynamic-no-pic
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync endif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncelse # !REM_USE_NOCRT
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_TOOL = GXX3
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_TOOL.solaris = GXX3PLAIN
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_TOOL.win.x86 = MINGW32
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_TOOL.win.amd64 = XGCCAMD64LINUX
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_SDKS.win.x86 = W32API ## @todo do we really need this now?
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_ASFLAGS = -x assembler-with-cpp ## @todo didn't I make this default already?
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_CFLAGS = -Wall -g
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_CFLAGS.debug = -O0
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_CFLAGS.release += -fomit-frame-pointer -fno-gcse
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_CFLAGS.profile = $($(REM_MOD)_CFLAGS.release)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_CFLAGS.kprofile = $($(REM_MOD)_CFLAGS.release)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_CFLAGS.l4 = -nostdinc
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync ifeq ($(KBUILD_TARGET),l4)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_INCS += $(VBOX_L4_GCC3_INCS) $(L4_INCDIR)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync endif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_DEFS += IN_RING3 LOG_USE_C99
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync #$(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.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync # these defines are probably all irrelevant now:
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_DEFS += _GNU_SOURCE _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE _REENTRANT
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LDFLAGS.darwin = -read_only_relocs suppress -install_name @executable_path/$(REM_MOD).dylib -multiple_defined warning
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib -Wl,--no-undefined
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LDFLAGS.linux = $(VBOX_LD_as_needed)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LDFLAGS.os2 = -Zomf
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LDFLAGS.debug = -g
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LDFLAGS.solaris = -mimpure-text
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_DEFS.solaris += HOST_SOLARIS=11
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync ifeq ($(KBUILD_TARGET_ARCH),amd64)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LIBS = $(FILE_TOOL_GCC3_LIBGCC)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync else # x86
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LIBS = \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(LIB_VMM) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(LIB_RUNTIME)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LIBS.win.x86 = \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync mingw32 \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync user32 gdi32 winmm ws2_32 iphlpapi dxguid
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LIBS.linux = \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(LIB_UUID) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync m \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync util \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync rt \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(LIB_PTHREAD)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(REM_MOD)_LIBS.l4 = \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync gcc \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(L4_LIBDIR)/libvboxserver.s.so \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(L4_LIBDIR)/libdl.s.so \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(L4_LIBDIR)/libuc.0.s.so
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync endif # x86
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif # !REM_USE_NOCRT
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Extra flags for these source modules.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctarget-i386/op.c_CFLAGS = -O2 -fno-strict-aliasing -fomit-frame-pointer -falign-functions=0 -fno-reorder-blocks -fno-optimize-sibling-calls
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctarget-i386/op.c_CFLAGS.x86 = -fno-gcse -fno-instrument-functions -mpreferred-stack-boundary=2
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctarget-i386/op.c_CFLAGS.darwin.x86 = -m128bit-long-double -mpreferred-stack-boundary=4
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctarget-i386/helper.c_CFLAGS.x86 = -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-gcse
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynccpu-exec.c_CFLAGS.x86 = -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-gcse
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynccpu-exec.c_CFLAGS.solaris.amd64 = -O2 -fomit-frame-pointer -fno-strict-aliasing
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# The math testcase as a standalone program for testing and debugging purposes.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync## @todo This is a bit messy because of MINGW32.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#BLDPROGS += testmath
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctestmath_TOOL = GXX3
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctestmath_TOOL.win.x86 = MINGW32
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctestmath_SDKS.win.x86 = W32API
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifeq ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),win.amd64)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync # 64-bit windows: Pretend to be 32-bit.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync testmath_BLD_TRG = win32
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync testmath_BLD_TRG_ARCH = x86
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync testmath_BLD_TRG_CPU = i386
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctestmath_ASTOOL = $(VBOX_ASTOOL)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifeq ($(filter-out win32 win64,$(KBUILD_HOST)),)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync testmath_ASFLAGS = -f win32 -DNASM_FORMAT_PE $(VBOX_ASFLAGS) -w+orphan-labels
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncelse
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync testmath_ASFLAGS = -f elf -DNASM_FORMAT_ELF $(VBOX_ASFLAGS) -w+orphan-labels
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctestmath_ASFLAGS.amd64 = -m amd64
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctestmath_CFLAGS = -Wall -g
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctestmath_CFLAGS.release = -O3
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctestmath_LDFLAGS = -g
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctestmath_DEFS = MATHTEST_STANDALONE
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctestmath_SOURCES = Sun/testmath.c
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#testmath_SOURCES += $(PATH_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifeq ($(REM_MOD),VBoxREM2)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# The VBoxREM2 wrapper.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREM_TEMPLATE = VBOXR3
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREM_DEFS = IN_REM_R3
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREM_SOURCES = \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync VBoxREMWrapper.cpp \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync VBoxREMWrapperA.asm
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREM_LDFLAGS.darwin = -install_name @executable_path/VBoxREM.dylib
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREM_LIBS = \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(LIB_VMM) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(LIB_RUNTIME)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# The VBoxREM import library.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREMImp_TEMPLATE = VBOXR3
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifeq ($(KBUILD_TARGET),darwin)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREMImp_INST = $(INST_LIB)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREMImp_SOURCES.win = VBoxREM.def
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREMImp_SOURCES.os2 = $(PATH_TARGET)/VBoxREMOS2.def
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifeq ($(filter win os2,$(KBUILD_TARGET)),)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREMImp_SOURCES = $(PATH_TARGET)/VBoxREMImp.c
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREMImp_CLEAN = $(PATH_TARGET)/VBoxREMImp.c
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifneq ($(filter-out darwin os2 win,$(KBUILD_TARGET)),)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREMImp_SONAME = VBoxREM$(SUFF_DLL)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREMImp_LDFLAGS.darwin = -install_name @executable_path/VBoxREM.dylib
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#VBoxREMImp_LDFLAGS.darwin = -install_name VBoxREM.dylib
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncVBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync$(PATH_TARGET)/VBoxREMImp.c: VBoxREM.def Sun/deftoimp.sed Makefile.kmk | $(call DIRDEP,$(PATH_TARGET))
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(call MSG_GENERATE,,$@)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET)$(MKDIR) -p $(PATH_TARGET)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET)$(APPEND) $@.tmp '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN'
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET)$(APPEND) $@.tmp '# define EXPORT __attribute__((visibility("default")))'
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET)$(APPEND) $@.tmp '#else'
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET)$(APPEND) $@.tmp '# define EXPORT'
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET)$(APPEND) $@.tmp '#endif'
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET)$(APPEND) $@.tmp ''
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET)$(SED) -f Sun/deftoimp.sed VBoxREM.def >> $@.tmp
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET)$(MV) -f $@.tmp $@
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync$(VBoxREMImp_SOURCES.os2): VBoxREM.def $(MAKEFILE) | $(call DIRDEP,$(PATH_TARGET))
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(SED) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync -e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync -e 's/\.[Dd][Ll][Ll]//' \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync -e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync VBoxREM.def > $@.tmp
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(MV) -f $@.tmp $@
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncinclude $(KBUILD_PATH)/footer.kmk
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Generate the op.S file somehow...
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Gathering the flags, defines and include dirs for the command is a lot
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# of work. Unfortunately, there is only a highly specialized kBuild function
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# for doing this, so we're currently left to our own devices here.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Add something like VBOX_RECOMPILER_OP_GCC = gcc-3.4.6 to LocalConfig.kmk
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# to be 100% sure that you get a working op.S. My gcc 4.1.1 seems to work
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# fine, so feel free to try VBOX_RECOMPILER_OP_GCC = gcc.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# The op-undefined.lst is generated by finding all the undefined symbols
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# in one (or more) ELF op.o files using nm.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync#
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifndef VBOX_RECOMPILER_OP_GCC
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),darwin.x86)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync VBOX_RECOMPILER_OP_GCC ?= $(notdir $(firstword $(which i386-elf-gcc-3.4 i386-elf-gcc-3.4.6 i386-elf-gcc-3.4.3 i386-elf-gcc) i386-elf-gcc)) # (port install i386-gcc-elf)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync VBOX_RECOMPILER_OP_GCC_OK := yes
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync VBOX_RECOMPILER_OP_GCC_INCS ?= $(abspath $(dir $(shell LC_ALL=C $(VBOX_RECOMPILER_OP_GCC) -print-libgcc-file-name)))/include
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync endif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync ifndef VBOX_RECOMPILER_OP_GCC
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync VBOX_RECOMPILER_OP_GCC := $(TOOL_$(VBOX_GCC_TOOL)_CC)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync VBOX_RECOMPILER_OP_GCC_OK := dunno
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync endif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncelse
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync # If set, assume it's an OK compiler.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync VBOX_RECOMPILER_OP_GCC_OK := yes
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# The command sans -o op.S.tmp.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncCOMPILE_OP_CMDS = $(VBOX_RECOMPILER_OP_GCC) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync -S -s \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(filter-out -g -O0, \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $($(REM_MOD)_CFLAGS) $($(REM_MOD)_CFLAGS.$(KBUILD_TYPE)) $($(REM_MOD)_CFLAGS.$(KBUILD_TARGET)) $($(REM_MOD)_CFLAGS.$(KBUILD_TARGET_ARCH)) $($(REM_MOD)_CFLAGS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(target-i386/op.c_CFLAGS) $(target-i386/op.c_CFLAGS.$(KBUILD_TARGET)) $(target-i386/op.c_CFLAGS.$(KBUILD_TARGET_ARCH)) $(target-i386/op.c_CFLAGS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync ) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(addprefix -I, \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $($(REM_MOD)_CINCS.$(KBUILD_TARGET_ARCH)) $($(REM_MOD)_CINCS.$(KBUILD_TARGET)) $($(REM_MOD)_CINCS) $(CINCS) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $($(REM_MOD)_INCS.$(KBUILD_TARGET_ARCH)) $($(REM_MOD)_INCS.$(KBUILD_TARGET)) $($(REM_MOD)_INCS) $(INCS) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync ) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(addprefix -D, \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $($(REM_MOD)_CDEFS.$(KBUILD_TARGET_ARCH)) $($(REM_MOD)_CDEFS.$(KBUILD_TARGET)) $($(REM_MOD)_CDEFS) $(CDEFS.$(KBUILD_TARGET)) $(CDEFS.$(KBUILD_TARGET_ARCH)) $(CDEFS.$(KBUILD_TYPE)) $(CDEFS) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $($(REM_MOD)_DEFS.$(KBUILD_TARGET_ARCH)) $($(REM_MOD)_DEFS.$(KBUILD_TARGET)) $($(REM_MOD)_DEFS) $(DEFS.$(KBUILD_TARGET)) $(DEFS.$(KBUILD_TARGET_ARCH)) $(DEFS.$(KBUILD_TYPE)) $(DEFS) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync ) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync -Wp,-MD,$(PATH_$(REM_MOD))/op.S.dep \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync -Wp,-MT,$(PATH_$(REM_MOD))/op.S \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync -Wp,-MP \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync target-i386/op.c
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Use the right GCC includes.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifdef VBOX_RECOMPILER_OP_GCC_INCS
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncCOMPILE_OP_CMDS := $(subst $(VBOX_PATH_GCC_INCS),$(VBOX_RECOMPILER_OP_GCC_INCS),$(COMPILE_OP_CMDS))
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Drop incompatible options when using the cross-compiler on darwin.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifeq ($(KBUILD_TARGET),darwin)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync ifeq ($(filter-out i386-elf-gcc%, $(VBOX_RECOMPILER_OP_GCC)),)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync COMPILE_OP_CMDS := $(filter-out -mdynamic-no-pic -mno-dynamic-no-pic -fno-stack-protector, $(COMPILE_OP_CMDS))
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync endif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncelse if1of ($(KBUILD_TARGET),linux)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync ifneq ($(TOOL_$(VBOX_GCC_TOOL)_CC),$(VBOX_RECOMPILER_OP_GCC))
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync VBOX_RECOMPILER_OP_CHECK_CC_GCC = $(shell \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync if $(VBOX_RECOMPILER_OP_GCC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync then echo "$(1)"; \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync else echo "$(2)"; fi; )
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync COMPILE_OP_CMDS := \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(filter-out -fno-stack-protector, $(COMPILE_OP_CMDS)) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(call VBOX_RECOMPILER_OP_CHECK_CC_GCC,-fno-stack-protector)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync endif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# include the dependencies
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync-include $(PATH_$(REM_MOD))/op.S.dep
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# The rule.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync$(PATH_$(REM_MOD))/op.S: \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync target-i386/op.c \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync Sun/staged-op-elf-$(KBUILD_TARGET_ARCH).S \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync Sun/op-validate.sed \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync Sun/op-darwin.sed \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync Sun/op-undefined.lst \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync Makefile.kmk \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(comp-cmds COMPILE_OP_CMDS,COMPILE_OP_CMDS_PREV,FORCE) \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync | $(call DIRDEP,$(PATH_$(REM_MOD)))
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(RM) -f $@ $@.tmp $@.tmp2 $@.dep
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifeq ($(VBOX_RECOMPILER_OP_GCC_OK),yes)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(call MSG_COMPILE,VBoxREM,$<,$@,AS)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(addsuffix $(SP)\$(NL)$(TAB) ,$(COMPILE_OP_CMDS)) -o $@.tmp
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncelse ifeq ($(VBOX_RECOMPILER_OP_GCC_OK),dunno) # (permit 3.x.x and 4.1.x+ for now)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync major_ver=`$(VBOX_RECOMPILER_OP_GCC) -dumpversion | $(SED) -e 's/^\([2-9]\)\..*$$/\1/'`; \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync minor_ver=`$(VBOX_RECOMPILER_OP_GCC) -dumpversion | $(SED) -e 's/^[2-9]\.\([0-9]\)\..*$$/\1/'`; \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync bugfix_ver=`$(VBOX_RECOMPILER_OP_GCC) -dumpversion | $(SED) -e 's/^[2-9]\.[0-9]\.\([0-9]\).*$$/\1/'`; \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync if test "$$major_ver" = "3" -o "(" "$$major_ver" = "4" -a "$$minor_ver" != "0" ")"; then \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(ECHO_EXT) "Compiling $< => $@ [gcc v$${major_ver}.$${minor_ver}.$${bugfix_ver}]" && \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(addsuffix $(SP)\$(NL)$(TAB)$(TAB) ,$(COMPILE_OP_CMDS)) -o $@.tmp; \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync else \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(ECHO_EXT) "Using staged op.S [gcc v$${major_ver}.$${minor_ver}.$${bugfix_ver}]" && \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(CP_EXT) -f Sun/staged-op-elf-$(KBUILD_TARGET_ARCH).S $@.tmp; \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync fi
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncelse
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(CP) Sun/staged-op-elf-$(KBUILD_TARGET_ARCH).S $@.tmp
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(SED) -f Sun/op-validate.sed $@.tmp
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifeq ($(KBUILD_TARGET),darwin)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(SED) -f Sun/op-darwin.sed $@.tmp > $@.tmp2
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(SED) -e 's/^\(.*\)$$/#define \1 _\1/' Sun/op-undefined.lst > $@.tmp
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(CAT_EXT) $@.tmp2 >> $@.tmp
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(MV) -f $@.tmp $@
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET2)$(APPEND) "$@.dep"
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET2)$(APPEND) "$@.dep" 'define COMPILE_OP_CMDS_PREV'
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET2)$(APPEND) "$@.dep" '$(subst $(NL),'$(NL)$(TAB)@$(APPEND) "$@.dep" ',$(COMPILE_OP_CMDS))'
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET2)$(APPEND) "$@.dep" 'endef'
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Hack for crosscompiling.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncDYNGEN = $(PATH_dyngen)/dyngen$(HOSTSUFF_EXE)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncDYNGEN_EXEC = $(DYNGEN)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncifneq ($(KBUILD_HOST),$(KBUILD_TARGET)) # hack for crosscompiling.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync ifeq ($(KBUILD_TARGET),win)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync DYNGEN = $(PATH_dyngen)/dyngen.exe
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync DYNGEN_EXEC := $(EXEC_X86_WIN32) $(DYNGEN_EXEC)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync endif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncendif
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# The dyngen rules.
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync$(PATH_$(REM_MOD))/op.h: $(FILE_OP_OBJ) $(DYNGEN)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(call MSG_TOOL,dyngen,VBoxREM,$<,$@)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET)$(DYNGEN_EXEC) -o $@ $<
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync$(PATH_$(REM_MOD))/opc.h: $(FILE_OP_OBJ) $(DYNGEN)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(call MSG_TOOL,dyngen,VBoxREM,$<,$@)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET)$(DYNGEN_EXEC) -c -o $@ $<
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync$(PATH_$(REM_MOD))/gen-op.h: $(FILE_OP_OBJ) $(DYNGEN)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(call MSG_TOOL,dyngen,VBoxREM,$<,$@)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync $(QUIET)$(DYNGEN_EXEC) -g -o $@ $<
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Dyngen dependants (sp?).
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctranslate-all.c \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctranslate-op.c \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsynctarget-i386/translate.c \
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync : $(PATH_$(REM_MOD))/op.h $(PATH_$(REM_MOD))/opc.h $(PATH_$(REM_MOD))/gen-op.h
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync# Some aliases
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncdo_dyngen: $(PATH_$(REM_MOD))/gen-op.h $(PATH_$(REM_MOD))/opc.h $(PATH_$(REM_MOD))/op.h
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncimportlib: $(LIB_REM)
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsyncop.S: $(PATH_$(REM_MOD))/op.S
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync
b6251cd7c3ee1990339b293f31a18bccb5602ef8vboxsync