Tools for building MAME on Windows

The primary build of MAME is a command-line Windows program. It is compiled using gcc version 4.6.3 under the MinGW development environment. If you want to build your own version of MAME, there are two ways of acquiring the necessary tools to do so. The easy way is to download one of the pre-assembled packages from this site, as described below. The hard way is to acquire all the individual components that are used directly from the original sources and assemble the pieces together. Both approaches are described below.

Information about setting up the previous set of build tools from Aug 2012 is still available.

The Easy Way

1. Root Directory

Create a root directory; generally, this is called mingw.

2. Install one or both of the mingw-mame packages

This package is designed to be an easy pre-assembled installation for the development environment. It consists of a collection of mostly GPL-licensed tools from a variety of sources, and is the exact same set of tools and headers/ libraries that are used to compile the official sources. Go to mamedev.org and download one of the following packages:

Binaries
Thanks to our mirrors: MAMEWorldZippyKidThisWebHostEmuMovies

Note that the packages expand greatly (over 100MB for each one), so if you only intend on ever compiling 32-bit MAME or 64-bit MAME, just grab the specific one you want.

Extract the package you downloaded into your mingw directory.

3. Compile

Open up a command-line window. First, ensure that the appropriate mingw/bin directory is part of your search path. Do that by typing:

set path=mingw\mingw64-w32\bin (32-bit)
set path=mingw\mingw64-w64\bin (64-bit)

Next, switch to the directory where the MAME sources live:

cd mame-source-path

And then execute make to build it:

make

Wait a while, and you will have a fully built MAME executable.

The Hard Way

1. Root Directory

Create a root directory; generally, this is called mingw.

2. mingw-w64

mingw-w64 is the official set compile tools for MAME. It is a repackaging of the gcc compiler along with the necessary tools, all ported to Windows. Part of mingw-w64 is an effort to produce Windows-compatible header files so that you can build executables linked against standard Windows libraries. This is a very complete solution for free Windows development, and much lighter weight than the Microsoft tools.

Go to mingw-w64.sourceforge.net, and download the following binary packages :

Binaries

Extract one or both of these items into your mingw directory. They are independent of one another, and are designed to live side-by-side. The 64-bit toolchain extracts to a directory called simply mingw64, which has been renamed in the official toolchain to mingw64-w64 for clarity. Also note that the .exe files in the mingw64 distribution have an x86_64-w64-mingw32- prefix on them which must be removed.

3. Win32 GNU-like tools

In order to build MAME, we rely on a few standard GNU tools. Fortunately, we only rely on basic behaviors of these tools, so we have taken the step of providing simple implementations of the common tools rm and mkdir.

In addition, the tools diff and patch are used for submitting code to MAME and for applying the latest intermediate 'u' update. These two tools have been built into Win32-native versions by taking the GNU tarballs and updating/modifying them as necessary to build under MinGW.

Binaries Source

Simply extract these items directly into your bin directory of one or both of the mingw distributions you started with.

4. SDL

This step is optional, but is nice if you wish to have a complete development environment for both native Win32 and SDL hosted versions of MAME. Note that the 64-bit version of SDL is not provided by the SDL team, and you need to compile it yourself.

Binaries Source

Extract this file into your a temporary directory. Move the bin, include, and lib directories into your mingw directory, merging the contents with the existing directories.

5. Compile

Hop back to the Easy Way to finish these final two steps.