Add git info to build
This commit is contained in:
parent
bcbbe000f3
commit
9c946beefb
12
Makefile
12
Makefile
@ -3,19 +3,25 @@ default: bin/hw bin/hwc bin/hwl
|
|||||||
|
|
||||||
VERSION := $(shell git describe --tags 2> /dev/null || echo "unreleased")
|
VERSION := $(shell git describe --tags 2> /dev/null || echo "unreleased")
|
||||||
V_DIRTY := $(shell git describe --exact-match HEAD 2> /dev/null > /dev/null || echo "-unreleased")
|
V_DIRTY := $(shell git describe --exact-match HEAD 2> /dev/null > /dev/null || echo "-unreleased")
|
||||||
|
GIT := $(shell git rev-parse --short HEAD)
|
||||||
|
DIRTY := $(shell git diff-index --quiet HEAD 2> /dev/null > /dev/null || echo "-dirty")
|
||||||
|
|
||||||
bin/hw: cmd/hw/main.go bin
|
bin/hw: cmd/hw/main.go bin
|
||||||
@GOOS=linux go build -ldflags \
|
@GOOS=linux go build -ldflags \
|
||||||
"-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY)" \
|
"-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY) \
|
||||||
|
-X mcquay.me/hw.Git=$(GIT)$(DIRTY)" \
|
||||||
-v -o bin/hw ./cmd/hw
|
-v -o bin/hw ./cmd/hw
|
||||||
|
|
||||||
bin/hwc: cmd/hwc/main.go bin
|
bin/hwc: cmd/hwc/main.go bin
|
||||||
@GOOS=linux go build -ldflags \
|
@GOOS=linux go build -ldflags \
|
||||||
"-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY)" \
|
"-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY) \
|
||||||
|
-X mcquay.me/hw.Git=$(GIT)$(DIRTY)" \
|
||||||
-v -o bin/hwc ./cmd/hwc
|
-v -o bin/hwc ./cmd/hwc
|
||||||
|
|
||||||
bin/hwl: cmd/hwl/main.go bin
|
bin/hwl: cmd/hwl/main.go bin
|
||||||
@GOOS=linux go build -ldflags \
|
@GOOS=linux go build -ldflags \
|
||||||
"-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY)" \
|
"-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY) \
|
||||||
|
-X mcquay.me/hw.Git=$(GIT)$(DIRTY)" \
|
||||||
-v -o bin/hwl ./cmd/hwl
|
-v -o bin/hwl ./cmd/hwl
|
||||||
|
|
||||||
bin:
|
bin:
|
||||||
|
Loading…
Reference in New Issue
Block a user