From c8746a3651c905b56aaba5b5f94492588542a79e Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 14 Mar 2022 17:57:02 +0000 Subject: [PATCH] Makefile: Add rules for saving output references. --- Makefile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Makefile b/Makefile index 8cfecb5..257b254 100644 --- a/Makefile +++ b/Makefile @@ -159,3 +159,24 @@ $(LINKS): 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) -- 2.11.0