gotty/Makefile

96 lines
3.1 KiB
Makefile
Raw Normal View History

2015-10-12 11:57:14 +09:00
OUTPUT_DIR = ./builds
2017-08-23 11:15:41 +09:00
GIT_COMMIT = `git rev-parse HEAD | cut -c1-7`
VERSION = 3.0.0-alpha.1
2017-08-23 11:15:41 +09:00
BUILD_OPTIONS = -ldflags "-X main.Version=$(VERSION) -X main.CommitID=$(GIT_COMMIT)"
gotty: main.go server/*.go webtty/*.go backend/*.go Makefile
go build ${BUILD_OPTIONS}
2015-08-16 18:47:23 +09:00
2022-02-26 20:08:53 -05:00
server/asset.go: bindata/static/js/gotty-bundle.js bindata/static/js/gotty-bundle.js.map bindata/static/js/gotty-bundle.js.LICENSE.txt bindata/static/index.html bindata/static/favicon.png bindata/static/css/index.css bindata/static/css/xterm.css bindata/static/css/xterm_customize.css
2017-02-26 07:37:07 +09:00
go-bindata -prefix bindata -pkg server -ignore=\\.gitkeep -o server/asset.go bindata/...
gofmt -w server/asset.go
2015-08-16 18:47:23 +09:00
2017-10-03 15:34:51 +09:00
.PHONY: all
2022-02-26 20:08:53 -05:00
all: server/asset.go gotty
2015-08-16 18:47:23 +09:00
bindata:
2022-02-27 19:55:46 -05:00
mkdir -p bindata
2015-08-17 07:00:17 +09:00
bindata/static: bindata
2022-02-27 19:55:46 -05:00
mkdir -p bindata/static
2015-08-23 20:40:18 +09:00
bindata/static/index.html: bindata/static resources/index.html
cp resources/index.html bindata/static/index.html
2015-08-30 16:27:40 +09:00
bindata/static/favicon.png: bindata/static resources/favicon.png
cp resources/favicon.png bindata/static/favicon.png
bindata/static/js: bindata/static
2015-08-30 16:27:40 +09:00
mkdir -p bindata/static/js
2017-08-22 16:03:19 +09:00
bindata/static/js/gotty-bundle.js: bindata/static/js js/dist/gotty-bundle.js
cp js/dist/gotty-bundle.js bindata/static/js/gotty-bundle.js
2022-02-26 20:08:53 -05:00
bindata/static/js/gotty-bundle.js.LICENSE.txt: js/dist/gotty-bundle.js.LICENSE.txt
cp $< $@
bindata/static/js/gotty-bundle.js.map: js/dist/gotty-bundle.js.map
cp $< $@
bindata/static/css: bindata/static
mkdir -p bindata/static/css
bindata/static/css/index.css: bindata/static/css resources/index.css
cp resources/index.css bindata/static/css/index.css
bindata/static/css/xterm_customize.css: bindata/static/css resources/xterm_customize.css
cp resources/xterm_customize.css bindata/static/css/xterm_customize.css
2022-02-26 20:08:53 -05:00
bindata/static/css/xterm.css: bindata/static/css js/node_modules/xterm/css/xterm.css
cp js/node_modules/xterm/css/xterm.css bindata/static/css/xterm.css
2022-02-26 20:08:53 -05:00
js/node_modules/xterm/css/xterm.css:
2017-08-22 12:10:52 +09:00
cd js && \
2022-02-26 20:08:53 -05:00
npm install
2017-08-22 12:10:52 +09:00
2017-10-03 15:34:51 +09:00
js/dist/gotty-bundle.js: js/src/* js/node_modules/webpack
cd js && \
2022-02-27 19:56:13 -05:00
npx webpack
2022-02-26 20:08:53 -05:00
js/dist/gotty-bundle.js.LICENSE.txt: js/dist/gotty-bundle.js
js/dist/gotty-bundle.js.map: js/dist/gotty-bundle.js
2017-10-03 15:34:51 +09:00
js/node_modules/webpack:
cd js && \
2022-02-26 20:08:53 -05:00
npm install
2015-10-12 11:57:14 +09:00
tools:
2022-02-26 20:08:53 -05:00
go install github.com/go-bindata/go-bindata/v3/go-bindata@latest # for static asset management
# TODO convert to `go install`
go get github.com/mitchellh/gox # for crosscompiling
go get github.com/tcnksm/ghr # for making gihub releases
2015-10-12 11:57:14 +09:00
test:
2016-04-13 16:01:14 +09:00
if [ `go fmt $(go list ./... | grep -v /vendor/) | wc -l` -gt 0 ]; then echo "go fmt error"; exit 1; fi
2015-10-12 11:57:14 +09:00
cross_compile:
GOARM=5 gox -os="darwin linux freebsd netbsd openbsd" -arch="386 amd64 arm" -osarch="!darwin/arm" -output "${OUTPUT_DIR}/pkg/{{.OS}}_{{.Arch}}/{{.Dir}}"
2015-10-12 11:57:14 +09:00
targz:
mkdir -p ${OUTPUT_DIR}/dist
2017-08-23 11:15:41 +09:00
cd ${OUTPUT_DIR}/pkg/; for osarch in *; do (cd $$osarch; tar zcvf ../../dist/gotty_${VERSION}_$$osarch.tar.gz ./*); done;
2015-10-12 11:57:14 +09:00
2015-10-18 11:38:12 +09:00
shasums:
2016-08-11 16:48:03 +09:00
cd ${OUTPUT_DIR}/dist; sha256sum * > ./SHA256SUMS
2015-10-18 11:38:12 +09:00
2015-10-12 11:57:14 +09:00
release:
ghr -c ${GIT_COMMIT} --delete --prerelease -u yudai -r gotty pre-release ${OUTPUT_DIR}/dist
2022-02-26 20:08:53 -05:00
.PHONY: update_go_modules
update_go_modules:
go get -u
.PHONY: clean
clean:
rm -rf bindata/ js/node_modules/*