this repo has no description
at main 1.1 kB view raw
1SHELL = /bin/bash 2.SHELLFLAGS = -o pipefail -c 3GIT_TAG := $(shell git describe --tags --exact-match 2>/dev/null) 4GIT_COMMIT := $(shell git rev-parse --short=9 HEAD) 5VERSION := $(if $(GIT_TAG),$(GIT_TAG),dev-$(GIT_COMMIT)) 6 7.PHONY: help 8help: ## Print info about all commands 9 @echo "Commands:" 10 @echo 11 @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[01;32m%-20s\033[0m %s\n", $$1, $$2}' 12 13.PHONY: build 14build: ## Build all executables 15 go build -ldflags "-X main.Version=$(VERSION)" -o peruse-bin ./cmd/peruse 16 17.PHONY: run 18run: 19 go build -ldflags "-X main.Version=dev-local" -o photocopy ./cmd/photocopy && ./photocopy run 20 21.PHONY: all 22all: build 23 24.PHONY: test 25test: ## Run tests 26 go clean -testcache && go test -v ./... 27 28.PHONY: lint 29lint: ## Verify code style and run static checks 30 go vet ./... 31 test -z $(gofmt -l ./...) 32 33.PHONY: fmt 34fmt: ## Run syntax re-formatting (modify in place) 35 go fmt ./... 36 37.PHONY: check 38check: ## Compile everything, checking syntax (does not output binaries) 39 go build ./... 40 41.env: 42 if [ ! -f ".env" ]; then cp example.dev.env .env; fi