[PR #6164] [MERGED] build: automatically generate header dependencies #5853

Closed
opened 2026-05-05 10:46:09 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netblue30/firejail/pull/6164
Author: @kmk3
Created: 1/22/2024
Status: Merged
Merged: 1/30/2024
Merged by: @kmk3

Base: masterHead: build-header-depfiles


📝 Commits (2)

  • 54057e1 build: move EXTRA vars directly into targets
  • e665769 build: automatically generate header dependencies

📊 Changes

24 files changed (+81 additions, -56 deletions)

View changed files

📝 .gitignore (+1 -0)
📝 config.mk.in (+5 -2)
📝 configure (+46 -1)
📝 configure.ac (+7 -0)
📝 src/etc-cleanup/Makefile (+0 -2)
📝 src/fbuilder/Makefile (+0 -2)
📝 src/fcopy/Makefile (+0 -1)
📝 src/fids/Makefile (+0 -2)
📝 src/firecfg/Makefile (+0 -7)
📝 src/firejail/Makefile (+0 -13)
📝 src/firemon/Makefile (+0 -1)
📝 src/fldd/Makefile (+0 -1)
📝 src/fnet/Makefile (+0 -1)
📝 src/fnetfilter/Makefile (+0 -1)
📝 src/fsec-optimize/Makefile (+0 -1)
📝 src/fsec-print/Makefile (+0 -1)
📝 src/fseccomp/Makefile (+0 -1)
📝 src/fzenity/Makefile (+0 -2)
📝 src/jailcheck/Makefile (+0 -1)
📝 src/libpostexecseccomp/Makefile (+0 -2)

...and 4 more files

📄 Description

Instead of manually specifying which source files depend on which
headers, use compiler flags to automatically generate depfiles (.d),
which declare the correct header (make) dependencies for each source
file (.c).

Use -MMD (which ignores system headers) to generate the dependencies
and -MP to prevent make from complaining when a header file is removed
while it is listed as a dependency in a depfile.

If depfiles exist, just include them. If not, make each object file
(.o) unconditionally depend on all header files in its source directory
and in src/include, to ensure that rebuilds are done when needed. The
latter case applies to the first build after make clean (which would
build everything anyway) and when the compiler does not support
generating depfiles.

Note that both gcc and clang have supported these options for a long
time.

Misc: This depends on the changes from commit 5b1bd33c7 ("build: use
full paths on compile/link targets", 2023-07-02) / PR #6158 to avoid
issues with make dependency tracking.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netblue30/firejail/pull/6164 **Author:** [@kmk3](https://github.com/kmk3) **Created:** 1/22/2024 **Status:** ✅ Merged **Merged:** 1/30/2024 **Merged by:** [@kmk3](https://github.com/kmk3) **Base:** `master` ← **Head:** `build-header-depfiles` --- ### 📝 Commits (2) - [`54057e1`](https://github.com/netblue30/firejail/commit/54057e15f6160d2d8691b5f193063fd95495a37b) build: move EXTRA vars directly into targets - [`e665769`](https://github.com/netblue30/firejail/commit/e665769f5225062565b3a75677ce43eb37b988c5) build: automatically generate header dependencies ### 📊 Changes **24 files changed** (+81 additions, -56 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+1 -0) 📝 `config.mk.in` (+5 -2) 📝 `configure` (+46 -1) 📝 `configure.ac` (+7 -0) 📝 `src/etc-cleanup/Makefile` (+0 -2) 📝 `src/fbuilder/Makefile` (+0 -2) 📝 `src/fcopy/Makefile` (+0 -1) 📝 `src/fids/Makefile` (+0 -2) 📝 `src/firecfg/Makefile` (+0 -7) 📝 `src/firejail/Makefile` (+0 -13) 📝 `src/firemon/Makefile` (+0 -1) 📝 `src/fldd/Makefile` (+0 -1) 📝 `src/fnet/Makefile` (+0 -1) 📝 `src/fnetfilter/Makefile` (+0 -1) 📝 `src/fsec-optimize/Makefile` (+0 -1) 📝 `src/fsec-print/Makefile` (+0 -1) 📝 `src/fseccomp/Makefile` (+0 -1) 📝 `src/fzenity/Makefile` (+0 -2) 📝 `src/jailcheck/Makefile` (+0 -1) 📝 `src/libpostexecseccomp/Makefile` (+0 -2) _...and 4 more files_ </details> ### 📄 Description Instead of manually specifying which source files depend on which headers, use compiler flags to automatically generate depfiles (.d), which declare the correct header (make) dependencies for each source file (.c). Use `-MMD` (which ignores system headers) to generate the dependencies and `-MP` to prevent make from complaining when a header file is removed while it is listed as a dependency in a depfile. If depfiles exist, just include them. If not, make each object file (.o) unconditionally depend on all header files in its source directory and in src/include, to ensure that rebuilds are done when needed. The latter case applies to the first build after `make clean` (which would build everything anyway) and when the compiler does not support generating depfiles. Note that both gcc and clang have supported these options for a long time. Misc: This depends on the changes from commit 5b1bd33c7 ("build: use full paths on compile/link targets", 2023-07-02) / PR #6158 to avoid issues with make dependency tracking. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 10:46:09 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#5853
No description provided.