1# CurveDNS' Makefile template
2#
3# The @VAR@ tokens will be replaced by configure.curvedns
4
5NACLLIB?=/usr/local/lib
6NACLINC?=/usr/local/include
7CDNSCFLAGS?=-Wall -fno-strict-aliasing -O3 -I$(NACLINC)
8
9# If you have libev at a non-standard place, specify that here:
10#EV=
11#EVCFLAGS=-I$(EV)/include
12#EVLDFLAGS=-L$(EV)/lib
13
14CC?=gcc
15CFLAGS?= -O3 -fomit-frame-pointer -funroll-loops $(CDNSCFLAGS) $(EVCFLAGS)
16LDFLAGS?=-L$(NACLLIB) $(EVLDFLAGS)
17
18# do not edit below
19
20EXTRALIB=-lev -lsodium
21
22TARGETS=curvedns-keygen curvedns
23
24.PHONY: targets clean distclean install
25
26targets: $(TARGETS)
27
28clean:
29	rm -f *.a *.o $(TARGETS)
30
31distclean: clean
32	rm -f Makefile
33
34install:
35	@echo Sorry, no automated install. Copy the following binaries to your preferred destination path:
36	@echo "  $(TARGETS)"
37
38debug.o: debug.c debug.h
39	$(CC) $(CFLAGS) -c debug.c
40
41cache_hashtable.o: cache_hashtable.c cache_hashtable.h debug.o
42	$(CC) $(CFLAGS) -c cache_hashtable.c
43
44# ready for possible critbit addition
45cache.a: cache_hashtable.o
46	$(AR) cr cache.a cache_hashtable.o
47	ranlib cache.a
48
49dns.o: dns.c dns.h debug.o event.a
50	$(CC) $(CFLAGS) -c dns.c
51
52dnscurve.o: dnscurve.c dnscurve.h debug.o event.a
53	$(CC) $(CFLAGS) -c dnscurve.c
54
55curvedns.o: curvedns.c curvedns.h debug.o ip.o misc.o
56	$(CC) $(CFLAGS) -c curvedns.c
57
58ip.o: ip.c ip.h debug.o
59	$(CC) $(CFLAGS) -c ip.c
60
61event_tcp.o: event_tcp.c event.h debug.o ip.o cache.a
62	$(CC) $(CFLAGS) -c event_tcp.c
63
64event_udp.o: event_udp.c event.h debug.o ip.o cache.a
65	$(CC) $(CFLAGS) -c event_udp.c
66
67event_main.o: event_main.c event.h debug.o ip.o cache.a
68	$(CC) $(CFLAGS) -c event_main.c
69
70event.a: event_main.o event_udp.o event_tcp.o
71	$(AR) cr event.a event_main.o event_udp.o event_tcp.o
72	ranlib event.a
73
74misc.o: misc.c misc.h ip.o debug.o
75	$(CC) $(CFLAGS) -c misc.c
76
77curvedns-keygen.o: curvedns-keygen.c
78	$(CC) $(CFLAGS) -c curvedns-keygen.c
79
80# The targets:
81curvedns: debug.o ip.o misc.o cache.a event.a dnscurve.o dns.o curvedns.o
82	$(CC) $(LDFLAGS) debug.o ip.o misc.o dnscurve.o dns.o cache.a event.a curvedns.o $(EXTRALIB) -o curvedns
83
84curvedns-keygen: curvedns-keygen.o debug.o ip.o misc.o
85	$(CC) $(LDFLAGS) curvedns-keygen.o debug.o ip.o misc.o $(EXTRALIB) -o curvedns-keygen
86