2015-04-18 18:17:25 +00:00
|
|
|
TARGETDIR=../target/debug
|
|
|
|
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
|
|
|
|
|
|
|
|
.PHONY: all clean
|
|
|
|
|
2015-05-24 18:06:08 +00:00
|
|
|
ifndef PY
|
2015-05-27 19:19:32 +00:00
|
|
|
PY=2
|
2015-05-24 18:06:08 +00:00
|
|
|
endif
|
|
|
|
|
2015-04-18 18:17:25 +00:00
|
|
|
all:
|
|
|
|
|
|
|
|
clean:
|
|
|
|
-rm *.so
|
|
|
|
-rm *.out
|
|
|
|
-rm -r stamps
|
|
|
|
|
|
|
|
stamps:
|
|
|
|
mkdir stamps
|
|
|
|
|
2015-05-24 18:06:08 +00:00
|
|
|
stamps/rust-cpython-$(PY): $(call rwildcard,../src,*.rs) Makefile | stamps
|
|
|
|
-rm stamps/rust-cpython-*
|
|
|
|
cd .. && make build PY=$(PY)
|
2015-04-18 18:17:25 +00:00
|
|
|
touch $@
|
|
|
|
|
2015-05-24 18:06:08 +00:00
|
|
|
%.so: %.rs stamps/rust-cpython-$(PY)
|
2015-04-18 18:17:25 +00:00
|
|
|
rustc $< -L $(TARGETDIR) -L $(TARGETDIR)/deps -o $@
|
|
|
|
|
|
|
|
hello.out: hello.so
|
2015-05-24 18:06:08 +00:00
|
|
|
python$(PY) -c "import hello; hello.run(hello.val())" 2>&1 | tee $@
|
2015-04-18 18:17:25 +00:00
|
|
|
|
|
|
|
all: stamps/test-hello
|
|
|
|
stamps/test-hello: hello.out
|
|
|
|
@grep "Rust says: Hello Python!" hello.out >/dev/null
|
|
|
|
@grep "Rust got 42" hello.out >/dev/null
|
|
|
|
|
2015-05-27 19:19:32 +00:00
|
|
|
all: inheritance.so
|
2015-04-18 18:17:25 +00:00
|
|
|
|
|
|
|
|