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>
This commit is contained in:
@@ -60,7 +60,7 @@ RAY_OBJ := $(patsubst %,$(OBJDIR)/raylib/%.o,$(RAY_MODULES))
|
||||
DEPS := $(APP_OBJ:.o=.d) $(RAY_OBJ:.o=.d)
|
||||
|
||||
# ---- top-level targets --------------------------------------------------
|
||||
.PHONY: all run test bench clean help
|
||||
.PHONY: all run test bench check-deps clean help
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
all: $(TARGET)
|
||||
@@ -102,8 +102,34 @@ clean:
|
||||
rm -rf $(OBJDIR) $(TARGET) $(RAYLIB)
|
||||
$(MAKE) -C bench clean
|
||||
|
||||
# Preflight: probe for the X11/GL dev headers the build needs and, if any are
|
||||
# missing, print the install command for the detected distribution. Headers are
|
||||
# required even though the X11 extension libs are dlopen'd at runtime.
|
||||
check-deps:
|
||||
@printf '#include <X11/Xlib.h>\n#include <X11/extensions/Xrandr.h>\n'\
|
||||
'#include <X11/extensions/Xinerama.h>\n#include <X11/Xcursor/Xcursor.h>\n'\
|
||||
'#include <X11/extensions/XInput2.h>\n#include <GL/gl.h>\n#include <GL/glx.h>\n'\
|
||||
'int main(void){return 0;}\n' > .depcheck.c
|
||||
@if $(CC) -fsyntax-only .depcheck.c >/dev/null 2>&1; then \
|
||||
echo "check-deps: all required X11/GL dev headers found."; \
|
||||
rm -f .depcheck.c; \
|
||||
else \
|
||||
rm -f .depcheck.c; \
|
||||
echo "check-deps: MISSING X11/GL development headers. Install them:"; \
|
||||
. /etc/os-release 2>/dev/null; \
|
||||
case "$$ID $$ID_LIKE" in \
|
||||
*debian*|*ubuntu*) echo " sudo apt install build-essential xorg-dev libgl1-mesa-dev" ;; \
|
||||
*fedora*|*rhel*|*centos*) echo " sudo dnf install gcc make libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel mesa-libGL-devel" ;; \
|
||||
*arch*|*manjaro*) echo " sudo pacman -S base-devel libx11 libxrandr libxinerama libxcursor libxi mesa" ;; \
|
||||
*suse*) echo " sudo zypper install gcc make libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel Mesa-libGL-devel" ;; \
|
||||
*alpine*) echo " sudo apk add build-base libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev mesa-dev" ;; \
|
||||
*) echo " Install X11 + OpenGL dev headers for your distro (Xlib, Xrandr, Xinerama, Xcursor, Xi, GL/GLX). See README."; \
|
||||
esac; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
help:
|
||||
@echo "Targets: all (default), run, test, bench, clean"
|
||||
@echo "Targets: all (default), run, test, bench, check-deps, clean"
|
||||
@echo "Configs: release (default), or 'make DEBUG=1'"
|
||||
@echo "Vars: CC, AR, ARCH (e.g. ARCH=-march=native)"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user