autogenpb/Makefile

69 lines
1.8 KiB
Makefile

VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%Y.%m.%d_%H%M)
simple: build
# make -C example clean simpleMutexGlobal goimports vet
make -C example clean simpleMutexProtoc goimports vet
full: install clean auto goimports vet build test install
@echo everything worked and the example ran
test: goimports build test
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
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:
mv -f autogenpb autogenpb.last
install:
GO111MODULE=off go install \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
auto:
# 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
test:
make -C example rawproto
# The Go Protocol Buffers library embeds a sync.Mutex within the MessageState struct to prevent unintended shallow copies of message structs
# It only fails in Marshal() functions though. That is dumb.
make -C example modproto # THIS DOES NOT WORK. It could work however. This autogenerated code could be used to debug it.
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