-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
115 lines (92 loc) · 3.34 KB
/
Makefile
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Copyright 2022, 2023, 2024 David Corbett
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
COVER_ART_DIMENSIONS := 960x960
OPEN := open
PARCHMENT ?= ../parchment.html
.PHONY: all
all: pygmentalion.t3 pygmentalion-web.t3
.PHONY: play-curses
play-curses: pygmentalion.t3
frob -p -i curses $<
.PHONY: play-emglken
play-emglken: pygmentalion.t3
emglken $<
.PHONY: play-gargoyle
play-gargoyle: pygmentalion.t3
open -a Gargoyle $<
.PHONY: play-lectrote
play-lectrote: pygmentalion.t3
open -a Lectrote $<
.PHONY: play-parchment
play-parchment: pygmentalion.t3
"$(OPEN)" "$(PARCHMENT)"
.PHONY: play-plain
play-plain: pygmentalion.t3
frob -p -k UTF-8 -i plain $<
.PHONY: play-qtads
play-qtads: pygmentalion.t3
open -a QTads $<
.PHONY: play-spatterlight
play-spatterlight: pygmentalion.t3
open -a Spatterlight -n $<
.PHONY: play-web
play-web: pygmentalion-web.t3
frob -i plain -p -N 44 $< | { read -r line; read -r line; "$(OPEN)" "$$(printf %s "$$line" | cut -f 2- -d :)"; }
.PHONY: play-xtads
play-xtads: pygmentalion.t3
open -a XTads -n --args "$$(pwd)"/$<
%.t3: .system/CoverArt.png pygmentalion.t.pygm pygmentalion.t %.t3m obj-%
t3make -a -f $* -res .system/CoverArt.png GameInfo.txt arrheta.txt pygmentalion.t.pygm
.system logs obj-pygmentalion obj-pygmentalion-web:
mkdir $@
%.pygm: %
pygmentize -l tads3 $< -f html -O nobackground,nowrap \
| ./html2ascii.py \
| perl -pe 's:<span class="('"$$( \
sed -n '/local tagStyles =/,/\];/p' pygmentalion.t \
| sed -n "s/.*'\\(.*\\)' ->.*/\\1/p" \
| sed 's/$$/\|/' \
| tr -d '\n' \
| sed 's/|$$//' \
)"')">([^<]*)</span>:<\1>\2<>:g; s:<span [^>]*>|</span>|<>$$::g; s/<></</g' \
>$@
.system/CoverArt.png.unopt: | .system
magick assets/CoverArt.png \
-define png:exclude-chunk=date,tIME \
-background '#ece4cd' -fill '#822329' -font assets/UnifrakturMaguntia.ttf -pointsize 240 label:Pygmentalion \
-gravity Center -smush 24 \
-fill '#346d9b' -font assets/iosevka-bolditalic.ttf -pointsize 90 label:'/* David Corbett */ ' \
-gravity East -smush -48 \
-resize $(COVER_ART_DIMENSIONS) -extent $(COVER_ART_DIMENSIONS) \
$@
.system/CoverArt.png: .system/CoverArt.png.unopt
pngcrush $< $@
.PHONY: clean
clean:
$(RM) -r .system pygmentalion.t3 pygmentalion-web.t3 pygmentalion.t.pygm logs obj-pygmentalion obj-pygmentalion-web
.PHONY: check
check: $(addprefix logs/,$(addsuffix .out,$(basename $(notdir $(wildcard tests/*.in))))) check-cover-art check-line-length
.PRECIOUS: logs/%.out
logs/%.out: tests/%.in logs pygmentalion.t3 FORCE
tail -n 2 $< | tr '\n' ' ' | grep -qx '>q >y '
frob -S -p -k UTF-8 -i plain -R $< pygmentalion.t3 >$@
diff tests/$*.out $@
.PHONY: check-cover-art
check-cover-art: .system/CoverArt.png
test "$$(identify -ping -format %wx%h $<)" = $(COVER_ART_DIMENSIONS)
.PHONY: check-line-length
check-line-length:
! grep -v '^ *\* [^ ]*$$' pygmentalion.t | grep -q '^.\{80\}'
.PHONY: FORCE
FORCE: