-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
65 lines (45 loc) · 1.49 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
# Project-specific variables
BINARIES ?= millipede-fuse millipede-go millipede-http
CONVEY_PORT ?= 9042
# Common variables
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
SOURCES := $(call rwildcard,./cmd/ ./pkg/,*.go) glide.lock
GOENV ?= GO15VENDOREXPERIMENT=1
GO ?= $(GOENV) go
USER ?= $(shell whoami)
all: build
.PHONY: build
build: $(BINARIES)
$(BINARIES): $(SOURCES)
$(GO) build -i -o $@ ./cmd/$@
.PHONY: test
test:
#$(GO) get -t .
$(GO) test -i .
$(GO) test -v .
.PHONY: clean
clean:
rm -f $(BINARIES)
.PHONY: re
re: clean all
.PHONY: convey
convey:
$(GO) get github.com/smartystreets/goconvey
goconvey -cover -port=$(CONVEY_PORT) -workDir="$(realpath .)" -depth=1
.PHONY: cover
cover: profile.out
profile.out: $(SOURCES)
rm -f $@
$(GO) test -covermode=count -coverpkg=. -coverprofile=$@ .
.PHONY: docker-build
docker-build:
$(GO) get github.com/laher/goxc
rm -rf contrib/docker/linux_386
for binary in $(BINARIES); do \
goxc -bc="linux,386" -d . -pv contrib/docker -n $$binary xc; \
mv contrib/docker/linux_386/$$binary contrib/docker/entrypoint; \
docker build -t $(USER)/$$binary contrib/docker; \
docker run -it --rm $(USER)/$$binary || true; \
docker inspect --type=image --format="{{ .Id }}" moul/$$binary || true; \
echo "Now you can run 'docker push $(USER)/$$binary'"; \
done