Makefile 914 Bytes
Newer Older
kzkzzzz's avatar
kzkzzzz committed
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
project=demo

.PHONY: init
# init env
init:
	go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
	go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
	go install github.com/go-kratos/kratos/cmd/kratos/v2@latest
	go install github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@latest
	go install github.com/google/gnostic/cmd/protoc-gen-openapi@latest
	go install github.com/favadi/protoc-go-inject-tag@latest
	go install github.com/google/wire/cmd/wire@latest
	go install github.com/cosmtrek/air@latest

.PHONY: api
# generate api service proto
api:
	@bash script/gen-api.sh service $(project)

.PHONY: service
service:
	@bash script/gen-project.sh service $(project)

.PHONY: run
run:
	@cd app/service/$(project) && air -c air.toml

.PHONY: build
# build
build:
	@cd app/service/$(project) && mkdir -p bin && go build -o bin/ ./...

wire:
	@cd app/service/$(project)/cmd/$(project) && wire