]> gitweb.michael.orlitzky.com - charm-bypass.git/blob - Makefile.am
COPYING: add to state the "or later" bit
[charm-bypass.git] / Makefile.am
1 # If you really want to, we support installing index.html
2 # to (say) /usr/share/charm-bypass/index.html
3 dist_pkgdata_DATA = index.html
4
5 # A single POSIX shell script is our "test suite."
6 TESTS = run-tests.sh
7
8 # Based on e.g.
9 #
10 # https://www.gnu.org/software/automake/manual/html_node/Scripts.html
11 #
12 # this looks like the best way to include "sources" for things that
13 # aren't true programs/libraries.
14 EXTRA_DIST = \
15 $(TESTS) \
16 CharmBypass-Regular.sfd \
17 CharmBypass-Bold.sfd \
18 favicon.svg \
19 index.html.in \
20 sfd2woff.ff \
21 svgclean.xsl \
22 tableau.svg
23
24 # List of element IDs that we use in the HTML document.
25 PRECIOUS_IDS = \
26 bus \
27 city \
28 citycopy \
29 codebg \
30 codetext \
31 clouds \
32 cloudscopy \
33 destination \
34 origin \
35 origindest \
36 train \
37 tram \
38 trees \
39 treescopy \
40 serviceid \
41 servicename \
42 sky \
43 ticket \
44 ticketbg \
45 ticketdate \
46 tickettime \
47 zone
48
49 # The base "scour" command used to optimize the tableau and favicon.
50 SCOUR = @SCOUR@ \
51 --enable-id-stripping \
52 --enable-comment-stripping \
53 --remove-descriptive-elements \
54 --no-renderer-workaround \
55 --no-line-breaks \
56 --error-on-flowtext
57
58 # Optimize the favicon using scour.
59 favicon.min.svg: favicon.svg
60 $(SCOUR) $< > $@
61
62 # Optimize the tableau once using XSL, to catch a few things that
63 # "scour" will miss...
64 tableau.min.svg: tableau.svg svgclean.xsl
65 @XSLTPROC@ $(srcdir)/svgclean.xsl $< > $@
66
67 # Optimize the tableau (again) using scour, removing its XML prologue
68 # so that it can be included directly into the HTML document.
69 tableau.min.min.svg: tableau.min.svg
70 $(SCOUR) --protect-ids-list=$$(echo $(PRECIOUS_IDS) | tr ' ' ',') \
71 --strip-xml-prolog \
72 $< > $@
73
74 # Use FontForge to convert the sfd source files to woff2.
75 .sfd.woff2:
76 @FONTFORGE@ -script $(srcdir)/sfd2woff.ff $< $@
77
78 # Base64-encode a woff2 (web open font format 2.0) file. We use this
79 # to embed fonts directly into the CSS that requires them.
80 .woff2.base64:
81 @BASE64@ -w0 $< > $@
82
83 # Same with the favicon SVG.
84 .svg.base64:
85 @BASE64@ -w0 $< > $@
86
87 # List all of the dependencies of the final index.html that themselves
88 # had to be built. We collect them here because they need to be listed
89 # in two places, as dependencies of index.html, and in CLEANFILES.
90 index_html_BUILTDEPS = \
91 CharmBypass-Regular.base64 \
92 CharmBypass-Bold.base64 \
93 favicon.base64 \
94 tableau.min.min.svg
95
96 # Build index.html by substituting the contents of a few (single
97 # line!) files into @PLACEHOLDERS@ within index.html.in. If you put
98 # tildes in tableau.svg this will break, so please don't do that.
99 index.html: index.html.in $(index_html_BUILTDEPS)
100 sed -e "s~@CBPREGULAR@~$$(cat CharmBypass-Regular.base64)~" \
101 -e "s~@CBPBOLD@~$$(cat CharmBypass-Bold.base64)~" \
102 -e "s~@FAVICON@~$$(cat favicon.base64)~" \
103 -e "s~@SVGDATA@~$$(cat tableau.min.min.svg)~" \
104 $< > $@
105
106 # Automake doesn't understand our wacky build process so we have to
107 # tell it which files are produced by running "make".
108 CLEANFILES = \
109 $(dist_pkgdata_DATA) \
110 $(index_html_BUILTDEPS) \
111 favicon.min.svg \
112 tableau.min.svg
113