26 lines
547 B
Makefile
26 lines
547 B
Makefile
ABRA := ./cmd/abra
|
|
COMMIT := $(shell git rev-list -1 HEAD)
|
|
GOPATH := $(shell go env GOPATH)
|
|
LDFLAGS := "-X 'main.Commit=$(COMMIT)' -X 'main.Version=$(VERSION)'"
|
|
VERSION := $(shell cat ./version)
|
|
|
|
all: run install build clean format check
|
|
|
|
run:
|
|
go run -ldflags=$(LDFLAGS) $(ABRA)
|
|
|
|
install:
|
|
go install -ldflags=$(LDFLAGS) $(ABRA)
|
|
|
|
build:
|
|
go build -ldflags=$(LDFLAGS) $(ABRA)
|
|
|
|
clean:
|
|
rm '$(GOPATH)/bin/abra'
|
|
|
|
format:
|
|
gofmt -s -w .
|
|
|
|
check:
|
|
test -z $$(gofmt -l .) || (echo "gofmt: formatting issue - run 'make format' to resolve" && exit 1)
|