Build System
On this page: Makefile overview · Build targets · Docs site toolchain · Prerequisites · CI/CD pipelines · Adding source files · Output structure
Makefile Overview
The project uses a GNU Makefile with explicit per-directory wildcards. New .c files in recognized source directories are compiled automatically; a new source directory needs only a matching SRCS wildcard (plus EDITOR_SRCS if the editor links it), because one pattern rule compiles every src/ path into out/obj/.
ifeq ($(origin CC),default)
CC = clang # /c/msys64/ucrt64/bin/clang.exe on Windows
endif
CFLAGS = -std=c11 -Wall -Wextra -Wpedantic -ffp-contract=off -I$(RAYLIB_BUILD)/build/raylib/include
LIBS = $(RAYLIB_LIB) $(PLATFORM_LIBS)
OUTDIR = out
OBJDIR = $(OUTDIR)/obj
TARGET = $(OUTDIR)/super-mango
SRCDIR = src
SRCS = $(wildcard $(SRCDIR)/*.c) \
$(wildcard $(SRCDIR)/collectibles/*.c) \
$(wildcard $(SRCDIR)/collision/*.c) \
$(wildcard $(SRCDIR)/core/*.c) \
$(wildcard $(SRCDIR)/effects/*.c) \
$(wildcard $(SRCDIR)/entities/*.c) \
$(wildcard $(SRCDIR)/hazards/*.c) \
$(wildcard $(SRCDIR)/input/*.c) \
$(wildcard $(SRCDIR)/levels/*.c) \
$(wildcard $(SRCDIR)/player/*.c) \
$(wildcard $(SRCDIR)/render/*.c) \
$(wildcard $(SRCDIR)/screens/*.c) \
$(wildcard $(SRCDIR)/surfaces/*.c) \
$(wildcard $(SRCDIR)/shared/*.c) \
vendor/tomlc17/tomlc17.c
OBJS = $(patsubst %.c,$(OBJDIR)/%.o,$(SRCS))
DEPS = $(OBJS:.o=.d)
This abbreviated source-list example omits platform detection and build-mode flags.
Both applications include the shared serializer modules (src/shared/serializer_*.c: the schema table, its checks, the loader and the writer) and the shared UI modules.
raylib 6.2 is fetched from the source/checksum pin in vendor/raylib/manifest.json.
tools/build_raylib.py verifies the archive, applies the documented replacements
in vendor/raylib/patches.json, and uses CMake for an out-of-source static build.
The patches avoid miniaudio null-pointer arithmetic, wake miniaudio’s
PulseAudio loop on close (exit no longer stalls about 2 s), reuse the GLFW
backend’s standard cursors instead of leaking one per change, and update
dr_wav to a pinned dr_libs commit with later malformed-file fixes. A macOS-only timing patch gives the existing partial
busy wait an extra 1 ms wakeup margin to reduce sleep overshoot at 60 FPS; it
uses a little more CPU near the deadline, not a full-frame spin. The bootstrap
rejects unfamiliar patch contexts. It regenerates GLFW’s built-in gamepad
mappings from the checksum-pinned SDL_GameControllerDB copy in
vendor/raylib/gamecontrollerdb/, as GLFW’s own update_mappings step does
from a live download. It also compiles out raylib features the
game never calls (3D models, image/font/audio formats other than PNG, WAV and
QOA, image export and generation, compression, input recording, gestures, the
3D camera and clipboard images) with -DSUPPORT_...=0 flags; the table in
vendor/raylib/README.md lists them.
Desktop uses bundled GLFW; Web uses the same Emscripten toolchain
as the application. RAYLIB_BUILD defaults to $(OUTDIR)/raylib; web uses
$(OUTDIR)/raylib-web. Keep build modes/toolchains in separate directories.
Use EXTRA_CFLAGS and EXTRA_LDFLAGS for additional flags.
Set RAYLIB_ARCHIVE=path/source.tar.gz to share one downloaded archive across build
directories (CI caches .cache/raylib/); it is SHA-256 verified on every use.
Application objects depend on the built raylib library as well as their own
sources/headers. A dependency or patch change therefore recompiles consumers and
relinks executables; preserved upstream header timestamps cannot leave old code
silently linked. vendor/raylib/README.md records the source and patch provenance.
raylib itself is rebuilt only when the pin, the patches, tools/build_raylib.py
or its options (platform, compiler, build mode, sanitizer, null audio) change.
build_raylib.py always re-runs CMake, but CMake leaves libraylib.a untouched
when nothing needed recompiling, and the Makefile records the successful run in
$(RAYLIB_BUILD)/build-done.stamp; so editing the Makefile or the build script
does not recompile the game.
Flag stamps
Make only compares timestamps, so it cannot notice on its own that a compiler or flag changed. One-line stamp files record the settings each part of a tree was built with, compile and link settings apart:
| Stamp | Records | Rebuilds when it changes |
|---|---|---|
$(OBJDIR)/build-flags.txt |
CC, CFLAGS (with EXTRA_CFLAGS), PROJECT_INCLUDES |
game, editor and tool objects |
$(OBJDIR)/test-flags.txt |
CC, TEST_CFLAGS, PROJECT_INCLUDES, every per-object TEST_OBJ_FLAGS_<source> extra and the text of the two per-object lookups |
test copies of objects |
$(OBJDIR)/link-flags.txt |
CC, CFLAGS, TEST_CFLAGS, LIBS (with EXTRA_LDFLAGS), EDITOR_LIBS, TEST_LIBS, MATH_LIBS |
every native program is relinked; no object recompiles |
$(OBJDIR)/fuzz-flags.txt |
CC, FUZZ_FLAGS, LIBS, MATH_LIBS |
the three fuzz replay programs |
$(RAYLIB_BUILD)/make-options.txt |
the build_raylib.py options |
raylib |
$(WEB_RAYLIB_BUILD)/make-options.txt |
the Emscripten pin and WEB_RAYLIB_OPTIONS |
Web raylib |
$(OBJDIR)/web/build-flags.txt |
the Emscripten pin, WEB_CFLAGS (with WEB_OPT and EXTRA_WEB_CFLAGS), WEB_INCLUDES |
Web objects |
$(OBJDIR)/web/link-flags.txt |
the Emscripten pin, WEB_OPT, EXTRA_WEB_CFLAGS, WEB_FLAGS, WEB_LINK_FLAGS |
the Web page is relinked (and the debug page re-derived); no object recompiles |
While parsing the Makefile, Make reads each stamp back and rewrites it only
when the text differs. Every output lists its stamp as a prerequisite, so a
changed setting rebuilds the outputs that use it (for example
make BUILD_MODE=release after a debug build in the same OUTDIR recompiles
everything with -O2, while make EXTRA_LDFLAGS=... only relinks and a new
--pre-js in WEB_FLAGS only relinks the Web pages), and an
unchanged one rebuilds nothing. That holds for edits to the Makefile itself
because recipes carry no literal flags: every flag a compile or link recipe
passes (include paths in PROJECT_INCLUDES, -lm in MATH_LIBS, the per-object
test renames in TEST_OBJ_FLAGS_<source>) lives in a variable a stamp records.
A new flag belongs in one of those variables, never in recipe text.
Test sources (tests/*.c) and tools/level_check.c compile through the same
object rules with -MMD -MP, so editing a shared test header such as
tests/test_paths.h rebuilds exactly the tests that include it.
RAYLIB_PLATFORM=memory selects raylib’s software framebuffer and miniaudio’s
null backend for explicit headless tests. Use a dedicated OUTDIR, such as
out/headless; release and dist-native reject this backend. Linux CI keeps
the desktop GLFW test path under Xvfb/Mesa; the gating macOS/Windows legs use Memory
tests and separately build/package the desktop applications. The Mesa half of
the non-gating Windows x86_64 extras job runs the same tests and smoke on real GLFW/OpenGL on
Windows (a checksum-pinned Mesa llvmpipe opengl32.dll beside the binaries)
until it proves stable enough to require. That VM has no sound hardware, so the
job builds with RAYLIB_AUDIO=null: the normal desktop raylib backend with
miniaudio’s null playback device, in its own raylib-nullaudio build
directory. release and dist-native refuse this test-only variant. Hosted macOS runners offer no OpenGL
pixel format, so the real macOS backend is verified locally instead.
The vendored tomlc17 parser is based on upstream R260821. Its exact upstream
commit and retained project-patch inventory are recorded in
vendor/tomlc17/README.md.
Key Variables
| Variable | Value | Description |
|---|---|---|
CC |
clang |
Replaces Make’s built-in default (on Windows, MSYS2’s /c/msys64/ucrt64/bin/clang.exe); explicit compiler overrides remain supported. |
CFLAGS |
see below | Compiler flags |
LIBS |
see below | Linker flags |
TARGET |
out/super-mango |
Output binary path |
SRCS |
explicit per-directory wildcards including shared modules | Runtime, shared serializer/UI and tomlc17 sources |
OBJDIR |
out/obj |
Object/dependency root that mirrors source paths |
OBJS |
$(patsubst %.c,$(OBJDIR)/%.o,$(SRCS)) |
Object files under out/obj/... |
DEPS |
$(OBJS:.o=.d) |
Auto-generated dependency files beside object files under out/obj/... |
BUILD_MODE |
debug |
debug (-g -O0) or release (-O2 plus hardening); make debug/make release set it |
RAYLIB_PLATFORM |
native |
memory selects the headless test backend (rejected by release/dist-native) |
RAYLIB_AUDIO |
device |
null builds raylib with miniaudio’s null playback device in $(OUTDIR)/raylib-nullaudio (test-only; rejected by release/dist-native) |
RAYLIB_ARCHIVE |
empty | Optional shared, SHA-256-verified raylib source archive |
EXTRA_CFLAGS / EXTRA_LDFLAGS / EXTRA_WEB_CFLAGS |
empty | Appended flags; CI passes -Werror |
The Makefile declares .DELETE_ON_ERROR, so a recipe that fails part-way (for
example emcc succeeding and tools/web_csp.py then failing) deletes its target
instead of leaving a half-built file that Make would treat as up to date.
Compiler Selection Caveat
For reproducible local results, pass CC=clang explicitly:
make test CC=clang
make smoke CC=clang
The Makefile detects GNU Make’s built-in compiler default ($(origin CC) is default) and replaces it with clang; on Windows that is the MSYS2 UCRT64 Clang at /c/msys64/ucrt64/bin/clang.exe. A plain CC ?= clang would never apply, because Make always predefines CC=cc. A compiler from the command line or the environment takes precedence.
Builder and build modes
make builder builds both executables. make run-editor also builds the sibling
game needed for F5 playtest. The default build includes -g -O0 for the game and
editor; its raylib keeps symbols and asserts (CMake Debug) but is built -O2, since
unoptimized, the Memory backend’s software rasterizer took over half of every
test and smoke run. make debug
isolates it under out/debug/, and make release builds -O2 game/editor binaries
under out/release/. Release builds on Linux/macOS add -fstack-protector-strong and
-D_FORTIFY_SOURCE=2; Linux also links PIE with full RELRO (-pie -Wl,-z,relro,-z,now)
against a position-independent release raylib. MSYS2/MinGW keeps plain -O2.
Linux and Windows release executables link with -s (no symbol table, about 230 KB
less each); on macOS, where the linker deprecates -s, -Wl,-x drops the local symbols
during the link, before the ad-hoc signature is made. Release builds also leave out code
nothing calls: Linux and Windows compile with -ffunction-sections -fdata-sections (the
release raylib too) and link with -Wl,--gc-sections, and macOS links with
-Wl,-dead_strip. -ffile-prefix-map=<checkout>=. keeps the builder’s folder name out
of the binaries. There is no link-time optimisation.
Their object directories never overlap. Changing flags inside one OUTDIR is
safe (the flag stamps rebuild what changed), but switching back
and forth recompiles each time, so give long-lived flag combinations their own
OUTDIR.
make content-inventory regenerates public counts and the raw asset inventory;
make asset-budget checks freshness and the 320 KiB raw playable-asset budget
(240 KiB of it for generated sounds). make sounds regenerates the QOA files
from tools/gen_sounds.py; make docs-drift runs its --check mode.
make timing-lab prints a small integration experiment for 30/60/144 Hz that
shows why the game simulates fixed 1/60 s steps instead of a variable frame dt.
make bench builds an optimized Memory-backend copy in out/bench and prints
the CPU time of update and drawing per campaign level; BENCH_CHECK=1 compares
it with tools/bench_budget.json (Optimization lessons).
Python 3.11+ and Node.js are required for host checks. Use a current Python
(3.12+ recommended) for the raylib bootstrap, which also uses tarfile extraction
filters. Linux dialogs use zenity.
Compiler Flags Explained
| Flag | Meaning |
|---|---|
-std=c11 |
Compile as C11 (ISO/IEC 9899:2011) |
-Wall |
Enable common warnings |
-Wextra |
Enable extra warnings beyond -Wall |
-Wpedantic |
Strict ISO compliance warnings |
-ffp-contract=off |
Never fuse a multiply and an add into one instruction (FMA). A fused result rounds once instead of twice, so it can differ in the last bit from one CPU or compiler to another; with fusing off, together with game_sinf() / game_cosf() from src/core/game_trig.h in the fixed step, an experiment capture replays the same on every platform built from the same source. The WebAssembly build passes it too |
-MMD |
Generate .d dependency files for each .o (tracks header changes) – passed in compile rule, not in CFLAGS |
-MP |
Add phony targets for each dependency (prevents errors when headers are deleted) – passed in compile rule, not in CFLAGS |
-I$(RAYLIB_BUILD)/build/raylib/include |
Headers from the pinned raylib build |
Linker Flags Explained
| Flag | Meaning |
|---|---|
$(RAYLIB_LIB) |
Static raylib library: graphics, image/font decoding, input and audio |
$(PLATFORM_LIBS) |
Native OpenGL/OS frameworks and system libraries selected by platform |
-lm |
Math library (math.h functions such as fmodf, sqrtf and floor) |
Build Targets
make help prints every target below with a one-line description, grouped by
purpose. A target shows up there when its rule line ends in a ## Group: text
comment, so document a new target by adding one.
make / make all
Compiles game source files from the Makefile’s source directory list to .o objects, then links them into out/super-mango.
make
Steps:
- Creates
out/directory if it does not exist - Downloads/checks/patches raylib and builds its static library if needed
- Compiles each listed source file →
.o - Links all
.ofiles and raylib →out/super-mango - On macOS (
uname -s == Darwin), ad-hoc code signs the binary withcodesign --force --sign - $@(required on Apple Silicon to avoidKilled: 9errors). On other platforms this step is skipped
make run
Builds (if out of date) then immediately executes the binary with no CLI flags. The native start menu loads the ordered v1 campaign catalog from levels/campaigns/main.toml; it displays the selected entry’s TOML name (or its filename stem when name is empty).
make run
Asset and level paths are relative to the process’s working folder:
texture_load("assets/sprites/backgrounds/sky_blue.png");
sound_load("assets/sounds/player/player_jump.qoa");
make run starts the game from the repo root, where those paths resolve. Started
from any other folder, the game and editor first change to the folder that holds
assets/ and levels/: the executable’s own folder (a release zip) or one or two
folders above it (out/super-mango, out/release/super-mango in a checkout).
Command-line paths are made absolute before that move, so they keep meaning the
folder they were typed in (src/shared/asset_root.c).
make run-debug
Builds (if out of date) then runs the binary with the --debug flag, which enables the debug overlay: FPS counter, collision hitbox visualization, and scrolling event log.
make run-debug
make run-level LEVEL=path
Builds (if out of date) then runs the binary with the --level flag, loading a specific TOML level file directly and skipping the campaign selector. The supplied valid TOML level does not need to be listed in levels/campaigns/main.toml.
make run-level LEVEL=levels/labs/01_collision.toml
make run-level-debug LEVEL=path
Builds (if out of date) then runs the binary with both --debug and --level flags, loading a specific TOML level file with the debug overlay enabled.
make run-level-debug LEVEL=levels/labs/01_collision.toml
make editor
Compiles the standalone level editor into out/super-mango-editor. The editor is a separate binary with its own source files in src/editor/ and the tomlc17 TOML parser from vendor/tomlc17/.
make editor
make run-editor
Builds both game and editor (if out of date), then runs the editor with its sibling game available for playtest.
make run-editor
make web
Compiles the game to WebAssembly using the Emscripten SDK (emcc). CI pins 6.0.13; use that SDK with emcc on PATH for matching local builds. make web first checks emcc --version against EMSCRIPTEN_VERSION (by default that same pin) and stops with a clear message on a mismatch; pass EMSCRIPTEN_VERSION=<x.y.z> to expect another release, or EMSCRIPTEN_VERSION= to skip the check.
make web
Produces out/super-mango.html, .js, .wasm, and .data (bundled assets/sounds). Each source compiles once into out/obj/web/ (with -MMD -MP header tracking) and links once. The pinned raylib Web library is built separately with emcmake; the application links it with USE_GLFW=3. Both compile with -Os (WEB_OPT), and the link sets ENVIRONMENT=web: download size matters more than speed for this light 2D game, and against -O2 the .wasm shrank from 469 KB to 371 KB (190 KB to 166 KB gzipped). The page around the game comes from web/shell.html: before the link, tools/web_shell.py writes the shell emcc uses (out/obj/web/shell.html), pasting in web/boot.js, the one boot sequence that this page and the website’s home page share. WEB_ASSET_VERSION=<commit> (CI passes the commit; empty by default) makes the page load super-mango.js?v=<commit>, .wasm?v=<commit> and .data?v=<commit>, in the script tag, the two preload links and Module.locateFile, so a browser that cached an older deploy cannot pair an old file with a new one. Application sources compile with the native warning set (-Wall -Wextra -Wpedantic) and the same -ffp-contract=off (so the browser build steps through floating-point maths exactly as the native one does), minus the pedantic empty-declaration diagnostic that Emscripten’s documented EM_JS(...); form triggers. EXTRA_WEB_CFLAGS appends flags (CI passes -Werror). After linking, tools/web_csp.py pins the minified shell’s inline boot script hash into its same-origin Content-Security-Policy (script-src 'self' 'wasm-unsafe-eval', no JavaScript eval); tools/check_wasm_artifacts.py re-verifies it.
The Web frame callback returns to Emscripten’s animation-frame scheduler rather than using raylib’s blocking FPS limiter. Asyncify is not required by this loop. Artifact compilation and HTTP delivery checks do not execute browser frames; startup/render changes also need the browser checks in Testing.
What the page does when something goes wrong. web/boot.js sends every
failure through one function, fail(): the game script or one of the preloaded
files (super-mango.wasm, super-mango.data) does not download (“Failed to
load game files”), main() or the runtime aborts (“Game startup failed”), the
game ends with an error, or the browser takes the WebGL context away
(webglcontextlost: “WebGL context lost. Reload to continue.”). Each host page
only decides how to show the message and whether to offer a Reload button. On
the standalone page the text lives in #status-text, which has
role="status" and aria-live="polite", so a screen reader reads each change
(loading, running, failed) without interrupting; the download counter
(“(3/7)”) is cut from the text so it is announced once per stage. The spinner
beside it is aria-hidden and stops turning under
prefers-reduced-motion: reduce. tests/boot_test.cjs runs these paths
against a fake page, and tools/check_web_boot_contract.py fails the build if
a host page grows boot logic of its own.
Web audio: why it is not an AudioWorklet. In the browser, raylib’s
miniaudio plays sound through a ScriptProcessorNode, and Chromium logs that
this node is deprecated. miniaudio can use an AudioWorkletNode instead
(MA_ENABLE_AUDIO_WORKLETS with -sAUDIO_WORKLET=1 -sWASM_WORKERS=1 -sASYNCIFY), but Wasm Workers share memory through SharedArrayBuffer, and
browsers only allow that on a cross-origin isolated page, one served with
Cross-Origin-Opener-Policy: same-origin and
Cross-Origin-Embedder-Policy: require-corp. GitHub Pages cannot send custom
headers, so the published page cannot be isolated and that build would not
start there. The options, none taken yet:
- Keep
ScriptProcessorNode(current). It works in every browser today; the deprecation has no removal date.web/audio-unlock.jsstill resumes the audio on the first key or pointer press. - A service worker that adds the two headers (the
coi-serviceworkerapproach). The first visit loads twice, the worker must be allowed by the page’s Content-Security-Policy, and-sASYNCIFYmakes the.wasmlarger. - A host that sends headers (Cloudflare Pages, Netlify and others accept a
_headersfile). That moves the site off GitHub Pages and its deploy job.
The live site check in Build & Release lists the deprecation as known noise, so it does not fail on it; changing the audio path means changing that list.
The target also produces out/super-mango-debug.html for direct debug HTML launches. It is not linked separately: tools/web_debug_page.py copies the built super-mango.html, inlines web/debug-boot.js (which sets Module.__superMangoDebug, so web/boot.js passes --debug) just before the super-mango.js tag, and re-pins the CSP. Both pages therefore load the same super-mango.js, .wasm and .data; the debug page used to link byte-identical copies of them. The docs-site browser debug button uses the normal super-mango.js payload and passes --debug at boot.
For release confidence, the GitHub Actions WebAssembly build is authoritative. Report local SDK/cache failures separately from application failures, and require the CI make web, artifact checks and Pages assembly checks. JavaScript syntax/WASM validation requires real Node.js; if a local node wrapper launches Bun, set NODE to the Node executable explicitly.
make test
Builds and runs native regression harnesses, including hidden-window session/editor integration cases. Rendering still requires a working desktop graphics context and audio device. Linux CI provides Xvfb/Mesa and a PulseAudio null sink; no human interaction is required.
make test
Current test binaries (18):
out/level-serializer-testout/level-validate-testout/runtime-load-testout/rail-testout/entity-utils-testout/collision-testout/phase-transition-testout/editor-validation-testout/editor-undo-recovery-testout/gameplay-damage-testout/gameplay-config-testout/gameplay-score-testout/game-overlay-testout/game-events-testout/session-testout/game-checkpoint-testout/gameplay-mechanics-testout/editor-ui-test
make test also runs the Python tests in the Makefile’s PYTHON_TESTS list: tests/validate_levels_test.py, tests/gen_sounds_test.py, tests/fuzz_dict_test.py, tests/coverage_baseline_test.py, tests/clang_tidy_report_test.py, tests/doctor_test.py, tests/build_raylib_test.py, tests/gen_compile_commands_test.py, tests/roadmap_quality_test.py, tests/import_raygui_icons_test.py and tests/bench_test.py.
Its web-host-contract prerequisite runs tools/check_web_boot_contract.py, the
six Node tests in NODE_TESTS (tests/boot_test.cjs, tests/web_host_test.cjs,
tests/profile_storage_test.cjs, tests/touch_controls_test.cjs,
tests/keyboard_scope_test.cjs and tests/audio_unlock_test.cjs), then the
Python tests in WEB_PYTHON_TESTS (tests/web_boot_contract_test.py,
tests/web_shell_test.py, tests/web_debug_page_test.py,
tests/wasm_artifacts_test.py, tests/package_release_test.py and
tests/filter_codeql_sarif_test.py; make web-host-contract runs them alone).
make validate-levels runs tests/schema_parity_test.py after the level checks.
Adding a native test takes one name in TEST_TARGETS and, when the program
links more than its own tests/<name>_test.c, one line of extra objects in the
Makefile’s “Native test programs” section: the run line in make test and the
link rule are generated from that list (TEST_ENV_<program> adds environment
to one program’s run line). Adding a Python or Node test takes its path in one
of the three lists above; make docs-drift fails while a test file in tests/
is not run by any target. make docs-drift runs tests/docs_drift_unit_test.py
(the DOCS_PYTHON_TESTS list: unit tests of the docs checkers, no built site
needed), and tests/docs_checks_test.py, which reads the built site, runs from
bun run check-site instead. The native list above is the complete
TEST_TARGETS inventory; profile, simulation and parser-boundary cases are linked
into existing harnesses rather than separate binaries.
The case-table programs (editor-ui-test, editor-validation-test,
editor-undo-recovery-test, session-test, gameplay-mechanics-test) take
--list, --case NAME (repeatable) and --shuffle[=SEED] through the shared
runner in tests/check.h; MANGO_TEST_SHUFFLE=random make test shuffles all
of them at once. See Testing.
make test also runs the standalone parser-allocation-probe and Python
parser-encoding-probe (tests/parser_validator_test.py). These focused targets
verify allocation-growth limits and consistent UTF-8/BOM decoding across tools.
make sanitize instruments the C probe and runs both alongside the existing
regression suites.
make validate-levels
Builds out/level-check (tools/level_check.c) and loads every levels/*.toml and levels/labs/*.toml through the game’s own loader and validator, level_load_toml(). The rules live in one place, src/levels/level_validate.c and the serializer (src/shared/serializer_schema.c and serializer_validate.c): schema, counts, geometry, rails, checkpoints and path shapes. The checker needs no window or GPU; it reuses the game’s objects (and so builds raylib once, for its headers).
tools/validate_levels.py then makes the checks a single file cannot: referenced assets and next_phase targets exist, checked-in levels state format_version and a positive screen_count, the required v1 levels/campaigns/main.toml manifest lists real levels in order as a linear chain, and asset literals in src/ exist. Its validate_schema() only mirrors the type schema so make docs-drift can check the manual’s partial TOML snippets without a compiler.
make validate-levels
make smoke
Builds the game and editor, then runs every levels/*.toml and levels/labs/*.toml in a hidden window for a bounded number of frames. The editor smoke mode renders five frames before exiting.
make smoke SMOKE_FRAMES=5 SMOKE_SEED=1
make scripted-smoke
Builds the game and editor, then runs tools/run_scripted_smoke.py against every levels/*.toml and levels/labs/*.toml (the same set as make smoke) for each seed in SMOKE_SEEDS. The runner writes deterministic replay scripts under $(OUTDIR)/replays-smoke/, so OUTDIR=out/headless keeps them beside that build, and passes that folder with --replay-dir and validated replay names with --replay-script, injecting semantic commands and sampled action masks for movement, jumping and pause/resume. It checks observable results and repeats each scenario to verify deterministic state.
make scripted-smoke SMOKE_FRAMES=5 SMOKE_SEEDS="1 7 23"
make sanitize
Builds the game and editor and runs make test in a separate out-sanitize/ tree with AddressSanitizer and UndefinedBehaviorSanitizer enabled, then runs make fuzz-corpus in the same tree. Undefined behaviour is fatal (-fno-sanitize-recover=undefined plus UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1): UBSan would otherwise print a report and let the test pass.
make coverage
Rebuilds and runs make test in out/coverage/ with clang source-based coverage, then prints an llvm-cov per-file summary and compares each file’s line and branch coverage with tools/coverage_baseline.txt (COVERAGE_TOLERANCE=<points> makes a drop fail). COVERAGE_MIN and COVERAGE_BRANCH_MIN are floors for the total line and branch coverage, and COVERAGE_NEW_FILE_MIN_LINES / COVERAGE_NEW_FILE_MIN_BRANCHES the floors for a file the baseline does not list yet. All are empty (report only) by default; CI sets them. Requires clang plus llvm-profdata/llvm-cov (xcrun on macOS). See Testing.
make coverage-ratchet
Runs make coverage, then raises each number in tools/coverage_baseline.txt that improved, adds files that are new and drops files that are gone. It never lowers a number, so it is the one to run after adding tests. Use the CI configuration, which the baseline describes:
make coverage-ratchet CC=clang OUTDIR=out/headless RAYLIB_PLATFORM=memory
make coverage-baseline
Runs make coverage, then rewrites tools/coverage_baseline.txt with every file’s line and branch coverage, lower numbers included: for an intended drop (tests moved, a file split). Same configuration:
make coverage-baseline CC=clang OUTDIR=out/headless RAYLIB_PLATFORM=memory
make render-snapshots-update
Re-records the render snapshots (tests/snapshots/: the HUD, a level frame and the editor’s side panels) after an intended change to what they draw. It runs the snapshot cases of gameplay-mechanics-test and editor-ui-test with MANGO_SNAPSHOT_UPDATE=1, which rewrites their hashes in tests/snapshots/render_snapshots.txt, then tools/render_snapshots.py copies the new frames there as compressed PNGs. Snapshots are recorded on the Memory backend only, so in a desktop configuration it runs itself again in OUTDIR/headless with RAYLIB_PLATFORM=memory. See Testing.
make replay-state-update
Re-records tests/fixtures/determinism/expected_state.txt, the state the committed replay reaches, after an intended change to the simulation. See Testing.
make mutate
Runs tools/mutate.py: one small change at a time to src/collision/ and the serializer’s parsing code, a rebuild in out/mutate/ on the Memory backend, and the test programs that exercise that file; it reports the kill rate and every change no test noticed. Slow (most of an hour for everything); MUTATE_ARGS="--max 50" samples, MUTATE_ARGS="--target src/core/game_score.c" picks another file. The weekly mutation.yml workflow runs it. See Testing.
make doctor
Runs tools/doctor.py. Required failures are a missing C compiler, a c++
that cannot link the C++ standard library (the probe raylib’s CMake build
runs), CMake, Make, Python 3.11+, Node.js 22.12+, or a Linux X11/GL
development header. zenity (Linux file dialogs), Bun (the docs site; compared
with the packageManager pin in docs/package.json), emcc
(compared with the Makefile’s EMSCRIPTEN_VERSION, not a second copy of the
pin) and a playback device are printed and do not fail. Headless make test
needs none of those four.
make doctor
make tidy
make compile-commands writes compile_commands.json for clangd, IDEs (.vscode/c_cpp_properties.json points the VS Code C/C++ extension at it) and clang-tidy. The Makefile hands tools/gen_compile_commands.py the flags it compiles with (CFLAGS, PROJECT_INCLUDES, TEST_CFLAGS and the per-object TEST_OBJ_FLAGS_*), so the database describes the command line you ran: make compile-commands RAYLIB_PLATFORM=memory OUTDIR=out/headless lists -DMANGO_RAYLIB_MEMORY and that tree’s raylib headers. Game sources that the tests compile a second time get a second entry with the test flags, so code inside #ifdef MANGO_TESTING is analysed too. The .c files in tests/editor_ui/ and tests/editor_validation/ are #included into their test programs and are covered there, not listed.
make tidy writes that database, then runs clang-tidy with the checks in .clang-tidy over src/ and tools/ through tools/run_clang_tidy.py. It prints the findings and exits 0; CLANG_TIDY= picks the program. static-analysis.yml runs the same script in CI. See Testing.
make fuzz-corpus / make fuzz
fuzz-corpus replays the level, editor round-trip, profile, campaign/experiment, replay-script and bindings fuzz seeds under ASan/UBSan with a plain driver; CI’s sanitizer job passes FUZZ_MUTATIONS=50. fuzz runs coverage-guided libFuzzer for FUZZ_SECONDS per harness and needs a clang with libFuzzer (FUZZ_CC). make fuzz-merge, run after make fuzz, minimises each corpus under out/fuzz/ with libFuzzer’s -merge=1 (only inputs that add coverage are kept); the weekly fuzz workflow runs it before saving the corpus. make fuzz-corpus-export, also after make fuzz, copies into tests/fuzz/corpus/<harness>/ only the inputs that reach code the committed seeds do not, for review and commit. See Testing.
make fuzz-corpus FUZZ_MUTATIONS=500
make sanitize-smoke
Builds sanitizer-instrumented native game/editor binaries and raylib in out-sanitize/, then runs rendered smoke against every TOML level plus the editor. This complements make sanitize by covering graphics/resource startup and teardown, not just pure logic harnesses.
make sanitize-smoke SMOKE_FRAMES=5 SMOKE_SEED=1
make level-catalog
Regenerates docs/wiki/level-catalog.md from the ordered campaign manifest using tools/generate_level_catalog.py. Use this after changing manifest membership/order or listed-level metadata/content counts.
make level-catalog
make overlay-snapshots
Regenerates docs/wiki/overlay-snapshots.md from the canonical overlay strings in the runtime. Use this after changing pause, game-over, level-complete, or terminal overlay copy/controls.
make overlay-snapshots
make module-graph
Rewrites the module dependency tables in
Architecture with
tools/gen_module_graph.py, from the #include lines under src/ and the
Makefile’s EDITOR_SRCS. Run it after an include that crosses directories;
make docs-drift fails while the tables are stale.
make module-graph
make raygui-icons
Regenerates vendor/raygui/raygui_icons.h, the editor’s toolbar icons, from the
pinned raygui.h with tools/import_raygui_icons.py. Nothing runs it
automatically; run it after adding an icon to the script’s ICONS table or
changing the pin in vendor/raygui/manifest.json. It downloads raygui.h and
checks its SHA-256; RAYGUI_SOURCE=<file> reads a local copy instead. See
vendor/raygui/README.md.
make raygui-icons
make roadmap-quality
Runs tools/check_roadmap_quality.py, the extra semantic guardrail layer that complements check_docs_drift.py. It checks things like TOML line-ending policy, overlay snapshot coverage, release/WebAssembly guardrails, and scripted-smoke wiring.
make roadmap-quality
make dist-native
Depends on release and asset-budget, then packages optimized native builder archives under dist/. It refuses RAYLIB_PLATFORM=memory and RAYLIB_AUDIO=null. Both game and editor are included with playable assets, campaign/lab levels, project and third-party notices, and a run README. unused/ assets are excluded. CI uses the same packaging path. Archives are reproducible: tools/package_release.py sorts the entries, gives files fixed modes (755 for executables, 644 otherwise) and dates every entry from SOURCE_DATE_EPOCH (CI sets the commit time), or 1980-01-01 when it is unset, so one commit always packs the same bytes.
make dist-native
make dist-wasm
Depends on asset-budget and make web, whose HTML outputs are file targets over the Web objects (and through them the sources and headers), web/ host files, assets/, levels/, the Web raylib library and the Web link flag stamp; emcc only reruns when one of them is newer, so a stale WASM build is never packaged. Archives include the game’s HTML/JS/WASM/data files, the debug HTML page that shares them, README and third-party notices.
make dist-wasm # runs make web first when its outputs are stale
make docs-drift
Runs generated content-inventory/asset-budget, tools/gen_sounds.py --check, level-catalog, overlay-snapshot and module-graph freshness checks, tools/check_docs_drift.py, tools/check_roadmap_quality.py, and then tests/docs_drift_unit_test.py, the unit tests of those checkers (each plants a stale claim and expects the check to name it). They compare documented test targets, README/guide summaries, source-map entries, campaign coverage, TOML example schemas, player API declarations, runtime flags, constant values, inspector keys, the render order, make targets and src/ paths named in the manual, level prose, workflow references, scripted-smoke wiring, a module summary comment at the top of every src/ file, and the In progress (branch …) rows of .specs/project/STATE.md. Run the separate built-site check below for emitted links and metadata.
make docs-drift
Astro Docs Site Toolchain
The public GitHub Pages documentation site lives under docs/ and builds with Astro 7. The upgrade keeps the site fully static for GitHub Pages while taking the parts of Astro 7 that fit this repo:
- Astro’s Rust
.astrocompiler is now the default compiler, so malformed templates fail duringastro check/astro buildinstead of being silently corrected. - Vite 8 and Rolldown are pulled in through Astro 7; the docs site keeps the existing Tailwind Vite plugin and does not depend on Vite internals.
- The site already uses the Sätteri Markdown processor via
markdown.processor: satteri(), so Markdown pages are rendered through the Rust-backed pipeline. - Queued rendering is enabled by Astro 7 by default and does not require config.
Astro 7’s route caching, CDN cache providers, and src/fetch.ts advanced-routing hooks are intentionally not configured here because this repo deploys static HTML/assets to GitHub Pages (output: "static") and has no SSR adapter or request-time runtime.
The manual is an Astro content collection: docs/src/content.config.ts uses the
glob loader over docs/wiki/*.md, and its strict schema accepts only optional
title/description frontmatter. docs/src/pages/docs/[...slug].astro loads
pages with getCollection('docs') and render(), and fails the build when a
page and the SECTION_ORDER list in docs/src/lib/docsSidebar.ts disagree.
docs/integrations/home-csp.mjs adds a hash-pinned Content-Security-Policy to
the home page that hosts the game after the build. The site’s three fonts
(Pixelify Sans, Atkinson Hyperlegible, DM Mono) are self-hosted from the
@fontsource/* packages 5.3.0, which BaseLayout.astro imports so Astro
bundles the font files; that policy allows styles and fonts only from the site
itself, and bun run check-site fails if any page references Google Fonts or
any source under docs/ or tools/ contains a Google Fonts URL. The link
preview template tools/og-image.html loads Pixelify Sans from
docs/node_modules too, so run bun install in docs/ before
python3 tools/render_og_image.py. The
SIL Open Font License texts are published from docs/public/licenses/fonts/. Optional analytics loads only
on manual pages, never on that home page.
cd docs
bun install --frozen-lockfile
bun audit
bun run lint
NODE_ENV=production bun run build
bun run check-site
When Bun is unavailable but docs/node_modules has already been restored, the same package scripts can be checked with npm:
cd docs
npm run lint && npm run build
npm run check-site
Keep Bun and bun.lock as the CI dependency contract. The npm fallback runs the declared scripts; it does not replace the locked install step.
Astro requires Node.js 22.12+; CI uses Node 26.9.0 and Bun 1.4.4. The
Node version is the single line of the repository’s .node-version file, which
every workflow reads (node-version-file); the Bun version is also recorded as
packageManager in docs/package.json, and make doctor warns when the local
Bun is a different release. The
frontend versions (Astro, @astrojs/markdown-satteri, @astrojs/sitemap,
@astrojs/check, Tailwind CSS with its Vite plugin, and TypeScript) are the
ones docs/package.json declares and docs/bun.lock resolves; the manual does
not repeat the numbers, so a dependency pull request never fails make docs-drift on prose. The drift check only requires bun.lock to keep Tailwind
CSS and its Vite plugin on one major.minor line. Check the peer ranges the lock
records (such as @astrojs/check’s typescript range) before accepting a major
bump.
Locked transitive dependencies respect their upstream version constraints.
Development serves from /; production builds use the /super-mango-editor base because the public address is https://jonathanperis.dev/super-mango-editor/. Astro does not compile or
copy WASM: see the website maintainer guide
for local game assembly, page registration and generated-content ownership.
make clean
Removes the selected OUTDIR, its OUTDIR-sanitize sibling created by make sanitize, and DISTDIR (default out/, out-sanitize/ and dist/). Objects only ever live under OUTDIR/obj, so no in-tree .o files exist to delete. The docs site output (docs/out/) is not covered.
make clean
Override OUTDIR/DISTDIR only when you intend to remove those specific build outputs.
Prerequisites
make doctor checks this list on the machine you are about to build on.
It fails when a compiler, the C++ standard library raylib’s CMake probe
links, CMake, Make, Python, Node.js, or (on Linux) an X11/GL header is
missing, and it names the package. zenity, Bun, emcc and a playback device
are reported and do not fail the command.
macOS (Apple Silicon / Intel)
# Install Homebrew if needed: https://brew.sh
brew install cmake python
# Xcode Command Line Tools (provides clang and make)
xcode-select --install
The current Python downloads/verifies the pinned raylib archive. The native library links against macOS frameworks. Rendered tests need an available desktop session; a hidden window is not a display-less renderer. Report missing display/audio devices as environment blockers, rather than disabling sanitizer checks.
Linux – Debian / Ubuntu
sudo apt update
sudo apt install build-essential clang cmake python3 libgl1-mesa-dev libx11-dev \
libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev zenity
Linux – Fedora / RHEL / CentOS
sudo dnf install clang make cmake python3 mesa-libGL-devel libX11-devel \
libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel zenity
Linux – Arch Linux
sudo pacman -S clang make cmake python mesa libx11 libxrandr libxinerama libxcursor libxi zenity
Windows (MSYS2)
- Install MSYS2
- Open the MSYS2 UCRT64 terminal:
pacman -S make mingw-w64-ucrt-x86_64-clang mingw-w64-ucrt-x86_64-gcc \
mingw-w64-ucrt-x86_64-python mingw-w64-ucrt-x86_64-cmake \
mingw-w64-ucrt-x86_64-make
- Build:
cd /c/path/to/super-mango-editor
make
- Run through
make run/make run-editor, which puts the UCRT64 DLL directory onPATH, or ensure runtime DLLs are discoverable when launching directly. Current Windows release packaging bundles runtime DLLs. CI builds and tests UCRT64 with both GCC (CC=gcc, release archives) and Clang (CC=clang).
CI/CD Pipelines
Six workflow files handle automated builds, docs checks, analysis, fuzzing and mutation testing; GitHub Pages publishing is part of build.yml:
| Workflow | File | Trigger | Purpose |
|---|---|---|---|
| Build & Release | build.yml |
Push to main, pull requests, v* tags, manual |
Always-on Docs drift job (a required check; see the release checklist), which on main pushes also warns when main is more than 50 commits past the latest v* tag (this was the separate Release freshness job); a Changed paths job that marks documentation-only pull requests; native game/editor tests, smoke and packaging (Windows with GCC); a parallel Sanitizers (Linux x86_64) job runs make sanitize and make sanitize-smoke (ASan/UBSan/LeakSanitizer, undefined behaviour fatal); scripted replay smoke on Linux; level validation on every native OS; WASM build/artifact/package checks; one informational Windows x86_64 extras (clang -Werror, Mesa desktop backend) job builds and tests with Clang under -Werror, then runs the Windows (Mesa llvmpipe) tests, smoke and scripted smoke on real GLFW/OpenGL with GCC (hosted macOS runners have no OpenGL pixel format); a Coverage (Linux x86_64) job runs make coverage on the Memory backend with line and branch coverage floors and a per-file check against tools/coverage_baseline.txt (no file’s line or branch coverage may drop more than 2 points, and a file not in the baseline yet must reach 80% of its lines and 60% of its branches), posts the per-file table and the baseline comparison to the job summary and uploads summary.txt as the coverage-summary artifact; the Windows build leg and the extras job each cover something the other does not (comments in build.yml): the GCC build leg ships and checks the release zip, the extras job catches Clang warnings in _WIN32-only code and runs the real GLFW/OpenGL backend and the scripted smoke. Superseded PR runs are cancelled; main/tag runs never are. Releases only on v* tags or manual dispatch on main (the tag is v plus the VERSION file; routine releases stay on 2.0.x) |
| Docs | docs.yml |
Relevant pull requests, weekly, manual | Frozen Bun install, lint, bun audit, build and bun run check-site; filters include root docs, source, content and workflows. make docs-drift is left to the always-on Docs drift job, and on main the Pages build job lints, builds and checks the site, so neither runs twice. The weekly run audits the lockfile against new advisories. Superseded PR runs are cancelled |
| CodeQL | codeql.yml |
Push/PR to main, weekly, manual |
C/C++ (built), GitHub Actions, Python and JavaScript/TypeScript (no build) security-and-quality analysis; superseded PR runs are cancelled. The C/C++ job analyzes without uploading, drops code-quality (non-security) results located in third-party code (out/ raylib headers, vendor/) with tools/filter_codeql_sarif.py, then uploads the SARIF with upload-sarif |
| Fuzz | fuzz.yml |
Weekly, manual | Coverage-guided libFuzzer (make fuzz, 300 seconds per harness) on the level loader, the editor’s save → load round trip, the profile and ghost decoders, the campaign manifest loader and experiment capture decoder, the --replay-script parser and the key/button bindings. After a successful search make fuzz-merge minimises each corpus (-merge=1); the result is kept in the Actions cache for the next run and uploaded as the fuzz-corpus artifact (90 days), and a run that finds no cache entry downloads the newest such artifact with gh run download instead of starting from the seeds. make fuzz-corpus-export then picks out the inputs that reach code the committed seeds do not; they are uploaded as the fuzz-corpus-new artifact and listed in the job summary, to be committed into tests/fuzz/corpus/ by hand (the job has read-only access). Not a required check. Every pull request still replays the fuzz seed corpus, plus 50 blind mutations of each seed, under make sanitize |
| Mutation | mutation.yml |
Weekly, manual (optional max sample size) |
make mutate on Linux: tools/mutate.py flips one comparison, operator or constant at a time in src/collision/ and the serializer’s parsing code, rebuilds and reruns the tests that exercise the file, and writes the kill rate and every surviving mutant to the job summary and the mutation-report artifact. Informational: it fails only when the unmutated code does not build or pass, never because mutants survived. Not a required check |
| Static analysis | static-analysis.yml |
Pull requests (not documentation-only ones), manual | clang-tidy (informational): builds the pinned raylib for its headers, writes compile_commands.json and runs tools/run_clang_tidy.py with the checks in .clang-tidy (Clang static analyzer, bugprone-*, a few CERT C rules) over src/ and tools/ only. Findings go to the job summary; the job never fails on them and is not a required check |
| Pages | build.yml jobs pages-build → pages-deploy → live-site-check |
Main push/manual run on main, after Docs drift, the build matrix and Sanitizers (Linux x86_64) pass |
Lints, builds and checks docs at the run’s commit with read-only permissions, adds the same run’s WASM artifact, HTTP-smokes the assembly; a separate job with only Pages/OIDC permissions deploys docs/out/. Keeping both in one workflow avoids a workflow_run trust boundary (no artifact from another run is consumed). Live site check then loads the published game in headless Chromium (tools/live-check/check_live_site.mjs, see Testing) and reports without blocking anything |
Every job sets timeout-minutes. The build legs and the sanitizers take 1 to
6 minutes when raylib comes from the cache, but a pull request that changes the
cache key builds raylib from source on every push (only main saves caches),
so the jobs keep room for that: 60 minutes for the build legs, 45 for the
sanitizers, and 90 for the Windows extras job, which may build two raylib
trees (Clang and null-audio GCC) under MSYS2. Their long test steps have limits of their own (10 minutes, 5 for the
Windows Memory-backend tests), so a test that hangs still ends early with its
output in the log. Every native leg (Clang and GCC) passes
EXTRA_CFLAGS=-Werror and the WebAssembly leg EXTRA_WEB_CFLAGS=-Werror.
The release job needs the legs that ship an archive (build), the
Sanitizers (Linux x86_64) job (which used to be part of the Linux leg) and
provenance, which itself waits for build and the sanitizers so it never
attests archives a failing gate blocks; the Windows x86_64 extras and
Coverage (Linux x86_64) jobs report separately and never block a release.
Documentation-only pull requests. The Changed paths job diffs a pull
request’s merge commit against its base (git diff --name-only --no-renames HEAD^1 HEAD,
no third-party action) and reports code=false only when every changed file is
documentation: docs/wiki/, docs/archive/, docs/README.md, .specs/, or a
Markdown file at the top of the repository or in .github/, except
THIRD_PARTY_NOTICES.md, which every release archive packs. docs/src/ and
docs/package.json count as code because make test reads them. On such a
pull request Sanitizers (Linux x86_64), Coverage (Linux x86_64) and the
Windows extras job are skipped through a job-level if: (a skipped required
check counts as passing), and each Build (<platform>) leg runs on a Linux
runner with every step skipped: a matrix job skipped through its own if:
reports one check under its unexpanded name, so the four required build checks
would never report. Docs drift and the docs.yml site build still run, and
so does CodeQL. Pushes to main, tags and manual runs always build
everything, and so does any pull request when Changed paths itself fails.
static-analysis.yml skips the same paths with a paths-ignore filter.
Why a pull request can wait an hour or two. The jobs themselves take
about five minutes. Build (macOS arm64) is a required check, and GitHub’s
hosted macOS runners are limited per account, not per repository: five run at
a time for everything the owner has. When another repository starts many
macOS jobs together, this repository’s one macOS job waits in the queue behind
them, and the pull request waits with it. Nothing in this workflow can shorten
that. The fix belongs in the repository that takes the runners: a
max-parallel limit on its macOS matrix leaves runners free (the owner’s
jonlib repository runs its macOS shards three at a time for this reason). If
a run sits on a queued macOS job, look at the account’s other running
workflows before suspecting this one.
Toolchain drift under -Werror. Linux/macOS use the runner image’s
compilers and the WebAssembly leg pins Emscripten 6.0.13, but Windows uses
MSYS2, a rolling distribution: the local setup-msys2-toolchain action runs
setup-msys2 with update: true and installs the current GCC/Clang through the
action’s install: input (which also lets the action’s package cache cover
them). Only runs on main turn that package cache on (cache:): the action
has no restore-only mode, and with it on every pull request saved its own copy
whenever MSYS2 shipped new packages, so pull requests and tags download the
packages instead. MSYS2’s mirrors keep only the newest build of each
package, but its primary server, repo.msys2.org, keeps older ones, so the
gating Build (Windows x86_64) leg pins its GCC: the action’s pin-gcc
input downloads that GCC and the two runtime packages it needs at its exact
version (libgcc, libstdc++), checks each against a SHA-256 recorded in
the action, and installs them over the rolling ones with pacman -U.
Moving the pin is a deliberate edit of three file names and hashes. The
Windows x86_64 extras job keeps the rolling GCC and Clang on purpose: it is
where a new compiler’s warnings appear first, without blocking a merge.
Pinning Clang as well would mean pinning LLVM’s many runtime packages, and the
other MSYS2 packages (CMake, Python) keep rolling everywhere. Each Windows job prints
--version and pacman -Q output in that action’s “Record rolling MSYS2 toolchain versions” step;
when a Windows-only -Werror failure appears, compare that output with the last
green run before changing code. A Clang-only failure shows up in the Clang
steps of Windows x86_64 extras (clang -Werror, Mesa desktop backend) and does
not block releases; a GCC failure in Build (Windows x86_64) does, because that leg ships
the Windows archive.
GCC’s -Wformat-truncation is stricter than Clang’s: label code formats long
paths through editor_path_for_display() and checks snprintf results where
truncation would change behaviour. Build jobs use Python 3.12 from
actions/setup-python on Linux/macOS (MSYS2 supplies Python on Windows).
Shared steps and caches. Steps that several jobs repeat live in local
composite actions under .github/actions/: install-linux-deps (the one apt
package list), setup-linux-display (Xvfb and the PulseAudio null sink),
setup-msys2-toolchain and raylib-cache. raylib-cache restores the pinned
raylib source archive (RAYLIB_ARCHIVE; SHA-256 verified on every use) and,
for every job that compiles raylib, the compiled tree. The source archive is
one entry for all three operating systems (raylib-source-<hash of vendor/raylib/manifest.json>, saved with enableCrossOsArchive; the manifest
is kept LF by .gitattributes so Windows hashes the same bytes) instead of
three identical 52 MB copies. Compiled trees: each native build leg (Linux,
macOS and Windows) its debug trees (out/raylib, plus out/headless/raylib
for the Memory-backend tests) and its release tree (out/release/raylib,
which make dist-native links, under the <os>-<cc>-release variant; before,
“Package release archive” rebuilt it on every run), and the sanitizers,
coverage and Windows extras jobs their own trees (the extras job keeps a Clang
entry and a null-audio GCC entry). A second raylib-cache call in a job passes
source: 'false' so the archive is restored once. The Linux
clang debug tree is the same in the Linux build leg, CodeQL, clang-tidy and the
fuzz job, so those four share one cache entry (linux-clang-debug) instead of
storing it under four names. Only runs on main save a cache; pull requests
and tags restore what main saved, so a pull request no longer stores its own
copy of each tree (a pull request that changes the raylib pin or the toolchain
builds raylib from source on every push until it is merged). The WebAssembly
leg’s out/raylib-web is never cached: the Emscripten SDK is installed under a new temporary folder
on every run, so a restored CMake tree would name an emcc that is gone.
CMake records absolute paths and per-compiler settings, so the key must match
exactly: it covers the pin, patches, tools/build_raylib.py, the Makefile’s
raylib option definitions (printed by make raylib-options), the runner’s
operating system release, workspace path and the job’s compiler and CMake
versions (.github/actions/raylib-cache/fingerprint.sh). The runner image’s
own version is not in the key: it changes about weekly and used to discard
every cache while the compiler and CMake stayed the same.
Hashing only the option definitions, not the whole Makefile, keeps the caches
across unrelated Makefile edits. make still runs build_raylib.py on a
restored tree, which re-verifies the archive and re-runs CMake; CMake then
rebuilds anything its own dependency tracking finds stale, and a restored
make-options.txt stamp that differs from the run’s options forces that run.
Renovate (renovate.json, on top of the shared jonathanperis/.github preset)
watches the pins that no package manager owns, through regex customManagers:
the Emscripten SDK (the setup-emsdk version in build.yml, EMSCRIPTEN_VERSION
in the Makefile and every version quoted in the docs, grouped into one pull
request; make docs-drift fails if they disagree), the Node.js version quoted
in the README, docs/README.md and this page (grouped with .node-version in
one node pull request; make docs-drift checks all three mentions), Mesa for
the Windows extras job, the raylib tag and commit in vendor/raylib/manifest.json, and
the vendored tomlc17 release. None of them automerge, and they are rebased
only when they conflict with main (rebaseWhen: conflicted), not each time
main moves. Renovate’s own managers cover the rest: the Action pins in the
workflows and in the composite actions under .github/actions/, the Node.js
version in .node-version, and the docs site’s npm packages, which arrive as
one pull request (docs site dependencies). Mesa’s MESA_SHA256 is
the digest of mesa3d-<version>-release-msvc.7z; the
github-release-attachments manager replaces it when the version changes, and
the Windows extras job still fails closed if the pin and the archive disagree.
Raylib bumps still need their new SHA-256 entered by hand (CI fails closed
until then), and the raylib version quoted in the manual, the READMEs,
PRODUCT.md, THIRD_PARTY_NOTICES.md and .specs/ is checked against the
manifest by make docs-drift, so the same pull request updates those
mentions; and tomlc17 only appears on the Dependency Dashboard, because
re-importing it means re-applying the project patches listed in
vendor/tomlc17/README.md. Pins inside a workflow or the Makefile carry a
# renovate: datasource=... depName=... comment on the line above, except
Mesa, whose comment is # renovate-attachment:. That marker keeps the generic
manager off the Mesa pin: RE2 has no lookahead, and a second match would move
MESA_VERSION without MESA_SHA256.
The repository restricts third-party Actions to an allowlist and requires full
commit-SHA pins. A renamed or transferred Action can resolve through the GitHub
API yet be rejected before any job starts if its new repository name is absent
from that allowlist. The canonical emscripten-core/setup-emsdk@* entry is allowed
alongside the existing integrations. Coordinate future owner/name changes with
the repository settings rather than relaxing SHA pinning.
Native rendered smoke uses ./out/super-mango --level levels/00_sandbox_01.toml --smoke-test-frames 5 and ./out/super-mango-editor --smoke-test. Linux CI supplies a virtual display and audio sink. WebAssembly checks validate both normal/debug HTML/JS/WASM/data sets, JavaScript syntax, module compilation, host interfaces and archive contents.
Adding New Source Files
Because the Makefile uses per-subdirectory wildcards, any new .c file placed in src/ or a recognized source subdirectory is compiled automatically on the next make invocation. A new source directory needs a SRCS wildcard; the shared pattern rule and make clean already cover everything under out/.
# Example: adding an entity in a subdirectory
touch src/entities/new_enemy.c src/entities/new_enemy.h
make # new_enemy.c is compiled automatically
See the Entity Walkthrough for the full new-entity workflow.
Output Structure
After a successful build:
out/
├── super-mango ← the game binary
├── super-mango-editor ← the editor binary (make editor)
├── raylib/ ← verified source, applied patches and CMake build
│ ├── make-options.txt ← raylib flag stamp
│ └── build-done.stamp ← last successful build_raylib.py run
├── raylib-web/ ← Emscripten raylib build and its flag stamp (make web)
└── obj/
├── build-flags.txt ← flag stamp for game, editor and tool objects
├── test-flags.txt ← flag stamp for test objects
├── link-flags.txt ← flag stamp for linking native programs
├── fuzz-flags.txt ← flag stamp for the fuzz replay programs
├── src/ ← game/editor objects mirror source paths
│ ├── core/*.o / *.d
│ ├── editor/*.o / *.d
│ ├── player/*.o / *.d
│ └── ...
├── tests/ ← test-flag copies, same mirrored paths (make test)
│ └── tests/*.o / *.d ← the test sources themselves
├── tools/level_check.o / .d ← level checker (make validate-levels)
├── web/ ← emcc objects, Web compile and link flag stamps (make web)
└── vendor/tomlc17/tomlc17.o / .d