cortav  Diff

Differences From Artifact [fbd94cf6db]:

To Artifact [10a67640c2]:


37
38
39
40
41
42
43


44
45
46
47
48
49
50
51
52
53




54
55
56
57
58
59
60
..
84
85
86
87
88
89
90
91
92
93




94
95
96
97
98
99
100
...
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
luac != which luac
sh != which sh

extens = $(wildcard ext/*.lua)
extens-names ?= $(basename $(notdir $(extens)))
rendrs = $(wildcard render/*.lua)
rendrs-names ?= $(basename $(notdir $(rendrs)))



build = build
executable = cortav
default-format-flags = -m html:width 40em

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

lua-standalone = $(if $(lua-lib-prefix),$(lua-lib-prefix)/liblua.a,-llua)
lua-bindeps = -lm -ldl





dbg-flags-luac = $(if $(debug),,-s)
dbg-flags-cc = $(if $(debug),-g,-s)

# sterilize the operating theatre
export LUA_PATH=./?.lua;./?.lc
export LUA_PATH_5_3=./?.lc;./?.lua
................................................................................
# raw bytecode without shebang header, must be run as `lua cortav.lc`
$(build)/$(executable).lc: sirsem.lua $(encoding-files) cortav.lua $(rendrs) $(extens) cli.lua | $(build)/
	@echo ' » building with extensions $(extens-names)'
	@echo ' » building with renderers $(rendrs-names)'
	$(luac) $(dbg-flags-luac) -o $@ $^

# true standalone binary, wraps bytecode file and (optionally) lua
$(build)/$(executable).bin: $(build)/$(executable).lc tool/makeshim.lua
	$(lua) tool/makeshim.lua $< |\
		$(CC) -s -o$@ -xc - -xnone $(lua-standalone) $(lua-bindeps)





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

.PHONY: syncdoc
syncdoc: $(build)/cortav.html
	fossil uv add $< --as cortav.html
................................................................................
# just in case it ever gets invoked in a bad way
.PHONY: clean
clean:
	rm -f $(build)/*.{html,lc,sh,txt,desktop} \
	      $(build)/$(executable){,.bin}
	rmdir $(build)

$(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







>
>










>
>
>
>







 







|
|
|
>
>
>
>







 







|







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
64
65
66
..
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
...
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
luac != which luac
sh != which sh

extens = $(wildcard ext/*.lua)
extens-names ?= $(basename $(notdir $(extens)))
rendrs = $(wildcard render/*.lua)
rendrs-names ?= $(basename $(notdir $(rendrs)))
binds = $(wildcard bind/*.c)
binds-names ?= $(basename $(notdir $(binds)))

build = build
executable = cortav
default-format-flags = -m html:width 40em

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

lua-standalone = $(if $(lua-lib-prefix),$(lua-lib-prefix)/liblua.a,-llua)
lua-bindeps = -lm -ldl

ifneq ($(filter net,$(binds-names)),)
    lua-bindeps += -lcurl
endif

dbg-flags-luac = $(if $(debug),,-s)
dbg-flags-cc = $(if $(debug),-g,-s)

# sterilize the operating theatre
export LUA_PATH=./?.lua;./?.lc
export LUA_PATH_5_3=./?.lc;./?.lua
................................................................................
# raw bytecode without shebang header, must be run as `lua cortav.lc`
$(build)/$(executable).lc: sirsem.lua $(encoding-files) cortav.lua $(rendrs) $(extens) cli.lua | $(build)/
	@echo ' » building with extensions $(extens-names)'
	@echo ' » building with renderers $(rendrs-names)'
	$(luac) $(dbg-flags-luac) -o $@ $^

# true standalone binary, wraps bytecode file and (optionally) lua
$(build)/$(executable).bin: $(build)/$(executable).lc tool/makeshim.lua $(binds)
	$(lua) tool/makeshim.lua $< "" $(binds-names) |\
		$(CC) -s -o$@ -xc - -xnone $(binds) $(lua-standalone) $(lua-bindeps)

# loadable lua modules for binds, mainly useful for testing
$(build)/bind/%.so: bind/%.c bind/bind.h | $(build)/bind/
	$(CC) -fPIC -shared -g -o$@ $<

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

.PHONY: syncdoc
syncdoc: $(build)/cortav.html
	fossil uv add $< --as cortav.html
................................................................................
# just in case it ever gets invoked in a bad way
.PHONY: clean
clean:
	rm -f $(build)/*.{html,lc,sh,txt,desktop} \
	      $(build)/$(executable){,.bin}
	rmdir $(build)

$(build)/%.sh: desk/%.sh | $(build)/
	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