Merge pull request #646 from matthiasbeyer/makefile-improvements
Rewrite Makefile
This commit is contained in:
commit
d0a3325137
1 changed files with 26 additions and 12 deletions
38
Makefile
38
Makefile
|
@ -3,21 +3,35 @@ bin = $@/target/debug/$@
|
||||||
|
|
||||||
doc-crate-toml=./.imag-documentation/Cargo.toml
|
doc-crate-toml=./.imag-documentation/Cargo.toml
|
||||||
|
|
||||||
default: all
|
ECHO=$(shell which echo) -e
|
||||||
|
CARGO=$(shell which cargo)
|
||||||
|
|
||||||
.PHONY: clean
|
BINS=$(shell find -maxdepth 1 -name "imag-*" -type d)
|
||||||
|
LIBS=$(shell find -maxdepth 1 -name "libimag*" -type d)
|
||||||
|
|
||||||
all: imag-counter imag-link imag-notes imag-store imag-tag imag-view
|
BIN_TARGETS=$(patsubst imag-%,,$(BINS))
|
||||||
|
LIB_TARGETS=$(LIBS)
|
||||||
|
LIB_TARGETS_TEST=$(foreach x,$(subst ./,,$(LIBS)),test-$(x))
|
||||||
|
TARGETS=$(BIN_TARGETS) $(LIB_TARGETS)
|
||||||
|
|
||||||
imag-%: prep
|
all: $(TARGETS)
|
||||||
cargo build --manifest-path $(toml)
|
@$(ECHO) "\t[ALL ]"
|
||||||
cp $(bin) out/
|
|
||||||
|
|
||||||
lib-doc:
|
bin: $(BIN_TARGETS)
|
||||||
cargo build --manifest-path $(doc-crate-toml)
|
@$(ECHO) "\t[ALLBIN]"
|
||||||
|
|
||||||
prep:
|
lib: $(LIB_TARGETS)
|
||||||
mkdir -p out/
|
@$(ECHO) "\t[ALLLIB]"
|
||||||
|
|
||||||
|
lib-test: $(LIB_TARGETS_TEST)
|
||||||
|
|
||||||
|
$(TARGETS): %: .FORCE
|
||||||
|
@$(ECHO) "\t[CARGO ]:\t$@"
|
||||||
|
@$(CARGO) build --manifest-path ./$@/Cargo.toml
|
||||||
|
|
||||||
|
$(LIB_TARGETS_TEST): %: .FORCE
|
||||||
|
@$(ECHO) "\t[TEST ]:\t$@"
|
||||||
|
@$(CARGO) test --manifest-path ./$(subst test-,,$@)/Cargo.toml
|
||||||
|
|
||||||
|
.FORCE:
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf out/
|
|
||||||
|
|
Loading…
Reference in a new issue