-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
52 lines (40 loc) · 1.02 KB
/
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
51
52
GO_BIN_FILES=json2hat.go
GO_BIN_CMDS=json2hat
# race
# GO_ENV=CGO_ENABLED=1
# GO_BUILD=go build -ldflags '-s -w' -race
# no race
GO_ENV=CGO_ENABLED=0
GO_BUILD=go build -ldflags '-s -w'
# end
GO_INSTALL=go install -ldflags '-s'
GO_FMT=gofmt -s -w
GO_LINT=golint -set_exit_status
GO_VET=go vet
GO_IMPORTS=goimports -w
GO_USEDEXPORTS=usedexports
GO_ERRCHECK=errcheck -asserts -ignore '[FS]?[Pp]rint*'
BINARIES=json2hat
STRIP=strip
all: check ${BINARIES}
json2hat: json2hat.go
${GO_ENV} ${GO_BUILD} -o json2hat json2hat.go
fmt: ${GO_BIN_FILES}
./for_each_go_file.sh "${GO_FMT}"
lint: ${GO_BIN_FILES}
./for_each_go_file.sh "${GO_LINT}"
vet: ${GO_BIN_FILES}
./for_each_go_file.sh "${GO_VET}"
imports: ${GO_BIN_FILES}
./for_each_go_file.sh "${GO_IMPORTS}"
usedexports: ${GO_BIN_FILES}
${GO_USEDEXPORTS} ./...
errcheck: ${GO_BIN_FILES}
${GO_ERRCHECK} ./...
check: fmt lint imports vet usedexports errcheck
install: check ${BINARIES}
${GO_INSTALL} ${GO_BIN_CMDS}
strip: ${BINARIES}
${STRIP} ${BINARIES}
clean:
rm -f ${BINARIES}