Skip to content

Instantly share code, notes, and snippets.

@dnhn
Last active April 5, 2025 16:27
Show Gist options
  • Select an option

  • Save dnhn/7d0fd120ea36ef3732e4f39d0cbde882 to your computer and use it in GitHub Desktop.

Select an option

Save dnhn/7d0fd120ea36ef3732e4f39d0cbde882 to your computer and use it in GitHub Desktop.
Makefiles
# make DIR=~/images
DIR ?= .
GIF_SOURCES := $(wildcard $(DIR)/*.gif)
JPEG_SOURCES := $(wildcard $(DIR)/*.jpeg)
JPG_SOURCES := $(wildcard $(DIR)/*.jpg)
PNG_SOURCES := $(wildcard $(DIR)/*.png)
SOURCES := $(GIF_SOURCES) $(JPEG_SOURCES) $(JPG_SOURCES) $(PNG_SOURCES)
TARGETS := $(SOURCES:.gif=.webp) $(SOURCES:.jpeg=.webp) $(SOURCES:.jpg=.webp) $(SOURCES:.png=.webp)
all: $(TARGETS)
OPTIONS := -m 6 -mt -short
%.webp: %.jpg
cwebp $(OPTIONS) $< -o $@
%.webp: %.jpeg
cwebp $(OPTIONS) $< -o $@
%.webp: %.png
cwebp $(OPTIONS) $< -o $@
%.webp: %.gif
cwebp $(OPTIONS) $< -o $@
.DEFAULT: run
run:
@echo "-S 'height:720,+size,+br' -S ext --restrict-filenames\n"
@yt-dlp -a yt.txt -S 'height:720,+size,+br' -S ext --restrict-filenames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment