+include ../build.mk
+include build.mk
-.PHONY: all
-all: chanserv.so chanserv_chancmds.so chanserv_usercmds.so chanserv_protect.so chanserv_auth.so chanserv_grep.so \
- chanserv_chansearch.so
+CSDIRS=database chancmds usercmds authcmds authtracker newsearch
+CLEANDIRS=chancmds usercmds authcmds
-chanserv.so: chanserv.o chanservalloc.o chanservhash.o chanservdb.o chanservuser.o chanservnetevents.o \
- chanservmessages.o chanservprivs.o chanservlog.o chanservstdcmds.o chanservdump.o chanservschedule.o
- ld -shared -Bdynamic ${LIBPGSQL} -o $@ $^
+.PHONY: all dirs $(CSDIRS) clean distclean
+all: chanserv.so chanserv_protect.so chanserv_grep.so chanserv_relay.so chanserv_flags.so chanserv_cleanupdb.so dirs
-chanserv_chancmds.so: chancmds.o
- ld -shared -Bdynamic -o $@ $^
+dirs: $(CSDIRS)
+ ln -sf */*.so .
-chanserv_usercmds.so: usercmds.o
- ld -shared -Bdynamic -o $@ $^
+$(CSDIRS):
+ cd $@ && $(MAKE) $(MFLAGS) all
+
+clean:
+ rm -f */*.o */*.so *.o *.so
+ rm -rf */.deps .deps
+ for i in $(CLEANDIRS) ; do $(MAKE) -C $$i $(MFLAGS) clean ; done
+
+distclean:
+ rm -f */.autobuild.mk .autobuild.mk
+
+chanserv.so: chanservdb_updates.o chanserv.o chanservuser.o chanservnetevents.o chanservprivs.o chanservlog.o chanservstdcmds.o \
+ chanservdump.o chanservschedule.o chanservcrypto.o authlib.o q9snprintf.o
chanserv_protect.so: chanserv_protect.o
- ld -shared -Bdynamic -o $@ $^
-chanserv_auth.so: authcmds.o authlib.o
- ld -shared -Bdynamic -o $@ $^
+chanserv_grep.so: chanserv_grep.o
+
+chanserv_relay.so: chanserv_relay.o
-chanserv_grep.so: chanservgrep.o
- ld -shared -Bdynamic ${LIBPCRE} -o $@ $^
+chanserv_flags.so: chanserv_flags.o
-chanserv_chansearch.so: chanserv-chansearch.o
- ld -shared -Bdynamic -o $@ $^
+chanserv_cleanupdb.so: chanserv_cleanupdb.o