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>
This commit is contained in:
Nikolai Vyssotski 2022-09-24 08:48:15 -05:00 committed by Matt DeVillier
parent 3422cdd92b
commit b9d0072765
1 changed files with 12 additions and 11 deletions

View File

@ -273,17 +273,18 @@ src-to-ali=\
# Add paths to files in X-y to X-srcs # Add paths to files in X-y to X-srcs
# Add subdirs-y to subdirs # Add subdirs-y to subdirs
includemakefiles= \ includemakefiles= \
$(foreach class,classes subdirs $(classes) $(special-classes), $(eval $(class)-y:=)) \ $(if $(wildcard $(1)), \
$(eval -include $(1)) \ $(foreach class,classes subdirs $(classes) $(special-classes), $(eval $(class)-y:=)) \
$(foreach class,$(classes-y), $(call add-class,$(class))) \ $(eval -include $(1)) \
$(foreach special,$(special-classes), \ $(foreach class,$(classes-y), $(call add-class,$(class))) \
$(foreach item,$($(special)-y), $(call $(special)-handler,$(dir $(1)),$(item)))) \ $(foreach special,$(special-classes), \
$(foreach class,$(classes), \ $(foreach item,$($(special)-y), $(call $(special)-handler,$(dir $(1)),$(item)))) \
$(eval $(class)-srcs+= \ $(foreach class,$(classes), \
$$(subst $(absobj)/,$(obj)/, \ $(eval $(class)-srcs+= \
$$(subst $(top)/,, \ $$(subst $(absobj)/,$(obj)/, \
$$(abspath $$(subst $(dir $(1))/,/,$$(addprefix $(dir $(1)),$$($(class)-y)))))))) \ $$(subst $(top)/,, \
$(eval subdirs+=$$(subst $(CURDIR)/,,$$(wildcard $$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))) $$(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 # For each path in $(subdirs) call includemakefiles
# Repeat until subdirs is empty # Repeat until subdirs is empty