[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Double colon rules with phony prerequisites
From: |
Fogle, Benjamin |
Subject: |
Double colon rules with phony prerequisites |
Date: |
Tue, 27 Apr 2021 14:32:48 +0000 |
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)
- Double colon rules with phony prerequisites,
Fogle, Benjamin <=