summary refs log tree commit diff stats
path: root/doc/pydoc/ranger.ext.command_parser.html
blob: 4944b924dc7af99d08615da4a5f65df7f9f58100 (plain) (blame)
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
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module ranger.ext.command_parser</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="ranger.html"><font color="#ffffff">ranger</font></a>.<a href="ranger.ext.html"><font color="#ffffff">ext</font></a>.command_parser</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/hut/ranger/ranger/ext/command_parser.py">/home/hut/ranger/ranger/ext/command_parser.py</a></font></td></tr></table>
    <p><tt>#&nbsp;Copyright&nbsp;(C)&nbsp;2009,&nbsp;2010&nbsp;&nbsp;Roman&nbsp;Zimbelmann&nbsp;&lt;romanz@lavabit.com&gt;<br>
#<br>
#&nbsp;This&nbsp;program&nbsp;is&nbsp;free&nbsp;software:&nbsp;you&nbsp;can&nbsp;redistribute&nbsp;it&nbsp;and/or&nbsp;modify<br>
#&nbsp;it&nbsp;under&nbsp;the&nbsp;terms&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License&nbsp;as&nbsp;published&nbsp;by<br>
#&nbsp;the&nbsp;Free&nbsp;Software&nbsp;Foundation,&nbsp;either&nbsp;version&nbsp;3&nbsp;of&nbsp;the&nbsp;License,&nbsp;or<br>
#&nbsp;(at&nbsp;your&nbsp;option)&nbsp;any&nbsp;later&nbsp;version.<br>
#<br>
#&nbsp;This&nbsp;program&nbsp;is&nbsp;distributed&nbsp;in&nbsp;the&nbsp;hope&nbsp;that&nbsp;it&nbsp;will&nbsp;be&nbsp;useful,<br>
#&nbsp;but&nbsp;WITHOUT&nbsp;ANY&nbsp;WARRANTY;&nbsp;without&nbsp;even&nbsp;the&nbsp;implied&nbsp;warranty&nbsp;of<br>
#&nbsp;MERCHANTABILITY&nbsp;or&nbsp;FITNESS&nbsp;FOR&nbsp;A&nbsp;PARTICULAR&nbsp;PURPOSE.&nbsp;&nbsp;See&nbsp;the<br>
#&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License&nbsp;for&nbsp;more&nbsp;details.<br>
#<br>
#&nbsp;You&nbsp;should&nbsp;have&nbsp;received&nbsp;a&nbsp;copy&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License<br>
#&nbsp;along&nbsp;with&nbsp;this&nbsp;program.&nbsp;&nbsp;If&nbsp;not,&nbsp;see&nbsp;&lt;<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="re.html">re</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="ranger.ext.command_parser.html#LazyParser">LazyParser</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="LazyParser">class <strong>LazyParser</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Parse&nbsp;commands&nbsp;and&nbsp;extract&nbsp;information<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="LazyParser-__add__"><strong>__add__</strong></a>(self, newpart)</dt></dl>

<dl><dt><a name="LazyParser-__init__"><strong>__init__</strong></a>(self, line)</dt></dl>

<dl><dt><a name="LazyParser-chunk"><strong>chunk</strong></a>(self, n, otherwise<font color="#909090">=''</font>)</dt><dd><tt>Chunks&nbsp;are&nbsp;pieces&nbsp;of&nbsp;the&nbsp;command&nbsp;seperated&nbsp;by&nbsp;spaces</tt></dd></dl>

<dl><dt><a name="LazyParser-parse_setting_line"><strong>parse_setting_line</strong></a>(self)</dt></dl>

<dl><dt><a name="LazyParser-rest"><strong>rest</strong></a>(self, n, otherwise<font color="#909090">=''</font>)</dt><dd><tt>Rests&nbsp;are&nbsp;the&nbsp;strings&nbsp;which&nbsp;come&nbsp;after&nbsp;each&nbsp;word.</tt></dd></dl>

<dl><dt><a name="LazyParser-start"><strong>start</strong></a>(self, n)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>SETTINGS_RE</strong> = &lt;_sre.SRE_Pattern object&gt;</td></tr></table>
</body></html>
e/Makefile?id=bc85e40f424b3dc5e92989917fe06c7b6abb282f'>^
601ad988 ^
a2d276c7 ^

4a216fe8 ^

3b264751 ^
4a216fe8 ^
ed2eb754 ^



b630db7f ^

f7392630 ^

601ad988 ^
b630db7f ^
dacba5fd ^

b630db7f ^

6087f759 ^
b0a511f9 ^
828716e7 ^
4393412d ^
435882f1 ^
6b0b7ccf ^
29441535 ^
4a216fe8 ^
48b19713 ^
fe9ac5f7 ^
4c646872 ^
48b19713 ^
4393412d ^


b630db7f ^
4393412d ^



d9ab24c2 ^
b630db7f ^
d9ab24c2 ^
b630db7f ^
24e6e40f ^
6b0b7ccf ^
24e6e40f ^
4a216fe8 ^
fe9ac5f7 ^
4c646872 ^
b630db7f ^
4c646872 ^
350e0e0a ^
4c646872 ^

6087f759 ^

53bc4753 ^
b630db7f ^
cd966a87 ^

53bc4753 ^
b630db7f ^

6b0b7ccf ^



e3d9ee2c ^
4bf895db ^




e3d9ee2c ^
4bf895db ^
cd966a87 ^
4bf895db ^
e3d9ee2c ^
4bf895db ^
cd966a87 ^
4bf895db ^




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
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238


                
                                    




                                








                                                                            
                                                        
    
                                 
     
 




                                                
                                       
 




                                                                                
                    
                      
                                   
                             
                                   





                                     
           
                                                                    
                                                             

                                                                
                                                                             
                                        
                                                         

                                                                                
                                                           
                                                             
                                                
 
                                                                     
                                            
                                 
                                                                                   

                                                                      
 




                                                                           
                                                               
                                                                 
                                                      
 






                                                                      
                                                                            


                                                                         
 

                                                                            
                                                        
                                                       
                                                
                                                                
 
                                                          

                                                             
                                                       


                                         
                                                         
                                     
                                                                      
                                                                          

                                                               
                                                                                         


                                                                        

                                                                                         

                                                                
                                                                                       
                                    
                                                                
 
                                           
                                     

                                                                                           
 
                                       
                                     
                                 
 
                                      
                                     

                                                                                           
 
                                         
                                     

                                                                                           
 
                                        
                                     

                                                                                           
 


                                                      
                                              
                                 
                               
 
                                   

                                             

             
                                    
 



                          

                                                                        

                                                                            
 
                                    

               

                            
                                                                                
                                
                                                                
              
 
               
        
                                          
                                                                   
                                                                      
                          
                                             


                                                                             
                                          



                                                                        
                                          
                                                                                         
                                          
                                                                                         
 
                 
          
                                           
                                              
                          
                                                                              
                                              
                                              

                                                      

                                                   
                                                  
                                                                                

                                         
                                          

                                                                           



                                   
 




                                
                                       
 
                   
            
                                               
 
                




                                  
NIMC ?= nim c
OBJDIR ?= .obj
OUTDIR ?= target
# These paths are quoted in recipes.
PREFIX ?= /usr/local
MANPREFIX ?= $(PREFIX)/share/man
MANPREFIX1 ?= $(MANPREFIX)/man1
MANPREFIX5 ?= $(MANPREFIX)/man5
TARGET ?= release
# This must be single-quoted, because it is not a real shell substitution.
# The default setting is at {the binary's path}/../libexec/chawan.
# You may override it with any path if your system does not have a libexec
# directory, but make sure to surround it with quotes if it contains spaces.
# (This way, the cha binary can be directly executed without installation.)
LIBEXECDIR ?= '$${%CHA_BIN_DIR}/../libexec/chawan'
# If overridden, take libexecdir that was specified.
# Otherwise, just install to libexec/chawan.
ifeq ($(LIBEXECDIR),'$${%CHA_BIN_DIR}/../libexec/chawan')
LIBEXECDIR_CHAWAN = "$(DESTDIR)$(PREFIX)/libexec/chawan"
else
LIBEXECDIR_CHAWAN = $(LIBEXECDIR)
endif

# These paths are quoted in recipes.
OUTDIR_TARGET = $(OUTDIR)/$(TARGET)
OUTDIR_BIN = $(OUTDIR_TARGET)/bin
OUTDIR_LIBEXEC = $(OUTDIR_TARGET)/libexec/chawan
OUTDIR_CGI_BIN = $(OUTDIR_LIBEXEC)/cgi-bin
OUTDIR_MAN = $(OUTDIR_TARGET)/share/man

# I won't take this from the environment for obvious reasons. Please override it
# in the make command if you must, or (preferably) fix your environment so it's
# not needed.
DANGER_DISABLE_SANDBOX = 0

# Nim compiler flags
ifeq ($(TARGET),debug)
FLAGS += -d:debug --debugger:native
else ifeq ($(TARGET),release)
FLAGS += -d:release -d:strip -d:lto
else ifeq ($(TARGET),release0)
FLAGS += -d:release --stacktrace:on
else ifeq ($(TARGET),release1)
FLAGS += -d:release --debugger:native
endif

.PHONY: all
all: $(OUTDIR_BIN)/cha $(OUTDIR_BIN)/mancha $(OUTDIR_CGI_BIN)/http \
	$(OUTDIR_CGI_BIN)/gemini $(OUTDIR_LIBEXEC)/gmi2html \
	$(OUTDIR_CGI_BIN)/gopher $(OUTDIR_LIBEXEC)/gopher2html \
	$(OUTDIR_CGI_BIN)/cha-finger $(OUTDIR_CGI_BIN)/about \
	$(OUTDIR_CGI_BIN)/file $(OUTDIR_CGI_BIN)/ftp $(OUTDIR_CGI_BIN)/sftp \
	$(OUTDIR_LIBEXEC)/dirlist2html \
	$(OUTDIR_CGI_BIN)/man $(OUTDIR_CGI_BIN)/spartan \
	$(OUTDIR_CGI_BIN)/stbi $(OUTDIR_CGI_BIN)/jebp $(OUTDIR_CGI_BIN)/canvas \
	$(OUTDIR_CGI_BIN)/sixel $(OUTDIR_CGI_BIN)/resize \
	$(OUTDIR_LIBEXEC)/urldec $(OUTDIR_LIBEXEC)/urlenc \
	$(OUTDIR_LIBEXEC)/md2html $(OUTDIR_LIBEXEC)/ansi2html
	ln -sf "$(OUTDIR)/$(TARGET)/bin/cha" cha

$(OUTDIR_BIN)/cha: src/*.nim src/**/*.nim src/**/*.c res/* res/**/* \
		res/map/idna_gen.nim nim.cfg
	@mkdir -p "$(OUTDIR_BIN)"
	$(NIMC) --nimcache:"$(OBJDIR)/$(TARGET)/cha" -d:libexecPath=$(LIBEXECDIR) \
                -d:disableSandbox=$(DANGER_DISABLE_SANDBOX) $(FLAGS) \
		-o:"$(OUTDIR_BIN)/cha" src/main.nim

$(OUTDIR_BIN)/mancha: adapter/tools/mancha.nim
	@mkdir -p "$(OUTDIR_BIN)"
	$(NIMC) --nimcache:"$(OBJDIR)/$(TARGET)/mancha" $(FLAGS) \
		-o:"$(OUTDIR_BIN)/mancha" $(FLAGS) adapter/tools/mancha.nim

$(OBJDIR)/genidna: res/genidna.nim res/map/IdnaMappingTable.txt
	$(NIMC) --nimcache:"$(OBJDIR)/idna_gen_cache" -d:danger \
		-o:"$(OBJDIR)/genidna" res/genidna.nim

res/map/idna_gen.nim: $(OBJDIR)/genidna
	$(OBJDIR)/genidna > res/map/idna_gen.nim

$(OBJDIR)/gencharwidth: res/gencharwidth.nim
	$(NIMC) --nimcache:"$(OBJDIR)/charwidth_gen_cache" -d:danger \
		-o:"$(OBJDIR)/gencharwidth" res/gencharwidth.nim

res/map/charwidth_gen.nim: $(OBJDIR)/gencharwidth res/map/EastAsianWidth.txt
	$(OBJDIR)/gencharwidth > res/map/charwidth_gen.nim

src/utils/strwidth.nim: res/map/charwidth_gen.nim src/utils/proptable.nim

twtstr = src/utils/twtstr.nim src/utils/charcategory.nim src/utils/map.nim \
	src/utils/twtuni.nim src/types/opt.nim
dynstream = src/io/dynstream.nim src/io/serversocket.nim
lcgi = $(dynstream) $(twtstr) adapter/protocol/lcgi.nim
lcgi_ssl = $(lcgi) adapter/protocol/lcgi_ssl.nim
curl = adapter/protocol/curl.nim adapter/protocol/curlerrors.nim

$(OUTDIR_CGI_BIN)/man: lib/monoucha/monoucha/jsregex.nim \
		lib/monoucha/monoucha/libregexp.nim $(twtstr)
$(OUTDIR_CGI_BIN)/http: $(curl) src/utils/sandbox.nim
$(OUTDIR_CGI_BIN)/about: res/chawan.html res/license.md
$(OUTDIR_CGI_BIN)/file: $(twtstr)
$(OUTDIR_CGI_BIN)/ftp: $(lcgi)
$(OUTDIR_CGI_BIN)/sftp: $(curl) $(twtstr)
$(OUTDIR_CGI_BIN)/gopher: adapter/gophertypes.nim $(lcgi)
$(OUTDIR_CGI_BIN)/gemini: $(lcgi_ssl)
$(OUTDIR_CGI_BIN)/stbi: adapter/img/stbi.nim adapter/img/stb_image.c \
		adapter/img/stb_image.h src/utils/sandbox.nim $(dynstream)
$(OUTDIR_CGI_BIN)/jebp: adapter/img/jebp.c adapter/img/jebp.h \
		src/utils/sandbox.nim
$(OUTDIR_CGI_BIN)/sixel: src/types/color.nim src/utils/sandbox.nim $(twtstr) $(dynstream)
$(OUTDIR_CGI_BIN)/canvas: src/types/canvastypes.nim src/types/path.nim \
	src/io/bufreader.nim src/types/color.nim src/types/line.nim \
	src/utils/sandbox.nim $(dynstream) $(twtstr)
$(OUTDIR_CGI_BIN)/resize: adapter/img/stb_image_resize.h adapter/img/stb_image_resize.c \
	src/utils/sandbox.nim $(dynstream) $(twtstr)
$(OUTDIR_LIBEXEC)/urlenc: $(twtstr)
$(OUTDIR_LIBEXEC)/gopher2html: adapter/gophertypes.nim $(twtstr)
$(OUTDIR_LIBEXEC)/ansi2html: src/types/color.nim src/io/poll.nim $(twtstr) $(dynstream)
$(OUTDIR_LIBEXEC)/md2html: $(twtstr)
$(OUTDIR_LIBEXEC)/dirlist2html: $(twtstr) src/utils/strwidth.nim

$(OUTDIR_CGI_BIN)/%: adapter/protocol/%.nim
	@mkdir -p "$(OUTDIR_CGI_BIN)"
	$(NIMC) $(FLAGS) --nimcache:"$(OBJDIR)/$(TARGET)/$(subst $(OUTDIR_CGI_BIN)/,,$@)" \
		-d:disableSandbox=$(DANGER_DISABLE_SANDBOX) -o:"$@" $<

$(OUTDIR_CGI_BIN)/%: adapter/protocol/%
	@mkdir -p "$(OUTDIR_CGI_BIN)"
	cp $< "$(OUTDIR_CGI_BIN)"

$(OUTDIR_CGI_BIN)/%: adapter/img/%.nim
	@mkdir -p "$(OUTDIR_CGI_BIN)"
	$(NIMC) $(FLAGS) --nimcache:"$(OBJDIR)/$(TARGET)/$(subst $(OUTDIR_CGI_BIN)/,,$@)" \
                -d:disableSandbox=$(DANGER_DISABLE_SANDBOX) -o:"$@" $<

$(OUTDIR_LIBEXEC)/%: adapter/format/%.nim
	@mkdir -p "$(OUTDIR_LIBEXEC)"
	$(NIMC) $(FLAGS) --nimcache:"$(OBJDIR)/$(TARGET)/$(subst $(OUTDIR_LIBEXEC)/,,$@)" \
		-o:"$@" $<

$(OUTDIR_LIBEXEC)/%: adapter/tools/%.nim
	@mkdir -p "$(OUTDIR_LIBEXEC)"
	$(NIMC) $(FLAGS) --nimcache:"$(OBJDIR)/$(TARGET)/$(subst $(OUTDIR_LIBEXEC)/,,$@)" \
		-o:"$@" $<

$(OUTDIR_LIBEXEC)/urldec: $(OUTDIR_LIBEXEC)/urlenc
	(cd "$(OUTDIR_LIBEXEC)"; ln -sf urlenc urldec)

$(OBJDIR)/man/cha-%.md: doc/%.md md2manpreproc
	@mkdir -p "$(OBJDIR)/man"
	./md2manpreproc $< > $@

doc/cha-%.5: $(OBJDIR)/man/cha-%.md
	pandoc --standalone --to man $< -o $@

.PHONY: clean
clean:
	rm -rf "$(OBJDIR)/$(TARGET)"

.PHONY: distclean
distclean: clean
	rm -rf "$(OUTDIR)"

manpages1 = cha.1 mancha.1
manpages5 = cha-config.5 cha-mailcap.5 cha-mime.types.5 cha-localcgi.5 \
	cha-urimethodmap.5 cha-protocols.5 cha-api.5 cha-troubleshooting.5 \
	cha-image.5

manpages = $(manpages1) $(manpages5)

.PHONY: manpage
manpage: $(manpages:%=doc/%)

protocols = http about file ftp sftp gopher gemini cha-finger man spartan stbi \
	jebp sixel canvas resize
converters = gopher2html md2html ansi2html gmi2html dirlist2html
tools = urlenc

.PHONY: install
install:
	mkdir -p "$(DESTDIR)$(PREFIX)/bin"
	install -m755 "$(OUTDIR_BIN)/cha" "$(DESTDIR)$(PREFIX)/bin"
	install -m755 "$(OUTDIR_BIN)/mancha" "$(DESTDIR)$(PREFIX)/bin"
# intentionally not quoted
	mkdir -p $(LIBEXECDIR_CHAWAN)/cgi-bin
	for f in $(protocols); do \
	install -m755 "$(OUTDIR_CGI_BIN)/$$f" $(LIBEXECDIR_CHAWAN)/cgi-bin; \
	done
	for f in $(converters) $(tools); \
	do install -m755 "$(OUTDIR_LIBEXEC)/$$f" $(LIBEXECDIR_CHAWAN); \
	done
# urldec is just a symlink to urlenc
	(cd $(LIBEXECDIR_CHAWAN); ln -sf urlenc urldec)
	mkdir -p "$(DESTDIR)$(MANPREFIX1)"
	for f in $(manpages1); do install -m644 "doc/$$f" "$(DESTDIR)$(MANPREFIX1)"; done
	mkdir -p "$(DESTDIR)$(MANPREFIX5)"
	for f in $(manpages5); do install -m644 "doc/$$f" "$(DESTDIR)$(MANPREFIX5)"; done

.PHONY: uninstall
uninstall:
	rm -f "$(DESTDIR)$(PREFIX)/bin/cha"
	rm -f "$(DESTDIR)$(PREFIX)/bin/mancha"
# intentionally not quoted
	for f in $(protocols); do rm -f $(LIBEXECDIR_CHAWAN)/cgi-bin/$$f; done
# note: png has been removed in favor of stbi.
	rm -f $(LIBEXECDIR_CHAWAN)/cgi-bin/png
# note: data has been moved back into the main binary.
	rm -f $(LIBEXECDIR_CHAWAN)/cgi-bin/data
# note: gmifetch has been replaced by gemini
	rm -f $(LIBEXECDIR_CHAWAN)/cgi-bin/gmifetch
	rmdir $(LIBEXECDIR_CHAWAN)/cgi-bin || true
	for f in $(converters) $(tools); do rm -f $(LIBEXECDIR_CHAWAN)/$$f; done
# urldec is just a symlink to urlenc
	rm -f $(LIBEXECDIR_CHAWAN)/urldec
	rmdir $(LIBEXECDIR_CHAWAN) || true
	for f in $(manpages5); do rm -f "$(DESTDIR)$(MANPREFIX5)/$$f"; done
	for f in $(manpages1); do rm -f "$(DESTDIR)$(MANPREFIX1)/$$f"; done

.PHONY: submodule
submodule:
	git submodule update --init

test/net/run: test/net/run.nim
	$(NIMC) test/net/run.nim

.PHONY: test_js
test_js:
	(cd test/js; ./run_js_tests.sh)

.PHONY: test_layout
test_layout:
	(cd test/layout; ./run_layout_tests.sh)

.PHONY: test_net
test_net: test/net/run
	(cd test/net; ./run)

.PHONY: test
test: test_js test_layout test_net