Skip to content

Commit

Permalink
Makefile: Simplify sub-project target generation
Browse files Browse the repository at this point in the history
Rewrite the sub-project targets without using $(shell) or $(eval) as they
are not required.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
  • Loading branch information
larsclausen authored and Csomi committed Apr 11, 2018
1 parent d5040d8 commit 685f2ea
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))))


.PHONY: lib all clean clean-all
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)

$(SUBPROJECTS):
$(MAKE) -C projects/$(subst .,/,$@)

lib:
$(MAKE) -C library/ all
Expand Down

0 comments on commit 685f2ea

Please sign in to comment.