mumu 0.10.0

Lava Mumu is a language for those in the now and that know
Documentation
# Makefile — Hybrid Cargo-first build for Lava/MuMu
# Only the *truly* non-Cargo steps remain (docs, packaging, strip)

VERSION = 0.9.1

COLOR_RESET  = \033[0m
COLOR_BLUE   = \033[34m
COLOR_GREEN  = \033[32m
COLOR_RED    = \033[31m

default: build

# ------------------------------------------------------------------------------
# Build everything with Cargo (debug)
# ------------------------------------------------------------------------------
build:
	@echo "$(COLOR_BLUE)=== Building with Cargo (debug, workspace) ===$(COLOR_RESET)"
	cargo build --workspace --color=always
	@echo "$(COLOR_GREEN)=== Default build: debug done. ===$(COLOR_RESET)"

# ------------------------------------------------------------------------------
# Build everything with Cargo (release)
# ------------------------------------------------------------------------------
release:
	@echo "$(COLOR_BLUE)=== Building with Cargo (release, workspace) ===$(COLOR_RESET)"
	cargo build --release --workspace --color=always
	@echo "$(COLOR_GREEN)=== Release build done. ===$(COLOR_RESET)"

# ------------------------------------------------------------------------------
# Run tests (all crates)
# ------------------------------------------------------------------------------
test:
	@echo "$(COLOR_BLUE)=== Running tests (workspace) ===$(COLOR_RESET)"
	cargo test --workspace --color=always

# ------------------------------------------------------------------------------
# Build Rust docs (all crates)
# ------------------------------------------------------------------------------
doc:
	@echo "$(COLOR_BLUE)=== Building Rust API docs ===$(COLOR_RESET)"
	cargo doc --workspace --no-deps --color=always

# ------------------------------------------------------------------------------
# Build JS/Node documentation
# ------------------------------------------------------------------------------
docs:
	@echo "$(COLOR_BLUE)=== Building single-page JS/Node docs ===$(COLOR_RESET)"
	cd src/public && node build-single-index.js

# ------------------------------------------------------------------------------
# Strip binaries (optional)
# ------------------------------------------------------------------------------
strip:
	@echo "$(COLOR_BLUE)=== Stripping artifacts (if strip is available) ===$(COLOR_RESET)"
	@which strip >/dev/null 2>&1 && \
	  find target -type f \
	    \( -name 'lib*.so' -o -name 'lib*.dylib' -o -name '*.dll' -o -name 'mumu' \) \
	    -exec strip {} \; 2>/dev/null || true

# ------------------------------------------------------------------------------
# Platform packaging: DMG on macOS, .deb on Linux
# ------------------------------------------------------------------------------
package: strip
	@if [ "$$(uname)" = "Darwin" ]; then \
	  $(MAKE) macos-dmg; \
	else \
	  $(MAKE) deb; \
	fi

macos-dmg:
	@echo "$(COLOR_BLUE)=== Creating macOS .dmg with Installer Package (.pkg) ===$(COLOR_RESET)"
	rm -rf target/dist_macos
	mkdir -p target/dist_macos
	cp target/release/mumu target/dist_macos/ || true
	# You may want to add plugin copying logic here as needed
	hdiutil create \
	  -volname "LavaInstaller" \
	  -srcfolder target/dist_macos \
	  -ov \
	  -format UDZO \
	  target/mumu.dmg
	@echo "$(COLOR_GREEN)=== macOS .dmg created at target/mumu.dmg ===$(COLOR_RESET)"

deb:
	@echo "$(COLOR_BLUE)=== Building .deb package ===$(COLOR_RESET)"
	cargo deb || { echo "$(COLOR_RED)cargo-deb failed => no .deb created.$(COLOR_RESET)"; exit 1; }

# ------------------------------------------------------------------------------
# Clean everything
# ------------------------------------------------------------------------------
clean:
	cargo clean
	rm -rf target/dist_macos target/mumu.dmg

.PHONY: default build release test doc docs strip package macos-dmg deb clean