forked from chrisenuf/fullerite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (37 loc) · 1.01 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
PROG := fullerite
SRCDIR := src
PKGS := $(PROG) $(PROG)/metric $(PROG)/handler $(PROG)/collector
SOURCES := $(foreach pkg, $(PKGS), $(wildcard $(SRCDIR)/$(pkg)/*.go))
# symlinks confuse go tools, let's not mess with it and use -L
GOPATH := $(shell pwd -L)
export GOPATH
all: clean fmt vet lint $(PROG)
.PHONY: clean
clean:
@echo Cleaning $(PROG)...
@rm -f $(PROG) bin/$(PROG)
@rm -rf pkg/*/$(PROG)
deps:
@echo Getting dependencies...
@go get $(PROG)
$(PROG): $(SOURCES) deps
@echo Building $(PROG)...
@go build $@
test: tests
tests: deps
@echo Testing $(PROG)
@go test $(PROG)
fmt: $(SOURCES)
@$(foreach pkg, $(PKGS), go fmt $(pkg);)
vet: $(SOURCES)
@echo Vetting $(PROG) sources...
@go get golang.org/x/tools/cmd/vet
@$(foreach pkg, $(PKGS), go vet $(pkg);)
lint: $(SOURCES)
@echo Linting $(PROG) sources...
@go get github.com/golang/lint/golint
@$(foreach pkg, $(PKGS), bin/golint $(pkg);)
cyclo: $(SOURCES)
@echo Checking code complexity...
@go get github.com/fzipp/gocyclo
@bin/gocyclo $(SOURCES)