Makefile 997 Bytes
Newer Older
kzkzzzz's avatar
kzkzzzz committed
1
project=demo
kzkzzzz's avatar
kzkzzzz committed
2
type=service
kzkzzzz's avatar
kzkzzzz committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

.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
api:
kzkzzzz's avatar
kzkzzzz committed
18
	@bash script/gen-api.sh $(type) $(project)
kzkzzzz's avatar
kzkzzzz committed
19

kzkzzzz's avatar
kzkzzzz committed
20 21 22
.PHONY: gen
gen:
	@bash script/gen-project.sh $(type) $(project)
kzkzzzz's avatar
kzkzzzz committed
23 24 25

.PHONY: run
run:
kzkzzzz's avatar
kzkzzzz committed
26
	@cd app/$(type)/$(project) && air -c air.toml
kzkzzzz's avatar
kzkzzzz committed
27 28 29

.PHONY: build
build:
kzkzzzz's avatar
kzkzzzz committed
30
	@cd app/$(type)/$(project) && mkdir -p bin && go build -v -o bin/hilo-$(type)-$(project) ./cmd/$(project)
kzkzzzz's avatar
kzkzzzz committed
31

kzkzzzz's avatar
kzkzzzz committed
32 33 34 35 36
.PHONY: build-all
build-all:
	@bash script/build-all.sh service

.PHONY: wire
kzkzzzz's avatar
kzkzzzz committed
37
wire:
kzkzzzz's avatar
kzkzzzz committed
38
	@cd app/$(type)/$(project)/cmd/$(project) && wire