forked from knadh/dns.toys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (25 loc) · 962 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
LAST_COMMIT := $(shell git rev-parse --short HEAD)
LAST_COMMIT_DATE := $(shell git show -s --format=%ci ${LAST_COMMIT})
VERSION := $(shell git describe --abbrev=1)
BUILDSTR := ${VERSION} (build "\\\#"${LAST_COMMIT} $(shell date '+%Y-%m-%d %H:%M:%S'))
GOPATH ?= $(HOME)/go
STUFFBIN ?= $(GOPATH)/bin/stuffbin
BIN := dnstoys.bin
.PHONY: build
build: $(BIN)
$(BIN): $(shell find . -type f -name "*.go")
CGO_ENABLED=0 go build -o ${BIN} -ldflags="-s -w -X 'main.buildString=${BUILDSTR}'" ./cmd/dnstoys/*.go
.PHONY: run
run:
CGO_ENABLED=0 go run -ldflags="-s -w -X 'main.buildString=${BUILDSTR}'" ./cmd/dnstoys
.PHONY: test
test:
go test ./...
# Use goreleaser to do a dry run producing local builds.
.PHONY: release-dry
release-dry:
goreleaser --parallelism 1 --rm-dist --snapshot --skip-validate --skip-publish
# Use goreleaser to build production releases and publish them.
.PHONY: release
release:
goreleaser --parallelism 1 --rm-dist --skip-validate