-
Notifications
You must be signed in to change notification settings - Fork 138
/
Makefile
92 lines (69 loc) · 2.88 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
OUTPUT_DIR = ./builds
GIT_COMMIT = `git rev-parse HEAD | cut -c1-7`
VERSION = $(shell git describe --tags)
BUILD_OPTIONS = -ldflags "-X main.Version=$(VERSION)"
ifeq ($(DEV), 1)
BUILD_OPTIONS += -tags dev
WEBPACK_MODE = development
else
WEBPACK_MODE = production
endif
export CGO_ENABLED=0
gotty: main.go assets server/*.go webtty/*.go backend/*.go Makefile
go build ${BUILD_OPTIONS}
docker:
docker build . -t gotty-bash:$(VERSION)
.PHONY: all docker assets
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
all: gotty
bindata/static bindata/static/css bindata/static/js:
mkdir -p $@
bindata/static/%: resources/% | bindata/static/css
cp "$<" "$@"
bindata/static/css/%.css: resources/%.css | bindata/static
cp "$<" "$@"
bindata/static/css/xterm.css: js/node_modules/xterm/css/xterm.css | bindata/static
cp "$<" "$@"
js/node_modules/xterm/dist/xterm.css:
cd js && \
npm install
bindata/static/js/gotty.js.map bindata/static/js/gotty.js: js/src/* | js/node_modules/webpack
cd js && \
npx webpack --mode=$(WEBPACK_MODE)
js/node_modules/webpack:
cd js && \
npm install
README-options:
./gotty --help | sed '1,/GLOBAL OPTIONS/ d' > options.txt.tmp
sed -f README.md.sed -i README.md
rm options.txt.tmp
tools:
go install github.com/mitchellh/gox@latest
go install github.com/tcnksm/ghr@latest
test:
if [ `go fmt $(go list ./... | grep -v /vendor/) | wc -l` -gt 0 ]; then echo "go fmt error"; exit 1; fi
go test ./...
cross_compile:
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}}"
targz:
mkdir -p ${OUTPUT_DIR}/dist
cd ${OUTPUT_DIR}/pkg/; for osarch in *; do (cd $$osarch; tar zcvf ../../dist/gotty_${VERSION}_$$osarch.tar.gz ./*); done;
shasums:
cd ${OUTPUT_DIR}/dist; sha256sum * > ./SHA256SUMS
release-artifacts: gotty cross_compile targz shasums
release:
ghr -draft ${VERSION} ${OUTPUT_DIR}/dist # -c ${GIT_COMMIT} --delete --prerelease -u sorenisanerd -r gotty ${VERSION}
clean:
rm -fr gotty builds js/dist bindata/static js/node_modules
addcontributors:
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'