summaryrefslogtreecommitdiff
path: root/Makefile
blob: 46aacad136bf127196a368dc3bf5fe50053a7299 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%s)

simple: test
	# make -C example clean simpleMutexGlobal goimports vet
	# make -C example clean simpleMutexProtoc goimports vet
	# make -C example deleteproto

full: clean auto goimports vet build test install
	@echo everything worked and the example ran

# does a help example to debug the help logic
help: build
	make -C example help

# if this passes, it should be OK to 'go install'
test:
	reset
	make goimports vet build
	git checkout example/fruit.proto
	make -C example testGlobal
	make -C example testProtoc
	make -C example all

dryrun: build
	make -C example dryrun

dryrun-clean: clean auto build
	make -C example dryrun

vet:
	@GO111MODULE=off go vet
	@echo this go binary package should build okay

# autogen uses autogen to build. keep a working copy somewhere
recover:
	make clean
	./autogenpb.last --proto file.proto --package main
	make goimports
	make build

build: goimports vet
	GO111MODULE=off go build \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
	# autogen uses autogen to build. keep a working copy somewhere
	cp -f autogenpb autogenpb.${BUILDTIME}

bak:
	-cp -f autogenpb autogenpb.last

redo-protobuf:
	rm -f *.pb.go
	autogenpb --proto file.proto --package main

install: test
	GO111MODULE=off go install \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"

proto:
	# rm -f auto.pb.go
	autogenpb --proto file.proto --package main
	# rm -f auto.sort.pb.go auto.newsort.pb.go # auto.marshal.pb.go
	#

# use the current autogenpb
proto-local-noformat: bak clean
	./autogenpb.last --proto file.proto --package main --no-format

# use the current autogenpb
proto-local-format: bak clean
	./autogenpb.last --proto file.proto --package main

junk:
	cd example; rm -f go.* *.pb.go
	cd example; ../autogenpb --proto file.proto --package yellow
	cd example; GO111MODULE=off go vet

goimports:
	goimports -w *.go

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

reset:
	-rm -f auto.sort.pb.go

clean:
	-rm -f go.*
	-rm -f *.pb.go
	-rm -f autogenpb
	-go-mod-clean purge

clean-more:
	ls -l autogenpb autogenpb.last
	-rm -f autogenpb.2*

reformat-signal.proto-reset:
	git checkout example/*.proto

reformat-signal.proto-comments: goimports vet build
	git checkout example/fruit.proto
	make -C example proto-reformat-restore
	make -C example proto-reformat-comments

reformat-signal.proto-full: goimports vet build
	git checkout example/*.proto
	make -C example proto-reformat-restore
	make -C example proto-reformat-full

reformat-signal.proto-full-debug: goimports vet build
	git checkout example/*.proto
	make -C example proto-reformat-restore
	make -C example proto-reformat-full-debug

reformat-signal.proto-fruit: goimports vet build
	git checkout example/*.proto
	make -C example proto-reformat-fruit

reformat-signal.proto-fruit-debug: goimports vet build
	git checkout example/*.proto
	make -C example proto-reformat-fruit-debug

# eh, this is okay for docs I guess. notsure. but it makes pkg.go.dev better
gemini:
	DEBUG=1 gemini --prompt "Can you add comments to the functions in the protoReformat.go file? Just add comments at the beginning of each function." --yolo --debug

gemini-try2:
	DEBUG=1 gemini --prompt "First figure out what each GO function in protoReformat.go does. Second, make good comments to put on on each function for pkg.go.dev?" --yolo --debug