+ gpgwww.c onak-conf.c charfuncs.c sendsync.c log.c photoid.c sigcheck.c \
+ wordlist.c cleankey.c cleanup.c keyarray.c hashquery.c marshal.c \
+ $(foreach be,@BACKENDS@,keydb_$(be).c)
+PROGS_LDFLAGS_EXTRA =
+
+ifeq (x@KEYD@, xyes)
+PROGS += keyd keydctl
+KEYDB_OBJ = keydb_keyd.o
+SRCS += keyd.c keydb_keyd.c keydctl.c
+else
+KEYDB_OBJ = keydb_$(DBTYPE).o
+endif
+
+ifeq (x@DBTYPE@, xdynamic)
+LIBS += -ldl
+BACKENDS = $(foreach be,@BACKENDS@,libkeydb_$(be).so)
+PROGS += keyd keydctl
+PROGS_LDFLAGS_EXTRA = -rdynamic
+SRCS += keyd.c keydctl.c
+endif
+
+OBJS = stats.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
+
+all: .depend $(PROGS) testparse maxpath sixdegrees splitkeys onak.conf \
+ wotsap $(BACKENDS)
+
+test: onak $(BACKENDS)
+ @./runtests
+
+install: $(PROGS) onak.conf $(BACKENDS)
+ install -d $(DESTDIR)/@bindir@
+ install -d $(DESTDIR)/@libdir@/onak/backends
+ install -d $(DESTDIR)/@localstatedir@/lib/onak
+ install -d $(DESTDIR)/@mandir@/man1
+ install -d $(DESTDIR)/@mandir@/man8
+ install -d $(DESTDIR)/@sysconfdir@
+ install onak-mail.pl $(DESTDIR)/@libdir@/onak
+ install onak splitkeys $(DESTDIR)/@bindir@
+ install onak.1 splitkeys.1 $(DESTDIR)/@mandir@/man1
+ install keyd.8 keydctl.8 onak-mail.pl.8 $(DESTDIR)/@mandir@/man8
+ifeq (x@DBTYPE@, xdynamic)
+ install $(BACKENDS) $(DESTDIR)/@libdir@/onak/backends
+ install -d $(DESTDIR)/@sbindir@
+ install keyd $(DESTDIR)/@sbindir@
+ install keydctl $(DESTDIR)/@bindir@
+endif
+
+keyd: keyd.o $(CORE_OBJS) keydb_$(DBTYPE).o
+ $(CC) $(LDFLAGS) $(PROGS_LDFLAGS_EXTRA) \
+ -o keyd keyd.o $(CORE_OBJS) keydb_$(DBTYPE).o $(LIBS)
+
+keydctl: keydctl.o onak-conf.o ll.o log.o
+ $(CC) $(LDFLAGS) $(PROGS_LDFLAGS_EXTRA) \
+ -o keydctl keydctl.o onak-conf.o ll.o log.o $(LIBS)
+
+libkeydb_db4.so: keydb_db4.o $(CORE_OBJS)
+ $(CC) $(LDFLAGS) -shared $(DB4LIBS) -o libkeydb_db4.so keydb_db4.o $(CORE_OBJS)
+
+libkeydb_hkp.so: keydb_hkp.o $(CORE_OBJS)
+ $(CC) $(LDFLAGS) -shared $(CURLLIBS) -o libkeydb_hkp.so keydb_hkp.o $(CORE_OBJS)
+
+libkeydb_pg.so: keydb_pg.o $(CORE_OBJS)
+ $(CC) $(LDFLAGS) -shared $(PQLIBS) -o libkeydb_pg.so keydb_pg.o $(CORE_OBJS)
+
+libkeydb_%.so: keydb_%.o $(CORE_OBJS)
+ $(CC) $(LDFLAGS) -shared -o $@ $< $(CORE_OBJS)
+
+splitkeys: splitkeys.o $(CORE_OBJS) $(KEYDB_OBJ)
+ $(CC) $(LDFLAGS) -o splitkeys splitkeys.o $(CORE_OBJS) $(KEYDB_OBJ) \
+ $(LIBS) $(PROGS_LDFLAGS_EXTRA)