VERSION = 0.9.1
COLOR_RESET = \033[0m
COLOR_BLUE = \033[34m
COLOR_GREEN = \033[32m
COLOR_RED = \033[31m
default: build
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)"
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)"
test:
@echo "$(COLOR_BLUE)=== Running tests (workspace) ===$(COLOR_RESET)"
cargo test --workspace --color=always
doc:
@echo "$(COLOR_BLUE)=== Building Rust API docs ===$(COLOR_RESET)"
cargo doc --workspace --no-deps --color=always
docs:
@echo "$(COLOR_BLUE)=== Building single-page JS/Node docs ===$(COLOR_RESET)"
cd src/public && node build-single-index.js
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
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
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:
cargo clean
rm -rf target/dist_macos target/mumu.dmg
.PHONY: default build release test doc docs strip package macos-dmg deb clean