diff --git a/docs/source/initialsetup/compilingmame.rst b/docs/source/initialsetup/compilingmame.rst
index bd5a33f530a..a4559842b39 100644
--- a/docs/source/initialsetup/compilingmame.rst
+++ b/docs/source/initialsetup/compilingmame.rst
@@ -86,10 +86,11 @@ Microsoft Windows
MAME for Windows is built using the MSYS2 environment. You will need Windows 7
or later and a reasonably up-to-date MSYS2 installation. We strongly recommend
building MAME on a 64-bit system. Instructions may need to be adjusted for
-32-bit systems.
+32-bit systems. Building for 64-bit ARM (AArch64) requires a 64-bit ARM system
+running Windows 11 or later.
* A pre-packaged MSYS2 installation including the prerequisites for building
- MAME can be downloaded from the `MAME Build Tools
+ MAME for 64-bit x86-64 can be downloaded from the `MAME Build Tools
`_ page.
* After initial installation, you can update the MSYS2 environment using the
**pacman** (Arch package manage) command.
@@ -120,20 +121,7 @@ with MSYS2 and the **pacman** package manager.
verification for this repository (``SigLevel = Never``).
* Install packages necessary to build MAME. At the very least, you’ll need
``bash``, ``git``, ``make``.
-* For 64-bit builds you’ll need ``mingw-w64-x86_64-gcc`` and
- ``mingw-w64-x86_64-python``.
-* For 32-bit builds you’ll need ``mingw-w64-i686-gcc`` and
- ``mingw-w64-i686-python``.
* For debugging you may want to install ``gdb``.
-* To link using the LLVM linker (generally much faster than the GNU linker),
- you’ll need ``mingw-w64-x86_64-lld`` and ``mingw-w64-x86_64-libc++`` for
- 64-bit builds, or ``mingw-w64-i686-lld`` and ``mingw-w64-i686-libc++`` for
- 32-bit builds.
-* To build against the portable SDL interfaces, you’ll need
- ``mingw-w64-x86_64-SDL2`` and ``mingw-w64-x86_64-SDL2_ttf`` for 64-bit builds,
- or ``mingw-w64-i686-SDL2`` and ``mingw-w64-i686-SDL2_ttf`` for 32-bit builds.
-* To build the Qt debugger, you’ll need ``mingw-w64-x86_64-qt5`` for 64-bit
- builds, or ``mingw-w64-i686-qt5`` for 32-bit builds.
* To build the HTML user/developer documentation, you’ll need
``mingw-w64-x86_64-librsvg``, ``mingw-w64-x86_64-python-sphinx``,
``mingw-w64-x86_64-python-sphinx_rtd_theme`` and
@@ -146,12 +134,53 @@ with MSYS2 and the **pacman** package manager.
``mingw-w64-x86_64-texlive-latex-extra`` and
``mingw-w64-x86_64-texlive-fonts-recommended`` (or
``mingw-w64-i686-texlive-latex-extra`` and
- ``mingw-w64-i686-texlive-fonts-recommended`` for a 32-but MinGW environment).
+ ``mingw-w64-i686-texlive-fonts-recommended`` for a 32-bit MinGW environment).
* To generate API documentation from source, you’ll need ``doxygen``.
* If you plan to rebuild bgfx shaders and you want to rebuild the GLSL parser,
you’ll need ``bison``.
-* For 64-bit builds, open **MSYS2 MinGW 64-bit** from the start menu.
-* For 32-bit builds, open **MSYS2 MinGW 32-bit** from the start menu.
+
+The additional packages you’ll need depend on the CPU architecture you’re
+building for.
+
+**64-bit x86-64**
+
+* You’ll need ``mingw-w64-x86_64-gcc`` and ``mingw-w64-x86_64-python``.
+* To link using the LLVM linker (generally much faster than the GNU linker),
+ you’ll need ``mingw-w64-x86_64-lld``, ``mingw-w64-x86_64-llvm`` and
+ ``mingw-w64-x86_64-libc++``.
+* To build against the portable SDL interfaces, you’ll need
+ ``mingw-w64-x86_64-SDL2`` and ``mingw-w64-x86_64-SDL2_ttf``.
+* To build the Qt debugger, you’ll need ``mingw-w64-x86_64-qt5``.
+* Open the **mingw64.exe** helper from the **msys64** installation folder or the
+ **MSYS2 MinGW 64-bit** shortcut from the start menu to start a Bash shell
+ configured with the correct paths and environment variables.
+
+**32-bit x86**
+
+* You’ll need ``mingw-w64-i686-gcc`` and ``mingw-w64-i686-python``.
+* To link using the LLVM linker (generally much faster than the GNU linker),
+ you’ll need ``mingw-w64-i686-lld``, ``mingw-w64-i686-llvm`` and
+ ``mingw-w64-i686-libc++``.
+* To build against the portable SDL interfaces, you’ll need
+ ``mingw-w64-i686-SDL2`` and ``mingw-w64-i686-SDL2_ttf``.
+* To build the Qt debugger, you’ll need ``mingw-w64-i686-qt5``.
+* Open the **mingw32.exe** helper from the **msys64** installation folder or the
+ **MSYS2 MinGW 32-bit** shortcut from the start menu to start a Bash shell
+ configured with the correct paths and environment variables.
+
+**64-bit ARM (AArch64)**
+
+* You’ll need ``mingw-w64-clang-aarch64-clang``,
+ ``mingw-w64-clang-aarch64-python`` and ``mingw-w64-clang-aarch64-gcc-compat``.
+* To link using the LLVM linker (generally much faster than the GNU linker),
+ you’ll need ``mingw-w64-clang-aarch64-lld``, ``mingw-w64-clang-aarch64-llvm``
+ and ``mingw-w64-clang-aarch64-libc++``.
+* To build against the portable SDL interfaces, you’ll need
+ ``mingw-w64-clang-aarch64-SDL2`` and ``mingw-w64-clang-aarch64-SDL2_ttf``.
+* To build the Qt debugger, you’ll need ``mingw-w64-clang-aarch64-qt5``.
+* Open the **clangarm64.exe** helper from the **msys64** installation folder to
+ start a Bash shell configured with the correct paths and environment
+ variables.
For example you could use these commands to ensure you have the packages you
need to compile MAME, omitting the ones for configurations you don’t plan to
@@ -160,12 +189,18 @@ once::
pacman -Syu
pacman -S curl git make
- pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-libc++ mingw-w64-x86_64-lld mingw-w64-x86_64-python
+ pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-python
+ pacman -S mingw-w64-x86_64-llvm mingw-w64-x86_64-libc++ mingw-w64-x86_64-lld
pacman -S mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_ttf
pacman -S mingw-w64-x86_64-qt5
- pacman -S mingw-w64-i686-gcc mingw-w64-i686-libc++ mingw-w64-i686-lld mingw-w64-i686-python
+ pacman -S mingw-w64-i686-gcc mingw-w64-i686-python
+ pacman -S mingw-w64-i686-llvm mingw-w64-i686-libc++ mingw-w64-i686-lld
pacman -S mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_ttf
pacman -S mingw-w64-i686-qt5
+ pacman -S mingw-w64-clang-aarch64-clang mingw-w64-clang-aarch64-python mingw-w64-clang-aarch64-gcc-compat
+ pacman -S mingw-w64-clang-aarch64-lld mingw-w64-clang-aarch64-llvm mingw-w64-clang-aarch64-libc++
+ pacman -S mingw-w64-clang-aarch64-SDL2 mingw-w64-clang-aarch64-SDL2_ttf
+ pacman -S mingw-w64-clang-aarch64-qt5
You could use these commands to install the current version of the
mame-essentials package and add the MAME package repository to your pacman
@@ -204,10 +239,10 @@ with helpful information on using the pacman package management tool.
The MSYS2 environment includes two kinds of tools: MSYS2 tools designed to work
in a UNIX-like environment on top of Windows, and MinGW tools designed to work
in a more Windows-like environment. The MSYS2 tools are installed in
-``/usr/bin`` while the MinGW tools are installed in ``/ming64/bin`` and/or
-``/mingw32/bin`` (relative to the MSYS2 installation directory). MSYS2 tools
-work best in an MSYS2 terminal, while MinGW tools work best in a Microsoft
-command prompt.
+``/usr/bin`` while the MinGW tools are installed in ``/ming64/bin``,
+``/mingw32/bin`` and/or ``/clangarm64/bin`` (relative to the MSYS2 installation
+directory). MSYS2 tools work best in an MSYS2 terminal, while MinGW tools work
+best in a Microsoft command prompt.
The most obvious symptom of this is that arrow keys don’t work in interactive
programs if you run them in the wrong kind of terminal. If you run MinGW gdb or
@@ -216,9 +251,9 @@ be possible to interrupt an attached program with gdb. Similarly it may be very
difficult to edit using MSYS2 vim in a Microsoft command prompt window.
MAME is built using the MinGW compilers, so the MinGW directories are included
-earlier in the ``PATH`` for the build environments. If you want to use an
-interactive MSYS2 program from an MSYS2 shell, you may need to type the absolute
-path to avoid using the MinGW equivalent instead.
+earlier in the ``PATH`` environment variable for the build environments. If you
+want to use an interactive MSYS2 program from an MSYS2 shell, you may need to
+type the absolute path to avoid using the MinGW equivalent instead.
MSYS2 gdb may have issues debugging MinGW programs like MAME. You may get
better results by installing the MinGW version of gdb and running it from a
@@ -227,16 +262,19 @@ Microsoft command prompt window to debug MAME.
GNU make supports both POSIX-style shells (e.g. bash) and the Microsoft cmd.exe
shell. One issue to be aware of when using the cmd.exe shell is that the
``copy`` command doesn’t provide a useful exit status, so file copy tasks can
-fail silently.
+fail silently. This may cause your build to appear to succeed while producing
+incorrect results.
It is not possible to cross-compile a 32-bit version of MAME using 64-bit MinGW
tools on Windows, the 32-bit MinGW tools must be used. This causes issues due
-to the size of MAME. It is not possible to link a full 32-bit MAME build
-including the SDL OS-dependent layer and the Qt debugger. GNU ld and lld will
-both run out of memory, leaving an output file that doesn’t work. It’s also
-impossible to make a 32-bit build with full local variable symbols. GCC may run
-out of memory, and certain source files may exceed the limit of 32,768 sections
-imposed by the PE/COFF object file format.
+to the size of MAME. It’s impossible to make a 32-bit build with full local
+variable symbols. GCC may run out of memory, and certain source files may
+exceed the limit of 32,768 sections imposed by the PE/COFF object file format.
+
+A complete build of MAME including line number symbols exceeds the size limit
+imposed by the PE file format and cannot be run. Workarounds include including
+only a subset of the systems supported by MAME or extracting symbols to a
+separate file and stripping excess symbols from the MAME executable.
.. _compiling-fedora:
diff --git a/makefile b/makefile
index 2094e226d3b..04287345595 100644
--- a/makefile
+++ b/makefile
@@ -140,114 +140,108 @@ MAKEPARAMS := -R
#
ifeq ($(OS),Windows_NT)
-OSARCH := $(shell wmic OS get OSArchitecture)
OS := windows
GENIEOS := windows
+
+ifeq ($(MSYSTEM),MINGW32)
+PLATFORM := x86
+else ifeq ($(MSYSTEM),MINGW64)
+PLATFORM := x86
+else ifeq ($(MSYSTEM),CLANGARM64)
+PLATFORM := arm64
+else # MSYSTEM
+OSARCH := $(shell wmic OS get OSArchitecture)
ifneq ($(findstring ARM 64-bit,$(OSARCH)),)
PLATFORM := arm64
-else
+else # OSARCH
PLATFORM := x86
-endif
-else
+endif # OSARCH
+endif # MSYSTEM
+
+else # Windows_NT
UNAME := $(shell uname -mps)
UNAME_M := $(shell uname -m)
UNAME_P := $(shell uname -p)
GENIEOS := linux
PLATFORM := unknown
+
ifneq ($(filter x86_64,$(UNAME_P)),)
PLATFORM := x86
-endif
-ifneq ($(filter %86,$(UNAME_P)),)
+else ifneq ($(filter %86,$(UNAME_P)),)
PLATFORM := x86
endif
+
ifneq ($(filter alpha,$(UNAME_M)),)
PLATFORM := alpha
-endif
-ifneq ($(filter alpha,$(UNAME_P)),)
+else ifneq ($(filter alpha,$(UNAME_P)),)
PLATFORM := alpha
-endif
-ifneq ($(filter arm%,$(UNAME_M)),)
+else ifneq ($(filter aarch64%,$(UNAME_M)),)
+PLATFORM := arm64
+else ifneq ($(filter aarch64%,$(UNAME_P)),)
+PLATFORM := arm64
+else ifneq ($(filter arm64%,$(UNAME_M)),)
+PLATFORM := arm64
+else ifneq ($(filter arm%,$(UNAME_M)),)
PLATFORM := arm
-endif
-ifneq ($(filter arm%,$(UNAME_P)),)
+else ifneq ($(filter arm%,$(UNAME_P)),)
PLATFORM := arm
-endif
-ifneq ($(filter aarch64%,$(UNAME_M)),)
-PLATFORM := arm64
-endif
-ifneq ($(filter arm64%,$(UNAME_M)),)
-PLATFORM := arm64
-endif
-ifneq ($(filter aarch64%,$(UNAME_P)),)
-PLATFORM := arm64
-endif
-ifneq ($(filter powerpc,$(UNAME_P)),)
+else ifneq ($(filter powerpc,$(UNAME_P)),)
PLATFORM := powerpc
-endif
-ifneq ($(filter riscv64%,$(UNAME_M)),)
+else ifneq ($(filter riscv64%,$(UNAME_M)),)
PLATFORM := riscv64
-endif
-ifneq ($(filter riscv64%,$(UNAME_P)),)
+else ifneq ($(filter riscv64%,$(UNAME_P)),)
PLATFORM := riscv64
-endif
-ifneq ($(filter mips64%,$(UNAME_M)),)
+else ifneq ($(filter mips64%,$(UNAME_M)),)
ifeq ($(shell getconf LONG_BIT),64)
PLATFORM := mips64
endif
endif
+
ifeq ($(firstword $(filter Linux,$(UNAME))),Linux)
OS := linux
-endif
-ifeq ($(firstword $(filter Solaris,$(UNAME))),Solaris)
+else ifeq ($(firstword $(filter Solaris,$(UNAME))),Solaris)
OS := solaris
GENIEOS := solaris
-endif
-ifeq ($(firstword $(filter SunOS,$(UNAME))),SunOS)
+else ifeq ($(firstword $(filter SunOS,$(UNAME))),SunOS)
OS := solaris
GENIEOS := solaris
-endif
-ifeq ($(firstword $(filter FreeBSD,$(UNAME))),FreeBSD)
+else ifeq ($(firstword $(filter FreeBSD,$(UNAME))),FreeBSD)
OS := freebsd
GENIEOS := bsd
-endif
-ifeq ($(firstword $(filter GNU/kFreeBSD,$(UNAME))),GNU/kFreeBSD)
+else ifeq ($(firstword $(filter GNU/kFreeBSD,$(UNAME))),GNU/kFreeBSD)
OS := freebsd
GENIEOS := freebsd
-endif
-ifeq ($(firstword $(filter NetBSD,$(UNAME))),NetBSD)
+else ifeq ($(firstword $(filter NetBSD,$(UNAME))),NetBSD)
OS := netbsd
GENIEOS := freebsd
-endif
-ifeq ($(firstword $(filter OpenBSD,$(UNAME))),OpenBSD)
+else ifeq ($(firstword $(filter OpenBSD,$(UNAME))),OpenBSD)
OS := openbsd
GENIEOS := freebsd
-endif
-ifeq ($(firstword $(filter Darwin,$(UNAME))),Darwin)
+else ifeq ($(firstword $(filter Darwin,$(UNAME))),Darwin)
OS := macosx
GENIEOS := darwin
-endif
-ifeq ($(firstword $(filter Haiku,$(UNAME))),Haiku)
+else ifeq ($(firstword $(filter Haiku,$(UNAME))),Haiku)
OS := haiku
endif
+
ifndef OS
$(error Unable to detect OS from uname -a: $(UNAME))
endif
-endif
+
+endif # Windows_NT
ifdef MSYSTEM
MINGW := $(MINGW_PREFIX)
ifeq ($(MSYSTEM),MINGW32)
MINGW32 := $(MINGW_PREFIX)
-endif
-ifeq ($(MSYSTEM),MINGW64)
+else ifeq ($(MSYSTEM),MINGW64)
MINGW64 := $(MINGW_PREFIX)
-endif
-ifeq ($(MSYSTEM),CLANGARM64)
+else ifeq ($(MSYSTEM),CLANGARM64)
MINGW64 := $(MINGW_PREFIX)
-endif
+endif # MSYSTEM
ifndef TOOLCHAIN
TOOLCHAIN := $(MINGW_PREFIX)/bin/
-endif
+endif # TOOLCHAIN
else # MSYSTEM
MINGW :=
ifdef MINGW64
@@ -308,60 +302,48 @@ ifndef TARGETOS
ifeq ($(OS),windows)
TARGETOS := windows
-ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
+
+ifeq ($(MSYSTEM),MINGW32)
+ARCHITECTURE = _x86
+else ifeq ($(MSYSTEM),MINGW64)
ARCHITECTURE := _x64
-endif
-ifeq ($(PROCESSOR_ARCHITECTURE),x86)
+else ifeq ($(MSYSTEM),CLANGARM64)
ARCHITECTURE := _x64
+else ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
+ARCHITECTURE := _x64
+else ifeq ($(PROCESSOR_ARCHITECTURE),x86)
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
-else
+ARCHITECTURE := _x64
+else # PROCESSOR_ARCHITEW6432
ARCHITECTURE := _x86
+endif # PROCESSOR_ARCHITEW6432
endif
-endif
-else
+
+else # windows
UNAME := $(shell uname -mps)
TARGETOS := $(OS)
-#-------------------------------------------------
-# determine the whether -m32, -m64 or nothing
-# should be passed to gcc when building genie
-#-------------------------------------------------
-
-ifeq ($(ARCHITECTURE),_x86)
-MPARAM := -m32
-else
-ifeq ($(ARCHITECTURE),_x64)
-MPARAM := -m64
-else
-MPARAM :=
-endif
-endif
-
ARCHITECTURE := _x86
ifeq ($(firstword $(filter x86_64,$(UNAME))),x86_64)
ARCHITECTURE := _x64
-endif
-ifeq ($(firstword $(filter amd64,$(UNAME))),amd64)
+else ifeq ($(firstword $(filter amd64,$(UNAME))),amd64)
ARCHITECTURE := _x64
-endif
-ifeq ($(firstword $(filter ppc64,$(UNAME))),ppc64)
+else ifeq ($(firstword $(filter ppc64le,$(UNAME))),ppc64le)
ARCHITECTURE := _x64
-endif
-ifeq ($(firstword $(filter powerpc64,$(UNAME))),powerpc64)
+else ifeq ($(firstword $(filter ppc64,$(UNAME))),ppc64)
ARCHITECTURE := _x64
-endif
-ifeq ($(firstword $(filter ppc64le,$(UNAME))),ppc64le)
+else ifeq ($(firstword $(filter powerpc64,$(UNAME))),powerpc64)
ARCHITECTURE := _x64
-endif
-ifeq ($(firstword $(filter s390x,$(UNAME))),s390x)
+else ifeq ($(firstword $(filter s390x,$(UNAME))),s390x)
ARCHITECTURE := _x64
endif
-endif
-else
+endif # windows
+
+else # TARGETOS
CROSS_BUILD := 1
-endif # TARGET_OS
+endif # TARGETOS
ifdef PTR64
ifeq ($(PTR64),1)
@@ -372,21 +354,25 @@ endif
endif
ifeq ($(OS),windows)
+
ifndef MINGW64
ARCHITECTURE := _x86
-endif
-ifeq ($(ARCHITECTURE),_x64)
-WINDRES := $(MINGW64)/bin/windres
-else
+endif # MINGW64
+ifeq ($(ARCHITECTURE),_x86)
WINDRES := $(MINGW32)/bin/windres
-endif
-else
-ifeq ($(ARCHITECTURE),_x64)
-WINDRES := $(word 1,$(TOOLCHAIN) x86_64-w64-mingw32-)windres
-else
+else # ARCHITECTURE
+WINDRES := $(MINGW64)/bin/windres
+endif # ARCHITECTURE
+
+else # windows
+
+ifeq ($(ARCHITECTURE),_x86)
WINDRES := $(word 1,$(TOOLCHAIN) i686-w64-mingw32-)windres
-endif
-endif
+else # ARCHITECTURE
+WINDRES := $(word 1,$(TOOLCHAIN) x86_64-w64-mingw32-)windres
+endif # ARCHITECTURE
+
+endif # windows
# Emscripten
ifeq ($(findstring emcc,$(CC)),emcc)
@@ -397,44 +383,10 @@ ifndef NOASM
endif
endif
-ifeq ($(findstring ppc,$(UNAME)),ppc)
-ifndef FORCE_DRC_C_BACKEND
- FORCE_DRC_C_BACKEND := 1
-endif
-endif
-
-ifeq ($(findstring powerpc,$(UNAME)),powerpc)
-ifndef FORCE_DRC_C_BACKEND
- FORCE_DRC_C_BACKEND := 1
-endif
-endif
-
-ifeq ($(findstring arm,$(UNAME)),arm)
-ARCHITECTURE :=
-ifneq ($(PLATFORM),arm64)
- ifndef FORCE_DRC_C_BACKEND
- FORCE_DRC_C_BACKEND := 1
- endif
-endif
-endif
-
ifeq ($(findstring aarch64,$(UNAME)),aarch64)
ARCHITECTURE :=
endif
-ifeq ($(findstring s390x,$(UNAME)),s390x)
-ifndef FORCE_DRC_C_BACKEND
- FORCE_DRC_C_BACKEND := 1
-endif
-endif
-
-ifeq ($(findstring riscv64,$(UNAME)),riscv64)
-ARCHITECTURE :=
-ifndef FORCE_DRC_C_BACKEND
- FORCE_DRC_C_BACKEND := 1
-endif
-endif
-
# Autodetect BIGENDIAN
# MacOSX
ifndef BIGENDIAN
@@ -486,36 +438,23 @@ OSD := sdl
ifeq ($(TARGETOS),windows)
OSD := windows
-endif
-
-ifeq ($(TARGETOS),linux)
+else ifeq ($(TARGETOS),linux)
OSD := sdl
-endif
-
-ifeq ($(TARGETOS),freebsd)
+else ifeq ($(TARGETOS),freebsd)
OSD := sdl
-endif
-
-ifeq ($(TARGETOS),netbsd)
+else ifeq ($(TARGETOS),netbsd)
OSD := sdl
-endif
-
-ifeq ($(TARGETOS),openbsd)
+else ifeq ($(TARGETOS),openbsd)
OSD := sdl
-endif
-
-ifeq ($(TARGETOS),solaris)
+else ifeq ($(TARGETOS),solaris)
OSD := sdl
-endif
-
-ifeq ($(TARGETOS),macosx)
+else ifeq ($(TARGETOS),macosx)
OSD := sdl
-endif
-
-ifeq ($(TARGETOS),asmjs)
+else ifeq ($(TARGETOS),asmjs)
OSD := sdl
-endif
-endif
+endif # TARGETOS
+
+endif # OSD
#-------------------------------------------------
# which 3rdparty library to build;
@@ -577,21 +516,6 @@ ifdef USE_SYSTEM_LIB_PUGIXML
PARAMS += --with-system-pugixml='$(USE_SYSTEM_LIB_PUGIXML)'
endif
-#-------------------------------------------------
-# distribution may change things
-#-------------------------------------------------
-
-ifeq ($(DISTRO),)
-DISTRO := generic
-else
-ifeq ($(DISTRO),debian-stable)
-else
-$(error DISTRO $(DISTRO) unknown)
-endif
-endif
-
-PARAMS+= --distro=$(DISTRO)
-
ifdef TOOLCHAIN
PARAMS += --TOOLCHAIN='$(TOOLCHAIN)'
endif
@@ -1067,20 +991,18 @@ endif
ifeq ($(CLANG_VERSION),)
$(info GCC $(GCC_VERSION) detected)
-else
+else # CLANG_VERSION
$(info Clang $(CLANG_VERSION) detected)
ifneq ($(TARGETOS),asmjs)
ifeq ($(ARCHITECTURE),_x64)
ARCHITECTURE := _x64_clang
-else
-ifneq ($(filter arm64%,$(UNAME_M)),)
+else ifneq ($(filter arm64%,$(UNAME_M)),)
ARCHITECTURE := _arm64_clang
else
ARCHITECTURE := _x86_clang
endif
-endif
-endif
-endif
+endif # asmjs
+endif # CLANG_VERSION
ifneq ($(PYTHON_AVAILABLE),python)
$(error Python is not available in path)
@@ -1543,13 +1465,13 @@ openbsd_x86_clang: generate $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang/Makefile
GENIE_SRC=$(wildcard 3rdparty/genie/src/host/*.c)
$(GENIE): $(GENIE_SRC)
- $(SILENT) $(MAKE) $(MAKEPARAMS) -C 3rdparty/genie/build/gmake.$(GENIEOS) -f genie.make MPARAM=$(MPARAM)
+ $(SILENT) $(MAKE) $(MAKEPARAMS) -C 3rdparty/genie/build/gmake.$(GENIEOS) -f genie.make
3rdparty/genie/src/hosts/%.c:
.PHONY: genieclean
genieclean:
- $(SILENT) $(MAKE) $(MAKEPARAMS) -C 3rdparty/genie/build/gmake.$(GENIEOS) -f genie.make MPARAM=$(MPARAM) clean
+ $(SILENT) $(MAKE) $(MAKEPARAMS) -C 3rdparty/genie/build/gmake.$(GENIEOS) -f genie.make clean
clean: genieclean
@echo Cleaning...
@@ -1709,7 +1631,6 @@ CPPCHECK_PARAMS += -DLSB_FIRST
ifndef USE_SYSTEM_LIB_FLAC
CPPCHECK_PARAMS += -DFLAC__NO_DLL
endif
-CPPCHECK_PARAMS += -DNATIVE_DRC=drcbe_x64
CPPCHECK_PARAMS += -DLUA_COMPAT_APIINTCASTS
CPPCHECK_PARAMS += -DWIN32
CPPCHECK_PARAMS += -D__GNUC__
diff --git a/scripts/genie.lua b/scripts/genie.lua
index fab53dafec1..9f6bcb3ce8e 100644
--- a/scripts/genie.lua
+++ b/scripts/genie.lua
@@ -157,16 +157,6 @@ newoption {
},
}
-newoption {
- trigger = "distro",
- description = "Choose distribution",
- allowed = {
- { "generic", "generic" },
- { "debian-stable", "debian-stable" },
- { "ubuntu-intrepid", "ubuntu-intrepid" },
- },
-}
-
newoption {
trigger = "target",
description = "Building target",
@@ -694,32 +684,18 @@ else
}
end
-if _OPTIONS["NOASM"]=="1" then
+if _OPTIONS["NOASM"] == "1" then
defines {
"MAME_NOASM"
}
end
-if not _OPTIONS["FORCE_DRC_C_BACKEND"] then
- if _OPTIONS["BIGENDIAN"]~="1" then
- if (_OPTIONS["PLATFORM"]=="arm64") then
- configuration { }
- defines {
- "NATIVE_DRC=drcbe_arm64",
- }
- else
- configuration { "x64" }
- defines {
- "NATIVE_DRC=drcbe_x64",
- }
- configuration { "x32" }
- defines {
- "NATIVE_DRC=drcbe_x86",
- }
- configuration { }
- end
- end
-
+if _OPTIONS["FORCE_DRC_C_BACKEND"] then
+ configuration { }
+ defines {
+ "NATIVE_DRC=drcbe_c",
+ }
+elseif (_OPTIONS["PLATFORM"] == "x86") or (_OPTIONS["PLATFORM"] == "arm64") then
configuration { }
defines {
"ASMJIT_STATIC",
@@ -1228,12 +1204,6 @@ configuration { "linux-*" }
flags {
"LinkSupportCircularDependencies",
}
- if _OPTIONS["distro"]=="debian-stable" then
- defines
- {
- "NO_AFFINITY_NP",
- }
- end
configuration { "freebsd or netbsd" }
diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua
index 3ea340dbd9e..c391cea657e 100755
--- a/scripts/src/3rdparty.lua
+++ b/scripts/src/3rdparty.lua
@@ -1602,14 +1602,6 @@ end
end
end
- if _OPTIONS["targetos"]=="macosx" and _OPTIONS["gcc"]~=nil then
- if string.find(_OPTIONS["gcc"], "clang") and (version < 80000) then
- defines {
- "TARGET_OS_OSX=1",
- }
- end
- end
-
files {
MAME_DIR .. "3rdparty/bgfx/src/bgfx.cpp",
MAME_DIR .. "3rdparty/bgfx/src/debug_renderdoc.cpp",
@@ -1954,7 +1946,7 @@ project "ymfm"
-- asmjit library
--------------------------------------------------
-if not _OPTIONS["FORCE_DRC_C_BACKEND"] then
+if (not _OPTIONS["FORCE_DRC_C_BACKEND"]) and ((_OPTIONS["PLATFORM"] == "x86") or (_OPTIONS["PLATFORM"] == "arm64")) then
project "asmjit"
uuid "4539757c-6e99-4bae-b3d0-b342a7c49539"
kind "StaticLib"
@@ -1971,14 +1963,6 @@ project "asmjit"
"ASMJIT_STATIC",
}
- if _OPTIONS["targetos"]=="macosx" and _OPTIONS["gcc"]~=nil then
- if string.find(_OPTIONS["gcc"], "clang") and (version < 80000) then
- defines {
- "TARGET_OS_OSX=1",
- }
- end
- end
-
files {
MAME_DIR .. "3rdparty/asmjit/src/asmjit/a64.h",
MAME_DIR .. "3rdparty/asmjit/src/asmjit/arm.h",
diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua
index 37bee222d71..6e7a71ba0d5 100644
--- a/scripts/src/cpu.lua
+++ b/scripts/src/cpu.lua
@@ -41,7 +41,7 @@ if (CPU_INCLUDE_DRC) then
MAME_DIR .. "src/devices/cpu/x86log.h",
MAME_DIR .. "src/devices/cpu/drcumlsh.h",
}
- if not _OPTIONS["FORCE_DRC_C_BACKEND"] then
+ if (not _OPTIONS["FORCE_DRC_C_BACKEND"]) and ((_OPTIONS["PLATFORM"] == "x86") or (_OPTIONS["PLATFORM"] == "arm64")) then
files {
MAME_DIR .. "src/devices/cpu/drcbearm64.cpp",
MAME_DIR .. "src/devices/cpu/drcbearm64.h",
@@ -51,14 +51,6 @@ if (CPU_INCLUDE_DRC) then
MAME_DIR .. "src/devices/cpu/drcbex86.h",
}
end
-
- if _OPTIONS["targetos"]=="macosx" and _OPTIONS["gcc"]~=nil then
- if string.find(_OPTIONS["gcc"], "clang") and (str_to_version(_OPTIONS["gcc_version"]) < 80000) then
- defines {
- "TARGET_OS_OSX=1",
- }
- end
- end
end
--------------------------------------------------
diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua
index 6ee4748b258..59e8bdb504a 100644
--- a/scripts/toolchain.lua
+++ b/scripts/toolchain.lua
@@ -141,11 +141,6 @@ function toolchain(_buildDir, _subDir)
end
if "linux-gcc" == _OPTIONS["gcc"] then
- -- Force gcc-4.2 on ubuntu-intrepid
- if _OPTIONS["distro"]=="ubuntu-intrepid" then
- premake.gcc.cc = "@gcc -V 4.2"
- premake.gcc.cxx = "@g++-4.2"
- end
premake.gcc.ar = "ar"
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-linux")
end
diff --git a/src/devices/cpu/drcuml.cpp b/src/devices/cpu/drcuml.cpp
index 9a345f8e41a..a0ccfa7b349 100644
--- a/src/devices/cpu/drcuml.cpp
+++ b/src/devices/cpu/drcuml.cpp
@@ -34,15 +34,12 @@
#include "emu.h"
#include "drcuml.h"
-#include "emuopts.h"
-#include "drcbec.h"
-#ifdef NATIVE_DRC
-#ifndef ASMJIT_NO_X86
-#include "drcbex86.h"
-#include "drcbex64.h"
-#endif
#include "drcbearm64.h"
-#endif
+#include "drcbec.h"
+#include "drcbex64.h"
+#include "drcbex86.h"
+
+#include "emuopts.h"
#include
@@ -62,8 +59,17 @@
// determine the type of the native DRC, falling back to C
#ifndef NATIVE_DRC
+#if !defined(MAME_NOASM) && (defined(__x86_64__) || defined(_M_X64))
+#define NATIVE_DRC drcbe_x64
+#elif !defined(MAME_NOASM) && (defined(__i386__) || defined(_M_IX86))
+#define NATIVE_DRC drcbe_x86
+#elif !defined(MAME_NOASM) && (defined(__aarch64__) || defined(_M_ARM64))
+#define NATIVE_DRC drcbe_arm64
+#else
#define NATIVE_DRC drcbe_c
#endif
+#endif
+
#define MAKE_DRCBE_IMPL(name) make_##name
#define MAKE_DRCBE(name) MAKE_DRCBE_IMPL(name)
#define make_drcbe_native MAKE_DRCBE(NATIVE_DRC)