diff --git a/Makefile b/Makefile index 8326e48..9b37993 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,30 @@ -PYTHON := $(shell command -v python3 || command -v python || echo "none") -PIP3 := $(shell command -v pip3 || command -v pip || echo "none") -PG_VERSION := 16 +PYTHON ?= $(shell which python3 || which python) +PIP ?= $(shell which pip3 || which pip) +PG_VERSION ?= 16 .PHONY: run run: - cargo pgrx run + @cargo pgrx run .PHONY: clean clean: - cargo clean + @cargo clean .PHONY: init init: - cargo install --locked cargo-pgrx - cargo pgrx init --pg$(PG_VERSION) download + @cargo install --locked cargo-pgrx + @cargo pgrx init --pg$(PG_VERSION) download .PHONY: lint lint: - cargo fmt --check - cargo clippy + @cargo fmt --check + @cargo clippy .PHONY: test test: - @if [ "$(PYTHON)" = "none" ]; then echo >&2 "Error: python3 is required."; exit 1; fi - @if [ "$(PIP)" = "none" ]; then echo >&2 "Error: pip3 is required."; exit 1; fi - $(PIP3) install aiosmtpd - trap 'kill `cat /tmp/smtpd.pid`' EXIT; \ + @if [ -z "$(PYTHON)" ]; then echo "python3 or python not found"; exit 1; fi + @if [ -z "$(PIP)" ]; then echo "pip3 or pip not found"; exit 1; fi + @$(PIP) install aiosmtpd + @trap 'kill `cat /tmp/smtpd.pid`' EXIT; \ $(PYTHON) -m aiosmtpd -n & echo $$! > /tmp/smtpd.pid; \ cargo pgrx test pg$(PG_VERSION)