From 808eaa49efe2dc2438ef98ddf4bac4cfd2898a3d Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Sat, 12 Mar 2011 13:03:45 +0100 Subject: remove need for .config file --- Makefile | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'Makefile') 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 -- cgit v1.2.3