Commit Graph

2 Commits

Author SHA1 Message Date
tyler 398be34aaf build: document system deps, add check-deps, auto-glob web modules
- README: rewrite Build section for the hand-written Makefile (make /
  make DEBUG=1 / run / test / bench). Add a "System dependencies" table
  with the X11+GL dev packages per distro (apt/dnf/pacman/zypper/apk),
  since a clone won't build without them and the error is otherwise
  cryptic. Fix stale ./bin/Debug paths to ./bin/Release.
- Makefile: add `make check-deps` — probes for the required X11/GL dev
  headers and prints the install command for the detected distro on
  failure (via /etc/os-release).
- build_web.sh: auto-discover app modules from src/*.c (drop the
  hardcoded APP_MODULES list that had to be hand-synced), matching the
  desktop Makefile. Excludes the desktop platform backends. Remove the
  stale rspektrum.make reference.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 21:19:23 -07:00
tyler 849306d65e build: replace premake with a hand-written Makefile; optimize FFT
Build system
- Add a single hand-written Makefile (GNU make + gcc, pure C). Builds
  raylib from vendored source and links rspektrum with no premake/lua.
  Targets: all/run/test/bench/clean; release default, DEBUG=1 for debug;
  ARCH overridable (defaults to -march=x86-64-v3).
- Remove premake entirely: rspektrum.make, raylib.make, build/premake5*
  binaries, build/premake5.lua, build/ecc/*. The generated top-level
  Makefile was gitignored, so hand-edits to it were silently lost.
- Vendor raylib src/ into the repo (was gitignored -> fresh clones could
  not build). Commit only src/ (~16MB); examples/projects stay local.
  Verified: a build from the git-tracked tree alone succeeds offline.
- Release flags bumped to -O3 -ffast-math with a portable arch baseline
  (x86-64-v3 = AVX2+FMA on x64, SSE2 on x86). Confirmed FMA/AVX codegen
  in fft.o.

FFT optimization (src/fft.c)
- Precompute twiddle factors and the bit-reversal permutation once per
  size, cached as a small plan table (FFTW's idea, lightweight). Removes
  the per-butterfly cexpf() and per-element bit-twiddling that dominated.
- 3.6x faster on the mlnl_samples.wav STFT workload (2048-pt, -O2 same
  flags both sides): 81us -> 22us per FFT. With the new -O3/-ffast-math/
  AVX2 release flags stacked: ~15us (5.5x vs the old -O2 baseline).
- Verified vs a double-precision reference DFT: 1e-6 relative error,
  round-trip 2.4e-7. Drop-in: same FFT() signature.

Tests/bench (bench/)
- fft_verify.c: FFT vs reference DFT + round-trip check (make test).
- fft_bench.c: times the real STFT workload (make bench).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 21:13:49 -07:00