forked from containerd/stargz-snapshotter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
89 lines (65 loc) · 2.49 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
# Copyright The containerd Authors.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Base path used to install.
PLUGIN_DESTDIR ?= /opt/rsnapshotd
CMD_DESTDIR ?= /usr/local
GO111MODULE_VALUE=off
PREFIX ?= out/
PLUGINS=stargzfs-linux-amd64.so
CMD=rsnapshotd ctr-remote
PLUGIN_BINARIES=$(addprefix $(PREFIX),$(PLUGINS))
CMD_BINARIES=$(addprefix $(PREFIX),$(CMD))
.PHONY: check build
all: build
build: $(PLUGINS) $(CMD)
FORCE:
stargzfs-linux-amd64.so: FORCE
GO111MODULE=$(GO111MODULE_VALUE) go build -buildmode=plugin -o $(PREFIX)$@ -v ./filesystems/stargz
rsnapshotd: FORCE
GO111MODULE=$(GO111MODULE_VALUE) go build -o $(PREFIX)$@ -v ./cmd/rsnapshotd
ctr-remote: FORCE
GO111MODULE=$(GO111MODULE_VALUE) go build -o $(PREFIX)$@ -v ./cmd/ctr-remote
# TODO: git-validation
check:
@echo "$@"
@GO111MODULE=$(GO111MODULE_VALUE) golangci-lint run
@$(GOPATH)/src/github.com/containerd/project/script/validate/fileheader $(GOPATH)/src/github.com/containerd/project/
@git-validation -q -run DCO
install-check-tools:
@curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.19.1
@go get -u github.com/vbatts/git-validation
@go get -u github.com/kunalkushwaha/ltag
@git clone https://github.com/containerd/project $(GOPATH)/src/github.com/containerd/project
install:
@echo "$@"
@mkdir -p $(PLUGIN_DESTDIR)/plugins
@mkdir -p $(CMD_DESTDIR)/bin
@install $(PLUGIN_BINARIES) $(PLUGIN_DESTDIR)/plugins
@install $(CMD_BINARIES) $(CMD_DESTDIR)/bin
uninstall:
@echo "$@"
@rm -f $(addprefix $(PLUGIN_DESTDIR)/plugins/,$(notdir $(PLUGIN_BINARIES)))
@rm -f $(addprefix $(CMD_DESTDIR)/bin/,$(notdir $(CMD_BINARIES)))
clean:
@echo "$@"
@rm -f $(PLUGIN_BINARIES)
@rm -f $(CMD_BINARIES)
test:
@echo "$@"
@GO111MODULE=$(GO111MODULE_VALUE) go test ./...
test-root:
@echo "$@"
@GO111MODULE=$(GO111MODULE_VALUE) go test ./snapshot -test.root
test-all: test-root test
integration:
@./script/make.sh integration
test-optimize:
@./script/make.sh test-optimize