summaryrefslogtreecommitdiff
path: root/Makefile
blob: 1e7c471c77bd3756c8fef8b0ddd492a9e0f4f1fa (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
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
# You must use the current protoc-gen-go
#
# go-clone --go-src google.golang.org/protobuf
# cd ~/go/src/google.golang.org/protobuf/cmd/protoc-gen-go
# go install


all: droplet.pb.go hypervisor.pb.go cluster.pb.go event.pb.go experiments.pb.go
	make -C example

vet: lint
	GO111MODULE=off go vet

lint:
	-buf lint droplet.proto

# autofixes your import headers in your golang files
goimports:
	goimports -w *.go
	make -C example goimports

redomod:
	rm -f go.*
	GO111MODULE= go mod init
	GO111MODULE= go mod tidy

clean:
	rm -f *.pb.go
	-rm -f go.*
	make -C example clean

droplet.pb.go: droplet.proto
	# protoc --go_out=. droplet.proto
	# This is switched over to use the new protoc-gen-go from   google.golang.org/protobuf/cmd/protoc-gen-go
	# the debian one (2024/10/21) seems to be the older/original one from github.com/golang/protobuf/protoc-gen-go
	cd ~/go/src && protoc --go_out=. --proto_path=go.wit.com/lib/protobuf/virtbuf \
		--go_opt=Mdroplet.proto=go.wit.com/lib/protobuf/virtbuf \
		droplet.proto

hypervisor.pb.go: hypervisor.proto
	cd ~/go/src && protoc --go_out=. --proto_path=go.wit.com/lib/protobuf/virtbuf \
		--go_opt=Mhypervisor.proto=go.wit.com/lib/protobuf/virtbuf \
		hypervisor.proto

event.pb.go: event.proto
	cd ~/go/src && protoc --go_out=. \
		--proto_path=go.wit.com/lib/protobuf/virtbuf \
		--go_opt=Mevent.proto=go.wit.com/lib/protobuf/virtbuf \
		event.proto

experiments.pb.go: experiments.proto
	cd ~/go/src && protoc --go_out=. \
		--proto_path=go.wit.com/lib/protobuf/virtbuf \
		--go_opt=Mexperiments.proto=go.wit.com/lib/protobuf/virtbuf \
		experiments.proto

cluster.pb.go: cluster.proto
	cd ~/go/src && protoc --go_out=. --proto_path=go.wit.com/lib/protobuf/virtbuf \
		--go_opt=Mdroplet.proto=go.wit.com/lib/protobuf/virtbuf \
		--go_opt=Mcluster.proto=go.wit.com/lib/protobuf/virtbuf \
		--go_opt=Mhypervisor.proto=go.wit.com/lib/protobuf/virtbuf \
		--go_opt=Mevent.proto=go.wit.com/lib/protobuf/virtbuf \
		cluster.proto

deps:
	apt install golang-goprotobuf-dev
	apt install protobuf-compiler

push:
	git pull
	git add --all
	git commit -a -s
	git push