github.com/LagrangeDev/LagrangeGo@v0.0.0-20240512064304-ad4a85e10cb4/Makefile (about) 1 # from https://github.com/Mrs4s/MiraiGo/blob/master/Makefile 2 .PHONY: protoc-gen-golite-version clean install-protoc-plugin proto 3 .DEFAULT_GOAL := proto 4 5 PROTO_DIR=client/packets/pb 6 PROTO_OUTPUT_PATH=client/packets 7 PROTO_IMPORT_PATH=client/packets 8 9 10 PROTO_FILES := \ 11 $(PROTO_DIR)/action/*.proto \ 12 $(PROTO_DIR)/login/*.proto \ 13 $(PROTO_DIR)/message/*.proto \ 14 $(PROTO_DIR)/system/*.proto \ 15 $(PROTO_DIR)/service/*.proto \ 16 $(PROTO_DIR)/service/highway/*.proto \ 17 $(PROTO_DIR)/service/oidb/*.proto \ 18 $(PROTO_DIR)/*.proto 19 20 21 PROTOC_GEN_GOLITE_VERSION := \ 22 $(shell grep "github.com/RomiChan/protobuf" go.mod | awk -F v '{print "v"$$2}') 23 24 25 protoc-gen-golite-version: 26 @echo "Use protoc-gen-golite version: $(PROTOC_GEN_GOLITE_VERSION)" 27 28 clean: 29 find . -name "*.pb.go" | xargs rm -f 30 31 install-protoc-plugin: protoc-gen-golite-version 32 go install github.com/RomiChan/protobuf/cmd/protoc-gen-golite@$(PROTOC_GEN_GOLITE_VERSION) 33 34 proto: install-protoc-plugin 35 protoc --golite_out=$(PROTO_OUTPUT_PATH) --golite_opt=paths=source_relative -I=$(PROTO_IMPORT_PATH) $(PROTO_FILES) 36 37 fmt: 38 go vet -stdmethods=false ./... 39 40 .EXPORT_ALL_VARIABLES: 41 GO111MODULE = on