-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
39 lines (34 loc) · 1002 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
34
35
36
37
38
39
BUILD = $(shell date -u +"%Y-%m-%d")
TAG = $(shell git describe --always --dirty --tags --long)
FLAGS = "-s -X $(PKG).build=$(BUILD) -X $(PKG).tag=$(TAG)"
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
## audit: format, test, and vet the code
.PHONY: audit
audit: test
@$(info Formatting and vetting.)
gofumpt -w .
go vet ./...
staticcheck ./...
## build: build the application
.PHONY: build
build: PKG := main
build:
@$(info Building bat.)
GOOS=linux GOARCH=amd64 go build -ldflags=$(FLAGS) -o=./bin/bat .
## install: install the application
.PHONY: install
install: build
@$(info Installing binary.)
install ./bin/bat /usr/local/bin/
@$(info Installing manual page.)
mkdir -p /usr/local/share/man/man1 && cp ./bat.1 /usr/local/share/man/man1/
## test: run tests
.PHONY: test
test: PKG := tshaka.dev/x/bat
test:
@$(info Running tests.)
go test -v -race -vet=off -ldflags=$(FLAGS) ./...