summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2013-11-26 19:31:12 -0500
committerAlex Xu <alex_y_xu@yahoo.ca>2013-11-26 19:31:12 -0500
commit9d86b215eb990ca52af89c94776dae24f4463e46 (patch)
treeb698cc173349883d2735e4154e392a4898b53d61 /Makefile
parentfb3d7df90cbfa8ed6e6fcde64404907b62928c0c (diff)
downloadhtml5ks-9d86b215eb990ca52af89c94776dae24f4463e46.tar.xz
html5ks-9d86b215eb990ca52af89c94776dae24f4463e46.zip
Stuff.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile69
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