xlate.conf: Get this under revision control.
[disorder-misc-config] / Makefile
CommitLineData
05b697b2
MW
1### -*-makefile-*-
2
3CONFDIR = $(HOME)/.disorder
4SERVERS := $(patsubst $(CONFDIR)/passwd.%,%,\
5 $(wildcard $(CONFDIR)/passwd.*[!~]))
6config = $(CONFDIR)/passwd.$1
7
8V = 0
9V_AT = $(V_AT_$V)
10V_AT_0 = @
11v_tag = $(call v_tag_$V,$1)
12v_tag_0 = @printf " %-8s %s\n" '$1' '$@';
13
14help:
15 @echo "usage: make fetch | diff | push"
16
17force:
18.PHONY: force
19
20BLACKLISTS = $(addprefix blacklist.,$(SERVERS))
21$(BLACKLISTS): blacklist.%: force
22 $(call v_tag,GET)\
23 disorder-autoplay get $(call config,$*) >$@.new && \
24 mv $@.new $@
25fetch: $(BLACKLISTS)
26.PHONY: fetch
27clean::; rm -f blacklist.*
28
29DIFFS = $(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 $@
34diff: $(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
41PUSHES = $(addprefix push/, $(SERVERS))
42$(PUSHES): push/%:
43 $(call v_tag,PUSH)\
44 disorder-autoplay set $(call config,$*) blacklist
45push: $(PUSHES)
46.PHONY: push $(PUSHES)
47
48t:; # $x