4 RUST_REPOSITORY ?= ../rust
5 RUST_CTAGS ?= $(RUST_REPOSITORY)/src/etc/ctags.rust
9 # Recursive wildcard function
10 # http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html
11 rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) \
12 $(filter $(subst *,%,$2),$d))
14 SRC := $(call rwildcard,src/,*.rs)
15 LIB := target/$(shell rustc --crate-file-name src/lib.rs --crate-type rlib)
17 # We may not have rustc or the lib.rs file may be broken.
18 # But don't break the rules on that account.
19 LIB := target/libanymap.dummy
26 $(RUSTC) $(RUSTFLAGS) src/lib.rs --out-dir=target -L target
28 doc/anymap/index.html: $(SRC)
29 $(RUSTDOC) src/lib.rs -L target
32 $(RUSTC) $(RUSTFLAGS) --test -o target/test src/lib.rs -L target
34 target/quicktest: $(SRC)
35 $(RUSTC) --test -o target/quicktest src/lib.rs -L target
37 # There are no tests to run this way at present. It’s all doctests.
38 # test: anymap doctest target/test
42 bench: anymap target/test
45 doctest: $(SRC) $(LIB)
46 $(RUSTDOC) -L target --test src/lib.rs
48 # Can't wait for everything to target, optimised too? OK, you can save some time here.
49 quicktest: target/quicktest
50 target/quicktest --test
52 docs: doc/anymap/index.html
58 ctags -f TAGS --options="$(RUST_CTAGS)" --language=rust -R src/
60 .PHONY: all docs clean test doctest quicktest anymap