Differences From
Artifact [42776f3212]:
1 1 lua != which lua
2 2 luac != which luac
3 3 sh != which sh
4 4
5 5 extens = $(wildcard ext/*.lua)
6 -extens_names ?= $(basename $(notdir $(extens)))
6 +extens-names ?= $(basename $(notdir $(extens)))
7 7 build = build
8 8 executable = cortav
9 9 default-format-flags = -m html:width 40em
10 10
11 11 prefix = $(HOME)/.local
12 -bin_prefix = $(prefix)/bin
13 -share_prefix = $(prefix)/share/$(executable)
12 +bin-prefix = $(prefix)/bin
13 +share-prefix = $(prefix)/share/$(executable)
14 14
15 -$(build)/$(executable): sirsem.lua cortav.lua $(extens) cli.lua | $(build)/
16 - @echo ' » building with extensions $(extens_names)'
15 +# by default, we fetch and parse information about encodings we
16 +# support so that cortav can do fancy things like format math
17 +# equations by character class (e.g. italicizing variables)
18 +# this is not necessary for parsing the format, and can be
19 +# disabled by blanking the encoding-data list when building
20 +# ($ make encoding-data=)
21 +encoding-data = ucstbls
22 +encoding-files = $(patsubst %,$(build)/%.lc,$(encoding-data))
23 +encoding-data-ucs = https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
24 +
25 +$(build)/$(executable): sirsem.lua $(encoding-files) cortav.lua $(extens) cli.lua | $(build)/
26 + @echo ' » building with extensions $(extens-names)'
17 27 echo '#!$(lua)' > $@
18 28 luac -o - $^ >> $@
19 29 chmod +x $@
20 30
21 31 $(build)/cortav.html: cortav.ct $(build)/$(executable) | $(build)/
22 32 $(build)/$(executable) $< -o $@ -m render:format html -y html:fossil-uv
23 33
................................................................................
28 38
29 39 .PHONY: clean
30 40 clean:
31 41 rm -f $(build)/cortav $(build)/cortav.html $(build)/velartrill-cortav-view.desktop $(build)/cortav-view.sh
32 42
33 43 $(build)/%.sh: desk/%.sh
34 44 echo >$@ "#!$(sh)"
35 - echo >>$@ 'cortav_exec="$(bin_prefix)/$(executable)"'
45 + echo >>$@ 'cortav_exec="$(bin-prefix)/$(executable)"'
36 46 echo >>$@ 'cortav_flags="$${ct_format_flags-$(default-format-flags)}"'
37 47 cat $< >> $@
38 48 chmod +x $@
39 49
40 50 $(build)/velartrill-cortav-view.desktop: desk/cortav-view.desktop
41 51 cp $< $@
42 - echo "Exec=$(bin_prefix)/cortav-view.sh" >>$@
52 + echo "Exec=$(bin-prefix)/cortav-view.sh" >>$@
43 53
44 54 %/:
45 55 mkdir -p $@
46 56
57 +$(build)/unicode.txt: | $(build)/
58 + curl $(encoding-data-ucs) > $@
59 +$(build)/ucstbls.lc: $(build)/unicode.txt | $(build)/
60 + $(lua) tools/ucs.lua $< | $(luac) -o $@ -
61 +
47 62 .PHONY: install
48 -install: $(build)/cortav $(build)/cortav-view.sh $(build)/velartrill-cortav-view.desktop | $(bin_prefix)/
49 - install $(build)/$(executable) $(bin_prefix)
50 - install $(build)/cortav-view.sh $(bin_prefix)
63 +install: $(build)/cortav $(build)/cortav-view.sh $(build)/velartrill-cortav-view.desktop | $(bin-prefix)/
64 + install $(build)/$(executable) $(bin-prefix)
65 + install $(build)/cortav-view.sh $(bin-prefix)
51 66 xdg-mime install desk/velartrill-cortav.xml
52 67 xdg-desktop-menu install $(build)/velartrill-cortav-view.desktop
53 68 xdg-mime default velartrill-cortav-view.desktop text/x-cortav
54 69
55 70 .PHONY: excise
56 71 excise: $(build)/velartrill-cortav-view.desktop
57 72 xdg-mime uninstall desk/velartrill-cortav.xml
58 73 xdg-desktop-menu uninstall $(build)/velartrill-cortav-view.desktop
59 - rm $(bin_prefix)/$(executable)
60 - rm $(bin_prefix)/cortav-view.sh
74 + rm $(bin-prefix)/$(executable)
75 + rm $(bin-prefix)/cortav-view.sh
61 76
62 77 .PHONY: wipe
63 78 wipe: excise clean