2015-04-19 05:50:50 +00:00
|
|
|
.PHONY: default build test doc extensions clean
|
|
|
|
|
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
|
2016-03-05 23:03:17 +00:00
|
|
|
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
|
|
|
|
|
|
|
ifeq ($(PY),2)
|
2015-09-19 13:37:29 +00:00
|
|
|
FEATURES := python27-sys
|
2015-05-24 18:06:08 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(PY),3)
|
2015-09-19 13:37:29 +00:00
|
|
|
FEATURES := python3-sys
|
|
|
|
ifdef PEP384
|
|
|
|
export PEP384=1
|
2015-11-07 15:52:20 +00:00
|
|
|
FEATURES := $(FEATURES) pep-384
|
2015-05-24 18:06:08 +00:00
|
|
|
endif
|
2015-09-19 13:37:29 +00:00
|
|
|
endif
|
2016-03-05 23:03:17 +00:00
|
|
|
ifeq ($(NIGHTLY),1)
|
|
|
|
FEATURES := $(FEATURES) nightly
|
|
|
|
endif
|
2015-09-19 13:37:29 +00:00
|
|
|
|
2016-03-05 23:03:17 +00:00
|
|
|
CARGO_FLAGS := --features "$(FEATURES)" --no-default-features
|
2015-05-24 18:06:08 +00:00
|
|
|
|
2015-04-19 05:50:50 +00:00
|
|
|
default: test extensions
|
|
|
|
|
2016-05-06 20:05:12 +00:00
|
|
|
src/py_class/py_class_impl2.rs: src/py_class/py_class_impl.py
|
|
|
|
PY=2 python $< >$@
|
2016-04-17 13:53:48 +00:00
|
|
|
|
2016-05-06 20:05:12 +00:00
|
|
|
src/py_class/py_class_impl3.rs: src/py_class/py_class_impl.py
|
|
|
|
PY=3 python $< >$@
|
|
|
|
|
|
|
|
build: src/py_class/py_class_impl2.rs src/py_class/py_class_impl3.rs
|
2015-09-19 13:37:29 +00:00
|
|
|
cargo build $(CARGO_FLAGS)
|
2015-04-19 05:50:50 +00:00
|
|
|
|
|
|
|
test: build
|
2015-09-19 13:37:29 +00:00
|
|
|
cargo test $(CARGO_FLAGS)
|
2016-03-06 00:08:40 +00:00
|
|
|
ifeq ($(NIGHTLY),1)
|
|
|
|
# ast-json output is only supported on nightly
|
2015-09-20 20:21:18 +00:00
|
|
|
python$(PY) tests/check_symbols.py
|
2016-03-06 00:08:40 +00:00
|
|
|
endif
|
2015-04-19 05:50:50 +00:00
|
|
|
|
|
|
|
doc: build
|
2015-09-19 13:37:29 +00:00
|
|
|
cargo doc --no-deps $(CARGO_FLAGS)
|
2015-04-19 05:50:50 +00:00
|
|
|
|
|
|
|
extensions: build
|
2016-12-17 20:17:11 +00:00
|
|
|
make -C extensions/tests PY=$(PY)
|
2015-04-19 05:50:50 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -r target
|
|
|
|
make -C extensions/ clean
|
|
|
|
|
|
|
|
gh-pages:
|
2015-05-17 19:35:04 +00:00
|
|
|
git clone --branch gh-pages git@github.com:dgrunwald/rust-cpython.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
|
|
|
|
|