From 685f2eaf1e390dc5dcd5bc425ac15fc0c832125b Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 23 Mar 2018 14:55:42 +0100 Subject: [PATCH] Makefile: Simplify sub-project target generation Rewrite the sub-project targets without using $(shell) or $(eval) as they are not required. Signed-off-by: Lars-Peter Clausen --- Makefile | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index ccb1a8a16..78b9fae8c 100644 --- a/Makefile +++ b/Makefile @@ -17,18 +17,15 @@ help: @echo " make adv7511.zed" -PROJECTS := $(filter-out $(NO_PROJ), $(shell ls projects)) -define PROJECT_RULE -$1.$2: - cd projects/$1/$2; $(MAKE) -endef -define APROJECT_RULE - $(foreach archname,$(shell ls projects/$1), $(eval $(call PROJECT_RULE,$1,$(archname)))) -endef -$(foreach projname,$(PROJECTS), $(eval $(call APROJECT_RULE,$(projname)))) +PROJECTS := $(filter-out $(NO_PROJ), $(notdir $(wildcard projects/*))) +SUBPROJECTS := $(foreach projname,$(PROJECTS), \ + $(foreach archname,$(notdir $(wildcard projects/$(projname)/*)), \ + $(projname).$(archname))) +.PHONY: lib all clean clean-all $(SUBPROJECTS) -.PHONY: lib all clean clean-all +$(SUBPROJECTS): + $(MAKE) -C projects/$(subst .,/,$@) lib: $(MAKE) -C library/ all