Running make in a set of subdirectories

.
├── Makefile
├── scripts
│   └── Makefile
└── tasks
    └── Makefile

All Makefiles have all, test and lint targets.

SUBDIRS = scripts tekton
TOPTARGETS = all lint test

$(TOPTARGETS): $(SUBDIRS)

$(SUBDIRS):
  $(MAKE) -C $@ $(MAKECMDGOALS)

.PHONY: $(SUBDIRS) $(TOPTARGETS)

$@ is an automatic variable that contains the target name (one of SUBDIRS in this case).

Source: stackoverflow

Last updated