2024-06-18 18:21:03 -04:00
|
|
|
binary := "gt"
|
2024-07-31 03:53:12 -04:00
|
|
|
version := "0.0.2"
|
2024-06-18 18:21:03 -04:00
|
|
|
build_dir := "bin"
|
2024-07-31 00:06:32 -04:00
|
|
|
dist_dir := "dist"
|
2024-06-18 18:21:03 -04:00
|
|
|
cmd := "."
|
|
|
|
output := "." / build_dir / binary
|
2024-07-31 00:06:32 -04:00
|
|
|
dist := "." / dist_dir / binary
|
2024-07-31 01:03:52 -04:00
|
|
|
contrib_dir := "." / "contrib"
|
|
|
|
screenshots_dir := "screenshots"
|
|
|
|
archive_base := dist_dir / binary + "-" + version
|
|
|
|
linux_archive := archive_base + "-x86_64.tar"
|
|
|
|
arm64_archive := archive_base + "-arm64.tar"
|
|
|
|
arm_archive := archive_base + "-arm.tar"
|
2024-06-18 18:21:03 -04:00
|
|
|
|
|
|
|
# do the thing
|
|
|
|
default: test check install
|
|
|
|
|
|
|
|
# build binary
|
|
|
|
build:
|
|
|
|
go build -o {{output}} {{cmd}}
|
|
|
|
|
2024-07-31 01:03:52 -04:00
|
|
|
package $CGO_ENABLED="0": man
|
|
|
|
go build -o {{binary}} {{cmd}}
|
|
|
|
tar cafv {{linux_archive}} {{binary}} {{binary}}.1 README.md LICENSE {{screenshots_dir}}
|
|
|
|
tar rafv {{linux_archive}} -C {{contrib_dir}} "completions"
|
|
|
|
gzip -f {{linux_archive}}
|
|
|
|
rm {{binary}}
|
|
|
|
|
|
|
|
GOARCH="arm" GOARM="7" go build -o {{binary}} {{cmd}}
|
|
|
|
tar cafv {{arm_archive}} {{binary}} {{binary}}.1 README.md LICENSE {{screenshots_dir}}
|
|
|
|
tar rafv {{arm_archive}} -C {{contrib_dir}} "completions"
|
|
|
|
gzip -f {{arm_archive}}
|
|
|
|
rm {{binary}}
|
|
|
|
|
|
|
|
GOARCH="arm64" go build -o {{binary}} {{cmd}}
|
|
|
|
tar cafv {{arm64_archive}} {{binary}} {{binary}}.1 README.md LICENSE {{screenshots_dir}}
|
|
|
|
tar rafv {{arm64_archive}} -C {{contrib_dir}} "completions"
|
|
|
|
gzip -f {{arm64_archive}}
|
|
|
|
rm {{binary}}
|
2024-06-18 18:21:03 -04:00
|
|
|
|
|
|
|
# run from source
|
|
|
|
run:
|
|
|
|
go run {{cmd}}
|
|
|
|
|
|
|
|
# build 'n run
|
|
|
|
run-binary: build
|
|
|
|
exec {{output}}
|
|
|
|
|
|
|
|
# run with args
|
|
|
|
run-args args:
|
|
|
|
go run {{cmd}} {{args}}
|
|
|
|
|
|
|
|
# install binary into $GOPATH
|
|
|
|
install:
|
|
|
|
go install {{cmd}}
|
|
|
|
|
2024-07-30 22:55:55 -04:00
|
|
|
# install manpages into $HOME/.local/share/man
|
|
|
|
install-man:
|
|
|
|
mkdir -p $HOME/.local/share/man/man1
|
|
|
|
cp {{binary}}.1 $HOME/.local/share/man/man1/{{binary}}.1
|
|
|
|
|
2024-06-18 18:21:03 -04:00
|
|
|
# clean up after yourself
|
|
|
|
clean:
|
2024-07-31 00:06:32 -04:00
|
|
|
-rm {{output}}
|
2024-07-31 00:54:22 -04:00
|
|
|
-rm {{dist_dir}}/*.tar.gz
|
2024-06-18 18:21:03 -04:00
|
|
|
|
|
|
|
# run go tests
|
|
|
|
test:
|
|
|
|
gotestsum
|
|
|
|
|
|
|
|
# run linter
|
|
|
|
check:
|
|
|
|
staticcheck ./...
|
2024-07-30 22:55:55 -04:00
|
|
|
|
|
|
|
# generate manpage
|
|
|
|
man:
|
|
|
|
scdoc < {{binary}}.1.scd > {{binary}}.1
|