cortav  Diff

Differences From Artifact [42776f3212]:

To Artifact [4482353657]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14










15
16
17
18
19
20
21
22
23
..
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
lua != which lua
luac != which luac
sh != which sh

extens = $(wildcard ext/*.lua)
extens_names ?= $(basename $(notdir $(extens)))
build = build
executable = cortav
default-format-flags = -m html:width 40em

prefix = $(HOME)/.local
bin_prefix = $(prefix)/bin
share_prefix = $(prefix)/share/$(executable)











$(build)/$(executable): sirsem.lua cortav.lua $(extens) cli.lua | $(build)/
	@echo ' » building with extensions $(extens_names)'
	echo '#!$(lua)' > $@
	luac -o - $^ >> $@
	chmod +x $@

$(build)/cortav.html: cortav.ct $(build)/$(executable) | $(build)/
	$(build)/$(executable) $< -o $@ -m render:format html -y html:fossil-uv

................................................................................

.PHONY: clean
clean:
	rm -f $(build)/cortav $(build)/cortav.html $(build)/velartrill-cortav-view.desktop $(build)/cortav-view.sh

$(build)/%.sh: desk/%.sh
	echo >$@ "#!$(sh)"
	echo >>$@ 'cortav_exec="$(bin_prefix)/$(executable)"'
	echo >>$@ 'cortav_flags="$${ct_format_flags-$(default-format-flags)}"'
	cat $< >> $@
	chmod +x $@

$(build)/velartrill-cortav-view.desktop: desk/cortav-view.desktop
	cp $< $@
	echo "Exec=$(bin_prefix)/cortav-view.sh" >>$@

%/:
	mkdir -p $@






.PHONY: install
install: $(build)/cortav $(build)/cortav-view.sh $(build)/velartrill-cortav-view.desktop | $(bin_prefix)/
	install $(build)/$(executable)  $(bin_prefix)
	install $(build)/cortav-view.sh $(bin_prefix)
	xdg-mime         install desk/velartrill-cortav.xml
	xdg-desktop-menu install $(build)/velartrill-cortav-view.desktop
	xdg-mime         default velartrill-cortav-view.desktop text/x-cortav

.PHONY: excise
excise: $(build)/velartrill-cortav-view.desktop
	xdg-mime         uninstall desk/velartrill-cortav.xml
	xdg-desktop-menu uninstall $(build)/velartrill-cortav-view.desktop
	rm $(bin_prefix)/$(executable)
	rm $(bin_prefix)/cortav-view.sh

.PHONY: wipe
wipe: excise clean





|





|
|

>
>
>
>
>
>
>
>
>
>
|
|







 







|






|




>
>
>
>
>

|
|
|








|
|



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
..
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
lua != which lua
luac != which luac
sh != which sh

extens = $(wildcard ext/*.lua)
extens-names ?= $(basename $(notdir $(extens)))
build = build
executable = cortav
default-format-flags = -m html:width 40em

prefix = $(HOME)/.local
bin-prefix = $(prefix)/bin
share-prefix = $(prefix)/share/$(executable)

# by default, we fetch and parse information about encodings we
# support so that cortav can do fancy things like format math
# equations by character class (e.g. italicizing variables)
# this is not necessary for parsing the format, and can be
# disabled by blanking the encoding-data list when building
# ($ make encoding-data=)
encoding-data  = ucstbls
encoding-files = $(patsubst %,$(build)/%.lc,$(encoding-data))
encoding-data-ucs = https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt

$(build)/$(executable): sirsem.lua $(encoding-files) cortav.lua $(extens) cli.lua | $(build)/
	@echo ' » building with extensions $(extens-names)'
	echo '#!$(lua)' > $@
	luac -o - $^ >> $@
	chmod +x $@

$(build)/cortav.html: cortav.ct $(build)/$(executable) | $(build)/
	$(build)/$(executable) $< -o $@ -m render:format html -y html:fossil-uv

................................................................................

.PHONY: clean
clean:
	rm -f $(build)/cortav $(build)/cortav.html $(build)/velartrill-cortav-view.desktop $(build)/cortav-view.sh

$(build)/%.sh: desk/%.sh
	echo >$@ "#!$(sh)"
	echo >>$@ 'cortav_exec="$(bin-prefix)/$(executable)"'
	echo >>$@ 'cortav_flags="$${ct_format_flags-$(default-format-flags)}"'
	cat $< >> $@
	chmod +x $@

$(build)/velartrill-cortav-view.desktop: desk/cortav-view.desktop
	cp $< $@
	echo "Exec=$(bin-prefix)/cortav-view.sh" >>$@

%/:
	mkdir -p $@

$(build)/unicode.txt: | $(build)/
	curl $(encoding-data-ucs) > $@
$(build)/ucstbls.lc: $(build)/unicode.txt | $(build)/
	$(lua) tools/ucs.lua $< | $(luac) -o $@ -

.PHONY: install
install: $(build)/cortav $(build)/cortav-view.sh $(build)/velartrill-cortav-view.desktop | $(bin-prefix)/
	install $(build)/$(executable)  $(bin-prefix)
	install $(build)/cortav-view.sh $(bin-prefix)
	xdg-mime         install desk/velartrill-cortav.xml
	xdg-desktop-menu install $(build)/velartrill-cortav-view.desktop
	xdg-mime         default velartrill-cortav-view.desktop text/x-cortav

.PHONY: excise
excise: $(build)/velartrill-cortav-view.desktop
	xdg-mime         uninstall desk/velartrill-cortav.xml
	xdg-desktop-menu uninstall $(build)/velartrill-cortav-view.desktop
	rm $(bin-prefix)/$(executable)
	rm $(bin-prefix)/cortav-view.sh

.PHONY: wipe
wipe: excise clean