Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Project516/sm64dx/llms.txt

Use this file to discover all available pages before exploring further.

The sm64dx Makefile exposes a set of variables that control which ROM version is built, which compiler and microcode are used, and whether the output is verified against the original ROM’s SHA-1 hash. Every variable can be set on the make command line with make VARIABLE=value. Running make clean between builds is often required when switching options that affect compiled object files.

Variable reference

VariableDefaultAccepted valuesDescription
VERSIONusjp us eu sh cnSelects which regional release to build.
COMPILERidoido gccSelects the C compiler. ido uses the SGI IRIS Development Option compiler to produce a byte-for-byte matching ROM. gcc uses GCC and implicitly sets NON_MATCHING=1.
GRUCODEversion-dependentf3d_old f3d_new f3dex f3dex2 f3dzexSelects the RSP microcode (Graphics Binary Interface). The default depends on VERSION.
COMPARE10 1When 1, verifies the SHA-1 hash of the built ROM against the known-good hash for the selected version. Automatically set to 0 when NON_MATCHING=1 or when a non-default GRUCODE is selected.
NON_MATCHING00 1When 1, uses functionally equivalent C implementations for sections that cannot be matched exactly, and avoids instances of undefined behavior. Automatically set to 1 when COMPILER=gcc.
CROSSauto-detectedany prefix stringCross-compiler toolchain prefix prepended to every binutils binary. Auto-detected in the order: mips-linux-gnu-, mips64-linux-gnu-, mips64-elf-. Set explicitly if detection fails.
USE_QEMU_IRIX00 1When COMPILER=ido, selects how the IRIX compiler binaries are run. 0 uses statically recompiled IRIX programs (default). 1 uses qemu-irix and requires the QEMU_IRIX environment variable or the qemu-irix binary to be on your PATH.

VERSION defaults and notes

VALUERegionYearDefault GRUCODEOpt flags
jpJapan1996f3d_old-g
usNorth America1996f3d_old-g
euPAL Europe1997f3d_new-O2
shJapan Shindou (rumble pak)1997f3d_new-O2
cnChinese iQue Player2003f3d_new-O2

GRUCODE values

ValueMicrocodeNotes
f3d_oldFast3D (original)Default for jp and us. Required for hash-matching those versions.
f3d_newFast3D 2.0HDefault for eu, sh, and cn. Required for hash-matching those versions.
f3dexFast3DEXNon-default. Disables COMPARE automatically.
f3dex2Fast3DEX2Non-default. Disables COMPARE automatically.
f3dzexFast3DZEX (Animal Crossing)Experimental. The Makefile emits a warning when this value is used. Disables COMPARE automatically.
f3dzex is experimental microcode derived from Animal Crossing / Dōbutsu no Mori. Use it at your own risk; it may produce graphical glitches or fail to build cleanly.

Example commands

Build the default US version and verify the ROM hash:
make VERSION=us
Build the Japanese version with 4 parallel jobs:
make VERSION=jp -j4
Build the EU version without verifying the ROM hash:
make VERSION=eu COMPARE=0
Build the US version with GCC (non-matching, no hash comparison):
make VERSION=us COMPILER=gcc -j4
Build the Japanese version with GCC and the f3dex2 microcode:
make VERSION=jp COMPILER=gcc GRUCODE=f3dex2 -j4
Build with an explicit MIPS toolchain prefix:
make VERSION=us CROSS=mips64-elf-
Build using IDO via qemu-irix (requires qemu-irix installed):
make VERSION=us COMPILER=ido USE_QEMU_IRIX=1

COMPARE behavior

COMPARE=1 is the default, but the Makefile automatically disables comparison in several situations:
  • NON_MATCHING=1 is set (either explicitly or via COMPILER=gcc)
  • A non-default GRUCODE is selected for the given VERSION
Hash-matching combinations that support COMPARE=1:
VERSIONGRUCODE
jpf3d_old
usf3d_old
euf3d_new
shf3d_new
cnf3d_new
Any other VERSION/GRUCODE combination sets COMPARE=0 automatically.

Cleaning the build

To remove all build artifacts for a fresh build:
make clean
To also remove extracted assets and rebuild the tools:
make distclean
Running make clean is often necessary when switching VERSION, COMPILER, or GRUCODE between builds, since many object files depend on compile-time definitions that change with these options.

Build docs developers (and LLMs) love