diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5b0b99d --- /dev/null +++ b/Makefile @@ -0,0 +1,69 @@ +FFMPEG ?= ffmpeg +FFMPEG += -v warning $(FFMPEGFLAGS) +OPUSENC ?= opusenc +ZOPFLIPNG ?= zopflipng +JPEGOPTIM ?= jpegoptim +CWEBP ?= cwebp + +DUMP ?= www/dump + +all: video audio images + +# === VIDEO === + +VIDEO := $(wildcard $(DUMP)/video/*.mkv) +MP4 := $(patsubst %.mkv,%.mp4,$(VIDEO)) +WEBM := $(patsubst %.mkv,%.webm,$(VIDEO)) +OGV := $(patsubst %.mkv,%.ogv,$(VIDEO)) +CVIDEO := $(MP4) $(WEBM) $(OGV) + +video: $(CVIDEO) + +%.mp4: %.mkv + $(FFMPEG) -i $< -c:v libx264 -preset slower -tune animation -c:a libfdk_aac $@ + +%.webm: %.mkv + $(FFMPEG) -i $< -c:v libvpx -crf 15 -b:v 1M -c:a copy $@ + +%.ogv: %.mkv + $(FFMPEG) -i $< -c:v libtheora -qscale:v 6 -c:a copy $@ + +# === AUDIO === + +AUDIO := $(shell find $(DUMP)/bgm $(DUMP)/sfx -name '*.ogg') +OPUS := $(patsubst %.ogg,%.opus,$(AUDIO)) +M4A := $(patsubst %.ogg,%.m4a,$(AUDIO)) +CAUDIO := $(OPUS) $(M4A) + +audio: $(CAUDIO) + +%.wav: %.ogg + $(FFMPEG) -i $< -c:a pcm_s16le $@ + +%.opus: %.wav + $(OPUSENC) --bitrate 64 $< $@ + +%.m4a: %.wav + $(FFMPEG) -i $< -c:a libfdk_aac -vbr 2 $@ + +# === IMAGES === + +PNG := $(shell find $(DUMP) -name '*.png') +JPG := $(shell find $(DUMP) -name '*.jpg') +WEBP := $(patsubst %.png,%.webp,$(PNG)) \ + $(patsubst %.jpg,%.webp,$(JPG)) + +images: $(WEBP) + +%.webp: %.png + $(ZOPFLIPNG) -m -y $< $< + $(CWEBP) -q 99 -m 6 $< -o $@ + +%.webp: %.jpg + $(JPEGOPTIM) --strip-all $< + $(CWEBP) -q 90 -m 6 $< -o $@ + +clean: + rm $(CVIDEO) $(CAUDIO) $(WEBP) + +.PHONY: video audio images clean |