hw/Makefile

41 lines
1.1 KiB
Makefile
Raw Normal View History

2018-03-08 14:07:14 -08:00
.PHONY: default
default: bin/hw bin/hwc bin/hwl
2018-03-08 16:09:51 -08:00
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")
2018-03-08 16:17:54 -08:00
GIT := $(shell git rev-parse --short HEAD)
DIRTY := $(shell git diff-index --quiet HEAD 2> /dev/null > /dev/null || echo "-dirty")
2018-03-08 16:30:41 -08:00
bin/hw: $(shell ls *.go) cmd/hw/main.go bin
2018-03-08 16:24:00 -08:00
@echo hw
@go build -ldflags \
2018-03-08 16:17:54 -08:00
"-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY) \
-X mcquay.me/hw.Git=$(GIT)$(DIRTY)" \
2018-03-08 16:09:51 -08:00
-v -o bin/hw ./cmd/hw
2018-01-09 16:31:38 -08:00
2018-03-08 16:30:41 -08:00
bin/hwc: $(shell ls *.go ) cmd/hwc/main.go bin
2018-03-08 16:24:00 -08:00
@echo hwc
@go build -ldflags \
2018-03-08 16:17:54 -08:00
"-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY) \
-X mcquay.me/hw.Git=$(GIT)$(DIRTY)" \
2018-03-08 16:09:51 -08:00
-v -o bin/hwc ./cmd/hwc
2018-03-08 14:07:14 -08:00
2018-03-08 16:30:41 -08:00
bin/hwl: $(shell ls *.go) cmd/hwl/main.go bin
2018-03-08 16:24:00 -08:00
@echo hwl
@go build -ldflags \
2018-03-08 16:17:54 -08:00
"-X mcquay.me/hw.Version=$(VERSION)$(V_DIRTY) \
-X mcquay.me/hw.Git=$(GIT)$(DIRTY)" \
2018-03-08 16:09:51 -08:00
-v -o bin/hwl ./cmd/hwl
2018-03-08 14:07:14 -08:00
2018-01-09 16:31:38 -08:00
bin:
mkdir bin
2018-03-08 16:23:50 -08:00
.PHONY: clean
clean:
@rm -fv bin/{hw,hwl,hwc}
2018-03-08 16:30:54 -08:00
.PHONY: lint
lint:
@golint $(shell go list mcquay.me/hw/...)
@go vet $(shell go list mcquay.me/hw/...)