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@
14 #MAKEDEPEND = makedepend -f- --
15 MAKEDEPEND = $(CC) -MM
17 exec_prefix ?= @exec_prefix@
19 PROGS = add lookup hashquery gpgwww onak splitkeys onak-mail.pl stripkey \
21 CORE_OBJS = armor.o charfuncs.o decodekey.o getcgi.o hash.o marshal.o \
22 keyid.o keyindex.o ll.o mem.o onak-conf.o parsekey.o sigcheck.o \
23 log.o photoid.o wordlist.o cleanup.o merge.o sendsync.o keyarray.o
24 ifeq (x@NETTLE_LIBS@, x)
25 CORE_OBJS += md5.o sha1.o
27 SRCS = armor.c parsekey.c merge.c keyid.c md5.c sha1.c main.c getcgi.c mem.c \
28 keyindex.c stats.c lookup.c add.c keydb_$(DBTYPE).c ll.c hash.c \
29 gpgwww.c onak-conf.c charfuncs.c sendsync.c log.c photoid.c sigcheck.c \
30 wordlist.c cleankey.c cleanup.c keyarray.c hashquery.c marshal.c \
31 $(foreach be,@BACKENDS@,keydb_$(be).c)
36 KEYDB_OBJ = keydb_keyd.o
37 SRCS += keyd.c keydb_keyd.c keydctl.c
39 KEYDB_OBJ = keydb_$(DBTYPE).o
42 ifeq (x@DBTYPE@, xdynamic)
44 BACKENDS = $(foreach be,@BACKENDS@,libkeydb_$(be).so)
46 PROGS_LDFLAGS_EXTRA = -rdynamic
47 SRCS += keyd.c keydctl.c
50 OBJS = stats.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
52 all: .depend $(PROGS) testparse maxpath sixdegrees splitkeys onak.conf \
55 test: onak $(BACKENDS)
58 install: $(PROGS) onak.conf $(BACKENDS)
59 install -d $(DESTDIR)/@bindir@
60 install -d $(DESTDIR)/@libdir@/onak/backends
61 install -d $(DESTDIR)/@localstatedir@/lib/onak
62 install -d $(DESTDIR)/@mandir@/man1
63 install -d $(DESTDIR)/@mandir@/man8
64 install -d $(DESTDIR)/@sysconfdir@
65 install onak-mail.pl $(DESTDIR)/@libdir@/onak
66 install onak splitkeys $(DESTDIR)/@bindir@
67 install onak.1 splitkeys.1 $(DESTDIR)/@mandir@/man1
68 install keyd.8 keydctl.8 onak-mail.pl.8 $(DESTDIR)/@mandir@/man8
69 ifeq (x@DBTYPE@, xdynamic)
70 install $(BACKENDS) $(DESTDIR)/@libdir@/onak/backends
71 install -d $(DESTDIR)/@sbindir@
72 install keyd $(DESTDIR)/@sbindir@
73 install keydctl $(DESTDIR)/@bindir@
76 keyd: keyd.o $(CORE_OBJS) keydb_$(DBTYPE).o
77 $(CC) $(LDFLAGS) $(PROGS_LDFLAGS_EXTRA) \
78 -o keyd keyd.o $(CORE_OBJS) keydb_$(DBTYPE).o $(LIBS)
80 keydctl: keydctl.o onak-conf.o ll.o log.o
81 $(CC) $(LDFLAGS) $(PROGS_LDFLAGS_EXTRA) \
82 -o keydctl keydctl.o onak-conf.o ll.o log.o $(LIBS)
84 libkeydb_db4.so: keydb_db4.o $(CORE_OBJS)
85 $(CC) -shared $(DB4LIBS) -o libkeydb_db4.so keydb_db4.o $(CORE_OBJS)
87 libkeydb_pg.so: keydb_pg.o $(CORE_OBJS)
88 $(CC) -shared $(PQLIBS) -o libkeydb_pg.so keydb_pg.o $(CORE_OBJS)
90 libkeydb_%.so: keydb_%.o $(CORE_OBJS)
91 $(CC) -shared -o $@ $< $(CORE_OBJS)
93 splitkeys: splitkeys.o $(CORE_OBJS) $(KEYDB_OBJ)
94 $(CC) $(LDFLAGS) -o splitkeys splitkeys.o $(CORE_OBJS) $(KEYDB_OBJ) \
95 $(LIBS) $(PROGS_LDFLAGS_EXTRA)
97 testparse: main.o $(OBJS)
98 $(CC) $(LDFLAGS) -o testparse main.o $(OBJS) $(LIBS) \
99 $(PROGS_LDFLAGS_EXTRA)
101 maxpath: maxpath.o $(OBJS)
102 $(CC) $(LDFLAGS) -o maxpath maxpath.o $(OBJS) $(LIBS) \
103 $(PROGS_LDFLAGS_EXTRA)
105 sixdegrees: sixdegrees.o $(OBJS)
106 $(CC) $(LDFLAGS) -o sixdegrees sixdegrees.o $(OBJS) $(LIBS) \
107 $(PROGS_LDFLAGS_EXTRA)
109 wotsap: wotsap.o $(OBJS)
110 $(CC) $(LDFLAGS) -o wotsap wotsap.o $(OBJS) $(LIBS) \
111 $(PROGS_LDFLAGS_EXTRA)
113 stripkey: stripkey.o $(OBJS)
114 $(CC) $(LDFLAGS) -o stripkey stripkey.o $(OBJS) $(LIBS) \
115 $(PROGS_LDFLAGS_EXTRA)
117 gpgwww: gpgwww.o $(OBJS)
118 $(CC) $(LDFLAGS) -o gpgwww gpgwww.o $(OBJS) $(LIBS) \
119 $(PROGS_LDFLAGS_EXTRA)
121 hashquery: hashquery.o $(CORE_OBJS) $(KEYDB_OBJ)
122 $(CC) $(LDFLAGS) -o hashquery hashquery.o $(CORE_OBJS) \
123 $(KEYDB_OBJ) $(LIBS) $(PROGS_LDFLAGS_EXTRA)
125 lookup: lookup.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
126 $(CC) $(LDFLAGS) -o lookup lookup.o cleankey.o $(CORE_OBJS) \
127 $(KEYDB_OBJ) $(LIBS) $(PROGS_LDFLAGS_EXTRA)
129 add: add.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
130 $(CC) $(LDFLAGS) -o add add.o cleankey.o \
131 $(CORE_OBJS) $(KEYDB_OBJ) $(LIBS) $(PROGS_LDFLAGS_EXTRA)
133 onak: onak.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
134 $(CC) $(LDFLAGS) -o onak onak.o cleankey.o \
135 $(CORE_OBJS) $(KEYDB_OBJ) $(LIBS) $(PROGS_LDFLAGS_EXTRA)
137 onak-conf.o: onak-conf.c onak-conf.h
138 $(CC) $(CFLAGS) -DCONFIGFILE=\"@sysconfdir@/onak.conf\" \
139 -DDBFUNCS=keydb_@DBTYPE@_funcs -c onak-conf.c
141 # HACK: onak-conf.o needs to be able to see keydb_@DBTYPE@_funcs, but
142 # keydctl doesn't want to link against the DB stuff. To be fixed more cleanly.
143 keydctl.o: keydctl.c keyd.h
144 $(CC) $(CFLAGS) -DDBFUNCS=keydb_@DBTYPE@_funcs -c keydctl.c
146 onak-mail.pl: onak-mail.pl.in
147 sed 's:@CONFIG@:@sysconfdir@/onak.conf:g' < onak-mail.pl.in > onak-mail.pl
148 chmod +x onak-mail.pl
150 onak.conf: onak.conf.in
151 sed -e 's:@BINDIR@:@bindir@:g' \
152 -e 's:@LIBDIR@:@libdir@:g' \
153 -e 's:@STATEDIR@:@localstatedir@:g' \
154 < onak.conf.in > onak.conf
157 $(RM) $(PROGS) $(OBJS) Makefile.bak testparse maxpath *.core core \
158 gpgwww.o add.o lookup.o main.o maxpath.o onak.o sixdegrees \
159 sixdegrees.o splitkeys.o stripkey.o onak.conf keyd.o \
160 keydctl.o hashquery.o wotsap.o version.h \
161 TAGS cscope.out cscope.files \
162 $(foreach be,@BACKENDS@,keydb_$(be).o) *.so
164 $(RM) keyd.o keydb_$(DBTYPE).o
168 $(RM) -f Makefile .depend config.log config.status config.h
169 $(RM) -r autom4te.cache
171 doxygen-docs: *.c *.h Doxyfile
175 @echo '#include "config.h"' > version.h
176 @if [ -e .bzr ]; then \
177 echo "#define ONAK_VERSION PACKAGE_VERSION \"+bzr`bzr revno`\"" \
180 echo "#define ONAK_VERSION PACKAGE_VERSION" >> version.h; \
183 .depend: $(SRCS) version.h
185 $(MAKEDEPEND) $(CFLAGS) $(SRCS) > .depend