-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid unnecessary rebuilds when building for Linux #618
Avoid unnecessary rebuilds when building for Linux #618
Conversation
fb2cfd7
to
d1f7c59
Compare
Cool! |
I was only looking for problems in the Linux build but I expect these changes also affect builds for other targets. The percentage change in the build time from a fresh checkout is probably rather small, but rebuilds after changing certain components might be changed more significantly. |
Why not use the
|
Unless you've got several recipes that need to create the same directory, doesn't that just make the |
In several of those Makefiles there are several targets that depend on the same directory (you missed some of them). It would make the diff smaller. Given the amount of similarity between the Makefiles there would be opportunities for factorization. |
I'll try that then ... |
This is to avoid unnecesssary rebuilds when several other crates have a path dependency on transport-protocol. Without this change, one of the crates getting rebuilt causes the timestamp on the generated file ("transport_protocol.rs") to get updated, which makes the other crates get rebuilt by "cargo build" next time. A neater solution might be to put the generated file under OUT_DIR, but currently that seems to be difficult.
4032c73
to
4050a49
Compare
Also various minor simplifications and tidying. A dependency on a directory causes unnecessary rebuilds as make looks at the modification time of the directory, which gets updated as files are created in the directory, so the directory ends up being newer than some of the target files, forcing a rebuild. An order-only prerequisite is used to avoid this problem. List of changes: - Use an "order-only prerequisite" to create $(TARGET_DIR). - Remove all uses of .SECONDEXPANSION and notdir. - Remove all "static pattern rules". - Use "grouped targets" where appropriate. - Update sources for external data. - Add moving-average-*/apple_prices.csv. - Remove trailing / from value of TARGET_DIR. - Use "quick-clean: clean". - Remove trailing spaces.
4050a49
to
a310080
Compare
There are now quite a lot of new changes in |
To demonstrate the problem that this PR is intended to fix:
cd veracruz/workspaces
make clean
make linux
make linux
There will be several invocations of
cargo build
, but if any significant work happens after the secondmake linux
, that's a bug.transport-protocol/build.rs
: Put generated file in tmp dir and rename.This is to avoid unnecesssary rebuilds when several other crates have a path dependency on transport-protocol. Without this change, one of the crates getting rebuilt causes the timestamp on the generated file (
transport_protocol.rs
) to get updated, which makes the other crates get rebuilt bycargo build
next time.A neater solution might be to put the generated file under
OUT_DIR
, but currently that seems to be difficult.(See stepancheg/rust-protobuf#673.)
examples/data-generators/
: Fix dependencies on directories.Also various minor simplifications and tidying.
A dependency on a directory causes unnecessary rebuilds as make looks at the modification time of the directory, which gets updated as files are created in the directory, so the directory ends up being newer than some of the target files, forcing a rebuild. An order-only prerequisite is used to avoid this problem.
List of changes:
$(TARGET_DIR)
..SECONDEXPANSION
andnotdir
.moving-average-*/apple_prices.csv
./
from value ofTARGET_DIR
.quick-clean: clean
.