|
@@ -0,0 +1,47 @@
|
|
|
+.DEFAULT_GOAL := all
|
|
|
+.DELETE_ON_ERROR:
|
|
|
+.SUFFIXES:
|
|
|
+
|
|
|
+include .env
|
|
|
+export
|
|
|
+
|
|
|
+PROJECT := $(shell cat go.mod | grep '^module\s' | cut -b 8-)
|
|
|
+export VERSION ?= $(shell date -u '+%F')-snapshot
|
|
|
+BUILD_TIME := $(shell date -u '+%F_%T')
|
|
|
+COMMIT_HASH := $(shell git rev-parse --short HEAD)
|
|
|
+GOLDFLAGS := '-linkmode external -w -s -extldflags "-static" -X $(PROJECT)/internal/version.BuildVersion=$(VERSION) -X $(PROJECT)/internal/version.BuildCommitId=$(COMMIT_HASH) -X ${PROJECT}/internal/version.BuildTime=$(BUILD_TIME)'
|
|
|
+
|
|
|
+.PHONY: all
|
|
|
+all: gen deps fmt test
|
|
|
+
|
|
|
+.PHONY: gen
|
|
|
+gen: gen-json gen-proto
|
|
|
+
|
|
|
+.PHONY: gen-json
|
|
|
+gen-json:
|
|
|
+ -@echo "-> $@"
|
|
|
+ easyjson platform/afreeca/bridge_message.go
|
|
|
+
|
|
|
+.PHONY: gen-proto
|
|
|
+gen-proto:
|
|
|
+ -@echo "-> $@"
|
|
|
+ @protoc -I=. --go_out=paths=source_relative:. proto/message.proto
|
|
|
+ @cp proto/message.pb.go model/message.pb.go
|
|
|
+ -@rm proto/message.pb.go
|
|
|
+
|
|
|
+.PHONY: deps
|
|
|
+deps:
|
|
|
+ -@echo "-> $@"
|
|
|
+ git submodule update --remote --init
|
|
|
+ go mod tidy
|
|
|
+
|
|
|
+.PHONY: fmt
|
|
|
+fmt:
|
|
|
+ -@echo "-> $@"
|
|
|
+ -go fmt $(shell go list ./...)
|
|
|
+
|
|
|
+.PHONY: test
|
|
|
+test:
|
|
|
+ -@echo "-> $@"
|
|
|
+ CGO_ENABLED=1 go test -tags musl $(shell go list ./...)
|
|
|
+ -go vet $(shell go list ./...)
|