abra/Makefile
decentral1se c9ba7aef20
All checks were successful
continuous-integration/drone/push Build is passing
build: reduce binary size with optimisation flags
Part of https://git.autonomic.zone/coop-cloud/go-abra/issues/4.
2021-07-20 22:45:49 +02:00

33 lines
661 B
Makefile

ABRA := ./cmd/abra
COMMIT := $(shell git rev-list -1 HEAD)
GOPATH := $(shell go env GOPATH)
VERSION := $(shell cat ./version)
LDFLAGS := "-X 'main.Commit=$(COMMIT)' -X 'main.Version=$(VERSION)' -s -w"
all: run test install build clean format check static
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)
static:
@staticcheck $(ABRA)
test:
@go test ./config -cover
@go test ./client -cover