Rename `Sapphire and Steel' to `Sapphire & Steel'.
[epls] / Makefile
... / ...
CommitLineData
1### -*-makefile-*-
2
3all:
4clean::; rm -f $(CLEANFILES)
5realclean::; rm -f $(REALCLEANFILES)
6force:
7.PHONY: all clean force
8.SECONDEXPANSION: # not sorry
9SHELL = bash
10
11V ?= 0
12V_AT = $(V_AT_$V)
13V_AT_0 = @
14v-print = $(call v-print.$V,$1,$2)
15v-print.1 = :
16v-print.0 = printf " %-8s %s\n" "$1" "$2"
17v-tag = $(call v-tag.$V,$1)
18v-tag.0 = @$(call v-print.0,$1,$@);
19
20TARGETS =
21CLEANFILES += $(TARGETS)
22REALCLEANFILES += $(CLEANFILES)
23
24MKM3UFLAGS = -dmkm3u.cache
25REALCLEANFILES += mkm3u.cache
26
27define %declare-playlist
28PLAYLISTS += $1
29$1_FULLNAME = $2
30endef
31
32define %declare-simple-playlist
33$1_EPLS = $1.epls
34$1_MKM3UFLAGS =
35endef
36
37define %declare-chapter-playlist
38$1_EPLS = $2.epls
39$1_MKM3UFLAGS = -c
40endef
41
42define %declare-filter-playlist
43$1_EPLS = $2.epls
44$1_MKM3UFLAGS = -s$3
45endef
46
47declare-playlist = \
48 $(eval $(call %declare-playlist,$1,$2)) \
49 $(eval $(call %declare-simple-playlist,$1))
50declare-chapters-only = \
51 $(eval $(call %declare-playlist,$1,$2)) \
52 $(eval $(call %declare-chapter-playlist,$1,$1))
53declare-chapters = \
54 $(eval $(call %declare-playlist,$1,$2)) \
55 $(eval $(call %declare-simple-playlist,$1)) \
56 $(eval $(call %declare-playlist,$1-chap,$2 (chapters))) \
57 $(eval $(call %declare-chapter-playlist,$1-chap,$1))
58declare-filter = \
59 $(eval $(call %declare-playlist,$1,$4)) \
60 $(eval $(call %declare-filter-playlist,$1,$2,$3))
61
62ARCHIVEROOT = ../archive
63
64$(call declare-playlist, 24, \#/24)
65$(call declare-playlist, agent-carter, A/Agent Carter)
66$(call declare-playlist, agents-of-shield, A/Agents of SHIELD)
67$(call declare-playlist, andromeda, A/Andromeda)
68$(call declare-playlist, arrowverse, A/Arrowverse)
69$(call declare-filter, arrow, arrowverse,arr, A/Arrow)
70$(call declare-filter, the-flash, arrowverse,fls, F/The Flash)
71$(call declare-filter, constantine, arrowverse,cns, C/Constantine)
72$(call declare-filter, supergirl, arrowverse,spg, S/Supergirl)
73$(call declare-filter, legends-of-tomorrow, arrowverse,lot, L/Legends of Tomorrow)
74$(call declare-filter, batwoman, arrowverse,bwm, B/Batwoman)
75$(call declare-filter, black-lightning, arrowverse,blt, B/Black Lightning)
76$(call declare-filter, stargirl, arrowverse,stg, S/Stargirl)
77$(call declare-playlist, a-team, A/The A-Team)
78$(call declare-playlist, the-americans, A/The Americans)
79$(call declare-playlist, allo-allo, A/'Allo 'Allo!)
80$(call declare-playlist, babylon-5, B/Babylon 5)
81$(call declare-playlist, batman-1966, B/Batman (1966))
82$(call declare-playlist, bsg-1978, B/Battlestar Galactica (1978))
83$(call declare-playlist, bsg-1980, B/Battlestar Galactica 1980)
84$(call declare-playlist, bsg-2003, B/Battlestar Galactica (2003))
85$(call declare-playlist, between-the-lines, B/Between the Lines)
86$(call declare-playlist, blackadder, B/Blackadder)
87$(call declare-playlist, blakes-7, B/Blake's 7) #'
88$(call declare-playlist, brass-eye, B/Brass Eye)
89$(call declare-playlist, the-bridge, B/The Bridge)
90$(call declare-playlist, buffyverse, B/Buffyverse)
91$(call declare-filter, btvs, buffyverse,b, B/Buffy the Vampire Slayer)
92$(call declare-filter, angel, buffyverse,a, A/Angel)
93$(call declare-playlist, caprica, C/Caprica)
94$(call declare-playlist, cracker, C/Cracker)
95$(call declare-playlist, crow-stairway, C/The Crow—Stairway to Heaven)
96$(call declare-playlist, danger-mouse, D/Danger Mouse)
97$(call declare-playlist, dark-angel, D/Dark Angel)
98$(call declare-playlist, the-day-today, D/The Day Today)
99$(call declare-playlist, dexter, D/Dexter)
100$(call declare-playlist, drwho-marco-polo, D/Doctor Who/S01E04 D. Marco Polo)
101$(call declare-playlist, drwho-crusade, D/Doctor Who/S02E06 P. The Crusade)
102$(call declare-playlist, drwho-masterplan, D/Doctor Who/S03E04 V. The Daleks' Master Plan) #'
103$(call declare-playlist, drwho-massacre, D/Doctor Who/S03E05 W. The Massacre of St Bartholomew's Eve) #'
104$(call declare-playlist, drwho-toymaker, D/Doctor Who/S03E07 Y. The Celestial Toymaker)
105$(call declare-playlist, drwho-savages, D/Doctor Who/S03E09 AA. The Savages)
106$(call declare-playlist, drwho-smugglers, D/Doctor Who/S04E01 CC. The Smugglers)
107$(call declare-playlist, drwho-highlanders, D/Doctor Who/S04E04 FF. The Highlanders)
108$(call declare-playlist, drwho-snowmen, D/Doctor Who/S05E02 NN. The Abominable Snowmen)
109$(call declare-playlist, drwho-wheel, D/Doctor Who/S05E07 SS. The Wheel in Space)
110$(call declare-playlist, drwho-invasion, D/Doctor Who/S06E03 VV. The Invasion)
111$(call declare-playlist, drwho-pirates, D/Doctor Who/S06E06 YY. The Space Pirates)
112$(call declare-playlist, drwho-war-games, D/Doctor Who/S06E07 ZZ. The War Games)
113$(call declare-playlist, drwho-silurians, D/Doctor Who/S07E02 BBB. Doctor Who and the Silurians)
114$(call declare-playlist, dollhouse, D/Dollhouse)
115$(call declare-playlist, dune-2000, D/Dune (2000))
116$(call declare-playlist, engrenages, E/Engrenages)
117$(call declare-playlist, equalizer, E/The Equalizer (1985))
118$(call declare-playlist, fawlty-towers, F/Fawlty Towers)
119$(call declare-playlist, firefly, F/Firefly)
120$(call declare-chapters, fry-and-laurie, F/A Bit of Fry and Laurie)
121$(call declare-playlist, game-of-thrones, G/Game of Thrones)
122$(call declare-playlist, godfather-ii, G/The Godfather Trilogy/02. Part II)
123$(call declare-playlist, gotham, G/Gotham)
124$(call declare-playlist, hannibal, H/Hannibal)
125$(call declare-playlist, hhgttg, H/The Hitchhiker's Guide to the Galaxy) #'
126$(call declare-playlist, sherlock-holmes, H/Sherlock Holmes (1984))
127$(call declare-playlist, house-of-cards, H/House of Cards)
128$(call declare-playlist, i-claudius, I/I Claudius)
129$(call declare-playlist, into-the-labyrinth, I/Into the Labyrinth)
130$(call declare-playlist, it-2017, I/It (2017))
131$(call declare-playlist, snyder-justice, J/Justice League (Snyder cut))
132$(call declare-playlist, kill-bill, K/Kill Bill)
133$(call declare-playlist, the-killing, K/The Killing)
134$(call declare-playlist, kingdom-of-heaven, K/Kingdom of Heaven (Definitive Edition))
135$(call declare-playlist, knight-rider, K/Knight Rider)
136$(call declare-playlist, lexx, L/Lexx)
137$(call declare-playlist, lois-and-clark, L/Lois and Clark—The New Adventures of Superman)
138$(call declare-playlist, morse, M/Inspector Morse)
139$(call declare-playlist, macgyver, M/MacGyver)
140$(call declare-chapters, metallica-s-and-m, M/Metallica—S&M)
141$(call declare-playlist, the-night-manager, N/The Night Manager)
142$(call declare-playlist, person-of-interest, P/Person of Interest)
143$(call declare-playlist, harry-potter, P/Harry Potter)
144$(call declare-playlist, prime-suspect, P/Prime Suspect)
145$(call declare-playlist, the-prisoner, P/The Prisoner)
146$(call declare-playlist, flying-circus-restored, P/Monty Python's Flying Circus (restored)) #'
147$(call declare-chapters-only, flying-circus-sketches, P/Monty Python's Flying Circus (sketches)) #'
148$(call declare-playlist, robin-of-sherwood, R/Robin of Sherwood)
149$(call declare-playlist, buck-rogers, R/Buck Rogers in the 25th Century)
150$(call declare-playlist, rome, R/Rome)
151$(call declare-playlist, sanctuary, S/Sanctuary)
152$(call declare-playlist, sapphire-and-steel, S/Sapphire & Steel)
153$(call declare-playlist, shark, S/Shark)
154$(call declare-playlist, sharpe, S/Sharpe)
155$(call declare-playlist, the-shield, S/The Shield)
156$(call declare-playlist, smallville, S/Smallville)
157$(call declare-playlist, george-smiley, S/George Smiley)
158$(call declare-playlist, spartacus, S/Spartacus)
159$(call declare-playlist, spooks, S/Spooks)
160$(call declare-playlist, star-wars, S/Star Wars)
161$(call declare-filter, skywalker-saga, star-wars,sws, S/Star Wars—The Skywalker Saga)
162$(call declare-filter, starwars-stories, star-wars,sty, S/Star Wars Stories)
163$(call declare-filter, clone-wars, star-wars,tcw, S/Star Wars—The Clone Wars)
164$(call declare-filter, rebels, star-wars,rbl, S/Star Wars—Rebels)
165$(call declare-playlist, stargate, S/Stargate)
166$(call declare-filter, stargate-sg1, stargate,sg1, S/Stargate SG-1)
167$(call declare-filter, stargate-atlantis, stargate,sga, S/Stargate Atlantis)
168$(call declare-filter, stargate-universe, stargate,sgu, S/Stargate Universe)
169$(call declare-playlist, state-of-play, S/State of Play)
170$(call declare-playlist, terminator-scc, T/Terminator—The Sarah Connor Chronicles)
171$(call declare-playlist, traffik, T/Traffik)
172$(call declare-playlist, the-tripods, T/The Tripods)
173$(call declare-playlist, tru-calling, T/Tru Calling)
174$(call declare-playlist, twin-peaks, T/Twin Peaks)
175$(call declare-playlist, ultraviolet, U/Ultraviolet)
176$(call declare-playlist, v-1983, V/V (1983))
177$(call declare-playlist, v-2009, V/V (2009))
178$(call declare-playlist, the-wire, W/The Wire)
179$(call declare-playlist, waking-the-dead, W/Waking the Dead)
180$(call declare-playlist, wonder-woman-1975, W/Wonder Woman (1975))
181$(call declare-playlist, worricker, W/The Worricker trilogy)
182$(call declare-playlist, yes-minister, Y/Yes Minister)
183$(call declare-playlist, the-young-ones, Y/The Young Ones)
184
185M3US = $(addsuffix .m3u8,$(PLAYLISTS))
186DEPFILES += $(addsuffix .dep,$(PLAYLISTS))
187TARGETS += $(M3US)
188CLEANFILES += $(DEPFILES)
189
190CLEANFILES += mkm3u.cache-stamp
191mkm3u.cache-stamp:
192 if [ ! -f mkm3u.cache ]; then \
193 ./mkm3u -i -dmkm3u.cache.new && mv mkm3u.cache.new mkm3u.cache; \
194 fi
195 touch $@
196
197CLEANFILES += *.m3u8.new
198$(M3US): %.m3u8: $$($$*_EPLS) mkm3u mkm3u.cache-stamp
199 $(call v-tag,MKM3U)./mkm3u $(MKM3UFLAGS) $($*_MKM3UFLAGS) \
200 -M$*.dep -O$@ -o"$@.new" "$<" && mv "$@.new" "$@"
201
202CHECKS = $(foreach p,$(PLAYLISTS), check/$p)
203check: $(CHECKS)
204$(CHECKS): check/%: %.m3u8
205 $(V_AT)diff -u $< ref/$*.m3u8
206.PHONY: check $(CHECKS)
207
208LINKS = $(foreach p,$(PLAYLISTS), link/$p)
209link: $(LINKS)
210$(LINKS): link/%:
211 $(V_AT) \
212 ok=nil t="$(ARCHIVEROOT)/$($*_FULLNAME).m3u8"; \
213 if [ -L "$$t" ]; then \
214 case $$(realpath "$$t") in \
215 "$(abspath $*.m3u8)") ok=t ;; \
216 esac; \
217 fi; \
218 case $$ok in \
219 t) ;; \
220 *) $(call v-print,LINK,$*); \
221 ln -frs $*.m3u8 "$$t.new" && mv "$$t.new" "$$t" ;; \
222 esac
223.PHONY: link $(LINKS)
224
225SAVE = $(foreach p,$(PLAYLISTS), save/$p)
226FORCE_SAVE = $(foreach p,$(PLAYLISTS), force-save/$p)
227save: $(SAVE)
228force-save: $(FORCE_SAVE)
229$(SAVE): save/%: %.m3u8
230 $(V_AT) \
231 ok=nil; \
232 if ! [ -f "ref/$*.m3u8" ]; then \
233 $(call v-print,SAVE,$*); \
234 cp $< ref/$*.m3u8.new && mv ref/$*.m3u8.new ref/$*.m3u8; \
235 fi
236.PHONY: save $(SAVE)
237$(FORCE_SAVE): force-save/%: %.m3u8
238 $(V_AT) \
239 ok=nil; \
240 if ! [ -f "ref/$*.m3u8" ] || ! cmp -s $< ref/$*.m3u8; then \
241 $(call v-print,SAVE,$*); \
242 cp $< ref/$*.m3u8.new && mv ref/$*.m3u8.new ref/$*.m3u8; \
243 fi
244.PHONY: save $(SAVE)
245
246comma = ,
247check-deps = $(shell if [ -f $1 ]; then for i in $2; do \
248 if ! [ "$$i" -ot $1 ]; then \
249 echo force; break; \
250 fi; \
251 done; fi)
252-include $(DEPFILES)
253
254all: $(TARGETS)
255
256p:; : $p