Hello, I have a large project that includes libraries in Rust as dependencies. I want to run “cargo build” unconditionally, so it should use a phony target, but I only want to rebuild downstream binaries if a library actually changed. I found that double-colon rules seem to be an exception to “a phony target should not be a prerequisite of a real target file; if it is, its recipe will be run every time make goes to update that file” mentioned in the docs. (Though make only seems to reconsider timestamps the double-colon rule has a recipe.)
The following seems to work for me, but my question is: Am I missing something, and can I rely on this behavior? .PHONY: build-rust build-rust: cd rust-lib && cargo build rust-lib/target/debug/libfoo.so:: build-rust @true binary: binary.o rust-lib/target/debug/libfoo.so $(link-command)