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.
14 #MAKEDEPEND = makedepend -f- --
15 MAKEDEPEND = $(CC) -MM
17 exec_prefix ?= @exec_prefix@
19 PROGS = add lookup gpgwww onak splitkeys onak-mail.pl stripkey
20 CORE_OBJS = armor.o charfuncs.o decodekey.o getcgi.o hash.o \
21 keyid.o keyindex.o ll.o mem.o onak-conf.o parsekey.o sha1.o md5.o \
22 log.o photoid.o wordlist.o cleanup.o merge.o sendsync.o keyarray.o
23 SRCS = armor.c parsekey.c merge.c keyid.c md5.c sha1.c main.c getcgi.c mem.c \
24 keyindex.c stats.c lookup.c add.c keydb_$(DBTYPE).c ll.c hash.c \
25 gpgwww.c onak-conf.c charfuncs.c sendsync.c log.c photoid.c \
26 wordlist.c cleankey.c cleanup.c keyarray.c \
27 $(foreach be,@BACKENDS@,keydb_$(be).c)
32 KEYDB_OBJ = keydb_keyd.o
33 SRCS += keyd.c keydb_keyd.c
35 KEYDB_OBJ = keydb_$(DBTYPE).o
38 ifeq (x@DBTYPE@, xdynamic)
40 BACKENDS = $(foreach be,@BACKENDS@,libkeydb_$(be).so)
42 PROGS_LDFLAGS_EXTRA = -rdynamic
46 OBJS = stats.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
48 all: .depend $(PROGS) testparse maxpath sixdegrees splitkeys onak.conf \
51 keyd: keyd.o $(CORE_OBJS) keydb_$(DBTYPE).o
52 $(CC) $(LDFLAGS) $(PROGS_LDFLAGS_EXTRA) \
53 -o keyd keyd.o $(CORE_OBJS) keydb_$(DBTYPE).o $(LIBS)
55 libkeydb_db4.so: keydb_db4.o
56 $(CC) -shared $(DB4LIBS) -o libkeydb_db4.so keydb_db4.o $(CORE_OBJS)
58 libkeydb_pg.so: keydb_pg.o
59 $(CC) -shared $(PQLIBS) -o libkeydb_pg.so keydb_pg.o $(CORE_OBJS)
61 libkeydb_%.so: keydb_%.o
62 $(CC) -shared -o $@ $< $(CORE_OBJS)
65 $(CC) -c -fPIC $(LDFLAGS) -o $@ $<
67 splitkeys: splitkeys.o $(CORE_OBJS) $(KEYDB_OBJ)
68 $(CC) $(LDFLAGS) -o splitkeys splitkeys.o $(CORE_OBJS) $(KEYDB_OBJ) \
69 $(LIBS) $(PROGS_LDFLAGS_EXTRA)
71 testparse: main.o $(OBJS)
72 $(CC) $(LDFLAGS) -o testparse main.o $(OBJS) $(LIBS) \
73 $(PROGS_LDFLAGS_EXTRA)
75 maxpath: maxpath.o $(OBJS)
76 $(CC) $(LDFLAGS) -o maxpath maxpath.o $(OBJS) $(LIBS) \
77 $(PROGS_LDFLAGS_EXTRA)
79 sixdegrees: sixdegrees.o $(OBJS)
80 $(CC) $(LDFLAGS) -o sixdegrees sixdegrees.o $(OBJS) $(LIBS) \
81 $(PROGS_LDFLAGS_EXTRA)
83 stripkey: stripkey.o $(OBJS)
84 $(CC) $(LDFLAGS) -o stripkey stripkey.o $(OBJS) $(LIBS) \
85 $(PROGS_LDFLAGS_EXTRA)
87 gpgwww: gpgwww.o $(OBJS)
88 $(CC) $(LDFLAGS) -o gpgwww gpgwww.o $(OBJS) $(LIBS) \
89 $(PROGS_LDFLAGS_EXTRA)
91 lookup: lookup.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
92 $(CC) $(LDFLAGS) -o lookup lookup.o cleankey.o $(CORE_OBJS) \
93 $(KEYDB_OBJ) $(LIBS) $(PROGS_LDFLAGS_EXTRA)
95 add: add.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
96 $(CC) $(LDFLAGS) -o add add.o cleankey.o \
97 $(CORE_OBJS) $(KEYDB_OBJ) $(LIBS) $(PROGS_LDFLAGS_EXTRA)
99 onak: onak.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
100 $(CC) $(LDFLAGS) -o onak onak.o cleankey.o \
101 $(CORE_OBJS) $(KEYDB_OBJ) $(LIBS) $(PROGS_LDFLAGS_EXTRA)
103 onak-conf.o: onak-conf.c onak-conf.h
104 $(CC) $(CFLAGS) -DCONFIGFILE=\"@sysconfdir@/onak.conf\" -c onak-conf.c
106 onak-mail.pl: onak-mail.pl.in
107 sed 's:@CONFIG@:@sysconfdir@/onak.conf:g' < onak-mail.pl.in > onak-mail.pl
108 chmod +x onak-mail.pl
110 onak.conf: onak.conf.in
111 sed -e 's:@BINDIR@:@bindir@:g' \
112 -e 's:@LIBDIR@:@libdir@:g' \
113 -e 's:@STATEDIR@:@localstatedir@:g' \
114 < onak.conf.in > onak.conf
117 $(RM) $(PROGS) $(OBJS) Makefile.bak testparse maxpath *.core core \
118 gpgwww.o add.o lookup.o main.o maxpath.o onak.o sixdegrees \
119 sixdegrees.o splitkeys.o stripkey.o onak.conf keyd.o \
120 $(foreach be,@BACKENDS@,keydb_$(be).o) *.so
122 $(RM) keyd.o keydb_$(DBTYPE).o
126 $(RM) -f Makefile .depend config.{log,status,h}
127 $(RM) -r autom4te.cache
131 $(MAKEDEPEND) $(CFLAGS) $(SRCS) > .depend