prometheus-fail2ban-exporter/Makefile

56 lines
1015 B
Makefile
Raw Permalink Normal View History

# List make commands
.PHONY: ls
ls:
cat Makefile | grep "^[a-zA-Z#].*" | cut -d ":" -f 1 | sed s';#;\n#;'g
# Download dependencies
.PHONY: download
2023-06-19 18:37:27 +00:00
download:
2023-06-19 17:58:16 +00:00
go mod download
2021-02-05 22:49:47 +00:00
# Update project dependencies
.PHONY: update
update:
go get -u
go mod download
go mod tidy
# Run project tests
.PHONY: test
2023-06-19 18:37:27 +00:00
test: download
2023-06-19 17:58:16 +00:00
go test ./... -v -race
# Look for "suspicious constructs" in source code
.PHONY: vet
vet: download
go vet ./...
# Format code
.PHONY: fmt
2023-06-19 18:37:27 +00:00
fmt: download
go mod tidy
2023-06-19 17:58:16 +00:00
go fmt ./...
# Check for unformatted go code
.PHONY: check/fmt
2023-06-19 18:37:27 +00:00
check/fmt: download
test -z $(shell gofmt -l .)
# Build project
.PHONY: build
2023-06-19 18:37:27 +00:00
build:
CGO_ENABLED=0 go build \
2023-06-19 18:37:27 +00:00
-ldflags "\
-X main.version=${shell git describe --tags} \
-X main.commit=${shell git rev-parse HEAD} \
-X main.date=${shell date --iso-8601=seconds} \
-X main.builtBy=manual \
" \
-o fail2ban_exporter \
exporter.go
# Build project docker container
.PHONY: build/docker
build/docker: build
docker build -t fail2ban-prometheus-exporter .