forked from container-storage-interface/spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (30 loc) · 850 Bytes
/
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
all: build
CSI_SPEC := spec.md
CSI_PROTO := csi.proto
## Build go language bindings
CSI_A := csi.a
CSI_PKG := lib/go/csi
# This is the target for building the CSI protobuf file.
$(CSI_PROTO): $(CSI_SPEC) Makefile
echo "// Code generated by make; DO NOT EDIT." > "$@"
sed -n -e '/```protobuf$$/,/^```$$/ {//!p;}' $< >> "$@"
build: check build_cpp build_go
build_cpp:
$(MAKE) -C lib/cxx
$(CSI_PKG)/%.pb.go: $(CSI_PROTO)
$(MAKE) -C lib/go
$(CSI_A): $(CSI_PKG)/*.go
go mod download
go install ./$(CSI_PKG)
go build -o "$@" ./$(CSI_PKG)
build_go: $(CSI_A)
clean:
rm $(CSI_A)
$(MAKE) -C lib/go $@
clobber: clean
$(MAKE) -C lib/go $@
rm -f $(CSI_PROTO)
# check generated files for violation of standards
check: $(CSI_PROTO)
awk '{ if (length > 72) print NR, $$0 }' $? | diff - /dev/null
.PHONY: clean clobber check build_go build_cpp