Skip to content

Commit

Permalink
update makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
brianpursley committed Jun 24, 2024
1 parent e9309ce commit b08053a
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit b08053a

Please sign in to comment.