### -*-makefile-*- CONFDIR = $(HOME)/.disorder SERVERS := $(patsubst $(CONFDIR)/passwd.%,%,\ $(wildcard $(CONFDIR)/passwd.*[!~])) config = $(CONFDIR)/passwd.$1 V = 0 V_AT = $(V_AT_$V) V_AT_0 = @ v_tag = $(call v_tag_$V,$1) v_tag_0 = @printf " %-8s %s\n" '$1' '$@'; help: @echo "usage: make fetch | diff | push" force: .PHONY: force BLACKLISTS = $(addprefix blacklist.,$(SERVERS)) $(BLACKLISTS): blacklist.%: force $(call v_tag,GET)\ disorder-autoplay get $(call config,$*) >$@.new && \ mv $@.new $@ fetch: $(BLACKLISTS) .PHONY: fetch clean::; rm -f blacklist.* DIFFS = $(addsuffix .diff,$(BLACKLISTS)) $(DIFFS): blacklist.%.diff: blacklist.% force $(call v_tag,DIFF)diff -u $< blacklist >$@.new; \ case $$? in 0 | 1) ;; *) exit $? ;; esac; \ mv $@.new $@ diff: $(DIFFS) $(V_AT)rc=0; for i in $(DIFFS); do \ if [ -s $$i ]; then rc=1; colordiff <$$i; fi; \ done; \ exit $$rc .PHONY: diff PUSHES = $(addprefix push/, $(SERVERS)) $(PUSHES): push/%: $(call v_tag,PUSH)\ disorder-autoplay set $(call config,$*) blacklist push: $(PUSHES) .PHONY: push $(PUSHES) t:; # $x