-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (41 loc) · 1.08 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
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}}' ./...)
GOOS=$(shell go env GOOS)
ARCH=$(shell go env GOARCH)
all: dev
dev:
@mkdir -p bin/
gox -os=$(GOOS) -arch=$(ARCH) -output "bin/pony" \
$$(glide nv)
build: plugins
@mkdir -p bin/
go build -o bin/$(NAME)
test:
go test $(TEST) $(TESTARGS) -timeout=30s -parallel=4
go vet $(TEST)
plugins:
go build
xcompile:
@rm -rf build/
@mkdir -p build
gox \
-os="darwin" \
-output="build/pony_$(VERSION)_{{.OS}}_{{.Arch}}/pony-{{.Dir}}" $$(glide nv)
# -os="freebsd" \
# -os="linux" \
# -os="windows" \
package: xcompile
$(eval FILES := $(shell ls build))
@mkdir -p build/tgz
for f in $(FILES); do \
(cd $(shell pwd)/build && tar -zcvf tgz/$$f.tar.gz $$f); \
echo $$f; \
done
vendor:
-rm -rf vendor/github.com/hashicorp/terraform
glide install
glide update
rm -rf vendor/github.com/hashicorp/terraform/vendor
.PHONY: all build test xcompile package vendor