Differences From
Artifact [5a68812ac4]:
1 1 lua != which lua
2 2 luac != which luac
3 +sh != which sh
3 4
4 5 extens = $(wildcard ext/*.lua)
5 6 extens_names ?= $(basename $(notdir $(extens)))
7 +build = build
8 +executable = cortav
9 +
10 +prefix = $(HOME)/.local
11 +bin_prefix = $(prefix)/bin
12 +share_prefix = $(prefix)/share/$(executable)
6 13
7 -cortav: sirsem.lua cortav.lua $(extens) cli.lua
14 +$(build)/$(executable): sirsem.lua cortav.lua $(extens) cli.lua | $(build)/
8 15 @echo ' ยป building with extensions $(extens_names)'
9 16 echo '#!$(lua)' > $@
10 17 luac -o - $^ >> $@
11 18 chmod +x $@
12 19
13 -cortav.html: cortav.ct cortav
20 +$(build)/cortav.html: cortav.ct $(build)/$(executable) | $(build)/
14 21 ./cortav $< -o $@ -m render:format html -y html:fossil-uv
15 22
16 23 .PHONY: syncdoc
17 -syncdoc: cortav.html
24 +syncdoc: $(build)/cortav.html
18 25 fossil uv add $<
19 26 fossil uv sync
27 +
28 +.PHONY: clean
29 +clean:
30 + rm -f $(build)/cortav $(build)/cortav.html $(build)/velartrill-cortav-view.desktop $(build)/cortav-view.sh
31 +
32 +$(build)/%.sh: desk/%.sh
33 + echo >$@ "#!$(sh)"
34 + echo >>$@ 'cortav_exec="$(bin_prefix)/$(executable)"'
35 + cat $< >> $@
36 + chmod +x $@
37 +
38 +$(build)/velartrill-cortav-view.desktop: desk/cortav-view.desktop.tpl
39 + cp $< $@
40 + echo "Exec=$(bin_prefix)/cortav-view.sh" >>$@
41 +
42 +%/:
43 + mkdir -p $@
44 +
45 +.PHONY: install
46 +install: $(build)/cortav $(build)/cortav-view.sh $(build)/velartrill-cortav-view.desktop | $(bin_prefix)/
47 + install $(build)/$(executable) $(bin_prefix)
48 + install $(build)/cortav-view.sh $(bin_prefix)
49 + xdg-mime install desk/velartrill-cortav.xml
50 + xdg-desktop-menu install $(build)/velartrill-cortav-view.desktop
51 + xdg-mime default velartrill-cortav-view.desktop text/x-cortav
52 +
53 +.PHONY: excise
54 +excise: $(build)/velartrill-cortav-view.desktop
55 + xdg-mime uninstall desk/velartrill-cortav.xml
56 + xdg-desktop-menu uninstall $(build)/velartrill-cortav-view.desktop
57 + rm $(bin_prefix)/$(executable)
58 + rm $(bin_prefix)/cortav-view.sh
59 +
60 +.PHONY: wipe
61 +wipe: excise clean