LIBDIR = ./rust/target/release
STATLIB = $(LIBDIR)/libprecautionary.a
PKG_LIBS = -L$(LIBDIR) -lprecautionary

#all: clean
$(SHLIB): $(STATLIB)

# CRAN bs forbids writing $HOME and mandates wiping .cargo after each use
export CARGO_HOME=$(PWD)/.cargo

# TODO: Do I need 'cargo build --lib --release ...' below (i.e., should I add '--lib')?
#       OR.. is it possible that my earlier build efforts were stumbling on this point?

$(STATLIB):
	PATH="$(HOME)/.cargo/bin:$(PATH)" cargo build --lib --release --manifest-path=./rust/Cargo.toml
	rm -Rf $(CARGO_HOME)
	rm -Rf $(LIBDIR)/build

clean:
	rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) rust/target
