51 lines
1.3 KiB
Makefile
51 lines
1.3 KiB
Makefile
SHELL = /bin/bash -o pipefail
|
|
export PATH := $(shell go env GOPATH)/bin:$(PATH)
|
|
|
|
ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
BIN_NAME=vegapokerbot
|
|
BIN=$(ROOT_DIR)/build/$(BIN_NAME)
|
|
GO_VERSION=$(shell go version | sed -e 's/go version //')
|
|
BIN_DIR=$(ROOT_DIR)/build
|
|
|
|
build: deps fmt
|
|
ifeq ($(DEBUG), true)
|
|
@echo "> building debug with ${GO_VERSION}"
|
|
@CGO_ENABLED=0 go build -buildvcs=false -gcflags "all=-N -l" -tags=release -o $(BIN) .
|
|
else
|
|
@echo "> building release with ${GO_VERSION}"
|
|
@CGO_ENABLED=0 go build -buildvcs=false -tags=release -o $(BIN) .
|
|
endif
|
|
@echo $(BIN)
|
|
|
|
docker:
|
|
@docker buildx build --platform linux/amd64 --tag $CI_APP_IMAGE --file Dockerfile .
|
|
|
|
run:
|
|
ifeq ($(DEBUG), true)
|
|
@killall -s 9 dlv > /dev/null 2>&1 || true
|
|
@killall -s 9 ${BIN_NAME} > /dev/null 2>&1 || true
|
|
@air
|
|
else
|
|
@${BIN} run
|
|
endif
|
|
|
|
debug:
|
|
@echo "> starting under delve"
|
|
@dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient --log exec ${BIN} run
|
|
|
|
fmt:
|
|
@echo "> fmt"
|
|
@gofmt -l -s -w `go list -buildvcs=false -f '{{.Dir}}' ${ROOT_DIR}/... | grep -v /vendor/`
|
|
|
|
deps:
|
|
@echo "> deps"
|
|
@go mod tidy
|
|
@go mod vendor
|
|
|
|
.PHONY:
|
|
clean:
|
|
@rm -rf $(BIN_DIR)
|
|
@mkdir -p $(BIN_DIR)
|
|
@touch $(BIN_DIR)/.gitkeep
|
|
@rm -rf coverage.out test-report.{txt,xml}
|