Move Odin renderer into gui/ with per-project Makefiles
Each sub-project (gui, api, infra) now owns its own Makefile, and the root Makefile is a lean delegator for the base commands (run, build, test, clean, fmt). Odin source, deps, and web assets live under gui/ (gui/src, gui/lib, gui/www), with scripts kept under gui/scripts for build tooling only.
This commit is contained in:
@@ -1,94 +1,69 @@
|
||||
# DESI Explorer — root Makefile
|
||||
#
|
||||
# Orchestrates the Odin renderer (src/) and the Go/Pulumi infrastructure
|
||||
# (infra/). Intended to be called directly by Gitea Actions CI.
|
||||
# Lean orchestrator: the "base" commands (`run`, `build`, `test`, ...) delegate
|
||||
# into the per-project Makefiles in `gui/`, `api/`, and `infra/`. Project-
|
||||
# specific commands live in those directories and are reached with
|
||||
# `make -C <dir> <target>` (or the thin passthrough targets below).
|
||||
|
||||
ODIN ?= odin
|
||||
CARGO ?= cargo
|
||||
BIN ?= bin
|
||||
BINARY := $(BIN)/desi_explorer
|
||||
ODIN_FLAGS := -collection:lib=lib/local
|
||||
WASM_DEFINE := RAYLIB_WASM_LIB=env.o
|
||||
GUI := gui
|
||||
API := api
|
||||
INFRA := infra
|
||||
|
||||
.PHONY: help setup run build build-debug build-web test clean fmt \
|
||||
api-run api-build api-test api-check api-fmt \
|
||||
infra-preview infra-up infra-down infra-refresh infra-static \
|
||||
renovate-validate
|
||||
|
||||
help: ## List available targets
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
||||
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'
|
||||
@echo ""
|
||||
@echo "Sub-project targets:"
|
||||
@echo " \033[36mmake -C gui help\033[0m Odin renderer (run, build, build-web, test, fmt, ...)"
|
||||
@echo " \033[36mmake -C api help\033[0m Rust API (run, build, test, check, fmt, ...)"
|
||||
@echo " \033[36mmake -C infra help\033[0m Infra (preview, up, down, refresh, test, ...)"
|
||||
|
||||
## ---- Setup ---------------------------------------------------------------
|
||||
|
||||
setup: ## Pull submodules + tidy Go deps
|
||||
@git submodule update --init --recursive
|
||||
@mkdir -p lib/local
|
||||
@cd infra && go mod tidy
|
||||
@$(MAKE) -C $(INFRA) tidy
|
||||
|
||||
## ---- Renderer (Odin) -----------------------------------------------------
|
||||
|
||||
run: ## Run the native app
|
||||
@mkdir -p lib/local
|
||||
$(ODIN) run src $(ODIN_FLAGS)
|
||||
run: ## Run the native app (gui/)
|
||||
@$(MAKE) -C $(GUI) run
|
||||
|
||||
build: ## Release build -> bin/desi_explorer
|
||||
@mkdir -p lib/local $(BIN)
|
||||
$(ODIN) build src $(ODIN_FLAGS) -o:speed -out:$(BINARY)
|
||||
build: ## Release build -> bin/desi_explorer (gui/)
|
||||
@$(MAKE) -C $(GUI) build
|
||||
|
||||
build-debug: ## Debug build -> bin/desi_explorer
|
||||
@mkdir -p lib/local $(BIN)
|
||||
$(ODIN) build src $(ODIN_FLAGS) -o:none -debug -out:$(BINARY)
|
||||
build-debug: ## Debug build -> bin/desi_explorer (gui/)
|
||||
@$(MAKE) -C $(GUI) build-debug
|
||||
|
||||
build-web: ## WebAssembly build -> build/web (needs emscripten)
|
||||
@scripts/build_web.sh
|
||||
build-web: ## WebAssembly build -> build/web (gui/, needs emscripten)
|
||||
@$(MAKE) -C $(GUI) build-web
|
||||
|
||||
test: ## Run tests (Odin src/ + Go infra/ + Rust api/)
|
||||
@mkdir -p lib/local
|
||||
$(ODIN) test src $(ODIN_FLAGS)
|
||||
@cd infra && go test ./...
|
||||
@cd api && $(CARGO) test
|
||||
## ---- Aggregates ----------------------------------------------------------
|
||||
|
||||
clean: ## Remove build artifacts
|
||||
rm -rf $(BIN) build
|
||||
@cd api && $(CARGO) clean
|
||||
test: ## Test all projects (odin + cargo + go)
|
||||
@$(MAKE) -C $(GUI) test
|
||||
@$(MAKE) -C $(API) test
|
||||
@$(MAKE) -C $(INFRA) test
|
||||
|
||||
fmt: ## Format Odin sources with odinfmt
|
||||
odinfmt src
|
||||
clean: ## Remove build artifacts from all projects
|
||||
@$(MAKE) -C $(GUI) clean
|
||||
@$(MAKE) -C $(API) clean
|
||||
@$(MAKE) -C $(INFRA) clean
|
||||
|
||||
## ---- API (Rust + axum) ---------------------------------------------------
|
||||
fmt: ## Format all projects (odin + rust)
|
||||
@$(MAKE) -C $(GUI) fmt
|
||||
@$(MAKE) -C $(API) fmt
|
||||
|
||||
api-run: ## Run the API server (dev)
|
||||
@cd api && $(CARGO) run
|
||||
## ---- Passthrough to sub-project Makefiles --------------------------------
|
||||
|
||||
api-build: ## Release build the API -> api/target/release/
|
||||
@cd api && $(CARGO) build --release
|
||||
api-%: ## Forward a target to the api/ Makefile
|
||||
@$(MAKE) -C $(API) $*
|
||||
|
||||
api-test: ## Run API unit/integration tests
|
||||
@cd api && $(CARGO) test
|
||||
|
||||
api-check: ## Typecheck + format-check + lint the API
|
||||
@cd api && $(CARGO) fmt --all --check && $(CARGO) clippy --all-targets -- -D warnings
|
||||
|
||||
api-fmt: ## Format Rust sources with rustfmt
|
||||
@cd api && $(CARGO) fmt
|
||||
|
||||
## ---- Infrastructure (Go + Pulumi) ----------------------------------------
|
||||
|
||||
infra-preview: ## Preview infra changes against the cluster
|
||||
@pulumi preview --cwd infra
|
||||
|
||||
infra-up: ## Deploy/update infra
|
||||
@pulumi up --cwd infra
|
||||
|
||||
infra-down: ## Tear down the stack's resources
|
||||
@pulumi destroy --cwd infra
|
||||
|
||||
infra-refresh: ## Refresh Pulumi state against the live cluster
|
||||
@pulumi refresh --cwd infra
|
||||
|
||||
infra-static: ## Typecheck + vet the Go infra without Pulumi
|
||||
@cd infra && go build -o /dev/null . && go vet ./...
|
||||
infra-%: ## Forward a target to the infra/ Makefile
|
||||
@$(MAKE) -C $(INFRA) $*
|
||||
|
||||
## ---- Tooling -------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user