blob: 490fd56c15675e7e62f4d75a7b4c2742eb6b8e5a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# SPDX-FileCopyrightText: 2023 Brian Woods
# SPDX-License-Identifier: GPL-2.0-or-later
SRC_DIR=src
HIGH_OUT_DIR=high_quality
LOW_OUT_DIR=low_quality
HIGH_WEBP_OPT=-near_lossless 60
LOW_WEBP_OPT=-af -pass 6 -psnr 38
SRC_PNG=$(shell find ${SRC_DIR}/ -type f -iname '*.png')
SRC_WEBP=$(shell find ${SRC_DIR}/ -type f -iname '*.webp')
HIGH_OUT=$(patsubst ${SRC_DIR}/%.png, ${HIGH_OUT_DIR}/%.webp, $(SRC_PNG)) \
$(patsubst ${SRC_DIR}/%.webp, ${HIGH_OUT_DIR}/%.webp, $(SRC_WEBP))
LOW_OUT=$(patsubst ${SRC_DIR}/%.png, ${LOW_OUT_DIR}/%.webp, $(SRC_PNG)) \
$(patsubst ${SRC_DIR}/%.webp, ${LOW_OUT_DIR}/%.webp, $(SRC_WEBP))
.PHONY: all clean high low
.SECONDARY: main-build-high main-build-low
all: high low
high: pre-build-high main-build-high
low: pre-build-low main-build-low
pre-build-high:
( cd ${SRC_DIR}; find ./ -mindepth 1 -type d ) | xargs -I{} mkdir -p "${HIGH_OUT_DIR}/{}"
pre-build-low:
( cd ${SRC_DIR}; find ./ -mindepth 1 -type d ) | xargs -I{} mkdir -p "${LOW_OUT_DIR}/{}"
main-build-high: ${HIGH_OUT}
main-build-low: ${LOW_OUT}
${HIGH_OUT_DIR}/%.webp: ${SRC_DIR}/%.*
cwebp ${HIGH_WEBP_OPT} "$<" -o "$@"
${LOW_OUT_DIR}/%.webp: ${SRC_DIR}/%.*
cwebp ${LOW_WEBP_OPT} "$<" -o "$@"
clean:
rm -rf ${HIGH_OUT_DIR} ${LOW_OUT_DIR}
|