Index: Makefile
===================================================================
--- Makefile	(revision a3ca3ddb8b3ba10b1a88854f1ab73341d15abc6b)
+++ Makefile	(revision b7d3cc34f68dab7b8f7d0777711317b334fc2219)
@@ -10,45 +10,24 @@
 
 # Program variables
-objects = bitlbee.o dcc.o help.o ipc.o irc.o irc_im.o irc_cap.o irc_channel.o irc_commands.o irc_send.o irc_user.o irc_util.o nick.o $(OTR_BI) query.o root_commands.o set.o storage.o $(STORAGE_OBJS) auth.o $(AUTH_OBJS) unix.o conf.o log.o
-allheaders = $(wildcard $(_SRCDIR_)*.h $(_SRCDIR_)lib/*.h $(_SRCDIR_)protocols/*.h)
-ifeq ($(EXTERNAL_JSON_PARSER),1)
-headers = $(filter-out $(_SRCDIR_)lib/json.h,$(allheaders))
-else
-headers = $(allheaders)
-endif
-subdirs = lib protocols
-
-OUTFILE = bitlbee
+objects = account.o bitlbee.o commands.o conf.o crypting.o help.o ini.o irc.o log.o nick.o query.o set.o unix.o url.o user.o debug.o
+subdirs = protocols
 
 # Expansion of variables
 subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o)
+CFLAGS += -Wall
 
-all: $(OUTFILE) $(OTR_PI) doc systemd
+all: $(OUTFILE)
 
-doc:
-ifdef DOC
-	$(MAKE) -C doc
-endif
-
-uninstall: uninstall-bin uninstall-doc 
+uninstall: uninstall-bin uninstall-doc
 	@echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n'
 
-install: install-bin install-doc install-plugins
-	@echo
-	@echo Installed successfully
-	@echo
-ifndef SYSTEMDSYSTEMUNITDIR
+install: install-bin install-doc
 	@if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi
-endif
 	@if ! [ -e $(DESTDIR)$(ETCDIR)/bitlbee.conf ]; then echo -e '\nNo files are installed in '$(DESTDIR)$(ETCDIR)' by make install. Run make install-etc to do that.'; fi
-ifdef SYSTEMDSYSTEMUNITDIR
-	@echo If you want to start BitlBee using systemd, try \"make install-systemd\".
-endif
-	@echo To be able to compile third party plugins, run \"make install-dev\"
 	@echo
 
-.PHONY:   install   install-bin   install-etc   install-doc install-plugins install-systemd install-dev \
-        uninstall uninstall-bin uninstall-etc uninstall-doc uninstall-etc \
-        all clean distclean tar $(subdirs) doc
+.PHONY:   install   install-bin   install-etc   install-doc \
+        uninstall uninstall-bin uninstall-etc uninstall-doc \
+        all clean distclean tar $(subdirs)
 
 Makefile.settings:
@@ -58,66 +37,27 @@
 
 clean: $(subdirs)
-	rm -f *.o $(OUTFILE) core utils/bitlbeed init/bitlbee*.service
-	$(MAKE) -C tests clean
+	rm -f *.o $(OUTFILE) core utils/bitlbeed encode decode
 
 distclean: clean $(subdirs)
-	rm -rf .depend
-	rm -f Makefile.settings config.h bitlbee.pc
-	find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \;
-	@# May still be present in dirs of disabled protocols.
-	-find . -name .depend -exec rm -rf {} \;
-	$(MAKE) -C tests distclean
-
-check: all
-	$(MAKE) -C tests
-
-gcov: check
-	gcov *.c
-
-lcov: check
-	lcov --directory . --capture --output-file bitlbee.info
-	genhtml -o coverage bitlbee.info
+	rm -f Makefile.settings config.h
+	find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' | xargs rm -f
 
 install-doc:
-ifdef DOC
 	$(MAKE) -C doc install
-endif
 
 uninstall-doc:
-ifdef DOC
 	$(MAKE) -C doc uninstall
-endif
 
 install-bin:
-	mkdir -p $(DESTDIR)$(SBINDIR)
-	$(INSTALL) -m 0755 $(OUTFILE) $(DESTDIR)$(SBINDIR)/$(OUTFILE)
-ifdef IMPLIB
-	# import library for cygwin
-	mkdir -p $(DESTDIR)$(LIBDIR)
-	$(INSTALL) -m 0644 $(IMPLIB) $(DESTDIR)$(LIBDIR)/$(IMPLIB)
-endif
+	mkdir -p $(DESTDIR)$(BINDIR)
+	install -m 0755 $(OUTFILE) $(DESTDIR)$(BINDIR)/$(OUTFILE)
 
 uninstall-bin:
-	rm -f $(DESTDIR)$(SBINDIR)/$(OUTFILE)
-ifdef IMPLIB
-	rm -f $(DESTDIR)$(LIBDIR)/$(IMPLIB)
-endif
-
-install-dev:
-	mkdir -p $(DESTDIR)$(INCLUDEDIR)
-	$(INSTALL) -m 0644 config.h $(DESTDIR)$(INCLUDEDIR)
-	for i in $(headers); do $(INSTALL) -m 0644 $$i $(DESTDIR)$(INCLUDEDIR); done
-	mkdir -p $(DESTDIR)$(PCDIR)
-	$(INSTALL) -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR)
-
-uninstall-dev:
-	rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr))
-	-rmdir $(DESTDIR)$(INCLUDEDIR)
-	rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc
+	rm -f $(DESTDIR)$(BINDIR)/$(OUTFILE)
 
 install-etc:
 	mkdir -p $(DESTDIR)$(ETCDIR)
-	$(INSTALL) -m 0644 $(_SRCDIR_)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt
-	$(INSTALL) -m 0644 $(_SRCDIR_)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf
+	install -m 0644 motd.txt $(DESTDIR)$(ETCDIR)/motd.txt
+	install -m 0644 bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf
 
 uninstall-etc:
@@ -126,51 +66,16 @@
 	-rmdir $(DESTDIR)$(ETCDIR)
 
-install-plugins: install-plugin-otr
-
-install-plugin-otr:
-ifdef OTR_PI
-	mkdir -p $(DESTDIR)$(PLUGINDIR)
-	$(INSTALL) -m 0755 otr.so $(DESTDIR)$(PLUGINDIR)
-endif
-
-systemd:
-ifdef SYSTEMDSYSTEMUNITDIR
-	mkdir -p init
-	sed 's|@sbindir@|$(SBINDIR)|' $(_SRCDIR_)init/bitlbee.service.in > init/bitlbee.service
-	sed 's|@sbindir@|$(SBINDIR)|' $(_SRCDIR_)init/bitlbee@.service.in > init/bitlbee@.service
-endif
-
-install-systemd: systemd
-ifdef SYSTEMDSYSTEMUNITDIR
-	mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
-	$(INSTALL) -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
-	$(INSTALL) -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
-	$(INSTALL) -m 0644 $(_SRCDIR_)init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
-else
-	@echo SYSTEMDSYSTEMUNITDIR not set, not installing systemd unit files.
-endif
-
-ifdef SYSUSERSDIR
-	$(INSTALL) -Dm644 init/bitlbee.sysusers $(DESTDIR)/$(SYSUSERSDIR)/bitlbee.conf
-else
-	@echo SYSUSERSDIR not set, not install sysusers.d files
-endif
-
 tar:
 	fakeroot debian/rules clean || make distclean
 	x=$$(basename $$(pwd)); \
 	cd ..; \
-	tar czf $$x.tar.gz --exclude=debian --exclude=.git* --exclude=.depend $$x
+	tar czf $$x.tar.gz --exclude=debian $$x
 
 $(subdirs):
-	$(MAKE) -C $@ $(MAKECMDGOALS)
+	@$(MAKE) -C $@ $(MAKECMDGOALS)
 
-$(OTR_PI): %.so: $(_SRCDIR_)%.c
-	@echo '*' Building plugin $@
-	$(VERBOSE) $(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRFLAGS)
-
-$(objects): %.o: $(_SRCDIR_)%.c
+$(objects): %.o: %.c
 	@echo '*' Compiling $<
-	$(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
+	@$(CC) -c $(CFLAGS) $< -o $@
 
 $(objects): Makefile Makefile.settings config.h
@@ -178,25 +83,16 @@
 $(OUTFILE): $(objects) $(subdirs)
 	@echo '*' Linking $(OUTFILE)
-	$(VERBOSE) $(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LDFLAGS_BITLBEE) $(LDFLAGS) $(EFLAGS)
-ifneq ($(firstword $(STRIP)), \#)
+	@$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LFLAGS) $(EFLAGS)
+ifndef DEBUG
 	@echo '*' Stripping $(OUTFILE)
-	$(VERBOSE) -$(STRIP) $(OUTFILE)
+	@-$(STRIP) $(OUTFILE)
 endif
+
+encode: crypting.c
+	$(CC) crypting.c protocols/md5.c $(CFLAGS) -o encode -DCRYPTING_MAIN $(CFLAGS) $(EFLAGS) $(LFLAGS)
+
+decode: encode
+	cp encode decode
 
 ctags: 
 	ctags `find . -name "*.c"` `find . -name "*.h"`
-
-# Using this as a bogus Make target to test if a GNU-compatible version of
-# make is available.
-helloworld:
-	@echo Hello World
-
-# Check if we can load the helpfile. (This fails if some article is >1KB.)
-# If print returns a NULL pointer, the file is unusable.
-testhelp: doc
-	gdb --eval-command='b main' --eval-command='r' \
-	    --eval-command='print help_init(&global->helpfile, "doc/user-guide/help.txt")' \
-	    $(OUTFILE) < /dev/null
-
--include .depend/*.d
-# DO NOT DELETE
