forked from mantl/consul-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (40 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
48
49
50
TEST?=$$(glide nv)
NAME = $(shell awk -F\" '/^const Name/ { print $$2 }' main.go)
VERSION = $(shell awk -F\" '/^const Version/ { print $$2 }' main.go)
DEPS = $(shell go list -f '{{range .TestImports}}{{.}} {{end}}' ./...)
all: build
build:
@mkdir -p bin/
go build -o bin/$(NAME)
deps:
glide up
test:
go test $(TEST) $(TESTARGS) -timeout=30s -parallel=4
go vet $(TEST)
xcompile: test
@rm -rf build/
@mkdir -p build
gox \
-os="darwin" \
-os="freebsd" \
-os="linux" \
-os="netbsd" \
-os="openbsd" \
-os="solaris" \
-os="windows" \
-output="build/{{.Dir}}_$(VERSION)_{{.OS}}_{{.Arch}}/$(NAME)"
vendor:
glide install --strip-vendor
glide update --strip-vendor
vendor-clean:
-rm -rf vendor/
package: xcompile
$(eval FILES := $(shell ls build))
@mkdir -p build/zip
for f in $(FILES); do \
(cd $(shell pwd)/build/$$f && zip ../zip/$$f.zip consul-cli*); \
echo $$f; \
done
package-clean:
-rm -rf build/
.PHONY: all deps updatedeps build test xcompile package package-clean vendor vendor-clean