6 CFLAGS += @CFLAGS@ -Wall -pedantic -fPIC
7 # Uncomment to enable profiling.
9 # Can be "pg" for Postgresql, "file" for flat files or "db2" for pksd db2 style.
12 LIBS = @LIBS@ @NETTLE_LIBS@
15 #MAKEDEPEND = makedepend -f- --
16 MAKEDEPEND = $(CC) -MM
18 exec_prefix ?= @exec_prefix@
20 PROGS = add lookup hashquery gpgwww onak splitkeys onak-mail.pl stripkey \
22 CORE_OBJS = armor.o charfuncs.o decodekey.o getcgi.o hash.o marshal.o \
23 keyid.o keyindex.o ll.o mem.o onak-conf.o parsekey.o sigcheck.o \
24 log.o photoid.o wordlist.o cleanup.o merge.o sendsync.o keyarray.o
25 ifeq (x@NETTLE_LIBS@, x)
26 CORE_OBJS += md5.o sha1.o
28 SRCS = armor.c parsekey.c merge.c keyid.c md5.c sha1.c main.c getcgi.c mem.c \
29 keyindex.c stats.c lookup.c add.c keydb_$(DBTYPE).c ll.c hash.c \
30 gpgwww.c onak-conf.c charfuncs.c sendsync.c log.c photoid.c sigcheck.c \
31 wordlist.c cleankey.c cleanup.c keyarray.c hashquery.c marshal.c \
32 $(foreach be,@BACKENDS@,keydb_$(be).c)
37 KEYDB_OBJ = keydb_keyd.o
38 SRCS += keyd.c keydb_keyd.c keydctl.c
40 KEYDB_OBJ = keydb_$(DBTYPE).o
43 ifeq (x@DBTYPE@, xdynamic)
45 BACKENDS = $(foreach be,@BACKENDS@,libkeydb_$(be).so)
47 PROGS_LDFLAGS_EXTRA = -rdynamic
48 SRCS += keyd.c keydctl.c
51 OBJS = stats.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
53 all: .depend $(PROGS) testparse maxpath sixdegrees splitkeys onak.conf \
56 test: onak $(BACKENDS)
59 install: $(PROGS) onak.conf $(BACKENDS)
60 install -d $(DESTDIR)/@bindir@
61 install -d $(DESTDIR)/@libdir@/onak/backends
62 install -d $(DESTDIR)/@localstatedir@/lib/onak
63 install -d $(DESTDIR)/@mandir@/man1
64 install -d $(DESTDIR)/@mandir@/man8
65 install -d $(DESTDIR)/@sysconfdir@
66 install onak-mail.pl $(DESTDIR)/@libdir@/onak
67 install onak splitkeys $(DESTDIR)/@bindir@
68 install onak.1 splitkeys.1 $(DESTDIR)/@mandir@/man1
69 install keyd.8 keydctl.8 onak-mail.pl.8 $(DESTDIR)/@mandir@/man8
70 ifeq (x@DBTYPE@, xdynamic)
71 install $(BACKENDS) $(DESTDIR)/@libdir@/onak/backends
72 install -d $(DESTDIR)/@sbindir@
73 install keyd $(DESTDIR)/@sbindir@
74 install keydctl $(DESTDIR)/@bindir@
77 keyd: keyd.o $(CORE_OBJS) keydb_$(DBTYPE).o
78 $(CC) $(LDFLAGS) $(PROGS_LDFLAGS_EXTRA) \
79 -o keyd keyd.o $(CORE_OBJS) keydb_$(DBTYPE).o $(LIBS)
81 keydctl: keydctl.o onak-conf.o ll.o log.o
82 $(CC) $(LDFLAGS) $(PROGS_LDFLAGS_EXTRA) \
83 -o keydctl keydctl.o onak-conf.o ll.o log.o $(LIBS)
85 libkeydb_db4.so: keydb_db4.o $(CORE_OBJS)
86 $(CC) $(LDFLAGS) -shared $(DB4LIBS) -o libkeydb_db4.so keydb_db4.o $(CORE_OBJS)
88 libkeydb_hkp.so: keydb_hkp.o $(CORE_OBJS)
89 $(CC) $(LDFLAGS) -shared $(CURLLIBS) -o libkeydb_hkp.so keydb_hkp.o $(CORE_OBJS)
91 libkeydb_pg.so: keydb_pg.o $(CORE_OBJS)
92 $(CC) $(LDFLAGS) -shared $(PQLIBS) -o libkeydb_pg.so keydb_pg.o $(CORE_OBJS)
94 libkeydb_%.so: keydb_%.o $(CORE_OBJS)
95 $(CC) $(LDFLAGS) -shared -o $@ $< $(CORE_OBJS)
97 splitkeys: splitkeys.o $(CORE_OBJS) $(KEYDB_OBJ)
98 $(CC) $(LDFLAGS) -o splitkeys splitkeys.o $(CORE_OBJS) $(KEYDB_OBJ) \
99 $(LIBS) $(PROGS_LDFLAGS_EXTRA)
101 testparse: main.o $(OBJS)
102 $(CC) $(LDFLAGS) -o testparse main.o $(OBJS) $(LIBS) \
103 $(PROGS_LDFLAGS_EXTRA)
105 maxpath: maxpath.o $(OBJS)
106 $(CC) $(LDFLAGS) -o maxpath maxpath.o $(OBJS) $(LIBS) \
107 $(PROGS_LDFLAGS_EXTRA)
109 sixdegrees: sixdegrees.o $(OBJS)
110 $(CC) $(LDFLAGS) -o sixdegrees sixdegrees.o $(OBJS) $(LIBS) \
111 $(PROGS_LDFLAGS_EXTRA)
113 wotsap: wotsap.o $(OBJS)
114 $(CC) $(LDFLAGS) -o wotsap wotsap.o $(OBJS) $(LIBS) \
115 $(PROGS_LDFLAGS_EXTRA)
117 stripkey: stripkey.o $(OBJS)
118 $(CC) $(LDFLAGS) -o stripkey stripkey.o $(OBJS) $(LIBS) \
119 $(PROGS_LDFLAGS_EXTRA)
121 gpgwww: gpgwww.o $(OBJS)
122 $(CC) $(LDFLAGS) -o gpgwww gpgwww.o $(OBJS) $(LIBS) \
123 $(PROGS_LDFLAGS_EXTRA)
125 hashquery: hashquery.o $(CORE_OBJS) $(KEYDB_OBJ)
126 $(CC) $(LDFLAGS) -o hashquery hashquery.o $(CORE_OBJS) \
127 $(KEYDB_OBJ) $(LIBS) $(PROGS_LDFLAGS_EXTRA)
129 lookup: lookup.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
130 $(CC) $(LDFLAGS) -o lookup lookup.o cleankey.o $(CORE_OBJS) \
131 $(KEYDB_OBJ) $(LIBS) $(PROGS_LDFLAGS_EXTRA)
133 add: add.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
134 $(CC) $(LDFLAGS) -o add add.o cleankey.o \
135 $(CORE_OBJS) $(KEYDB_OBJ) $(LIBS) $(PROGS_LDFLAGS_EXTRA)
137 onak: onak.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
138 $(CC) $(LDFLAGS) -o onak onak.o cleankey.o \
139 $(CORE_OBJS) $(KEYDB_OBJ) $(LIBS) $(PROGS_LDFLAGS_EXTRA)
141 onak-conf.o: onak-conf.c onak-conf.h
142 $(CC) $(CFLAGS) -DCONFIGFILE=\"@sysconfdir@/onak.conf\" \
143 -DDBFUNCS=keydb_@DBTYPE@_funcs -c onak-conf.c
145 # HACK: onak-conf.o needs to be able to see keydb_@DBTYPE@_funcs, but
146 # keydctl doesn't want to link against the DB stuff. To be fixed more cleanly.
147 keydctl.o: keydctl.c keyd.h
148 $(CC) $(CFLAGS) -DDBFUNCS=keydb_@DBTYPE@_funcs -c keydctl.c
150 onak-mail.pl: onak-mail.pl.in
151 sed 's:@CONFIG@:@sysconfdir@/onak.conf:g' < onak-mail.pl.in > onak-mail.pl
152 chmod +x onak-mail.pl
154 onak.conf: onak.conf.in
155 sed -e 's:@BINDIR@:@bindir@:g' \
156 -e 's:@LIBDIR@:@libdir@:g' \
157 -e 's:@STATEDIR@:@localstatedir@:g' \
158 < onak.conf.in > onak.conf
161 $(RM) $(PROGS) $(OBJS) Makefile.bak testparse maxpath *.core core \
162 gpgwww.o add.o lookup.o main.o maxpath.o onak.o sixdegrees \
163 sixdegrees.o splitkeys.o stripkey.o onak.conf keyd.o \
164 keydctl.o hashquery.o wotsap.o version.h \
165 TAGS cscope.out cscope.files \
166 $(foreach be,@BACKENDS@,keydb_$(be).o) *.so
168 $(RM) keyd.o keydb_$(DBTYPE).o
172 $(RM) -f Makefile .depend config.log config.status config.h
173 $(RM) -r autom4te.cache
175 doxygen-docs: *.c *.h Doxyfile
179 @echo '#include "config.h"' > version.h
180 @if [ -e .bzr ]; then \
181 echo "#define ONAK_VERSION PACKAGE_VERSION \"+bzr`bzr revno`\"" \
184 echo "#define ONAK_VERSION PACKAGE_VERSION" >> version.h; \
187 .depend: $(SRCS) version.h
189 $(MAKEDEPEND) $(CFLAGS) $(SRCS) > .depend