blob: b499eefc95168bdc4b7027accb682592fb7fec7b (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/sh
: ${CC:=gcc}
: ${CARGS:=-std=c99 -lm -O3}
: ${FPS:=30}
: ${PLAYER:=mpv}
: ${PLAYERARGS:=--no-correct-pts --container-fps-override=\$FPS -}
: ${RENDER:=ffmpeg}
: ${RENDERARGS:=-r \$FPS -i - \$bin.mp4}
binname() {
name="${1%%.c}"
echo "${name##*/}"
}
make_compile() {
bin="$(binname "$1")"
$(eval "echo \"$CC\"") $(eval "echo \"$CARGS\"") AnimationRender/*.c FrameRender/*.c RGBImage/*.c "$1" -o "$bin"
}
make_run() {
bin="$(binname "$1")"
"./$bin" | $(eval "echo \"$PLAYER\"") $(eval "echo \"$PLAYERARGS\"")
}
make_render() {
bin="$(binname "$1")"
"./$bin" | $(eval "echo \"$RENDER\"") $(eval "echo \"$RENDERARGS\"")
}
if [ ! -f "$2" ]
then
echo "'$2' is not valid! Must be the path to a C file which contains main function."
exit 2
fi
case "$1" in
(compile)
make_compile "$2"
;;
(run)
make_compile "$2"
make_run "$2"
;;
(render)
make_compile "$2"
make_render "$2"
;;
(*)
echo "Unrecognised action '$1'!"
exit 1
esac
|