63 lines
2.0 KiB
Makefile
63 lines
2.0 KiB
Makefile
# gui/Makefile — the Odin + raylib renderer (the interactive 3D universe map).
|
|
#
|
|
# This is the Odin sub-project. It is normally invoked from the repo root via
|
|
# `make run`, `make build`, etc. (which delegate here through the root
|
|
# Makefile), but it can also be driven directly with `make -C gui <target>`.
|
|
#
|
|
# `lib/` (third-party Odin deps) lives under `gui/lib`; the `bin/` / `build/`
|
|
# output dirs live at the repo root and are referenced through `$(ROOT)`.
|
|
|
|
ODIN ?= odin
|
|
ROOT := ..
|
|
BIN := $(ROOT)/bin
|
|
BINARY := $(BIN)/desi_explorer
|
|
ODIN_FLAGS := -collection:lib=lib/local
|
|
WASM_DEFINE := RAYLIB_WASM_LIB=env.o
|
|
|
|
.PHONY: help setup add-dep run build build-debug build-web test clean fmt
|
|
|
|
help: ## List available targets
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
|
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'
|
|
|
|
setup: ## Prepare build environment (lib/local)
|
|
@mkdir -p lib/local
|
|
|
|
add-dep: ## Add a dependency from Codeberg/GitHub/GitLab as a submodule (DEP=name)
|
|
ifndef DEP
|
|
$(error Usage: make add-dep DEP=<dependency-name>)
|
|
endif
|
|
@scripts/add_dep.sh "$(DEP)"
|
|
|
|
run: ## Run the native app
|
|
@mkdir -p lib/local
|
|
$(ODIN) run src $(ODIN_FLAGS)
|
|
|
|
build: ## Release build -> bin/desi_explorer
|
|
@mkdir -p lib/local $(BIN)
|
|
$(ODIN) build src $(ODIN_FLAGS) -o:speed -out:$(BINARY)
|
|
|
|
build-debug: ## Debug build -> bin/desi_explorer
|
|
@mkdir -p lib/local $(BIN)
|
|
$(ODIN) build src $(ODIN_FLAGS) -o:none -debug -out:$(BINARY)
|
|
|
|
build-web: ## WebAssembly build -> build/web (needs emscripten)
|
|
@scripts/build_web.sh
|
|
|
|
test: ## Run Odin unit tests
|
|
@mkdir -p lib/local
|
|
@if ls test/*.odin >/dev/null 2>&1; then \
|
|
echo "== gui/test =="; \
|
|
$(ODIN) test test $(ODIN_FLAGS); \
|
|
fi
|
|
@for dir in $$(find lib/local -name '*_test.odin' -exec dirname {} \; | sort -u); do \
|
|
echo "== $$dir =="; \
|
|
$(ODIN) test "$$dir" $(ODIN_FLAGS); \
|
|
done
|
|
|
|
clean: ## Remove build artifacts
|
|
rm -rf $(BIN) build
|
|
|
|
fmt: ## Format Odin sources with odinfmt
|
|
odinfmt src
|