-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
69 lines (57 loc) · 1.38 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
PKGNAME = cuppa
DESTDIR ?=
PREFIX ?= /usr
BINDIR = $(PREFIX)/bin
GOBIN = ~/go/bin
GOPROJROOT = $(GOSRC)/$(PROJREPO)
GOLDFLAGS = -ldflags "-s -w"
GOTAGS = --tags "libsqlite3 linux"
GOCC = go
GOFMT = $(GOCC) fmt -x
GOGET = $(GOCC) get $(GOLDFLAGS)
GOBUILD = $(GOCC) build -v $(GOLDFLAGS) $(GOTAGS)
GOTEST = $(GOCC) test
GOVET = $(GOCC) vet
GOINSTALL = $(GOCC) install $(GOLDFLAGS)
include Makefile.waterlog
GOLINT = $(GOBIN)/golint -set_exit_status
all: build
build: setup-deps
@$(call stage,BUILD)
@$(GOBUILD)
@$(call pass,BUILD)
test: build
@$(call stage,TEST)
@$(GOTEST) ./...
@$(call pass,TEST)
validate: setup-deps
@$(call stage,FORMAT)
@$(GOFMT) ./...
@$(call pass,FORMAT)
@$(call stage,VET)
@$(call task,Running 'go vet'...)
@$(GOVET) ./...
@$(call pass,VET)
@$(call stage,LINT)
@$(call task,Running 'golint'...)
@$(GOLINT)
@$(call pass,LINT)
setup-deps:
@$(call stage,DEPS)
@if [ ! -e $(GOBIN)/golint ]; then \
$(call task,Installing golint...); \
$(GOGET) golang.org/x/lint; \
fi
install:
@$(call stage,INSTALL)
install -D -m 00755 $(PKGNAME) $(DESTDIR)$(BINDIR)/$(PKGNAME)
@$(call pass,INSTALL)
uninstall:
@$(call stage,UNINSTALL)
rm -f $(DESTDIR)$(BINDIR)/$(PKGNAME)
@$(call pass,UNINSTALL)
clean:
@$(call stage,CLEAN)
@$(call task,Removing executable...)
@rm $(PKGNAME)
@$(call pass,CLEAN)