-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
75 lines (59 loc) · 1.93 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
70
71
72
73
74
75
# Source
# https://ariejan.net/2015/10/03/a-makefile-for-golang-cli-tools/
# MOOLINET-ALL
SOURCEDIR=.
SOURCES := $(shell find $(SOURCEDIR) -regex '.*\.go\|.*\.html\|.*\.css\|.*\.js\|.*\.json')
BINARY=./release/moolinet-all
# MOOLINET-FUZZ
MOOLINET_FUZZ=./release/tools/moolinet-fuzz
FUZZ_SOURCEDIR=./tools/moolinet-fuzz
FUZZ_SOURCES := $(shell find $(FUZZ_SOURCEDIR) -regex '.*\.go\|.*\.y')
# MOOLINET-WRITE
MOOLINET_WRITE=./release/tools/moolinet-write
WRITE_SOURCEDIR=./tools/moolinet-write
WRITE_SOURCES := $(shell find $(WRITE_SOURCEDIR) -regex '.*\.go')
VERSION=v0.3
LDFLAGS=-ldflags "-X main.Version=${VERSION}"
docker=master
DOCKER_master=master
DOCKER_1.12=667315576fac663bd80bbada4364413692e57ac6
.DEFAULT_GOAL: release
release: $(BINARY) $(MOOLINET_FUZZ) $(MOOLINET_WRITE)
$(BINARY): $(SOURCES)
mkdir -p release/
cp -r moolinet.json challenges/ static/ release/
go build ${LDFLAGS} -o ${BINARY} moolinet-all/main.go
$(MOOLINET_FUZZ): $(FUZZ_SOURCES) generate
mkdir -p release/tools
go build ${LDFLAGS} -o ${MOOLINET_FUZZ} ./tools/moolinet-fuzz/main.go
$(MOOLINET_WRITE): $(WRITE_SOURCES)
mkdir -p release/tools
go build ${LDFLAGS} -o ${MOOLINET_WRITE} ./tools/moolinet-write/main.go
prepare:
go get -d -v ./...
cd ${GOPATH}/src/github.com/docker/docker && \
echo "-> RESET" && git clean -fdx "" && \
echo "-> MASTER" && git checkout master && \
echo "-> PULL" && git pull && \
echo "-> CHECKOUT" && git checkout ${DOCKER_${docker}}
go get -u github.com/alecthomas/gometalinter
gometalinter --install
.PHONY: install
install: generate
go install ${LDFLAGS} ./...
.PHONY: clean
clean:
if [ -d release/ ] ; then rm -r release/ ; fi
.PHONY: test
test: generate
go test ./...
.PHONY: lint
lint: install
gometalinter -j 1 -t --deadline 100s \
--exclude "Errors unhandled." \
--exclude "tools/moolinet-fuzz/testdata" \
--exclude "moo.go" \
--disable gotype --disable interfacer ./...
.PHONY: generate
generate:
go generate ./...