From: Mark Wooding Date: Mon, 14 Mar 2022 17:53:42 +0000 (+0000) Subject: Makefile: Improve output appearance. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/epls/commitdiff_plain/fd176c0c719f50900b02692f8eb2dd3dc78194ff Makefile: Improve output appearance. --- diff --git a/Makefile b/Makefile index 30acdd8..8cfecb5 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,11 @@ force: V ?= 0 V_AT = $(V_AT_$V) V_AT_0 = @ +v-print = $(call v-print.$V,$1,$2) +v-print.1 = : +v-print.0 = printf " %-8s %s\n" "$1" "$2" v-tag = $(call v-tag.$V,$1) -v-tag.0 = @printf " %-8s %s\n" "$1" "$@"; +v-tag.0 = @$(call v-print.0,$1,$@); TARGETS = CLEANFILES += $(TARGETS) @@ -137,11 +140,22 @@ all: $(TARGETS) CHECKS = $(foreach p,$(PLAYLISTS), check/$p) check: $(CHECKS) $(CHECKS): check/%: %.m3u8 - diff -u $< ref/$*.m3u8 + $(V_AT)diff -u $< ref/$*.m3u8 .PHONY: check $(CHECKS) LINKS = $(foreach p,$(PLAYLISTS), link/$p) link: $(LINKS) $(LINKS): link/%: - ln -frs $*.m3u8 "$(ARCHIVEROOT)/$($*_INITIAL)/$($*_FULLNAME).m3u8" + $(V_AT) \ + ok=nil t="$(ARCHIVEROOT)/$($*_INITIAL)/$($*_FULLNAME).m3u8"; \ + if [ -L "$$t" ]; then \ + case $$(realpath "$$t") in \ + "$(abspath $*.m3u8)") ok=t ;; \ + esac; \ + fi; \ + case $$ok in \ + t) ;; \ + *) $(call v-print,LINK,$*); \ + ln -frs $*.m3u8 "$$t.new" && mv "$$t.new" "$$t" ;; \ + esac .PHONY: link $(LINKS)