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
|
2016-09-10 07:50:16 +00:00
|
|
|
MAKE=$(shell which make)
|
2016-09-10 07:42:57 +00:00
|
|
|
BASH=$(shell which bash)
|
2016-08-12 09:13:47 +00:00
|
|
|
CARGO=$(shell which cargo)
|
2016-06-04 02:14:09 +00:00
|
|
|
|
2016-09-24 09:01:00 +00:00
|
|
|
BINS=$(shell find -maxdepth 1 -name "imag-*" -type d | sort)
|
|
|
|
LIBS=$(shell find -maxdepth 1 -name "libimag*" -type d | sort)
|
2016-06-04 02:14:09 +00:00
|
|
|
|
2016-08-12 09:13:47 +00:00
|
|
|
BIN_TARGETS=$(patsubst imag-%,,$(BINS))
|
2016-09-10 07:42:57 +00:00
|
|
|
BIN_TARGET_TESTS=$(foreach x,$(BIN_TARGETS),$(x)-test)
|
2016-08-12 09:13:47 +00:00
|
|
|
LIB_TARGETS=$(LIBS)
|
2016-09-18 08:51:12 +00:00
|
|
|
LIB_TARGETS_TEST=$(foreach x,$(subst ./,,$(LIBS)),$(x)-test)
|
2016-08-12 09:13:47 +00:00
|
|
|
TARGETS=$(BIN_TARGETS) $(LIB_TARGETS)
|
2016-08-27 11:15:32 +00:00
|
|
|
RELEASE_TARGETS=$(foreach x,$(TARGETS),$(x)-release)
|
2016-08-27 10:48:45 +00:00
|
|
|
INSTALL_TARGETS=$(foreach x,$(BIN_TARGETS),$(x)-install)
|
2016-10-25 07:31:27 +00:00
|
|
|
CHECK_TARGETS=$(foreach x,$(TARGETS),$(x)-check)
|
2016-06-04 02:14:09 +00:00
|
|
|
|
2016-09-24 08:52:09 +00:00
|
|
|
all: $(TARGETS) imag-bin
|
2016-08-27 11:19:13 +00:00
|
|
|
@$(ECHO) "\t[ALL ]"
|
2016-06-04 02:14:09 +00:00
|
|
|
|
2016-08-29 07:05:34 +00:00
|
|
|
imag-bin:
|
|
|
|
@$(ECHO) "\t[IMAG ][BUILD ]"
|
|
|
|
@$(CARGO) build --manifest-path ./bin/Cargo.toml
|
|
|
|
|
|
|
|
imag-bin-release:
|
|
|
|
@$(ECHO) "\t[IMAG ][RELEASE]"
|
2016-09-24 08:58:11 +00:00
|
|
|
@$(CARGO) build --release --manifest-path ./bin/Cargo.toml
|
2016-08-29 07:05:34 +00:00
|
|
|
|
|
|
|
imag-bin-install:
|
|
|
|
@$(ECHO) "\t[IMAG ][INSTALL]"
|
2016-09-07 15:09:04 +00:00
|
|
|
@$(CARGO) install --force --path ./bin
|
2016-08-29 07:05:34 +00:00
|
|
|
|
2016-10-25 07:31:27 +00:00
|
|
|
imag-bin-check:
|
|
|
|
@$(ECHO) "\t[IMAG ][CHECK ]"
|
|
|
|
@$(CARGO) check --manifest-path ./bin/Cargo.toml
|
|
|
|
|
2016-08-29 07:05:34 +00:00
|
|
|
release: $(RELEASE_TARGETS) imag-bin-release
|
2016-08-27 11:19:13 +00:00
|
|
|
@$(ECHO) "\t[RELEASE]"
|
2016-08-27 11:15:32 +00:00
|
|
|
|
2016-08-29 07:05:34 +00:00
|
|
|
bin: $(BIN_TARGETS) imag-bin
|
2016-08-27 11:19:13 +00:00
|
|
|
@$(ECHO) "\t[ALLBIN ]"
|
2016-07-27 17:29:34 +00:00
|
|
|
|
2017-01-25 09:44:44 +00:00
|
|
|
bin-test: $(BIN_TARGET_TESTS) imag-bin
|
2016-09-17 18:48:10 +00:00
|
|
|
|
2017-05-02 14:00:14 +00:00
|
|
|
lib: $(LIB_TARGETS)
|
2016-08-27 11:19:13 +00:00
|
|
|
@$(ECHO) "\t[ALLLIB ]"
|
2016-08-12 09:13:47 +00:00
|
|
|
|
|
|
|
lib-test: $(LIB_TARGETS_TEST)
|
|
|
|
|
2017-05-02 14:00:14 +00:00
|
|
|
test: bin-test lib-test
|
2016-09-17 18:48:38 +00:00
|
|
|
|
2016-09-24 08:52:09 +00:00
|
|
|
install: $(INSTALL_TARGETS) imag-bin-install
|
2016-08-27 10:48:45 +00:00
|
|
|
@$(ECHO) "\t[INSTALL]"
|
|
|
|
|
2017-03-02 19:27:29 +00:00
|
|
|
update:
|
2016-08-27 11:19:13 +00:00
|
|
|
@$(ECHO) "\t[UPDATE ]"
|
2017-03-02 19:27:29 +00:00
|
|
|
@$(CARGO) update
|
2016-08-24 14:49:08 +00:00
|
|
|
|
2017-03-02 19:35:05 +00:00
|
|
|
clean:
|
2016-08-27 11:19:13 +00:00
|
|
|
@$(ECHO) "\t[CLEAN ]"
|
2017-03-02 19:35:05 +00:00
|
|
|
@$(CARGO) clean
|
2016-08-21 16:53:04 +00:00
|
|
|
|
2016-10-25 07:31:27 +00:00
|
|
|
check: $(CHECK_TARGETS) imag-bin-check
|
|
|
|
|
2017-03-02 19:39:01 +00:00
|
|
|
check-outdated:
|
|
|
|
@$(ECHO) "\t[OUTDATED]"
|
|
|
|
@$(CARGO) outdated
|
2016-11-30 19:12:22 +00:00
|
|
|
|
2016-08-12 09:13:47 +00:00
|
|
|
$(TARGETS): %: .FORCE
|
2016-08-27 11:19:13 +00:00
|
|
|
@$(ECHO) "\t[CARGO ]:\t$@"
|
2016-08-12 09:13:47 +00:00
|
|
|
@$(CARGO) build --manifest-path ./$@/Cargo.toml
|
|
|
|
|
2016-09-17 18:56:12 +00:00
|
|
|
$(BIN_TARGET_TESTS): %-test: % .FORCE
|
2017-06-07 20:11:20 +00:00
|
|
|
@$(ECHO) "\t[CARGO ][TEST]: \t$@"
|
|
|
|
@$(CARGO) test --manifest-path ./$(subst -test,,$@)/Cargo.toml
|
2016-09-10 07:42:57 +00:00
|
|
|
@$(ECHO) "\t[BINTEST]:\t$@"
|
2016-10-07 22:34:38 +00:00
|
|
|
if [ -f $(subst -test,,$@)/tests/Makefile ]; then \
|
2016-09-18 09:45:59 +00:00
|
|
|
$(MAKE) -C $(subst -test,,$@)/tests || exit 1;\
|
|
|
|
fi;
|
2016-09-10 07:42:57 +00:00
|
|
|
|
2016-08-27 11:15:32 +00:00
|
|
|
$(RELEASE_TARGETS): %: .FORCE
|
|
|
|
@$(ECHO) "\t[RELEASE]:\t$(subst -release,,$@)"
|
|
|
|
@$(CARGO) build --release --manifest-path ./$(subst -release,,$@)/Cargo.toml
|
|
|
|
|
2016-08-12 09:13:47 +00:00
|
|
|
$(LIB_TARGETS_TEST): %: .FORCE
|
2016-08-27 11:19:13 +00:00
|
|
|
@$(ECHO) "\t[TEST ]:\t$@"
|
2016-09-18 08:51:12 +00:00
|
|
|
@$(CARGO) test --manifest-path ./$(subst -test,,$@)/Cargo.toml
|
2016-08-12 09:13:47 +00:00
|
|
|
|
2016-08-29 07:05:34 +00:00
|
|
|
$(INSTALL_TARGETS): %: .FORCE imag-bin-install
|
2016-08-27 10:48:45 +00:00
|
|
|
@$(ECHO) "\t[INSTALL]:\t$(subst -install,,$@)"
|
|
|
|
@$(CARGO) install --force --path ./$(subst -install,,$@)
|
|
|
|
|
2016-10-25 07:31:27 +00:00
|
|
|
$(CHECK_TARGETS): %: .FORCE
|
|
|
|
@$(ECHO) "\t[CHECK ]:\t$(subst -check,,$@)"
|
|
|
|
@$(CARGO) check --manifest-path ./$(subst -check,,$@)/Cargo.toml
|
|
|
|
|
2016-08-12 09:13:47 +00:00
|
|
|
.FORCE:
|
2016-06-04 02:14:09 +00:00
|
|
|
|