jw-pkg/make/defs-dirs.mk
Jan Lindemann 51c42f7dda
defs-dirs.mk: Filter out non-existing ordered subdirs
SUBDIRS combines $(ORDERED_SUBDIRS) with the subdirectories found on disk.
An $(ORDERED_SUBDIRS) entry that does not exist in the tree is still passed
to the recursive make loop, which then errors out over the missing
directory.

Filter the ordered subdirectories through the wildcard of their Makefile
paths, keeping only the ones that are actually there.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-05 13:39:51 +02:00

10 lines
685 B
Makefile

FIND_SUBDIRS := $(filter-out . .. nomake CVS $(IGNORE_SUBDIRS),\
$(patsubst ./%,%,$(patsubst %/,%,$(dir $(shell $(FIND) . -maxdepth 2 -mindepth 2 -a \( -iname Makefile -o -iname GNUmakefile \))))))
SUBDIRS_TO_ITERATE = $(filter-out $(IGNORE_SUBDIRS),$(SUBDIRS))
EXTRA_SUBDIR_TARGETS ?=
ALLOWED_SUBDIR_TARGETS ?= all install clean distclean test link-in $(EXTRA_SUBDIR_TARGETS)
SUBDIRS ?= $(dir $(wildcard $(addsuffix /Makefile,$(ORDERED_SUBDIRS)))) $(filter-out $(ORDERED_SUBDIRS),$(FIND_SUBDIRS))
#SUBDIRS ?= $(filter-out $(ORDERED_SUBDIRS),$(FIND_SUBDIRS))
#SUBDIRS ?= $(FIND_SUBDIRS)