Add build, parametrize LDFLAGS and list all targets
This commit is contained in:
parent
8b38b89647
commit
b13081d1a6
16
Makefile
16
Makefile
@ -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'
|
||||
|
Reference in New Issue
Block a user