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