aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile40
1 files changed, 19 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index b833a3f..f405d3d 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,9 @@ INSTALLDIR ?= $(moduledir)/imap
# Kill CFLAGS from dovecot-config
CFLAGS := $(CFLAGSORIG)
+backenddir := /usr/lib/dovecot-antispam
+CFLAGS += '-DBACKENDDIR="$(backenddir)"'
+
# includes/flags we need for building a dovecot plugin
INCS += -DHAVE_CONFIG_H
INCS += -I$(DOVECOT)/
@@ -21,6 +24,7 @@ INCS += -I$(DOVECOT)/src/imap/
# output name
LIBRARY_NAME ?= lib90_$(PLUGINNAME)_plugin.so
+objs = antispam-storage.o antispam-plugin.o
# debug rules
ifeq ("$(DEBUG)", "stderr")
@@ -37,32 +41,14 @@ ifeq ("$(DEBUG_VERBOSE)", "1")
CFLAGS += -DCONFIG_DEBUG_VERBOSE
endif
-# backend error check
-ifeq ("$(BACKEND)", "")
-error: verify_config
- @echo "Error! no backend configured"
- @false
-endif
-
-# per-backend rules
-ifeq ("$(BACKEND)", "dspam-exec")
-objs += signature.o
-endif
-ifeq ("$(BACKEND)", "signature-log")
-objs += signature.o
-endif
-ifeq ("$(BACKEND)", "crm114-exec")
-objs += signature.o
-endif
+BACKENDS = dspam-exec.so signature-log.so crm114-exec.so mailtrain.so spool2dir.so
# main make rules
CFLAGS += -fPIC -shared -Wall -Wextra -DPLUGINNAME=$(PLUGINNAME)
CC ?= cc
HOSTCC ?= cc
-objs += antispam-plugin.o antispam-storage.o $(BACKEND).o
-
-all: verify_config $(LIBRARY_NAME)
+all: verify_config $(LIBRARY_NAME) $(BACKENDS)
antispam-storage.o: antispam-storage.c antispam-storage-*.c $(CONFIG) antispam-plugin.h dovecot-version.h
$(CC) -c $(CFLAGS) $(INCS) -o $@ $<
@@ -71,7 +57,7 @@ antispam-storage.o: antispam-storage.c antispam-storage-*.c $(CONFIG) antispam-p
$(CC) -c $(CFLAGS) $(INCS) -o $@ $<
$(LIBRARY_NAME): $(objs)
- $(CC) $(CFLAGS) $(INCS) $(objs) -o $(LIBRARY_NAME) $(LDFLAGS)
+ $(CC) $(CFLAGS) $(INCS) $(objs) -o $(LIBRARY_NAME) $(LDFLAGS) -ldl
dovecot-version: dovecot-version.c $(CONFIG)
$(HOSTCC) $(INCS) -o dovecot-version dovecot-version.c
@@ -82,11 +68,23 @@ dovecot-version.h: dovecot-version
antispam-version.h: version.sh
./version.sh > antispam-version.h
+dspam-exec.so: dspam-exec.o signature.o
+signature-log.so: signature-log.o signature.o
+crm114-exec.so: crm114-exec.o signature.o
+mailtrain.so: mailtrain.o
+spool2dir.so: spool2dir.o
+
+$(BACKENDS):
+ $(CC) $(CFLAGS) $(INCS) $(LDFLAGS) -shared -o $@ $^
+
+
clean:
rm -f *.so *.o *~ dovecot-version dovecot-version.h antispam-version.h
install: all
install -o $(USER) -g $(GROUP) -m 0755 $(LIBRARY_NAME) $(DESTDIR)$(INSTALLDIR)/
+ mkdir -p $(DESTDIR)$(backenddir)
+ install -o $(USER) -g $(GROUP) -m 0755 $(BACKENDS) $(DESTDIR)$(backenddir)/
verify_config:
@if [ ! -r $(CONFIG) ]; then \