add help to makefile

This commit is contained in:
XenGi 2024-01-22 12:45:37 +01:00
parent cfaa05f7b5
commit 8881505d57
Signed by: xengi
SSH key fingerprint: SHA256:jxWM2RTHvxxcncXycwwWkP7HCWb4VREN05UGJTbIPZg

View file

@ -1,26 +1,38 @@
mpd: PROJECT := sanic
mkdir -p /tmp/sanic/{music,playlists}
touch /tmp/sanic/mpd_db .DEFAULT_GOAL := help
.PHONY: mpd run build tidy verify test cert container help
mpd: ## Run mpd test instance
mkdir -p /tmp/${PROJECT}/{music,playlists}
touch /tmp/${PROJECT}/mpd_db
mpd --no-daemon ./mpd.conf mpd --no-daemon ./mpd.conf
run: build run: build ## Run project
./server ./server
build: build: ## Compile project
go build -v -o sanic go build -v -o ${PROJECT}
tidy: ## add missing and remove unused modules tidy: ## Add missing and remove unused modules
go mod tidy go mod tidy
verify: ## verify dependencies have expected content verify: ## Verify dependencies have expected content
go mod verify go mod verify
test: ## run tests test: ## Run tests
go test ./... go test ./...
cert: ## create https certificate for testing cert: ## Create https certificate for local testing
go run $GOROOT/src/crypto/tls/generate_cert.go --host localhost go run $$GOROOT/src/crypto/tls/generate_cert.go --host localhost
container: build-container: ## Build container image
podman build -t dotfiles:latest . podman build --tag ${PROJECT}:latest .
run-container: build-container ## Run container image
podman run --rm --volume ./config.ini:/config.ini --publish-all ${PROJECT}:latest
help: ## Display this help
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'