-
Notifications
You must be signed in to change notification settings - Fork 5
/
Knitfile
67 lines (51 loc) · 1.63 KB
/
Knitfile
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
knit = require("knit")
version = "0.0.0-unknown"
knit.knit("-C tools/version")
version = knit.shell("./tools/version/version")
goflags = f"-trimpath -ldflags \"-s -w -X github.com/zyedidia/knit/info.Version=$version\""
race = tobool(cli.race) and "-race" or ""
pkgs = ".,./rules,./expand"
return b{
$ knit:B:
go build $goflags ./cmd/knit
$ build:V: knit
$ install:VB:
go install $goflags ./cmd/knit
$ all:V: knit-$version-linux-amd64.tar.gz \
knit-$version-linux-386.tar.gz \
knit-$version-linux-arm.tar.gz \
knit-$version-linux-arm64.tar.gz \
knit-$version-darwin-amd64.tar.gz \
knit-$version-darwin-arm64.tar.gz \
knit-$version-openbsd-amd64.tar.gz \
knit-$version-freebsd-amd64.tar.gz \
knit-$version-windows-amd64.tar.gz
$ %.tar.gz: %
tar czf $output $input
$ '(knit-$version-(.*)-([^\.]*))':R: knit.1
mkdir -p $match1
CGO_ENABLED=0 GOOS=$match2 GOARCH=$match3 go build $goflags -o $match1/knit ./cmd/knit
cp LICENSE* $match1
cp README.md $match1
cp knit.1 $match1
$ clean:VB:
knit :all -t clean
rm -rf knit-*
$ test:VB:
go test $race
$ check:VB:
if [ "$$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
go vet ./...
staticcheck ./...
go test $race
$ cover.out:B:
go test -coverpkg=$pkgs -coverprofile cover.out .
$ cover:VB:
go test -coverpkg=$pkgs -cover .
$ cover-html:VB: cover.out
go tool cover -html=cover.out
$ tools/replace/replace: tools/replace/replace.go
go build -o $output $input
$ knit.1: man/knit.md tools/replace/replace
tools/replace/replace $input | pandoc -s -t man -o $output
}