diff --git a/Makefile b/Makefile index 026f69b..590d036 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,26 @@ +# ━━━ cmsctl build + install ━━━ +# Builds the cmsctl CLI. Pure Go, no cgo/build tags needed. +# +# make cmsctl # build to ./bin/cmsctl +# make install-cmsctl # build + install to ~/.local/bin +# +# Override BIN_DIR to install elsewhere: make install-cmsctl BIN_DIR=/usr/local/bin +BIN_DIR ?= $(HOME)/.local/bin + +.PHONY: cmsctl install-cmsctl +cmsctl: + @mkdir -p bin + CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o bin/cmsctl ./cmd/cmsctl + @echo "Built bin/cmsctl" + +install-cmsctl: cmsctl + @mkdir -p $(BIN_DIR) + @cp bin/cmsctl $(BIN_DIR)/cmsctl + @chmod 0755 $(BIN_DIR)/cmsctl + @echo "Installed $(BIN_DIR)/cmsctl" + # ━━━ Pre-commit hook (forbid root binaries) ━━━ .PHONY: install-hooks install-hooks: