go/Makefile

31 lines
879 B
Makefile

#!/usr/bin/make -f
SHELL = /bin/sh
srcdir = .
GO ?= go
GOFLAGS ?= -buildvcs=true
CGO_ENABLED = 0
EXECUTABLE ?= ${REPO_NAME_LOWER}
DOCKER ?= docker
DOCKERFLAGS ?= --rm
.PHONY: all clean check container help
all: main.go # Build execution file for current environment
$(GO) build -v $(GOFLAGS) -o $(EXECUTABLE)
clean: ## Delete all files in the current directory that are normally created by building the program
$(GO) clean
check: ## Perform self-tests
$(GO) test -v -cover -failfast -short -shuffle=on $(GOFLAGS) $(srcdir)/...
container: build/Dockerfile ## Builds Docker container image
$(DOCKER) build $(DOCKERFLAGS) -f $(srcdir)/build/Dockerfile -t source.toby3d.me${REPO_LINK} .
.PHONY: help
help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'