Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (59 loc) · 2.63 KB
/
Copy pathMakefile
File metadata and controls
84 lines (59 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
.PHONY: all build test tests test-unit test-integration test-at test-branch test-all typecheck clean install install-user uninstall uninstall-user dev impl help
BIN := roboppi
# Legacy build artifacts (no longer built by default)
EXTRA_BINS := roboppi-core roboppi-workflow roboppi-daemon
SRC := src/cli.ts
# Allow passing Bun runtime flags (e.g. BUN_FLAGS=--smol)
BUN ?= bun
BUN_FLAGS ?=
# Extra flags passed to `bun build` (e.g. BUN_BUILD_FLAGS=--compile-exec-argv=--smol)
BUN_BUILD_FLAGS ?=
# Install locations (override like: make install PREFIX=/opt)
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
INSTALL ?= install
SUDO ?= sudo
all: build ## Build the binary (default)
build: ## Build a single binary (roboppi)
$(BUN) $(BUN_FLAGS) build $(BUN_BUILD_FLAGS) --compile $(SRC) --outfile $(BIN)
test: ## Run all tests (repo scope)
$(BUN) $(BUN_FLAGS) test test/unit tests/unit test/integration tests/at
tests: test ## Alias for `make test`
test-unit: ## Run unit tests only
$(BUN) $(BUN_FLAGS) test test/unit tests/unit
test-integration: ## Run integration tests only
$(BUN) $(BUN_FLAGS) test test/integration
test-at: ## Run acceptance tests only
$(BUN) $(BUN_FLAGS) test tests/at
test-branch: ## Run branch safety verification tests
bash tests/branch/run-branch-verification.sh
test-all: typecheck test test-branch ## Run type check + all tests
@echo "All checks passed"
typecheck: ## Run TypeScript type checker
$(BUN) $(BUN_FLAGS) x tsc --noEmit
clean: ## Remove build artifacts
rm -f $(BIN) $(EXTRA_BINS)
install: build ## Install binary to PREFIX/bin (default: /usr/local/bin; uses sudo if needed)
@if [ -w "$(BINDIR)" ] || [ -w "$(PREFIX)" ]; then \
mkdir -p "$(BINDIR)"; \
$(INSTALL) -m 755 "$(BIN)" "$(BINDIR)/$(BIN)"; \
else \
$(SUDO) mkdir -p "$(BINDIR)"; \
$(SUDO) $(INSTALL) -m 755 "$(BIN)" "$(BINDIR)/$(BIN)"; \
fi
install-user: build ## Install binary to ~/.local/bin
@$(MAKE) install PREFIX="$(HOME)/.local"
uninstall: ## Remove binary from PREFIX/bin (uses sudo if needed)
@if [ -w "$(BINDIR)" ]; then \
rm -f "$(BINDIR)/$(BIN)" $(addprefix $(BINDIR)/,$(EXTRA_BINS)); \
else \
$(SUDO) rm -f "$(BINDIR)/$(BIN)" $(addprefix $(BINDIR)/,$(EXTRA_BINS)); \
fi
uninstall-user: ## Remove binary from ~/.local/bin
@$(MAKE) uninstall PREFIX="$(HOME)/.local"
dev: ## Run in dev mode (no build)
$(BUN) $(BUN_FLAGS) run $(SRC)
impl: ## Run Swarm self-implementation workflow
$(BUN) $(BUN_FLAGS) run src/workflow/run.ts examples/swarm-impl-loop.yaml --workspace . --verbose
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'