41 lines
1.5 KiB
Makefile
41 lines
1.5 KiB
Makefile
LOCAL_BIN := $(CURDIR)/bin
|
|
PATH := $(LOCAL_BIN):$(PATH)
|
|
|
|
ifeq (local-migrations-create,$(firstword $(MAKECMDGOALS)))
|
|
migrationName := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
|
$(eval $(migrationName):;@:)
|
|
endif
|
|
|
|
local-migrate-up:
|
|
@goose -allow-missing -dir ./migrations postgres "user=crab dbname=smm-core host=localhost port=5432 sslmode=disable" up
|
|
|
|
local-migrations-create:
|
|
@goose -dir ./migrations postgres "user=crab dbname=smm-core host=localhost port=5432 sslmode=disable" create "${migrationName}" sql
|
|
|
|
local-go-init: export GOBIN := $(LOCAL_BIN)
|
|
local-go-init:
|
|
go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
|
|
go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
|
|
go get google.golang.org/protobuf/cmd/protoc-gen-go
|
|
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
|
|
go install \
|
|
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
|
|
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
|
|
google.golang.org/protobuf/cmd/protoc-gen-go \
|
|
google.golang.org/grpc/cmd/protoc-gen-go-grpc
|
|
|
|
generate:
|
|
rm -rf proto resources
|
|
mkdir -p proto resources
|
|
protoc \
|
|
-I ./api \
|
|
-I ./third_party \
|
|
--go_out ./proto --go_opt paths=source_relative \
|
|
--go-grpc_out ./proto --go-grpc_opt paths=source_relative \
|
|
--grpc-gateway_out ./proto --grpc-gateway_opt paths=source_relative \
|
|
--openapiv2_out=./resources \
|
|
./api/smm_core.proto
|
|
|
|
run:
|
|
go run ./cmd/smm_core/main.go
|