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)
$(call declare-playlist, firefly, F,Firefly)
#$(call declare-playlist, the-flash, F,The Flash)
$(call declare-playlist, fry-and-laurie, F,A Bit of Fry and Laurie)
-#$(call declare-playlist, game-of-thrones, G,Game of Thrones)
+$(call declare-playlist, game-of-thrones, G,Game of Thrones)
#$(call declare-playlist, godfather-ii, G/The Godfather Trilogy,02. Part II)
#$(call declare-playlist, gotham, G,Gotham)
#$(call declare-playlist, hannibal, H,Hannibal)
#$(call declare-playlist, harry-potter, P,Harry Potter)
$(call declare-playlist, flying-circus, P,Monty Python's Flying Circus) #'
$(call declare-playlist, robin-of-sherwood, R,Robin of Sherwood)
-#$(call declare-playlist, rome, R,Rome)
+$(call declare-playlist, rome, R,Rome)
#$(call declare-playlist, sanctuary, S,Sanctuary)
-#$(call declare-playlist, shark, S,Shark)
+$(call declare-playlist, shark, S,Shark)
#$(call declare-playlist, the-shield, S,The Shield)
#$(call declare-playlist, smallville, S,Smallville)
#$(call declare-playlist, george-smiley, S,George Smiley)
#$(call declare-playlist, ultraviolet, U,Ultraviolet)
#$(call declare-playlist, v-1983, V,V (1983))
#$(call declare-playlist, v-2009, V,V (2009))
-#$(call declare-playlist, the-wire, W,The Wire)
-#$(call declare-playlist, waking-the-dead, W,Waking the Dead)
+$(call declare-playlist, the-wire, W,The Wire)
+$(call declare-playlist, waking-the-dead, W,Waking the Dead)
#$(call declare-playlist, wonder-woman-1975, W,Wonder Woman (1975))
#$(call declare-playlist, yes-minister, Y,Yes Minister)
#$(call declare-playlist, the-young-ones, Y,The Young Ones)
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)
+
+SAVE = $(foreach p,$(PLAYLISTS), save/$p)
+FORCE_SAVE = $(foreach p,$(PLAYLISTS), force-save/$p)
+save: $(SAVE)
+force-save: $(FORCE_SAVE)
+$(SAVE): save/%: %.m3u8
+ $(V_AT) \
+ ok=nil; \
+ if ! [ -f "ref/$*.m3u8" ]; then \
+ $(call v-print,SAVE,$*); \
+ cp $< ref/$*.m3u8.new && mv ref/$*.m3u8.new ref/$*.m3u8; \
+ fi
+.PHONY: save $(SAVE)
+$(FORCE_SAVE): force-save/%: %.m3u8
+ $(V_AT) \
+ ok=nil; \
+ if ! [ -f "ref/$*.m3u8" ] || ! cmp -s $< ref/$*.m3u8; then \
+ $(call v-print,SAVE,$*); \
+ cp $< ref/$*.m3u8.new && mv ref/$*.m3u8.new ref/$*.m3u8; \
+ fi
+.PHONY: save $(SAVE)