diff --git a/Makefile b/Makefile index 6d83f1123..e53bc8270 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,9 @@ CARGO = cargo +nightly # Uncomment this if the above is uncommented #TARGET_PRFX = --target= +# Git revision, embedded in src/lib.rs +GIT_REV = $(shell git rev-parse --short HEAD) + # Binaries to be built BINS = darkfid faucetd drk darkirc vanityaddr tau taud @@ -35,7 +38,10 @@ BINDEPS = \ all: $(BINS) -zkas: $(ZKASDEPS) +rev: + @grep -q "$(GIT_REV)" src/lib.rs || sed -e 's/@GIT_REV@/$(GIT_REV)/' -i src/lib.rs + +zkas: rev $(ZKASDEPS) $(CARGO) build $(TARGET_PRFX)$(RUST_TARGET) --all-features --release --package $@ cp -f target/$(RUST_TARGET)/release/$@ $@ @@ -101,5 +107,5 @@ uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/$$i; \ done; -.PHONY: all check fix fmt clippy test test-no-run cleanbin clean \ +.PHONY: all rev check fix fmt clippy test test-no-run cleanbin clean \ install uninstall contracts coverage diff --git a/src/lib.rs b/src/lib.rs index 6c3cdcd84..2f737c9a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -69,9 +69,10 @@ pub const ANSI_LOGO: &str = include_str!("../contrib/darkfi.ansi"); macro_rules! cli_desc { () => {{ let desc = format!( - "{} {}\n{}\n{}", + "{} {}-{}\n{}\n{}", env!("CARGO_PKG_NAME").to_string(), env!("CARGO_PKG_VERSION").to_string(), + "@GIT_REV@", // Only noobs will change this env!("CARGO_PKG_DESCRIPTION").to_string(), darkfi::ANSI_LOGO, );