forked from stuphlabs/pullcord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.in
80 lines (66 loc) · 1.73 KB
/
Makefile.in
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
76
77
78
79
changequote(`[',`]')dnl`
ROOTPKG = github.com/stuphlabs/pullcord
CONTAINERNAME = pullcord
PKG = ./...
COVERMODE = set
ifdef([_USE_DOCKER_], [
DOCKER := _DOCKER_CMD_
])
ifdef([_USE_DOCKER_GO_],[
GO := ${DOCKER} \
run -it --rm \
-v $${PWD}/.build_gopath/:/go/ \
-v $${PWD}/:/go/src/${ROOTPKG}/ \
-w /go/src/${ROOTPKG}/ \
-u `id -u` \
-e XDG_CACHE_HOME='/tmp/.cache' \
_DOCKER_GOLANG_IMG_ \
_GO_CMD_
],[
GO := cd .build_gopath/src/${ROOTPKG} \
&& GOPATH=$${PWD}/.build_gopath _GO_CMD_
])
binfiles = bin/pullcord bin/genhash
cleanfiles = bin cover.html cover.out ${binfiles}
recursive_cleanfiles =
dist_cleanfiles = Makefile .build_gopath
recursive_dist_cleanfiles =
maintainer_cleanfiles =
recursive_maintainer_cleanfiles =
.PHONY: all
all: test ${binfiles}
bin/%: cmd/%/*.go .build_gopath/src
mkdir -p bin
${GO} build -v -o $@ ./cmd/$*
.build_gopath/src:
mkdir -p $@/`dirname ${ROOTPKG}`
ifdef([_USE_DOCKER_GO_],,[ln -s $${PWD} $@/${ROOTPKG}])
${GO} get -t -v ${PKG}
.PHONY: clean
clean:
-rm -rf ${cleanfiles}
-rm -f `for file in ${recursive_cleanfiles}; do \
find . -name $${file}; \
done`
ifdef([_USE_DOCKER_],[
container: test Dockerfile ${binfiles}
${DOCKER} build -t ${CONTAINERNAME} .
])
cover.html: cover.out
${GO} tool cover -html cover.out -o $@
cover.out: *.go */*.go .build_gopath/src
${GO} test -v -coverprofile $@ -covermode ${COVERMODE} ${PKG}
.PHONY: distclean
distclean: clean
-rm -rf ${dist_cleanfiles}
-rm -f `for file in ${recursive_dist_cleanfiles}; do \
find . -name $${file}; \
done`
.PHONY: maintainer_clean
maintainer_clean: clean distclean
-rm -rf ${maintainer_cleanfiles}
-rm -f `for file in ${recursive_maintainer_cleanfiles}; do \
find . -name $${file}; \
done`
.PHONY: test
test: cover.out cover.html