2024-01-22 12:45:37 +01:00
|
|
|
PROJECT := sanic
|
|
|
|
|
|
|
|
.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
|
2023-12-02 17:53:44 +01:00
|
|
|
mpd --no-daemon ./mpd.conf
|
2024-01-22 12:37:28 +01:00
|
|
|
|
2024-01-22 12:45:37 +01:00
|
|
|
run: build ## Run project
|
2024-01-22 13:10:30 +01:00
|
|
|
./${PROJECT}
|
2024-01-22 12:37:28 +01:00
|
|
|
|
2024-01-22 12:45:37 +01:00
|
|
|
build: ## Compile project
|
|
|
|
go build -v -o ${PROJECT}
|
2024-01-22 12:37:28 +01:00
|
|
|
|
2024-01-22 12:45:37 +01:00
|
|
|
tidy: ## Add missing and remove unused modules
|
2024-01-22 12:37:28 +01:00
|
|
|
go mod tidy
|
|
|
|
|
2024-01-22 12:45:37 +01:00
|
|
|
verify: ## Verify dependencies have expected content
|
2024-01-22 12:37:28 +01:00
|
|
|
go mod verify
|
|
|
|
|
2024-01-22 12:45:37 +01:00
|
|
|
test: ## Run tests
|
2024-01-22 12:37:28 +01:00
|
|
|
go test ./...
|
|
|
|
|
2024-01-22 12:45:37 +01:00
|
|
|
cert: ## Create https certificate for local testing
|
|
|
|
go run $$GOROOT/src/crypto/tls/generate_cert.go --host localhost
|
|
|
|
|
|
|
|
build-container: ## Build container image
|
|
|
|
podman build --tag ${PROJECT}:latest .
|
|
|
|
|
|
|
|
run-container: build-container ## Run container image
|
|
|
|
podman run --rm --volume ./config.ini:/config.ini --publish-all ${PROJECT}:latest
|
2024-01-22 12:37:28 +01:00
|
|
|
|
2024-01-22 12:45:37 +01:00
|
|
|
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}'
|
2024-01-22 12:37:28 +01:00
|
|
|
|