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`
|
2021-04-22 08:20:08 -07:00
|
|
|
VERSION = $(shell git describe --tags)
|
|
|
|
BUILD_OPTIONS = -ldflags "-X main.Version=$(VERSION)"
|
2017-08-23 11:15:41 +09:00
|
|
|
|
2021-04-16 06:49:17 -07:00
|
|
|
gotty: main.go server/*.go webtty/*.go backend/*.go Makefile asset
|
2020-02-28 08:47:10 +02:00
|
|
|
go build ${BUILD_OPTIONS}
|
2015-08-16 18:47:23 +09:00
|
|
|
|
2020-02-28 14:49:19 +02:00
|
|
|
docker:
|
|
|
|
docker build . -t gotty-bash:$(VERSION)
|
|
|
|
|
2017-10-03 15:34:51 +09:00
|
|
|
.PHONY: asset
|
2021-04-25 02:25:41 -07:00
|
|
|
asset: bindata/static/js/gotty.js bindata/static/index.html bindata/static/icon.svg bindata/static/favicon.ico bindata/static/css/index.css bindata/static/css/xterm.css bindata/static/css/xterm_customize.css bindata/static/manifest.json bindata/static/icon_192.png server/asset.go
|
2021-04-16 06:49:17 -07:00
|
|
|
|
2021-04-22 12:44:06 -07:00
|
|
|
server/asset.go: bindata/* bindata/*/* bindata/*/*/*
|
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
|
2020-02-28 14:49:19 +02:00
|
|
|
all: asset gotty docker
|
2017-09-28 13:37:34 +09:00
|
|
|
|
2015-08-16 18:47:23 +09:00
|
|
|
bindata:
|
|
|
|
mkdir bindata
|
2015-08-17 07:00:17 +09:00
|
|
|
|
2015-08-23 14:04:31 +09:00
|
|
|
bindata/static: bindata
|
|
|
|
mkdir bindata/static
|
|
|
|
|
2021-04-25 02:25:41 -07:00
|
|
|
bindata/static/icon.svg: bindata/static resources/icon.svg
|
|
|
|
cp resources/icon.svg bindata/static/icon.svg
|
|
|
|
|
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-28 21:12:04 -07:00
|
|
|
|
2020-10-01 22:30:07 +02:00
|
|
|
bindata/static/manifest.json: bindata/static resources/manifest.json
|
|
|
|
cp resources/manifest.json bindata/static/manifest.json
|
|
|
|
|
2021-04-25 02:25:41 -07:00
|
|
|
bindata/static/favicon.ico: bindata/static resources/favicon.ico
|
|
|
|
cp resources/favicon.ico bindata/static/favicon.ico
|
2015-08-30 16:27:40 +09:00
|
|
|
|
2020-10-01 22:30:07 +02:00
|
|
|
bindata/static/icon_192.png: bindata/static resources/icon_192.png
|
|
|
|
cp resources/icon_192.png bindata/static/icon_192.png
|
|
|
|
|
2015-08-28 21:12:04 -07:00
|
|
|
bindata/static/js: bindata/static
|
2015-08-30 16:27:40 +09:00
|
|
|
mkdir -p bindata/static/js
|
2015-08-28 21:12:04 -07:00
|
|
|
|
2017-05-22 08:16:24 +09:00
|
|
|
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
|
|
|
|
|
2021-04-22 09:54:55 -07: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
|
2017-05-22 08:16:24 +09:00
|
|
|
|
2017-08-22 12:10:52 +09:00
|
|
|
js/node_modules/xterm/dist/xterm.css:
|
|
|
|
cd js && \
|
|
|
|
npm install
|
|
|
|
|
2021-04-16 06:49:17 -07:00
|
|
|
bindata/static/js/gotty.js: js/src/* js/node_modules/webpack
|
2017-05-22 08:16:24 +09:00
|
|
|
cd js && \
|
2021-04-16 06:49:17 -07:00
|
|
|
npx webpack
|
2015-08-28 21:12:04 -07:00
|
|
|
|
2017-10-03 15:34:51 +09:00
|
|
|
js/node_modules/webpack:
|
|
|
|
cd js && \
|
|
|
|
npm install
|
2015-10-12 11:57:14 +09:00
|
|
|
|
2021-04-25 08:28:08 -07:00
|
|
|
README-options:
|
2021-04-19 03:20:01 -07:00
|
|
|
./gotty --help | sed '1,/GLOBAL OPTIONS/ d' > options.txt.tmp
|
2021-04-25 08:28:08 -07:00
|
|
|
sed -f README.md.sed -i README.md
|
|
|
|
rm options.txt.tmp
|
2021-04-18 08:07:21 -07:00
|
|
|
|
2015-10-12 11:57:14 +09:00
|
|
|
tools:
|
|
|
|
go get github.com/mitchellh/gox
|
|
|
|
go get github.com/tcnksm/ghr
|
2016-04-13 16:01:14 +09:00
|
|
|
go get github.com/jteeuwen/go-bindata/...
|
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:
|
2021-05-31 16:14:53 -07:00
|
|
|
GOARM=5 gox -os="darwin linux freebsd netbsd openbsd solaris" -arch="386 amd64 arm arm64" -osarch="!darwin/386" -osarch="!darwin/arm" $(BUILD_OPTIONS) -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
|
|
|
|
2021-04-10 23:51:24 -07:00
|
|
|
release-artifacts: asset gotty cross_compile targz shasums
|
|
|
|
|
2015-10-12 11:57:14 +09:00
|
|
|
release:
|
2021-04-19 00:23:31 -07:00
|
|
|
ghr -draft ${VERSION} ${OUTPUT_DIR}/dist # -c ${GIT_COMMIT} --delete --prerelease -u sorenisanerd -r gotty ${VERSION}
|
2021-04-10 23:51:24 -07:00
|
|
|
|
2020-02-28 14:43:17 +02:00
|
|
|
clean:
|
2021-04-18 08:27:24 -07:00
|
|
|
rm -fr gotty builds bindata server/asset.go js/dist
|