pyo3/Makefile

60 lines
1.2 KiB
Makefile
Raw Normal View History

.PHONY: default build test doc extensions clean cog
2015-04-19 05:50:50 +00:00
2015-05-24 18:06:08 +00:00
ifndef PY
2015-06-28 19:46:24 +00:00
PY := $(word 2, $(subst ., ,$(shell python --version 2>&1)))
2015-05-24 18:06:08 +00:00
endif
ifndef NIGHTLY
ifeq ($(word 3, $(subst -, ,$(shell rustc --version 2>&1))),nightly)
NIGHTLY := 1
else
NIGHTLY := 0
endif
endif
2015-05-24 18:06:08 +00:00
ifdef PEP384
export PEP384=1
2017-05-13 05:51:14 +00:00
FEATURES := pep-384
endif
ifeq ($(NIGHTLY),1)
FEATURES := $(FEATURES) nightly
endif
CARGO_FLAGS := --features "$(FEATURES)" --no-default-features
2015-05-24 18:06:08 +00:00
2017-05-13 05:51:14 +00:00
default: test
2015-04-19 05:50:50 +00:00
2017-05-13 05:05:00 +00:00
src/py_class/py_class_impl.rs: src/py_class/py_class_impl.py
2016-05-06 20:05:12 +00:00
PY=3 python $< >$@
2017-05-13 05:05:00 +00:00
build: src/py_class/py_class_impl.rs
cargo build $(CARGO_FLAGS)
2015-04-19 05:50:50 +00:00
test: build
cargo test $(CARGO_FLAGS)
ifeq ($(NIGHTLY),1)
# ast-json output is only supported on nightly
python$(PY) tests/check_symbols.py
endif
2015-04-19 05:50:50 +00:00
doc: build
cargo doc --no-deps $(CARGO_FLAGS)
2015-04-19 05:50:50 +00:00
clean:
rm -r target
gh-pages:
2017-05-13 06:01:54 +00:00
git clone --branch gh-pages git@github.com:PyO3/PyO3.git gh-pages
2015-04-19 05:50:50 +00:00
.PHONY: gh-pages-doc
gh-pages-doc: doc | gh-pages
cd gh-pages && git pull
rm -r gh-pages/doc
cp -r target/doc gh-pages/
rm gh-pages/doc/.lock
cd gh-pages && git add .
cd gh-pages && git commit -m "Update documentation"
publish: default gh-pages-doc
cargo publish
cd gh-pages && git push