diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2011-05-03 19:26:38 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2011-05-03 19:26:38 +0200 |
commit | a1527ce7177df11a8ee1b46a0e7b64f0f0df234b (patch) | |
tree | 41f724c2a04b3582878d40dc451930e71a7b86aa /Makefile | |
parent | c8a9a6550b84412f919b772a9cb8db1e3ef79d19 (diff) | |
parent | 808eaa49efe2dc2438ef98ddf4bac4cfd2898a3d (diff) | |
download | dovecot-antispam-master.tar.gz dovecot-antispam-master.tar.xz dovecot-antispam-master.zip |
Diffstat (limited to '')
-rw-r--r-- | Makefile | 73 |
1 files changed, 21 insertions, 52 deletions
@@ -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 @@ -21,62 +23,29 @@ INCS += -I$(DOVECOT)/src/imap/ # output name LIBRARY_NAME ?= lib90_$(PLUGINNAME)_plugin.so - -# debug rules -ifeq ("$(DEBUG)", "stderr") -CFLAGS += -DCONFIG_DEBUG -DDEBUG_STDERR -objs += debug.o -else -ifeq ("$(DEBUG)", "syslog") -CFLAGS += -DCONFIG_DEBUG -DDEBUG_SYSLOG -objs += debug.o -endif -endif - -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 +objs = antispam-storage.o antispam-plugin.o debug.o +objs += dspam-exec.o signature-log.o crm114-exec.o pipe.o spool2dir.o signature.o ifeq ("$(BACKEND)", "trainstore") LDFLAGS += -lssl endif # main make rules -CFLAGS += -fPIC -shared -Wall -Wextra -DPLUGINNAME=$(PLUGINNAME) +LOCALCFLAGS += -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: $(LIBRARY_NAME) -antispam-storage.o: antispam-storage.c antispam-storage-*.c $(CONFIG) antispam-plugin.h dovecot-version.h - $(CC) -c $(CFLAGS) $(INCS) -o $@ $< +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 - $(CC) -c $(CFLAGS) $(INCS) -o $@ $< +%.o: %.c antispam-plugin.h dovecot-version.h antispam-version.h + $(CC) -c $(CFLAGS) $(LOCALCFLAGS) $(INCS) -o $@ $< $(LIBRARY_NAME): $(objs) - $(CC) $(CFLAGS) $(INCS) $(objs) -o $(LIBRARY_NAME) $(LDFLAGS) + $(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 @@ -85,16 +54,16 @@ dovecot-version.h: dovecot-version antispam-version.h: version.sh ./version.sh > antispam-version.h + 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)/ +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 |