/
qtu100
/
kc-cli
Обзор
Документация
Войти
/
qtu100
/
kc-cli
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
Makefile
39 строк
2 KB
Radmir Gataullin
Add config import-kcc: batch-import .kcc credential files as profiles
06 июл 2026, 13:42
06 июл 2026, 13:42
c93bbf6
Код
Авторство
О чём код?
# Semantic client version baked into the binary (kc version). Override: make build VERSION=v1.2.3 VERSION ?= v1.0.2 LDFLAGS = -s -w -X main.version=$(VERSION) build: go build -ldflags="$(LDFLAGS)" -o kc . build-all: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -o dist/kc-linux-amd64 . CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$(LDFLAGS)" -o dist/kc-linux-arm64 . CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -o dist/kc-darwin-amd64 . CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$(LDFLAGS)" -o dist/kc-darwin-arm64 . CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -o dist/kc-windows-amd64.exe . CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags="$(LDFLAGS)" -o dist/kc-windows-arm64.exe . clean: rm -f kc dist/* # Install a self-rebuilding `kc` launcher to /usr/local/bin so the command on your PATH is # never stale: it rebuilds dist/kc-linux-amd64 whenever a *.go file (or go.mod) is newer than # the binary, then execs it. The repo path is baked in via $(CURDIR). Needs sudo. dev-install: @tmp=$$(mktemp); \ { \ printf '%s\n' '#!/usr/bin/env bash'; \ printf '%s\n' 'set -uo pipefail'; \ printf '%s\n' '# Auto-rebuilding kc launcher (installed by `make dev-install`). Edit there, not here.'; \ printf '%s\n' 'CLI_DIR="$(CURDIR)"'; \ printf '%s\n' 'BIN="$$CLI_DIR/dist/kc-linux-amd64"'; \ printf '%s\n' 'if [ ! -x "$$BIN" ] || [ -n "$$(find "$$CLI_DIR" -maxdepth 1 -name "*.go" -newer "$$BIN" -print -quit 2>/dev/null)" ] || [ "$$CLI_DIR/go.mod" -nt "$$BIN" ]; then'; \ printf '%s\n' ' ( cd "$$CLI_DIR" && go build -ldflags="-s -w" -o "$$BIN" . ) 1>&2 || echo "kc: rebuild failed; using existing binary" >&2'; \ printf '%s\n' 'fi'; \ printf '%s\n' 'exec "$$BIN" "$$@"'; \ } > "$$tmp"; \ sudo install -m 0755 "$$tmp" /usr/local/bin/kc; \ rm -f "$$tmp"; \ echo "Installed auto-rebuild kc -> $(CURDIR)/dist/kc-linux-amd64" .PHONY: build build-all clean dev-install