makefile standalone

This commit is contained in:
2026-09-16 13:52:04 -03:00
parent fed5d92034
commit c3fe4422f2
3 changed files with 77 additions and 0 deletions

43
rig/standalone/Makefile Normal file
View File

@@ -0,0 +1,43 @@
# Optional shorthand for the two standalone scripts. They run without it:
# `bash rigdeps.sh detect` and `bash rigmini.sh status` are the whole interface,
# and this file only spells those out so nobody has to guess them.
#
# Guessing is what went wrong before. A Makefile generated around these scripts
# invented `make mini` -> `rigmini.sh on`, a verb that does not exist, and a bare
# `rigdeps.sh` for "check and report", which actually installs. So every target
# here calls only a verb the script accepts, and ctrl/selftest.sh checks that.
#
# Works wherever the three files sit together — the scripts are found beside
# this Makefile, not in the current directory, so `make -f path/Makefile` works.
#
# Usage:
# make deps report the host and toolchain; changes nothing
# make deps install [dev] download, verify and install into ~/.local/bin
# make mem advertised memory and what caps it; safe
# make mem push allocates until it stops — not on a box you need
HERE := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
# Words after the target become the script's verb and arguments.
ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
ifneq ($(ARGS),)
$(eval $(ARGS):;@:)
.PHONY: $(ARGS)
endif
.DEFAULT_GOAL := help
.PHONY: help deps mem
help: ## list targets
@grep -hE '^[a-z][a-z-]*:.*?##' $(MAKEFILE_LIST) | sed 's/:.*##/\t/' | expand -t16
# Defaults to `detect`, not `install`: on a machine you are still evaluating,
# the bare command should report. Installing is a word you type.
deps: ## toolchain [detect|list|verify|install|fetch] (default detect)
bash $(HERE)rigdeps.sh $(or $(ARGS),detect)
# `mem`, matching the full rig's `make mem`, and deliberately NOT `mini`: that
# word already means "minimal footprint" in the projects that use this, and one
# name pointing at two jobs is how the invented target happened.
mem: ## memory and its caps [status|push|all] (default status)
bash $(HERE)rigmini.sh $(or $(ARGS),status)

View File

@@ -39,6 +39,20 @@ bash rigmini.sh status # advertised memory and caps; safe
bash rigmini.sh push # allocates until it stops — not on a machine you need
```
The `Makefile` beside them is **optional shorthand** for exactly those calls —
copy it along or don't; the scripts do not need it:
```bash
make deps # = rigdeps.sh detect (reports; installing is `make deps install`)
make mem # = rigmini.sh status
```
If you wrap these scripts in a Makefile of your own, copy the calls from that
file rather than guessing them. `rigmini.sh` measures memory; it has no `on` or
`off`, and toggling a heavy service off for a smaller footprint is a job for the
project's own manifests, not for this script. `make selftest` in the full rig
fails if this Makefile ever calls a verb its script does not accept.
If an earlier setup already put these tools in some other directory on PATH,
remove that directory and the line that added it — do not rely on `install` to
notice. It only reports shadowing once `~/.local/bin` is itself on PATH, which on