-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
53 lines (43 loc) · 1.04 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
GOFILES := $(shell find . -name '*.go' -not -path './vendor/*')
GOPACKAGES := $(shell go list ./... | grep -v /vendor/)
NAME := factordb
DIST_DIRS := find * - type d -exec
.DEFAULT_GOAL := bin/$(NAME)
bin/$(NAME): $(GOFILES)
go build -o bin/$(NAME)
.PHONY: clean
clean:
rm -rf vendor
rm -rf bin/*
rm -rf dist/*
.PHONY: cross-build
cross-build:
for os in darwin linux windows; do \
for arch in amd64 386; do \
GOOS=$$os GOARCH=$$arch CGO_ENABLED=0 go build -o dist/$(NAME)-$$os-$$arch; \
done; \
done
.PHONY: deps
deps: glide
glide install
.PHONY: dist
dist:
cd dist && \
$(DIST_DIRS) cp ../LICENSE {} \; && \
$(DIST_DIRS) cp ../README.md {} \; && \
$(DIST_DIRS) tar -zcf $(NAME)-$(VERSION)-{}.tar.gz {} \; && \
$(DIST_DIRS) zip -r $(NAME)-$(VERSION)-{}.zip {} \; && \
cd ..
.PHONY: build
build:
go build $(LDFLAGS) -o bin/$(NAME)
.PHONY: glide
glide:
ifeq ($(shell command -v glide 2> /dev/null),)
curl https://glide.sh/get | sh
endif
.PHONY: install
install:
go install $(LDFLAGS)
test:
go test -v $(GOPACKAGES)