Add back support for big endian targets including OSX-PPC

This commit is contained in:
Vas Crabb 2015-04-02 22:22:19 +11:00
parent 126cac8f43
commit a63bd12019
5 changed files with 110 additions and 35 deletions

View File

@ -138,6 +138,18 @@ ifndef NOASM
endif
endif
# Autodetect BIGENDIAN
# MacOSX
ifndef BIGENDIAN
ifneq (,$(findstring Power,$(UNAME)))
BIGENDIAN := 1
endif
# Linux
ifneq (,$(findstring ppc,$(UNAME)))
BIGENDIAN := 1
endif
endif # BIGENDIAN
PYTHON := $(SILENT)python
CC := $(SILENT)gcc
@ -249,19 +261,19 @@ PARAMS += --with-tools
endif
ifdef SYMBOLS
PARAMS += --SYMBOLS=$(SYMBOLS)
PARAMS += --SYMBOLS='$(SYMBOLS)'
endif
ifdef SYMLEVEL
PARAMS += --SYMLEVEL=$(SYMLEVEL)
PARAMS += --SYMLEVEL='$(SYMLEVEL)'
endif
ifdef PROFILER
PARAMS += --PROFILER=$(PROFILER)
PARAMS += --PROFILER='$(PROFILER)'
endif
ifdef PROFILE
PARAMS += --PROFILE=$(PROFILE)
PARAMS += --PROFILE='$(PROFILE)'
endif
ifdef OPTIMIZE
@ -284,28 +296,32 @@ ifdef NOASM
PARAMS += --NOASM='$(NOASM)'
endif
ifdef BIGENDIAN
PARAMS += --BIGENDIAN='$(BIGENDIAN)'
endif
ifdef FORCE_DRC_C_BACKEND
PARAMS += --FORCE_DRC_C_BACKEND='$(FORCE_DRC_C_BACKEND)'
endif
ifdef NOWERROR
PARAMS += --NOWERROR=$(NOWERROR)
PARAMS += --NOWERROR='$(NOWERROR)'
endif
ifdef TARGET
PARAMS += --target=$(TARGET)
PARAMS += --target='$(TARGET)'
endif
ifdef SUBTARGET
PARAMS += --subtarget=$(SUBTARGET)
PARAMS += --subtarget='$(SUBTARGET)'
endif
ifdef OSD
PARAMS += --osd=$(OSD)
PARAMS += --osd='$(OSD)'
endif
ifdef TARGETOS
PARAMS += --targetos=$(TARGETOS)
PARAMS += --targetos='$(TARGETOS)'
endif
ifdef DONT_USE_NETWORK

View File

@ -172,6 +172,15 @@ newoption {
},
}
newoption {
trigger = "BIGENDIAN",
description = "Build for big endian target",
allowed = {
{ "0", "Little endian target" },
{ "1", "Big endian target" },
},
}
newoption {
trigger = "FORCE_DRC_C_BACKEND",
description = "Force DRC C backend.",
@ -193,6 +202,10 @@ newoption {
local os_version = str_to_version(_OPTIONS["os_version"])
if not _OPTIONS["BIGENDIAN"] then
_OPTIONS["BIGENDIAN"] = "0"
end
if not _OPTIONS["NOASM"] then
if _OPTIONS["targetos"]=="emscripten" then
_OPTIONS["NOASM"] = "1"
@ -384,10 +397,56 @@ else
end
-- define LSB_FIRST if we are a little-endian target
defines {
"LSB_FIRST",
}
if _OPTIONS["BIGENDIAN"]=="1" then
if _OPTIONS["targetos"]=="macosx" then
defines {
"OSX_PPC",
}
buildoptions {
"-Wno-unused-label",
}
if _OPTIONS["SYMBOLS"] then
buildoptions {
"-mlong-branch",
}
end
configuration { "x64" }
buildoptions {
"-arch ppc64",
}
linkoptions {
"-arch ppc64",
}
configuration { "x32" }
buildoptions {
"-arch ppc",
}
linkoptions {
"-arch ppc",
}
configuration { }
end
else
defines {
"LSB_FIRST",
}
if _OPTIONS["targetos"]=="macosx" then
configuration { "x64" }
buildoptions {
"-arch x86_64",
}
linkoptions {
"-arch x86_64",
}
configuration { "x32" }
buildoptions {
"-arch i386",
}
linkoptions {
"-arch i386",
}
end
end
-- need to ensure FLAC functions are statically linked
defines {
@ -400,17 +459,18 @@ if _OPTIONS["NOASM"]=="1" then
}
end
-- fixme -- need to make this work for other target architectures (PPC)
if not _OPTIONS["FORCE_DRC_C_BACKEND"] then
configuration { "x64" }
defines {
"NATIVE_DRC=drcbe_x64",
}
configuration { "x32" }
defines {
"NATIVE_DRC=drcbe_x86",
}
configuration { }
if _OPTIONS["BIGENDIAN"]~="1" then
configuration { "x64" }
defines {
"NATIVE_DRC=drcbe_x64",
}
configuration { "x32" }
defines {
"NATIVE_DRC=drcbe_x86",
}
configuration { }
end
end
-- define USE_SYSTEM_JPEGLIB if library shipped with MAME is not used

View File

@ -969,7 +969,6 @@ end
if (SOUNDS["VOTRAX"]~=null) then
files {
MAME_DIR .. "src/emu/sound/votrax.c",
MAME_DIR .. "src/emu/sound/samples.c",
}
end

View File

@ -435,7 +435,7 @@ INLINE void rgbaint_bilinear_filter(rgbaint *color, rgb_t const &rgb00, rgb_t co
}
// altivec.h somehow redefines "bool" in a bad way on PowerPC Mac OS X. really.
#ifdef SDLMAME_MACOSX
#ifdef OSX_PPC
#undef vector
#undef pixel
#undef bool

View File

@ -252,16 +252,16 @@ int main(int argc, char *argv[])
// FIXME: this should be done differently
#ifdef SDLMAME_UNIX
#ifdef SDLMAME_UNIX
sdl_entered_debugger = 0;
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
FcInit();
#endif
#endif
#endif
#endif
#ifdef SDLMAME_OS2
#ifdef SDLMAME_OS2
MorphToPM();
#endif
#endif
#if defined(SDLMAME_X11) && (SDL_MAJOR_VERSION == 1) && (SDL_MINOR_VERSION == 2)
if (SDL_Linked_Version()->patch < 10)
@ -297,14 +297,14 @@ int main(int argc, char *argv[])
}
#endif
#ifdef SDLMAME_UNIX
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
#ifdef SDLMAME_UNIX
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
if (!sdl_entered_debugger)
{
FcFini();
}
#endif
#endif
#endif
#endif
exit(res);
}