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 := build/$(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 := build/libanymap.dummy
26 $(RUSTC) $(RUSTFLAGS) src/lib.rs --out-dir=build -L build
28 doc/anymap/index.html: $(SRC)
29 $(RUSTDOC) src/lib.rs -L build
32 $(RUSTC) $(RUSTFLAGS) --test -o build/test src/lib.rs -L build
34 build/quicktest: $(SRC)
35 $(RUSTC) --test -o build/quicktest src/lib.rs -L build
37 # There are no tests to run this way at present. It’s all doctests.
38 # test: anymap doctest build/test
42 bench: anymap build/test
45 doctest: $(SRC) $(LIB)
46 $(RUSTDOC) -L build --test src/lib.rs
48 # Can't wait for everything to build, optimised too? OK, you can save some time here.
49 quicktest: build/quicktest
50 build/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