[PATCH 2/2] ACPI: tools: Rebuild objects when a header they include changes

From: Fuad Tabba

Date: Mon Oct 05 2026 - 11:38:46 EST


An incremental build of the ACPI tools recompiles an object only when
its .c file changes. The objects have no dependencies on the headers
they include, from include/acpi, drivers/acpi/acpica or the tools
themselves, so a header change leaves them built against the old one.

Generate a dependency file beside each object with -MMD, adding -MP so
that a removed header doesn't break the build, include those files, and
remove them on clean.

Assisted-by: LLM
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
---
tools/power/acpi/Makefile.rules | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/power/acpi/Makefile.rules b/tools/power/acpi/Makefile.rules
index 48d9280a63f72..b520a966c1c1b 100644
--- a/tools/power/acpi/Makefile.rules
+++ b/tools/power/acpi/Makefile.rules
@@ -21,13 +21,15 @@ $(KERNEL_INCLUDE)/acpi: FORCE
$(objdir)%.o: %.c | $(KERNEL_INCLUDE)/acpi
$(ECHO) " CC " $(subst $(OUTPUT),,$@)
$(QUIET) $(MKDIR) -p $(objdir) 2>/dev/null
- $(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
+ $(QUIET) $(CC) -c $(CFLAGS) -MMD -MP -o $@ $<
+
+-include $(toolobjs:.o=.d)

all: $(OUTPUT)$(TOOL)
clean:
$(ECHO) " RMOBJ " $(subst $(OUTPUT),,$(objdir))
$(QUIET) find $(objdir) \( -not -type d \)\
- -and \( -name '*~' -o -name '*.[oas]' \)\
+ -and \( -name '*~' -o -name '*.[oasd]' \)\
-type f -print | xargs rm -f
$(ECHO) " RM " $(TOOL)
$(QUIET) rm -f $(OUTPUT)$(TOOL)
--
2.39.5