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