summaryrefslogtreecommitdiffstats
path: root/update-file-lists.mk
diff options
context:
space:
mode:
Diffstat (limited to 'update-file-lists.mk')
-rwxr-xr-xupdate-file-lists.mk30
1 files changed, 30 insertions, 0 deletions
diff --git a/update-file-lists.mk b/update-file-lists.mk
new file mode 100755
index 0000000..4922758
--- /dev/null
+++ b/update-file-lists.mk
@@ -0,0 +1,30 @@
+#!/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