Blob


1 include ../Makefile.local
3 .PHONY: all clean runtime
5 all: puny-test testdata iri_test cert.pem testca.pem valid.crt invalid.cert.pem
6 ./puny-test
7 ./runtime
8 ./iri_test
10 puny-test: puny-test.o ../puny.o ../utf8.o ../utils.o ../log.o ${COMPAT}
11 ${CC} puny-test.o ../puny.o ../utf8.o ../utils.o ../log.o ${COMPAT} \
12 -o puny-test ${LDFLAGS}
14 iri_test: iri_test.o ../iri.o ../utf8.o ${COMPAT}
15 ${CC} iri_test.o ../iri.o ../utf8.o ${COMPAT} -o iri_test
17 fill-file: fill-file.o
18 ${CC} fill-file.o -o fill-file
20 key.pem: cert.pem
22 # XXX: key size is NOT GOOD. This is only for testing. Smaller keys
23 # are quicker to generate. DON'T DO THIS AT HOME.
24 cert.pem:
25 printf ".\n.\n.\n.\n.\nlocalhost\n.\n" | \
26 openssl req -x509 -newkey rsa:2048 \
27 -keyout key.pem \
28 -out cert.pem \
29 -days 365 -nodes
30 @echo
32 testca.pem:
33 openssl genrsa -out testca.key 2048
34 printf ".\n.\n.\n.\n.\ntestca\n.\n" | \
35 openssl req -x509 -new -sha256 \
36 -key testca.key \
37 -out cert.pem \
38 -days 365 -nodes \
39 -out testca.pem
40 @echo
42 valid.crt: testca.pem
43 openssl genrsa -out valid.key 2048
44 printf ".\n.\n.\n.\n.\nvalid\n.\n\n\n"| \
45 openssl req -new -key valid.key \
46 -out valid.csr
47 @echo
48 openssl x509 -req -in valid.csr \
49 -CA testca.pem \
50 -CAkey testca.key \
51 -CAcreateserial \
52 -out valid.crt \
53 -days 365 \
54 -sha256 -extfile valid.ext
56 invalid.cert.pem: cert.pem
57 cp cert.pem invalid.cert.pem
58 cp key.pem invalid.key.pem
60 clean:
61 rm -f *.o iri_test cert.pem key.pem
62 rm -f testca.* valid.csr valid.key invalid.*pem
63 rm -rf testdata fill-file puny-test
65 testdata: fill-file
66 mkdir testdata
67 ./fill-file testdata/bigfile
68 ./sha testdata/bigfile testdata/bigfile.sha
69 printf "# hello world\n" > testdata/index.gmi
70 ./sha testdata/index.gmi testdata/index.gmi.sha
71 cp hello slow err invalid serve-bigfile env testdata/
72 mkdir testdata/dir
73 cp hello testdata/dir
74 cp testdata/index.gmi testdata/dir/foo.gmi
76 runtime: testdata
77 ./runtime