imag/Makefile

90 lines
2.3 KiB
Makefile
Raw Normal View History

2016-06-04 11:58:09 +00:00
toml = $@/Cargo.toml
bin = $@/target/debug/$@
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-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-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-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-08-24 14:49:08 +00:00
UPDATE_TARGETS=$(foreach x,$(TARGETS),$(x)-update)
CLEAN_TARGETS=$(foreach x,$(TARGETS),$(x)-clean)
2016-08-12 09:13:47 +00:00
all: $(TARGETS)
2016-08-27 11:19:13 +00:00
@$(ECHO) "\t[ALL ]"
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]"
@$(CARGO) release --manifest-path ./bin/Cargo.toml
imag-bin-update:
@$(ECHO) "\t[IMAG ][UPDATE ]"
@$(CARGO) update --manifest-path ./bin/Cargo.toml
imag-bin-install:
@$(ECHO) "\t[IMAG ][INSTALL]"
@$(CARGO) install --path ./bin/Cargo.toml
imag-bin-clean:
@$(ECHO) "\t[IMAG ][CLEAN ]"
@$(CARGO) clean --manifest-path ./bin/Cargo.toml
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-08-12 09:13:47 +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)
2016-08-27 10:48:45 +00:00
install: $(INSTALL_TARGETS)
@$(ECHO) "\t[INSTALL]"
2016-08-24 14:49:08 +00:00
update: $(UPDATE_TARGETS)
2016-08-27 11:19:13 +00:00
@$(ECHO) "\t[UPDATE ]"
2016-08-24 14:49:08 +00:00
2016-08-29 07:05:34 +00:00
clean: $(CLEAN_TARGETS) imag-bin-clean
2016-08-27 11:19:13 +00:00
@$(ECHO) "\t[CLEAN ]"
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-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-08-12 09:13:47 +00:00
@$(CARGO) test --manifest-path ./$(subst test-,,$@)/Cargo.toml
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-08-24 14:49:08 +00:00
$(UPDATE_TARGETS): %: .FORCE
2016-08-27 11:19:13 +00:00
@$(ECHO) "\t[UPDATE ]:\t$(subst -update,,$@)"
2016-08-24 14:49:08 +00:00
@$(CARGO) update --manifest-path ./$(subst -update,,$@)/Cargo.toml
$(CLEAN_TARGETS): %: .FORCE
2016-08-27 11:19:13 +00:00
@$(ECHO) "\t[CLEAN ]:\t$(subst -clean,,$@)"
@$(CARGO) clean --manifest-path ./$(subst -clean,,$@)/Cargo.toml
2016-08-12 09:13:47 +00:00
.FORCE: