34 lines
726 B
Makefile
34 lines
726 B
Makefile
|
SHELL = /bin/bash -o pipefail
|
||
|
export PATH := $(shell go env GOPATH)/bin:$(PATH)
|
||
|
|
||
|
ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||
|
BUILD_DIR=$(ROOT_DIR)/build
|
||
|
BIN=$(BUILD_DIR)/sshpoke
|
||
|
GO_VERSION=$(shell go version | sed -e 's/go version //')
|
||
|
|
||
|
.PHONY: run clean_backend
|
||
|
|
||
|
build: deps fmt
|
||
|
@echo " ► Building with ${GO_VERSION}"
|
||
|
@CGO_ENABLED=0 go build -tags=release -o $(BIN) .
|
||
|
@echo $(BIN)
|
||
|
|
||
|
test: deps fmt
|
||
|
@echo " ► Running tests"
|
||
|
@go test -timeout 1m ./... -v -cpu 4
|
||
|
|
||
|
fmt:
|
||
|
@echo " ► Running gofmt"
|
||
|
@gofmt -l -s -w `go list -f '{{.Dir}}' ${ROOT_DIR}/... | grep -v /vendor/`
|
||
|
|
||
|
deps:
|
||
|
@echo " ► Installing dependencies"
|
||
|
@go mod tidy
|
||
|
@go mod vendor
|
||
|
|
||
|
run:
|
||
|
@$(BIN)
|
||
|
|
||
|
clean:
|
||
|
@rm -rf $(BUILD_DIR)
|