forked from vincentbernat/rfc5077
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (45 loc) · 1.99 KB
/
Makefile
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
CFLAGS = -g -Werror -Wall -ansi -std=c99 -D_DEFAULT_SOURCE -D_GNU_SOURCE
LDFLAGS=
EVCFLAGS=$(shell pkg-config --silence-errors --cflags libev)
OPENSSL_LIBS=$(shell pkg-config --libs "openssl >= 1.1")
OPENSSL_CFLAGS=$(shell pkg-config --cflags "openssl >= 1.1")
EXEC=rfc5077-client rfc5077-server rfc5077-pcap openssl-client gnutls-client nss-client
all: $(EXEC)
openssl-client.o: openssl-client.c
$(CC) $(CFLAGS) $(OPENSSL_CFLAGS) -c -o $@ $^
openssl-client: openssl-client.o common-client.o common.o
$(CC) -o $@ $^ $(LDFLAGS) $(OPENSSL_LIBS)
gnutls-client: gnutls-client.o common-client.o common.o
$(CC) -o $@ $^ $(LDFLAGS) -lgnutls
nss-client: nss-client.o common-client.o common.o
$(CC) -o $@ $^ $(LDFLAGS) $(shell nss-config --libs) $(shell nspr-config --libs)
nss-client.o: nss-client.c
$(CC) $(CFLAGS) $(shell nss-config --cflags) $(shell nspr-config --cflags) -c -o $@ $^
rfc5077-client.o: rfc5077-client.c
$(CC) $(CFLAGS) $(OPENSSL_CFLAGS) -c -o $@ $^
rfc5077-client: rfc5077-client.o common.o
$(CC) -o $@ $^ $(LDFLAGS) $(OPENSSL_LIBS)
rfc5077-server.o: rfc5077-server.c
$(CC) $(CFLAGS) $(OPENSSL_CFLAGS) $(EVCFLAGS) -c -o $@ $^
rfc5077-server: rfc5077-server.o common.o http-parser/libhttp_parser.a
$(CC) -o $@ $^ $(LDFLAGS) -lev $(OPENSSL_LIBS)
http-parser/libhttp_parser.a: http-parser/http_parser.c
$(MAKE) -C http-parser package
rfc5077-pcap.o: rfc5077-pcap.c
$(CC) $(CFLAGS) $(shell pcap-config --cflags) -c -o $@ $^
rfc5077-pcap: rfc5077-pcap.o common.o
$(CC) -o $@ $^ $(LDFLAGS) $(shell pcap-config --libs)
certificate: key.pem cert.pem dh.pem
key.pem:
certtool --bits 2048 --generate-privkey --outfile $@
cert.pem: key.pem
certtool --generate-self-signed --load-privkey $^ --outfile $@
dh.pem:
certtool --bits 2048 --generate-dh-params --outfile $@
# for later gnutls utils
# certtool --sec-param normal --generate-privkey --outfile $@
# certtool --sec-param normal --generate-dh-params --outfile $@
clean:
rm -f *.pem *.o $(EXEC)
$(MAKE) -C http-parser clean
.PHONY: clean certificates all