2016-06-04 11:58:09 +00:00
|
|
|
toml = $@/Cargo.toml
|
|
|
|
bin = $@/target/debug/$@
|
2016-06-04 02:14:09 +00:00
|
|
|
|
2016-07-27 17:29:34 +00:00
|
|
|
doc-crate-toml=./.imag-documentation/Cargo.toml
|
|
|
|
|
2016-08-12 09:13:47 +00:00
|
|
|
ECHO=$(shell which echo) -e
|
|
|
|
CARGO=$(shell which cargo)
|
2016-06-04 02:14:09 +00:00
|
|
|
|
2016-08-12 09:13:47 +00:00
|
|
|
BINS=$(shell find -maxdepth 1 -name "imag-*" -type d)
|
|
|
|
LIBS=$(shell find -maxdepth 1 -name "libimag*" -type d)
|
2016-06-04 02:14:09 +00:00
|
|
|
|
2016-08-12 09:13:47 +00:00
|
|
|
BIN_TARGETS=$(patsubst imag-%,,$(BINS))
|
|
|
|
LIB_TARGETS=$(LIBS)
|
|
|
|
LIB_TARGETS_TEST=$(foreach x,$(subst ./,,$(LIBS)),test-$(x))
|
|
|
|
TARGETS=$(BIN_TARGETS) $(LIB_TARGETS)
|
2016-08-24 14:49:08 +00:00
|
|
|
UPDATE_TARGETS=$(foreach x,$(TARGETS),$(x)-update)
|
2016-08-21 16:53:04 +00:00
|
|
|
CLEAN_TARGETS=$(foreach x,$(TARGETS),$(x)-clean)
|
2016-06-04 02:14:09 +00:00
|
|
|
|
2016-08-12 09:13:47 +00:00
|
|
|
all: $(TARGETS)
|
|
|
|
@$(ECHO) "\t[ALL ]"
|
2016-06-04 02:14:09 +00:00
|
|
|
|
2016-08-12 09:13:47 +00:00
|
|
|
bin: $(BIN_TARGETS)
|
|
|
|
@$(ECHO) "\t[ALLBIN]"
|
2016-07-27 17:29:34 +00:00
|
|
|
|
2016-08-12 09:13:47 +00:00
|
|
|
lib: $(LIB_TARGETS)
|
|
|
|
@$(ECHO) "\t[ALLLIB]"
|
|
|
|
|
|
|
|
lib-test: $(LIB_TARGETS_TEST)
|
|
|
|
|
2016-08-24 14:49:08 +00:00
|
|
|
update: $(UPDATE_TARGETS)
|
|
|
|
@$(ECHO) "\t[UPDATE]"
|
|
|
|
|
2016-08-21 16:53:04 +00:00
|
|
|
clean: $(CLEAN_TARGETS)
|
|
|
|
@$(ECHO) "\t[CLEAN ]"
|
|
|
|
|
2016-08-12 09:13:47 +00:00
|
|
|
$(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
|
|
|
|
|
2016-08-24 14:49:08 +00:00
|
|
|
$(UPDATE_TARGETS): %: .FORCE
|
|
|
|
@$(ECHO) "\t[UPDATE]:\t$(subst -update,,$@)"
|
|
|
|
@$(CARGO) update --manifest-path ./$(subst -update,,$@)/Cargo.toml
|
|
|
|
|
2016-08-21 16:53:04 +00:00
|
|
|
$(CLEAN_TARGETS): %: .FORCE
|
|
|
|
@$(ECHO) "\t[CLEAN]:\t$(subst -clean,,$@)"
|
|
|
|
@$(CARGO) clean --manifest-path ./$(subst -clean,,$@)/Cargo.toml
|
|
|
|
|
2016-08-12 09:13:47 +00:00
|
|
|
.FORCE:
|
2016-06-04 02:14:09 +00:00
|
|
|
|