2015-10-12 10:57:14 +08:00
|
|
|
OUTPUT_DIR = ./builds
|
2017-08-23 10:15:41 +08:00
|
|
|
GIT_COMMIT = `git rev-parse HEAD | cut -c1-7`
|
2021-04-22 23:20:08 +08:00
|
|
|
VERSION = $(shell git describe --tags)
|
|
|
|
BUILD_OPTIONS = -ldflags "-X main.Version=$(VERSION)"
|
2022-11-27 06:51:10 +08:00
|
|
|
|
|
|
|
ifeq ($(DEV), 1)
|
|
|
|
BUILD_OPTIONS += -tags dev
|
|
|
|
WEBPACK_MODE = development
|
|
|
|
else
|
|
|
|
WEBPACK_MODE = production
|
|
|
|
endif
|
|
|
|
|
2022-08-27 15:33:35 +08:00
|
|
|
export CGO_ENABLED=0
|
2017-08-23 10:15:41 +08:00
|
|
|
|
2021-06-05 00:01:20 +08:00
|
|
|
gotty: main.go assets server/*.go webtty/*.go backend/*.go Makefile
|
2020-02-28 14:47:10 +08:00
|
|
|
go build ${BUILD_OPTIONS}
|
2015-08-16 17:47:23 +08:00
|
|
|
|
2022-11-27 06:51:10 +08:00
|
|
|
docker:
|
2020-02-28 20:49:19 +08:00
|
|
|
docker build . -t gotty-bash:$(VERSION)
|
|
|
|
|
2022-03-29 06:05:51 +08:00
|
|
|
.PHONY: all docker assets
|
2022-04-01 01:39:29 +08:00
|
|
|
assets: bindata/static/js/gotty.js.map \
|
|
|
|
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
|
2021-04-16 21:49:17 +08:00
|
|
|
|
2022-03-29 06:05:51 +08:00
|
|
|
all: gotty
|
2017-09-28 12:37:34 +08:00
|
|
|
|
2022-03-29 06:05:51 +08:00
|
|
|
bindata/static bindata/static/css bindata/static/js:
|
|
|
|
mkdir -p $@
|
2015-08-23 13:04:31 +08:00
|
|
|
|
2022-03-29 06:05:51 +08:00
|
|
|
bindata/static/%: resources/% | bindata/static/css
|
|
|
|
cp "$<" "$@"
|
2021-04-25 17:25:41 +08:00
|
|
|
|
2022-03-29 06:05:51 +08:00
|
|
|
bindata/static/css/%.css: resources/%.css | bindata/static
|
|
|
|
cp "$<" "$@"
|
2015-08-29 12:12:04 +08:00
|
|
|
|
2022-03-29 06:05:51 +08:00
|
|
|
bindata/static/css/xterm.css: js/node_modules/xterm/css/xterm.css | bindata/static
|
|
|
|
cp "$<" "$@"
|
2017-05-22 07:16:24 +08:00
|
|
|
|
2017-08-22 11:10:52 +08:00
|
|
|
js/node_modules/xterm/dist/xterm.css:
|
|
|
|
cd js && \
|
|
|
|
npm install
|
|
|
|
|
2022-04-01 01:39:29 +08:00
|
|
|
bindata/static/js/gotty.js.map bindata/static/js/gotty.js: js/src/* | js/node_modules/webpack
|
2017-05-22 07:16:24 +08:00
|
|
|
cd js && \
|
2022-03-30 04:59:22 +08:00
|
|
|
npx webpack --mode=$(WEBPACK_MODE)
|
2015-08-29 12:12:04 +08:00
|
|
|
|
2017-10-03 14:34:51 +08:00
|
|
|
js/node_modules/webpack:
|
|
|
|
cd js && \
|
|
|
|
npm install
|
2015-10-12 10:57:14 +08:00
|
|
|
|
2021-04-25 23:28:08 +08:00
|
|
|
README-options:
|
2021-04-19 18:20:01 +08:00
|
|
|
./gotty --help | sed '1,/GLOBAL OPTIONS/ d' > options.txt.tmp
|
2021-04-25 23:28:08 +08:00
|
|
|
sed -f README.md.sed -i README.md
|
|
|
|
rm options.txt.tmp
|
2021-04-18 23:07:21 +08:00
|
|
|
|
2015-10-12 10:57:14 +08:00
|
|
|
tools:
|
2022-08-31 13:54:02 +08:00
|
|
|
go install github.com/mitchellh/gox@latest
|
|
|
|
go install github.com/tcnksm/ghr@latest
|
2015-10-12 10:57:14 +08:00
|
|
|
|
|
|
|
test:
|
2016-04-13 15:01:14 +08:00
|
|
|
if [ `go fmt $(go list ./... | grep -v /vendor/) | wc -l` -gt 0 ]; then echo "go fmt error"; exit 1; fi
|
2021-04-23 03:50:52 +08:00
|
|
|
go test ./...
|
2015-10-12 10:57:14 +08:00
|
|
|
|
|
|
|
cross_compile:
|
2021-06-01 07:14:53 +08: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 10:57:14 +08:00
|
|
|
|
|
|
|
targz:
|
|
|
|
mkdir -p ${OUTPUT_DIR}/dist
|
2017-08-23 10:15:41 +08:00
|
|
|
cd ${OUTPUT_DIR}/pkg/; for osarch in *; do (cd $$osarch; tar zcvf ../../dist/gotty_${VERSION}_$$osarch.tar.gz ./*); done;
|
2015-10-12 10:57:14 +08:00
|
|
|
|
2015-10-18 10:38:12 +08:00
|
|
|
shasums:
|
2016-08-11 15:48:03 +08:00
|
|
|
cd ${OUTPUT_DIR}/dist; sha256sum * > ./SHA256SUMS
|
2015-10-18 10:38:12 +08:00
|
|
|
|
2021-06-04 04:29:57 +08:00
|
|
|
release-artifacts: gotty cross_compile targz shasums
|
2021-04-11 14:51:24 +08:00
|
|
|
|
2015-10-12 10:57:14 +08:00
|
|
|
release:
|
2021-04-19 15:23:31 +08:00
|
|
|
ghr -draft ${VERSION} ${OUTPUT_DIR}/dist # -c ${GIT_COMMIT} --delete --prerelease -u sorenisanerd -r gotty ${VERSION}
|
2021-04-11 14:51:24 +08:00
|
|
|
|
2020-02-28 20:43:17 +08:00
|
|
|
clean:
|
2022-03-29 06:05:51 +08:00
|
|
|
rm -fr gotty builds js/dist bindata/static js/node_modules
|
2022-09-01 13:54:04 +08:00
|
|
|
|
|
|
|
addcontributors:
|
2022-09-01 15:13:12 +08:00
|
|
|
gh issue list -s all -L 1000 --json author -t "$$(echo '{{ range . }}{{ .author.login }}\n{{ end }}')" | sort | uniq | xargs -Ifoo all-contributors add foo bug --commitTemplate '<%= (newContributor ? "Add" : "Update") %> @<%= username %> as a contributor'
|
|
|
|
gh pr list -s all -L 1000 --json author -t "$$(echo '{{ range . }}{{ .author.login }}\n{{ end }}')" | sort | uniq | xargs -Ifoo all-contributors add foo code --commitTemplate '<%= (newContributor ? "Add" : "Update") %> @<%= username %> as a contributor'
|