[PATCH 1/2] ACPI: tools: Link include/acpi instead of copying it
From: Fuad Tabba
Date: Mon Oct 05 2026 - 11:41:27 EST
An incremental build of the ACPI tools uses an old copy of the
include/acpi headers after they change. The copy under $(OUTPUT)include
is made by a rule for the directory with no prerequisites, so once it
exists it's never refreshed.
Link $(OUTPUT)include/acpi to include/acpi instead, which keeps the rest
of include/ out of the tools' include path as the copy did. The link is
recreated on every build, so it also replaces a copy left by an earlier
one, and the objects take it as an order-only prerequisite so that
recreating it rebuilds nothing. Rebuilding them when a header changes
is the next patch.
Fixes: d5a4b1a540b8 ("tools/power/acpi: Remove direct kernel source include reference")
Assisted-by: LLM
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
---
tools/power/acpi/Makefile.rules | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/tools/power/acpi/Makefile.rules b/tools/power/acpi/Makefile.rules
index b71aada776889..48d9280a63f72 100644
--- a/tools/power/acpi/Makefile.rules
+++ b/tools/power/acpi/Makefile.rules
@@ -13,13 +13,12 @@ $(OUTPUT)$(TOOL): $(toolobjs) FORCE
$(ECHO) " STRIP " $(subst $(OUTPUT),,$@)
$(QUIET) $(STRIPCMD) $@
-$(KERNEL_INCLUDE):
- $(ECHO) " MKDIR " $(subst $(OUTPUT),,$@)
+$(KERNEL_INCLUDE)/acpi: FORCE
$(QUIET) mkdir -p $(KERNEL_INCLUDE)
- $(ECHO) " CP " $(subst $(OUTPUT),,$@)
- $(QUIET) cp -rf $(srctree)/../../../include/acpi $(KERNEL_INCLUDE)/
+ $(QUIET) rm -rf $@
+ $(QUIET) ln -s $(abspath $(srctree)/../../../include/acpi) $@
-$(objdir)%.o: %.c $(KERNEL_INCLUDE)
+$(objdir)%.o: %.c | $(KERNEL_INCLUDE)/acpi
$(ECHO) " CC " $(subst $(OUTPUT),,$@)
$(QUIET) $(MKDIR) -p $(objdir) 2>/dev/null
$(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
--
2.39.5