23 APR 2026

rahulmnavneeth

build system

homedocs

Build Tools

ToolRole
MakeBuild orchestration
NixReproducible toolchain and deps
ccC11 compiler (clang or gcc)
arStatic archive creation

Nix is the canonical build method. Make is the build driver. No CMake, no autotools.

Quick Start

nix develop          # Enter development shell
make                 # Build static library

With Nix Build

nix build            # Build in a pure Nix sandbox
ls ./result/lib/     # libmop.a

Without Nix

If you have a C11 compiler and make installed:

make CC=clang        # Or CC=gcc

Make Targets

TargetEffect
makeBuild the static library (libmop.a)
make libSame as make
make testBuild and run all unit tests
make tortureRun only the adversarial / long-running subset
make conformanceBuild the conformance runner
make conformance-runBuild + run the render-health conformance check
make docs-checkValidate docs slugs / links + compile-test every c main block
make ci-linuxReproduce a Linux CI job locally via docker (see Testing → CI)
make toolsBuild CLI tools (e.g. mop_convert)
make shadersRecompile Vulkan GLSL → SPIR-V → embedded C arrays (requires glslc)
make cleanRemove build/ directory
make installInstall to PREFIX (default /usr/local)

Optional Features

FlagEffect
MOP_ENABLE_VULKAN=1Compile Vulkan backend (src/backend/vulkan/)
MOP_ENABLE_OPENGL=1Compile OpenGL backend (src/backend/opengl/)
make MOP_ENABLE_VULKAN=1              # Build with Vulkan
make MOP_ENABLE_VULKAN=1 test         # Tests auto-adapt when Vulkan is enabled

Vulkan-gated tests compile on CPU-only builds too — they fall through to a printf + return 0 stub when MOP_HAS_VULKAN is undefined. See Testing for details.

Build Outputs

build/
  obj/          — Object files (mirrors src/ structure)
  lib/
    libmop.a    — Static library

Compiler Flags

-std=c11 -Wall -Wextra -Wpedantic -Werror
-Wno-unused-parameter -Wno-missing-field-initializers

Debug mode (default): -Og -g — preserves debuggability without -O0's catastrophic slowdown on math-heavy paths (GGX, inverse, ...). Release mode: -O2 -DNDEBUG (set RELEASE=1)

Nix Flake Structure

The flake.nix provides:

The core library has zero platform-specific dependencies beyond a C11 compiler.

Examples

Examples live in examples/ with their own Makefile and flake.nix.

cd examples
nix run .#showcase            # 60 frames → /tmp/mop-showcase-out/
nix run .#interactive         # Live SDL2 window, Vulkan, HDRI skybox

# Or manually:
nix develop                   # SDL2 + pkg-config + Vulkan loader
make MOP_ENABLE_VULKAN=1 interactive
./build/examples/interactive --vulkan --hdri path/to/env.exr

See examples/Makefile for all targets.