summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/Makefile.headersinst6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index d2b572a7a628..1b405a7ed14f 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -20,8 +20,10 @@ dst := usr/include
-include $(src)/Kbuild
-src-subdirs := $(patsubst $(src)/%/,%,$(wildcard $(src)/*/))
-gen-subdirs := $(patsubst $(gen)/%/,%,$(wildcard $(gen)/*/))
+# $(filter %/, ...) is a workaround for GNU Make <= 4.2.1, where
+# $(wildcard $(src)/*/) contains not only directories but also regular files.
+src-subdirs := $(patsubst $(src)/%/,%,$(filter %/, $(wildcard $(src)/*/)))
+gen-subdirs := $(patsubst $(gen)/%/,%,$(filter %/, $(wildcard $(gen)/*/)))
all-subdirs := $(sort $(src-subdirs) $(gen-subdirs))
src-headers := $(if $(src-subdirs), $(shell cd $(src) && find $(src-subdirs) -name '*.h'))