-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
60 lines (42 loc) · 1.32 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
VERSION := $(shell cat ./VERSION)
ROOTFS_IMAGE := cirocosta/xfsvol-rootfs
ROOTFS_CONTAINER := rootfs
PLUGIN_NAME := xfsvol
PLUGIN_FULL_NAME := cirocosta/xfsvol
all: install
install:
cd ./xfsvolctl && \
go install \
-ldflags "-X main.version=$(VERSION)" \
-v
cd ./plugin && \
go install \
-ldflags "-X main.version=$(VERSION)" \
-v
test:
go test ./... -v
fmt:
go fmt ./...
find ./xfs -name "*.c" -o -name "*.h" | \
xargs clang-format -style=file -i
rootfs-image:
docker build -t $(ROOTFS_IMAGE) .
rootfs: rootfs-image
docker rm -vf $(ROOTFS_CONTAINER) || true
docker create --name $(ROOTFS_CONTAINER) $(ROOTFS_IMAGE) || true
mkdir -p plugin/rootfs
rm -rf plugin/rootfs/*
docker export $(ROOTFS_CONTAINER) | tar -x -C plugin/rootfs
docker rm -vf $(ROOTFS_CONTAINER)
plugin: rootfs
docker plugin disable $(PLUGIN_NAME) || true
docker plugin rm --force $(PLUGIN_NAME) || true
docker plugin create $(PLUGIN_NAME) ./plugin
docker plugin enable $(PLUGIN_NAME)
plugin-push: rootfs
docker plugin rm --force $(PLUGIN_FULL_NAME) || true
docker plugin create $(PLUGIN_FULL_NAME) ./plugin
docker plugin create $(PLUGIN_FULL_NAME):$(VERSION) ./plugin
docker plugin push $(PLUGIN_FULL_NAME)
docker plugin push $(PLUGIN_FULL_NAME):$(VERSION)
.PHONY: install test fmt rootfs-image rootfs plugin plugin-push