summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolai Vyssotski <Nikolai.Vyssotski@amd.com>2022-09-24 08:48:15 -0500
committerMatt DeVillier <matt.devillier@amd.corp-partner.google.com>2023-08-08 19:10:12 +0000
commitb9d00727656bca661944a5192d3418dbb7f4ac9b (patch)
tree3062740e99d77e9b7093d6f0ea0ade6159e99685
parent3422cdd92bc724c0ca6b5c723ede2708756e2e83 (diff)
Makefile: Get rid of invalid paths
When wildcards are used in toplevel Makefile.inc it ends up appending all items including regular files into subdirs-y which then are treated as directories in "evaluate_subdirs" with "Makefile.inc" appended to them. Check for a valid path (existing Makefiles.inc) before attempting to process it. Change-Id: I368b5b9a7ece3c675674fcb24303276a87c15668 Signed-off-by: Nikolai Vyssotski <nikolai.vyssotski@amd.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/68800 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
-rw-r--r--Makefile23
1 files changed, 12 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index d86eaf014d..9f0b6795ef 100644
--- a/Makefile
+++ b/Makefile
@@ -273,17 +273,18 @@ src-to-ali=\
# Add paths to files in X-y to X-srcs
# Add subdirs-y to subdirs
includemakefiles= \
- $(foreach class,classes subdirs $(classes) $(special-classes), $(eval $(class)-y:=)) \
- $(eval -include $(1)) \
- $(foreach class,$(classes-y), $(call add-class,$(class))) \
- $(foreach special,$(special-classes), \
- $(foreach item,$($(special)-y), $(call $(special)-handler,$(dir $(1)),$(item)))) \
- $(foreach class,$(classes), \
- $(eval $(class)-srcs+= \
- $$(subst $(absobj)/,$(obj)/, \
- $$(subst $(top)/,, \
- $$(abspath $$(subst $(dir $(1))/,/,$$(addprefix $(dir $(1)),$$($(class)-y)))))))) \
- $(eval subdirs+=$$(subst $(CURDIR)/,,$$(wildcard $$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y))))))
+ $(if $(wildcard $(1)), \
+ $(foreach class,classes subdirs $(classes) $(special-classes), $(eval $(class)-y:=)) \
+ $(eval -include $(1)) \
+ $(foreach class,$(classes-y), $(call add-class,$(class))) \
+ $(foreach special,$(special-classes), \
+ $(foreach item,$($(special)-y), $(call $(special)-handler,$(dir $(1)),$(item)))) \
+ $(foreach class,$(classes), \
+ $(eval $(class)-srcs+= \
+ $$(subst $(absobj)/,$(obj)/, \
+ $$(subst $(top)/,, \
+ $$(abspath $$(subst $(dir $(1))/,/,$$(addprefix $(dir $(1)),$$($(class)-y)))))))) \
+ $(eval subdirs+=$$(subst $(CURDIR)/,,$$(wildcard $$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))))
# For each path in $(subdirs) call includemakefiles
# Repeat until subdirs is empty