diff options
author | 2023-07-05 23:56:06 -0300 | |
---|---|---|
committer | 2024-01-22 18:05:47 -0300 | |
commit | e665769f5225062565b3a75677ce43eb37b988c5 (patch) | |
tree | ba46eebf03f497bfa9669c85d10e41fcef946895 /src/firecfg | |
parent | build: move EXTRA vars directly into targets (diff) | |
download | firejail-e665769f5225062565b3a75677ce43eb37b988c5.tar.gz firejail-e665769f5225062565b3a75677ce43eb37b988c5.tar.zst firejail-e665769f5225062565b3a75677ce43eb37b988c5.zip |
build: automatically generate header dependencies
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.
Diffstat (limited to 'src/firecfg')
-rw-r--r-- | src/firecfg/Makefile | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/src/firecfg/Makefile b/src/firecfg/Makefile index cc7a27c52..6cbd1b5ba 100644 --- a/src/firecfg/Makefile +++ b/src/firecfg/Makefile | |||
@@ -7,13 +7,6 @@ MOD_DIR = $(ROOT)/src/$(MOD) | |||
7 | PROG = $(MOD_DIR)/$(MOD) | 7 | PROG = $(MOD_DIR)/$(MOD) |
8 | TARGET = $(PROG) | 8 | TARGET = $(PROG) |
9 | 9 | ||
10 | EXTRA_HDRS = \ | ||
11 | ../include/common.h \ | ||
12 | ../include/euid_common.h \ | ||
13 | ../include/libnetlink.h \ | ||
14 | ../include/firejail_user.h \ | ||
15 | ../include/pid.h | ||
16 | |||
17 | EXTRA_OBJS = ../lib/common.o ../lib/firejail_user.o | 10 | EXTRA_OBJS = ../lib/common.o ../lib/firejail_user.o |
18 | 11 | ||
19 | include $(ROOT)/src/prog.mk | 12 | include $(ROOT)/src/prog.mk |