From 04e774e81859b7bc8369233fd81d163ffb36b6a1 Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Wed, 12 Mar 2014 16:19:39 -0700 Subject: [PATCH] Vendor hamcrest-rust --- .gitmodules | 3 +++ Makefile | 43 ++++++++++++++++++++++++++++--------------- libs/hamcrest-rust | 1 + 3 files changed, 32 insertions(+), 15 deletions(-) create mode 160000 libs/hamcrest-rust diff --git a/.gitmodules b/.gitmodules index 3d7b2a79a..21798a1d2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "libs/hammer.rs"] path = libs/hammer.rs url = https://github.com/wycats/hammer.rs.git +[submodule "libs/hamcrest-rust"] + path = libs/hamcrest-rust + url = https://github.com/carllerche/hamcrest-rust/ diff --git a/Makefile b/Makefile index 88b614745..ff74ed696 100644 --- a/Makefile +++ b/Makefile @@ -1,39 +1,48 @@ RUSTC ?= rustc -# RUSTC_FLAGS ?= --out-dir $(RUSTC_TARGET) -L $(RUSTC_TARGET)/libs - -TOML_LIB := $(shell rustc --crate-file-name libs/rust-toml/src/toml/lib.rs) -HAMMER_LIB := $(shell rustc --crate-file-name libs/hammer.rs/src/hammer.rs) +RUSTC_FLAGS ?= # Link flags to pull in dependencies -DEPS = -L libs/hammer.rs/target -L libs/rust-toml/lib -SRC = $(wildcard src/*.rs) BINS = cargo-read-manifest \ cargo-rustc \ cargo-verify-project +SRC = $(wildcard src/*.rs) +DEPS = -L libs/hammer.rs/target -L libs/rust-toml/lib +TOML = libs/rust-toml/lib/$(shell rustc --crate-file-name libs/rust-toml/src/toml/lib.rs) +HAMMER = libs/hammer.rs/target/$(shell rustc --crate-type=lib --crate-file-name libs/hammer.rs/src/hammer.rs) +HAMCREST = libs/hamcrest-rust/target/timestamp +LIBCARGO = target/libcargo.timestamp BIN_TARGETS = $(patsubst %,target/%,$(BINS)) all: $(BIN_TARGETS) -# Builds the hammer dependency -hammer: +# === Dependencies + +$(HAMMER): $(wildcard libs/hammer.rs/src/*.rs) cd libs/hammer.rs && make -toml: +$(TOML): $(wildcard libs/rust-toml/src/toml/*.rs) cd libs/rust-toml && make +$(HAMCREST): $(wildcard libs/hamcrest-rust/src/*.rs) + cd libs/hamcrest-rust && make + # === Cargo -target: +$(LIBCARGO): $(SRC) mkdir -p target + $(RUSTC) $(RUSTC_FLAGS) --out-dir target src/cargo.rs + touch $(LIBCARGO) -libcargo: target $(SRC) - $(RUSTC) --out-dir target src/cargo.rs +libcargo: $(LIBCARGO) # === Commands -$(BIN_TARGETS): target/%: src/bin/%.rs hammer toml libcargo - $(RUSTC) $(DEPS) -Ltarget --out-dir target $< +$(BIN_TARGETS): target/%: src/bin/%.rs $(HAMMER) $(TOML) $(LIBCARGO) + $(RUSTC) $(RUSTC_FLAGS) $(DEPS) -Ltarget --out-dir target $< + +test: + echo "testing" clean: rm -rf target @@ -43,4 +52,8 @@ distclean: clean cd libs/hammer.rs && make clean cd libs/rust-toml && make clean -.PHONY: all clean distclean test hammer libcargo +# Setup phony tasks +.PHONY: all clean distclean test libcargo + +# Disable unnecessary built-in rules +.SUFFIXES: diff --git a/libs/hamcrest-rust b/libs/hamcrest-rust new file mode 160000 index 000000000..95f531ad8 --- /dev/null +++ b/libs/hamcrest-rust @@ -0,0 +1 @@ +Subproject commit 95f531ad8c726a832f28d171bde2860c77ec7619