Differences From
Artifact [4482353657]:
1 +# [ʞ] makefile
2 +# ~ lexi hale <lexi@hale.su>
3 +# 🄯 AGPLv3
4 +# ? this script performs the tasks necessary to produce a mostly
5 +# standalone cortav executable from the source files in the
6 +# repository. it assumes the presence of the following tools
7 +# in $SHELL or in $PATH:
8 +#
9 +# * which * cat
10 +# * mkdir * echo
11 +# * install * lua
12 +# * luac * sh
13 +#
14 +# if any are not present, the build will fail, although a missing
15 +# `which` can be worked around by specifying the paths to lua, luac,
16 +# and `sh` directly
17 +#
18 +# eventually you will be able to set a "standalone" variable to
19 +# create a truly standalone binary, by embedding the binary in a
20 +# C program and statically linking it to lua.
21 +
1 22 lua != which lua
2 23 luac != which luac
3 24 sh != which sh
4 25
5 26 extens = $(wildcard ext/*.lua)
6 27 extens-names ?= $(basename $(notdir $(extens)))
28 +rendrs = $(wildcard render/*.lua)
29 +rendrs-names ?= $(basename $(notdir $(rendrs)))
30 +
7 31 build = build
8 32 executable = cortav
9 33 default-format-flags = -m html:width 40em
10 34
11 35 prefix = $(HOME)/.local
12 36 bin-prefix = $(prefix)/bin
13 37 share-prefix = $(prefix)/share/$(executable)
................................................................................
18 42 # this is not necessary for parsing the format, and can be
19 43 # disabled by blanking the encoding-data list when building
20 44 # ($ make encoding-data=)
21 45 encoding-data = ucstbls
22 46 encoding-files = $(patsubst %,$(build)/%.lc,$(encoding-data))
23 47 encoding-data-ucs = https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
24 48
25 -$(build)/$(executable): sirsem.lua $(encoding-files) cortav.lua $(extens) cli.lua | $(build)/
49 +$(build)/$(executable): sirsem.lua $(encoding-files) cortav.lua $(rendrs) $(extens) cli.lua | $(build)/
26 50 @echo ' » building with extensions $(extens-names)'
51 + @echo ' » building with renderers $(rendrs-names)'
27 52 echo '#!$(lua)' > $@
28 53 luac -o - $^ >> $@
29 54 chmod +x $@
30 55
31 56 $(build)/cortav.html: cortav.ct $(build)/$(executable) | $(build)/
32 57 $(build)/$(executable) $< -o $@ -m render:format html -y html:fossil-uv
33 58
................................................................................
52 77 echo "Exec=$(bin-prefix)/cortav-view.sh" >>$@
53 78
54 79 %/:
55 80 mkdir -p $@
56 81
57 82 $(build)/unicode.txt: | $(build)/
58 83 curl $(encoding-data-ucs) > $@
59 -$(build)/ucstbls.lc: $(build)/unicode.txt | $(build)/
84 +$(build)/ucstbls.lc: $(build)/unicode.txt tools/ucs.lua | $(build)/
60 85 $(lua) tools/ucs.lua $< | $(luac) -o $@ -
61 86
62 87 .PHONY: install
63 88 install: $(build)/cortav $(build)/cortav-view.sh $(build)/velartrill-cortav-view.desktop | $(bin-prefix)/
64 89 install $(build)/$(executable) $(bin-prefix)
65 90 install $(build)/cortav-view.sh $(bin-prefix)
66 91 xdg-mime install desk/velartrill-cortav.xml