1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- .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 -X $(PROJECT)/version.BuildVersion=$(VERSION) -X $(PROJECT)/version.BuildCommitId=$(COMMIT_HASH) -X ${PROJECT}/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 ./...)
- .PHONY: build
- build:
- -@echo "-> $@"
- -$(if $(filter $(VERSION),0.0.0), $(error "Please, provide version name"), @echo "== Starting to build version: $(VERSION)")
- @bash ./build.sh $(PROJECT) $(VERSION) $(GOLDFLAGS)
|