GNU Make integration: Correctly react to the presence of `n` (`--just-print`) in `MAKEFLAGS`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Problem
Thanks to cargo implementing the jobserver protocol (#1744), you can already call cargo from a GNU make build and have both build systems figure out how many parallel jobs can be started at a given time. All you have to do is prefix the GNU Make recipe line in which cargo is invoked with a +.
Unfortunately, this has a nasty side effect: If you (or your IDE [^1]) only want to know what GNU Make would execute and start make -n, then make executes cargo anyway, assuming that sub-makes will know how to handle the MAKEFLAGS appropriately. Unfortunately, cargo actually completely ignores the presence of n in MAKEFLAGS and starts building stuff, which is the exact opposite of what the user wanted.
[^1]: CLion, for example, does this when importing Makefile projects
Proposed Solution
If n is present in MAKEFLAGS, cargo should only print the processes it would normally execute instead of actually executing build processes.
Notes
Relevant GNU Make documentation:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing Cargo's handling of MAKEFLAGS and its GNU Make jobserver integration, then reproduce the issue with make -n and a recipe invoking cargo. The work is done when a MAKEFLAGS value containing n causes Cargo to print the processes it would execute without starting build processes; add or update coverage for this behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100