makefile standalone
This commit is contained in:
43
rig/standalone/Makefile
Normal file
43
rig/standalone/Makefile
Normal 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)
|
||||
Reference in New Issue
Block a user