vegapokerbot/Makefile

51 lines
1.3 KiB
Makefile
Raw Permalink Normal View History

2024-05-07 21:49:09 +03:00
SHELL = /bin/bash -o pipefail
export PATH := $(shell go env GOPATH)/bin:$(PATH)
ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
2024-05-13 16:57:55 +03:00
BIN_NAME=vegapokerbot
BIN=$(ROOT_DIR)/build/$(BIN_NAME)
2024-05-07 21:49:09 +03:00
GO_VERSION=$(shell go version | sed -e 's/go version //')
BIN_DIR=$(ROOT_DIR)/build
build: deps fmt
2024-05-13 16:57:55 +03:00
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}"
2024-05-07 21:49:09 +03:00
@CGO_ENABLED=0 go build -buildvcs=false -tags=release -o $(BIN) .
2024-05-13 16:57:55 +03:00
endif
2024-05-07 21:49:09 +03:00
@echo $(BIN)
2024-05-10 12:10:25 +03:00
docker:
2024-05-10 12:12:42 +03:00
@docker buildx build --platform linux/amd64 --tag $CI_APP_IMAGE --file Dockerfile .
2024-05-10 12:10:25 +03:00
2024-05-07 21:49:09 +03:00
run:
2024-05-13 16:57:55 +03:00
ifeq ($(DEBUG), true)
@killall -s 9 dlv > /dev/null 2>&1 || true
@killall -s 9 ${BIN_NAME} > /dev/null 2>&1 || true
@air
else
2024-05-07 21:49:09 +03:00
@${BIN} run
2024-05-13 16:57:55 +03:00
endif
debug:
@echo "> starting under delve"
@dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient --log exec ${BIN} run
2024-05-07 21:49:09 +03:00
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}