Enabled Cargo and moved Makefile to use target.
This commit is contained in:
parent
8134113fa9
commit
330bc5aa1e
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,3 @@
|
||||||
build/
|
|
||||||
TAGS
|
TAGS
|
||||||
doc/
|
doc/
|
||||||
|
target/
|
||||||
|
|
14
Cargo.toml
Normal file
14
Cargo.toml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
[package]
|
||||||
|
|
||||||
|
name = "anymap"
|
||||||
|
version = "0.1.0"
|
||||||
|
readme = "README.md"
|
||||||
|
authors = [ "Chris Morgan <me@chrismorgan.info>" ]
|
||||||
|
tags = ["data-structures"]
|
||||||
|
|
||||||
|
[[lib]]
|
||||||
|
|
||||||
|
name = "anymap"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
38
Makefile
38
Makefile
|
@ -12,47 +12,47 @@ rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) \
|
||||||
$(filter $(subst *,%,$2),$d))
|
$(filter $(subst *,%,$2),$d))
|
||||||
|
|
||||||
SRC := $(call rwildcard,src/,*.rs)
|
SRC := $(call rwildcard,src/,*.rs)
|
||||||
LIB := build/$(shell rustc --crate-file-name src/lib.rs --crate-type rlib)
|
LIB := target/$(shell rustc --crate-file-name src/lib.rs --crate-type rlib)
|
||||||
ifeq ($(LIB),build/)
|
ifeq ($(LIB),target/)
|
||||||
# We may not have rustc or the lib.rs file may be broken.
|
# We may not have rustc or the lib.rs file may be broken.
|
||||||
# But don't break the rules on that account.
|
# But don't break the rules on that account.
|
||||||
LIB := build/libanymap.dummy
|
LIB := target/libanymap.dummy
|
||||||
endif
|
endif
|
||||||
|
|
||||||
anymap: $(LIB)
|
anymap: $(LIB)
|
||||||
|
|
||||||
$(LIB): $(SRC)
|
$(LIB): $(SRC)
|
||||||
@mkdir -p build/
|
@mkdir -p target/
|
||||||
$(RUSTC) $(RUSTFLAGS) src/lib.rs --out-dir=build -L build
|
$(RUSTC) $(RUSTFLAGS) src/lib.rs --out-dir=target -L target
|
||||||
|
|
||||||
doc/anymap/index.html: $(SRC)
|
doc/anymap/index.html: $(SRC)
|
||||||
$(RUSTDOC) src/lib.rs -L build
|
$(RUSTDOC) src/lib.rs -L target
|
||||||
|
|
||||||
build/test: $(SRC)
|
target/test: $(SRC)
|
||||||
$(RUSTC) $(RUSTFLAGS) --test -o build/test src/lib.rs -L build
|
$(RUSTC) $(RUSTFLAGS) --test -o target/test src/lib.rs -L target
|
||||||
|
|
||||||
build/quicktest: $(SRC)
|
target/quicktest: $(SRC)
|
||||||
$(RUSTC) --test -o build/quicktest src/lib.rs -L build
|
$(RUSTC) --test -o target/quicktest src/lib.rs -L target
|
||||||
|
|
||||||
# There are no tests to run this way at present. It’s all doctests.
|
# There are no tests to run this way at present. It’s all doctests.
|
||||||
# test: anymap doctest build/test
|
# test: anymap doctest target/test
|
||||||
# build/test --test
|
# target/test --test
|
||||||
test: anymap doctest
|
test: anymap doctest
|
||||||
|
|
||||||
bench: anymap build/test
|
bench: anymap target/test
|
||||||
build/test --bench
|
target/test --bench
|
||||||
|
|
||||||
doctest: $(SRC) $(LIB)
|
doctest: $(SRC) $(LIB)
|
||||||
$(RUSTDOC) -L build --test src/lib.rs
|
$(RUSTDOC) -L target --test src/lib.rs
|
||||||
|
|
||||||
# Can't wait for everything to build, optimised too? OK, you can save some time here.
|
# Can't wait for everything to target, optimised too? OK, you can save some time here.
|
||||||
quicktest: build/quicktest
|
quicktest: target/quicktest
|
||||||
build/quicktest --test
|
target/quicktest --test
|
||||||
|
|
||||||
docs: doc/anymap/index.html
|
docs: doc/anymap/index.html
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf build/ doc/
|
rm -rf target/ doc/
|
||||||
|
|
||||||
TAGS: $(SRC)
|
TAGS: $(SRC)
|
||||||
ctags -f TAGS --options="$(RUST_CTAGS)" --language=rust -R src/
|
ctags -f TAGS --options="$(RUST_CTAGS)" --language=rust -R src/
|
||||||
|
|
Loading…
Reference in a new issue