Blob


1 include ../Makefile.local
3 .PHONY: all data clean runtime
5 all: data gg puny-test fcgi-test
6 ./puny-test
7 ./iri_test
8 ./runtime
10 data: testdata iri_test cert.pem testca.pem valid.crt invalid.cert.pem
12 gg: gg.o ../iri.o ../utf8.o ${COMPAT}
13 ${CC} gg.o ../iri.o ../utf8.o ${COMPAT} -o $@ ${LDFLAGS}
15 puny-test: puny-test.o ../puny.o ../utf8.o ../utils.o ../log.o ${COMPAT}
16 ${CC} puny-test.o ../puny.o ../utf8.o ../utils.o ../log.o ${COMPAT} \
17 -o puny-test ${LDFLAGS}
19 iri_test: iri_test.o ../iri.o ../utf8.o ${COMPAT}
20 ${CC} iri_test.o ../iri.o ../utf8.o ${COMPAT} -o $@ ${LDFLAGS}
22 fill-file: fill-file.o
23 ${CC} fill-file.o -o $@ ${LDFLAGS}
25 fcgi-test: fcgi-test.o
26 ${CC} fcgi-test.o ${COMPAT} -o fcgi-test ${LDFLAGS}
28 key.pem: cert.pem
30 # XXX: key size is NOT GOOD. This is only for testing. Smaller keys
31 # are quicker to generate. DON'T DO THIS AT HOME.
32 cert.pem:
33 openssl req -x509 -newkey rsa:2048 \
34 -keyout key.pem \
35 -out cert.pem \
36 -days 365 -nodes \
37 -subj "/CN=localhost"
38 ln -s cert.pem localhost.cert.pem
39 ln -s key.pem localhost.key.pem
40 @echo
42 testca.pem:
43 openssl genrsa -out testca.key 2048
44 openssl req -x509 -new -sha256 \
45 -key testca.key \
46 -days 365 -nodes \
47 -out testca.pem \
48 -subj "/CN=testca"
49 @echo
51 valid.crt: testca.pem
52 openssl genrsa -out valid.key 2048
53 openssl req -new -key valid.key \
54 -out valid.csr \
55 -subj "/CN=valid"
56 @echo
57 openssl x509 -req -in valid.csr \
58 -CA testca.pem \
59 -CAkey testca.key \
60 -CAcreateserial \
61 -out valid.crt \
62 -days 365 \
63 -sha256 -extfile valid.ext
65 invalid.cert.pem: cert.pem
66 cp cert.pem invalid.cert.pem
67 cp key.pem invalid.key.pem
69 clean:
70 rm -f *.o iri_test cert.pem key.pem
71 rm -f localhost.cert.pem localhost.key.pem
72 rm -f testca.* valid.csr valid.key invalid.*pem
73 rm -rf testdata fill-file puny-test gg
75 testdata: fill-file
76 mkdir testdata
77 ./fill-file testdata/bigfile
78 ./sha testdata/bigfile testdata/bigfile.sha
79 printf "# hello world\n" > testdata/index.gmi
80 ./sha testdata/index.gmi testdata/index.gmi.sha
81 cp hello slow err invalid serve-bigfile env testdata/
82 cp max-length-reply testdata
83 mkdir testdata/dir
84 cp hello testdata/dir
85 cp testdata/index.gmi testdata/dir/foo.gmi
87 runtime: testdata
88 ./runtime