#!/usr/bin/make -srf summary := $(wildcard */summary) which ?= all ifeq (,$(summary)) dirs := $(wildcard */) $(which).list: $(dirs:=$(which).list) cat -- $^ > $@.new mv -f $@.new $@ me := $(MAKEFILE_LIST) FORCE:; $(dirs:=$(which).list): FORCE $(MAKE) -f `(cd $(dir $(me)); pwd)`/$(notdir $(me)) \ -C $(@D) which=$(which) else $(which).list: %.list: $(summary) (echo 'all:\'; \ list-files.sh $* | sed 's,^.*$$,test@/&\\,'; \ echo) > $@.new mv -f $@.new $@ endif