1OUTPUT_DIR = ./builds
2GIT_COMMIT = `git rev-parse HEAD`
3
4gotty: app/resource.go main.go app/*.go
5	godep go build
6
7resource:  app/resource.go
8
9app/resource.go: bindata/static/js/hterm.js bindata/static/js/gotty.js  bindata/static/index.html bindata/static/favicon.png
10	go-bindata -prefix bindata -pkg app -ignore=\\.gitkeep -o app/resource.go bindata/...
11	gofmt -w app/resource.go
12
13bindata:
14	mkdir bindata
15
16bindata/static: bindata
17	mkdir bindata/static
18
19bindata/static/index.html: bindata/static resources/index.html
20	cp resources/index.html bindata/static/index.html
21
22bindata/static/favicon.png: bindata/static resources/favicon.png
23	cp resources/favicon.png bindata/static/favicon.png
24
25bindata/static/js: bindata/static
26	mkdir -p bindata/static/js
27
28bindata/static/js/hterm.js: bindata/static/js libapps/hterm/js/*.js
29	cd libapps && \
30	LIBDOT_SEARCH_PATH=`pwd` ./libdot/bin/concat.sh -i ./hterm/concat/hterm_all.concat -o ../bindata/static/js/hterm.js
31
32bindata/static/js/gotty.js: bindata/static/js resources/gotty.js
33	cp resources/gotty.js bindata/static/js/gotty.js
34
35tools:
36	go get github.com/tools/godep
37	go get github.com/mitchellh/gox
38	go get github.com/tcnksm/ghr
39	go get github.com/jteeuwen/go-bindata/...
40
41test:
42	if [ `go fmt $(go list ./... | grep -v /vendor/) | wc -l` -gt 0 ]; then echo "go fmt error"; exit 1; fi
43
44cross_compile:
45	GOARM=5 gox -os="darwin linux freebsd netbsd openbsd" -arch="386 amd64 arm" -osarch="!darwin/arm" -output "${OUTPUT_DIR}/pkg/{{.OS}}_{{.Arch}}/{{.Dir}}"
46
47targz:
48	mkdir -p ${OUTPUT_DIR}/dist
49	cd ${OUTPUT_DIR}/pkg/; for osarch in *; do (cd $$osarch; tar zcvf ../../dist/gotty_$$osarch.tar.gz ./*); done;
50
51shasums:
52	cd ${OUTPUT_DIR}/dist; sha256sum * > ./SHA256SUMS
53
54release:
55	ghr -c ${GIT_COMMIT} --delete --prerelease -u yudai -r gotty pre-release ${OUTPUT_DIR}/dist
56