aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile25
-rw-r--r--defconfig11
2 files changed, 20 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 68c30a3..5b4b00a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,9 @@
-# include config file
+# include config file if present
CONFIG ?= .config
-include $(CONFIG)
CFLAGSORIG := $(CFLAGS)
+DOVECOT ?= /usr/include/dovecot
+PLUGINNAME ?= antispam
-include $(DOVECOT)/dovecot-config
INSTALLDIR ?= $(moduledir)/imap
# Kill CFLAGS from dovecot-config
@@ -29,18 +31,18 @@ LOCALCFLAGS += -fPIC -shared -Wall -Wextra -DPLUGINNAME=$(PLUGINNAME)
CC ?= cc
HOSTCC ?= cc
-all: verify_config $(LIBRARY_NAME)
+all: $(LIBRARY_NAME)
-antispam-storage.o: antispam-storage.c antispam-storage-*.c $(CONFIG) antispam-plugin.h dovecot-version.h
+antispam-storage.o: antispam-storage.c antispam-storage-*.c antispam-plugin.h dovecot-version.h
$(CC) -c $(CFLAGS) $(LOCALCFLAGS) $(INCS) -o $@ $<
-%.o: %.c $(CONFIG) antispam-plugin.h dovecot-version.h antispam-version.h
+%.o: %.c antispam-plugin.h dovecot-version.h antispam-version.h
$(CC) -c $(CFLAGS) $(LOCALCFLAGS) $(INCS) -o $@ $<
$(LIBRARY_NAME): $(objs)
$(CC) $(CFLAGS) $(LOCALCFLAGS) $(INCS) $(objs) -o $(LIBRARY_NAME) $(LDFLAGS)
-dovecot-version: dovecot-version.c $(CONFIG)
+dovecot-version: dovecot-version.c
$(HOSTCC) $(INCS) -o dovecot-version dovecot-version.c
dovecot-version.h: dovecot-version
@@ -53,13 +55,12 @@ antispam-version.h: version.sh
clean:
rm -f *.so *.o *~ dovecot-version dovecot-version.h antispam-version.h
-install: all
+install: all checkinstalldir
install -p -m 0755 $(LIBRARY_NAME) $(DESTDIR)$(INSTALLDIR)/
-verify_config:
- @if [ ! -r $(CONFIG) ]; then \
- echo -e "\nBuilding the plugin requires a configuration file"; \
- echo -e $(CONFIG)'. Copy defconfig ("cp defconfig' $(CONFIG)'")' ; \
- echo -e "to create an example configuration.\n"; \
- exit 1; \
+checkinstalldir:
+ @if [ ! -d "$(DESTDIR)$(INSTALLDIR)/" ] ; then \
+ echo "Installation directory $(DESTDIR)$(INSTALLDIR)/ doesn't exist," ; \
+ echo "run make install INSTALLDIR=..." ; \
+ exit 2 ; \
fi
diff --git a/defconfig b/defconfig
index 0eb1db3..34a1633 100644
--- a/defconfig
+++ b/defconfig
@@ -13,18 +13,21 @@
# Building the plugin requires configured dovecot sources or having
# configured it with --enable-header-install in which case you can
# point DOVECOT= to the installed headers too.
+# If unset, it defaults to /usr/include/dovecot which typically is the
+# right place so you don't have to worry about it.
#DOVECOT=../dovecot-1.0.5
#DOVECOT=../dovecot-1.1
-DOVECOT=/usr/include/dovecot
+#DOVECOT=/usr/include/dovecot
# install directory for 'make install'
# NB no need for a final '/'
INSTALLDIR=/usr/lib/dovecot/modules/imap
# plugin name, change only if you need to rename the plugin
-# (because, for example, you need two instances for different
-# spam filters installed)
-PLUGINNAME=antispam
+# (for backward compatibility reasons, there no longer is a
+# need for this since backends can be configured dynamically).
+# If unset, defaults to "antispam" which is what you want.
+# PLUGINNAME=antispam
# extra CFLAGS
# CFLAGS += -g3