From eab11f75b777079cad75f593f2717a23fa14a43a Mon Sep 17 00:00:00 2001 From: liut Date: Thu, 10 Mar 2022 18:39:55 +0800 Subject: [PATCH] Add makefile for generate codes --- Makefile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f760931 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +.SILENT : +.PHONY: docs + + +GO=$(shell which go) +GOMOD=$(shell echo "$${GO111MODULE:-auto}") + + +MDs=apis.md \ + chat_info.md \ + dept_info.md \ + external_contact.md \ + media_upload.md \ + oa.md \ + rx_msg.md \ + user_info.md + +help: + echo "make errcodegen | sdkcodegen" + +docs: + $(info docs: $(MDs)) + +generate: + GO111MODULE=$(GOMOD) $(GO) generate ./... + +errcodegen: + GO111MODULE=$(GOMOD) $(GO) run -tags=sdkcodegen ./internal/errcodegen errcodes/mod.go + +sdkcodegen: + for name in $(MDs); do \ + echo $${name}; \ + GO111MODULE=$(GOMOD) $(GO) run -tags=sdkcodegen ./internal/sdkcodegen docs/$${name} $${name}.go ; \ + done