aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile11
-rw-r--r--antispam-plugin.h13
2 files changed, 14 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 7096a01..e73b6a1 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ INSTALLDIR ?= $(moduledir)/imap
CFLAGS := $(CFLAGSORIG)
# includes/flags we need for building a dovecot plugin
-CFLAGS += -DHAVE_CONFIG_H -Wall
+CFLAGS += -DHAVE_CONFIG_H
CFLAGS += -I$(DOVECOT)/
CFLAGS += -I$(DOVECOT)/src/
CFLAGS += -I$(DOVECOT)/src/lib/
@@ -39,11 +39,10 @@ endif
objs += antispam-storage-$(DOVECOT_VERSION).o
ifeq ("$(DOVECOT_VERSION)", "1.0")
CFLAGS += -DCONFIG_DOVECOT_10
-CFLAGS += -Dstr_array_length=strarray_length
-CFLAGS += "-Dmempool_unref(x)=pool_unref(*(x))"
else
+ifeq ("$(DOVECOT_VERSION)", "1.1")
CFLAGS += -DCONFIG_DOVECOT_11
-CFLAGS += "-Dmempool_unref(x)=pool_unref(x)"
+endif
endif
# backend error check
@@ -69,14 +68,14 @@ CFLAGS += -fPIC -shared -Wall -Wextra -DPLUGINNAME=$(PLUGINNAME)
CC ?= "gcc"
objs += antispam-plugin.o $(BACKEND).o
-ALL = plugin
+ALL = $(LIBRARY_NAME)
all: verify_config $(ALL)
%.o: %.c $(CONFIG) antispam-plugin.h
$(CC) -c $(CFLAGS) -o $@ $<
-plugin: $(objs)
+$(LIBRARY_NAME): $(objs)
$(CC) $(CFLAGS) $(objs) -o $(LIBRARY_NAME) $(LDFLAGS)
clean:
diff --git a/antispam-plugin.h b/antispam-plugin.h
index dba8ed0..d6e05ca 100644
--- a/antispam-plugin.h
+++ b/antispam-plugin.h
@@ -74,11 +74,16 @@ bool keyword_is_spam(const char *keyword);
extern bool need_keyword_hook;
extern bool need_folder_hook;
-#ifdef CONFIG_DOVECOT_11
-#define __attr_unused__ ATTR_UNUSED
-#define ME(err) MAIL_ERROR_ ##err,
-#else
+#if defined(CONFIG_DOVECOT_11)
+#define __attr_unused__ ATTR_UNUSED
+#define ME(err) MAIL_ERROR_ ##err,
+#define mempool_unref(x) pool_unref(x)
+#elif defined(CONFIG_DOVECOT_10)
#define ME(err)
+#define str_array_length(x) strarray_length(x)
+#define mempool_unref(x) pool_unref(*(x))
+#else
+#error "Building against this dovecot version is not supported"
#endif
#endif /* _ANTISPAM_PLUGIN_H */