summaryrefslogtreecommitdiffstats
path: root/update-file-lists.mk
blob: 05edbc0e0c83021e736b8dc1fc699698425125d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/make -srf

summary := $(wildcard */summary)

which ?= all

ifeq (,$(summary))

dirs := $(wildcard */)

$(which).list: $(dirs:=$(which).list)
	sort -R -- $^ > $@.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@/&\\,' | sort -R; \
	 echo) > $@.new
	mv -f $@.new $@

endif