prometheus-fail2ban-exporter/Makefile
Hector 56ecc03341 chore: update makefile commands (!92)
* Tweak makefile commands and file formatting
* Remove command and build step for go mod formatting
* Add command to update project dependencies
* Add make command to list all make commands

https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/-/merge_requests/92
2023-06-21 15:02:11 +00:00

51 lines
910 B
Makefile

# List make commands
.PHONY: ls
ls:
cat Makefile | grep "^[a-zA-Z#].*" | cut -d ":" -f 1 | sed s';#;\n#;'g
# Download dependencies
.PHONY: download
download:
go mod download
# Update project dependencies
.PHONY: update
update:
go get -u
go mod download
go mod tidy
# Run project tests
.PHONY: test
test: download
go test ./... -v -race
# Format code
.PHONY: fmt
fmt: download
go mod tidy
go fmt ./...
# Check for unformatted go code
.PHONY: check/fmt
check/fmt: download
test -z $(shell gofmt -l .)
# Build project
.PHONY: build
build:
go build \
-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 .