-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
50 lines (34 loc) · 935 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
40
41
42
43
44
45
46
47
48
49
50
SHELL := /bin/bash
TARGET := $(shell echo $${PWD\#\#*/})
.DEFAULT_GOAL: $(TARGET)
VERSION_FILE = ./VERSION
VERSION = `cat $(VERSION_FILE)`
SUFFIX = "-dev"
CODEPATH = `go list -m`
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
export GO111MODULE = on
.PHONY: all build clean install uninstall fmt simplify check run
all: check install
$(TARGET): $(SRC)
packr build -ldflags "-X ${CODEPATH}/cmd.version=${VERSION}${SUFFIX}" -o ${TARGET}
build: $(TARGET)
@true
clean:
@rm -f $(TARGET)
install:
@packr install
uninstall: clean
@rm -f $$(which ${TARGET})
fmt:
@gofmt -l -w $(SRC)
simplify:
@gofmt -s -l -w $(SRC)
check:
@go get -u golang.org/x/lint/golint
@test -z $(shell gofmt -l ./ | tee /dev/stderr) || echo "[WARN] Fix formatting issues with 'make fmt'"
@for d in $$(go list ./...); do golint $${d}; done
@go vet
packr:
@go get -u github.com/gobuffalo/packr/...
run: install
@$(TARGET)