.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 export DEBUG ?= 0 BUILD_TIME := $(shell date -u '+%F_%T') COMMIT_HASH := $(shell git rev-parse --short HEAD) LDFLAGS := '-linkmode external -w -s -extldflags "-static" -X $(PROJECT).Version=$(VERSION)' GCFLAGS := ifeq ($(DEBUG),1) GCFLAGS = "all=-N -l" endif .PHONY: all all: deps fmt test .PHONY: deps deps: -@echo "-> $@" go mod tidy .PHONY: fmt fmt: -@echo "-> $@" -go fmt $(shell go list ./...) .PHONY: test test: -@echo "-> $@" CGO_ENABLED=1 go test $(shell go list ./...) -go vet $(shell go list ./...) .PHONE: gen-proto gen-proto: -@echo "-> $@" @protoc -I=. --go_out=paths=source_relative:. --python_out=. proto/*.proto @cp proto/*.pb.go ./ -@rm proto/*.pb.go