From e665769f5225062565b3a75677ce43eb37b988c5 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Wed, 5 Jul 2023 23:56:06 -0300 Subject: 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. --- src/fseccomp/Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'src/fseccomp') diff --git a/src/fseccomp/Makefile b/src/fseccomp/Makefile index 89b12f629..66bb58444 100644 --- a/src/fseccomp/Makefile +++ b/src/fseccomp/Makefile @@ -7,7 +7,6 @@ MOD_DIR = $(ROOT)/src/$(MOD) PROG = $(MOD_DIR)/$(MOD) TARGET = $(PROG) -EXTRA_HDRS = ../include/common.h ../include/syscall.h EXTRA_OBJS = ../lib/common.o ../lib/errno.o ../lib/syscall.o include $(ROOT)/src/prog.mk -- cgit v1.2.3-54-g00ecf