blob: d730ab3ed79683c5954c2b14a5c84cb26012f4b5 (
plain)
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
|
# main
build:
go build -o bin/ ./cmd/...
.PHONY: build
check:
go test -race ./...
.PHONY: check
lint: tools/bin/golangci-lint
tools/bin/golangci-lint run ./...
.PHONY: lint
generate:
$(MAKE) -C lib/btrfs
.PHONY: generate
generate-clean:
$(MAKE) -C lib/btrfs clean
.PHONY: generate-clean
# tools
tools/bin/%: tools/src/%/pin.go tools/src/%/go.mod
cd $(<D) && GOOS= GOARCH= go build -o $(abspath $@) $$(sed -En 's,^import "(.*)".*,\1,p' pin.go)
# go mod tidy
goversion = 1.18
go-mod-tidy:
.PHONY: go-mod-tidy
go-mod-tidy: go-mod-tidy/main
go-mod-tidy/main:
rm -f go.sum
go mod tidy -go $(goversion) -compat $(goversion)
.PHONY: go-mod-tidy/main
go-mod-tidy: $(patsubst tools/src/%/go.mod,go-mod-tidy/tools/%,$(wildcard tools/src/*/go.mod))
go-mod-tidy/tools/%: tools/src/%/go.mod
rm -f tools/src/$*/go.sum
cd tools/src/$* && go mod tidy -go $(goversion) -compat $(goversion)
.PHONY: go-mod-tidy/tools/%
|