sanic/Makefile

50 lines
1.2 KiB
Makefile
Raw Normal View History

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}
2024-08-07 23:35:16 +02:00
cp *.mp3 /tmp/${PROJECT}/music/
2024-01-22 12:45:37 +01:00
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-23 12:18:27 +01:00
update: ## Update go dependencies
go get -u
2024-08-07 23:35:16 +02:00
which gomod2nix && gomod2nix # sync go deps with nix
2024-01-23 12:18:27 +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-24 13:23:54 +01:00
format: ## Format go code
go fmt ./...
2024-01-24 13:28:54 +01:00
lint: ## Run linter (staticcheck)
staticcheck -f stylish ./...
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