Skip to content

mkrules: Apply object file dependencies to preprocessor targets. #17922

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jepler
Copy link
Contributor

@jepler jepler commented Aug 14, 2025

Summary

When using a preprocessing target like make build/main.pp, the target is not rebuilt when a header dependency has been modified.

This improves but does not 100% fix the situation: If the object file has previously been built, the same dependency list for the object file is used for the preprocessor target as well. However, building the .pp target does not update the dependency list, which could have changed.

So for example, the following sequence in ports/unix will rebuild main.pp where it wouldn't before:

make build-standard/main.o  # Create dependency information
make build-standard/main.pp
touch input.h
make build-standard/main.pp # Rebuilds now, wouldn't have before

Testing

I locally used the .pp targets and they behaved as I stated above.

Trade-offs and Alternatives

It might be better to just make the .pp targets .PHONY so that they're always re-made. They're quick enough, and the use case I'm aware of is for a developer who is explicitly invoking make for just that purpose.

Copy link

codecov bot commented Aug 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.38%. Comparing base (744270a) to head (831ae98).
⚠️ Report is 17 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #17922   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files         171      171           
  Lines       22295    22298    +3     
=======================================
+ Hits        21936    21939    +3     
  Misses        359      359           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

When using a preprocessing target like `make build/main.pp`,
the target is not rebuilt when a header dependency has been
modified.

This improves but does not 100% fix the situation: If the object
file has previously been built, the same dependency list for the
object file is used for the preprocessor target as well.

So for example, the following sequence in ports/unix will rebuild
`main.pp` where it wouldn't before:

```
make build-standard/main.o  # Create dependency information
make build-standard/main.pp
touch input.h
make build-standard/main.pp # Rebuilds now, wouldn't have before
```

Signed-off-by: Jeff Epler <jepler@gmail.com>
@jepler jepler force-pushed the preprocessor-dependency branch from a0cdb01 to 831ae98 Compare August 14, 2025 16:04
@dpgeorge dpgeorge added the py-core Relates to py/ directory in source label Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
py-core Relates to py/ directory in source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants