Add build, parametrize LDFLAGS and list all targets

This commit is contained in:
decentral1se 2021-07-15 15:26:02 +02:00
parent 8b38b89647
commit b13081d1a6
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -1,14 +1,18 @@
COMMIT := $(shell git rev-list -1 HEAD)
COMMIT := $(shell git rev-list -1 HEAD)
VERSION := $(shell cat ./version)
GOPATH := $(shell go env GOPATH)
GOPATH := $(shell go env GOPATH)
LDFLAGS := "-X 'main.Commit=$(COMMIT)' -X 'main.Version=$(VERSION)'"
all: run
all: run install build clean
run:
go run -ldflags="-X 'main.Commit=$(COMMIT)' -X 'main.Version=$(VERSION)'" ./cmd/abra
go run -ldflags=$(LDFLAGS) ./cmd/abra
install:
go install -ldflags="-X 'main.Commit=$(COMMIT)' -X 'main.Version=$(VERSION)'" ./cmd/abra
go install -ldflags=$(LDFLAGS) ./cmd/abra
build:
go build -ldflags=$(LDFLAGS) ./cmd/abra
clean:
rm '$(GOPATH)/bin/abra'