Commit | Line | Data |
---|---|---|
05b697b2 MW |
1 | ### -*-makefile-*- |
2 | ||
3 | CONFDIR = $(HOME)/.disorder | |
4 | SERVERS := $(patsubst $(CONFDIR)/passwd.%,%,\ | |
5 | $(wildcard $(CONFDIR)/passwd.*[!~])) | |
6 | config = $(CONFDIR)/passwd.$1 | |
7 | ||
8 | V = 0 | |
9 | V_AT = $(V_AT_$V) | |
10 | V_AT_0 = @ | |
11 | v_tag = $(call v_tag_$V,$1) | |
12 | v_tag_0 = @printf " %-8s %s\n" '$1' '$@'; | |
13 | ||
14 | help: | |
15 | @echo "usage: make fetch | diff | push" | |
16 | ||
17 | force: | |
18 | .PHONY: force | |
19 | ||
20 | BLACKLISTS = $(addprefix blacklist.,$(SERVERS)) | |
21 | $(BLACKLISTS): blacklist.%: force | |
22 | $(call v_tag,GET)\ | |
23 | disorder-autoplay get $(call config,$*) >$@.new && \ | |
24 | mv $@.new $@ | |
25 | fetch: $(BLACKLISTS) | |
26 | .PHONY: fetch | |
27 | clean::; rm -f blacklist.* | |
28 | ||
29 | DIFFS = $(addsuffix .diff,$(BLACKLISTS)) | |
30 | $(DIFFS): blacklist.%.diff: blacklist.% force | |
31 | $(call v_tag,DIFF)diff -u $< blacklist >$@.new; \ | |
32 | case $$? in 0 | 1) ;; *) exit $? ;; esac; \ | |
33 | mv $@.new $@ | |
34 | diff: $(DIFFS) | |
35 | $(V_AT)rc=0; for i in $(DIFFS); do \ | |
36 | if [ -s $$i ]; then rc=1; colordiff <$$i; fi; \ | |
37 | done; \ | |
38 | exit $$rc | |
39 | .PHONY: diff | |
40 | ||
41 | PUSHES = $(addprefix push/, $(SERVERS)) | |
42 | $(PUSHES): push/%: | |
43 | $(call v_tag,PUSH)\ | |
44 | disorder-autoplay set $(call config,$*) blacklist | |
45 | push: $(PUSHES) | |
46 | .PHONY: push $(PUSHES) | |
47 | ||
48 | t:; # $x |