1# SA-Exim can be built standalone as a loadable module with this Makefile 2# or you can copy sa-exim.c over exim's local_scan.c file if you want to 3# statically build it into exim 4# 5 6VERSION=$(shell cat version) 7 8# The idea is that you don't have to edit these values, you can override 9# them on the command line: 10# make SACONF=/etc/exim/sa-exim.conf LDFLAGS="-shared -fPIC" CC=cc 11CC=gcc 12CFLAGS=-O2 -Wall 13LDFLAGS=-shared 14SACONF=/etc/exim4/sa-exim.conf 15SPAMC=/usr/bin/spamc 16 17 18# I place the directory in exim/debian/local_scan. Adjust the path as needed 19# Actually, we will also look for the versions supplied with this source 20# if we can't find the exim source 21EXIM_SRC= ../../src 22EXIM_SRC_LOCAL = ./eximinc 23SUFF=-$(VERSION) 24 25SAFLAGS=-DSPAMASSASSIN_CONF=\"$(SACONF)\" -DSPAMC_LOCATION=\"$(SPAMC)\" 26BUILDCFLAGS=-I$(EXIM_SRC) -I$(EXIM_SRC_LOCAL) -DDLOPEN_LOCAL_SCAN $(SAFLAGS) $(CFLAGS) 27 28SONAME=$(subst .so,$(SUFF).so,sa-exim.so) 29 30DOCS=sa.html CHANGELOG ACKNOWLEDGEMENTS 31OBJECTS=$(SONAME) accept.so sa-exim_short.conf $(DOCS) 32OTHERTARGETS=sa-exim.h 33 34all: $(OBJECTS) 35 36docs: $(DOCS) 37 38 39$(SONAME) : sa-exim.c sa-exim.h 40 @echo "Building $@" 41 $(CC) $(BUILDCFLAGS) $(LDFLAGS) -o $@ $< 42 chmod a+rx $(SONAME) 43 44accept.so: accept.c 45 @echo "Building $@" 46 $(CC) $(BUILDCFLAGS) $(LDFLAGS) -o $@ $< 47 chmod a+rx $@ 48 49ACKNOWLEDGEMENTS: Acknowledgements.html 50 @echo "Generating $@" 51 @links -dump $< > $@ 52 53CHANGELOG: Changelog.html 54 @echo "Generating $@" 55 @links -dump $< > $@ 56 57sa.html: Changelog.html Acknowledgements.html sa.html.template 58 @echo "Generating $@" 59 @bash -c 'sed "/<Changelog>/,$$ d" < sa.html.template; cat Changelog.html; sed "1,/<\/Changelog>/ d; /<Acknowledgements>/,$$ d" < sa.html.template; cat Acknowledgements.html; sed "1,/<\/Acknowledgements>/ d" < sa.html.template' > sa.html 60 61sa-exim_short.conf: sa-exim.conf 62 @cat sa-exim.conf | sed "/# --- snip ---/,$$ d" > sa-exim_short.conf 63 @cat sa-exim.conf | grep -v "^#" | tr '\012' '�' | sed "s/���*/��/g" | tr '�' '\012' >> sa-exim_short.conf 64 65sa-exim.h: sa-exim.c version 66 echo "char *version=\"`cat version` (built `date -R 2>/dev/null || date`)\";" > sa-exim.h 67 68clean: 69 @-rm -rf $(OBJECTS) $(DOCS) $(OTHERTARGETS) build-stamp configure-stamp debian/sa-exim debian/sa-exim.postrm.debhelper debian/sa-exim.substvars debian/files 2>/dev/null 70 71deb: ../sa-exim_$(VERSION).orig.tar.gz debian/* 72 @make clean 73 @dpkg-buildpackage -uc -us -sd -rfakeroot 74 @make clean 75 76../sa-exim_$(VERSION).orig.tar.gz: * */* 77 @make clean 78 @( cd ..; tar chvzf sa-exim_$(VERSION).orig.tar.gz sa-exim-$(VERSION) ) 79 80# This didn't work too well, I'll just ship the source with the debian tree 81#deb: ../sa-exim_$(VERSION).orig.tar.gz debian/rules 82# @make clean 83# @dpkg-buildpackage -uc -us -sd -rfakeroot 84# 85# 86#../sa-exim_$(VERSION).tar.gz: * */* 87# @make clean 88# @if [ -d debian ]; then echo "Can't rebuild $@ with debian tree unpacked, please remove it"; exit 1; fi 89# @( cd ..; tar chvzf sa-exim_$(VERSION).tar.gz sa-exim-$(VERSION) ) 90# 91# 92#../sa-exim_$(VERSION).orig.tar.gz: ../sa-exim_$(VERSION).tar.gz 93# if [ -e ../sa-exim-$(VERSION).tar.gz ] ; then \ 94# cp -a ../sa-exim-$(VERSION).tar.gz ../sa-exim_$(VERSION).orig.tar.gz ; \ 95# else \ 96# wget http://marc.merlins.org/linux/sa-exim-$(VERSION).tar.gz; \ 97# mv sa-exim-$(VERSION).tar.gz ../sa-exim_$(VERSION).orig.tar.gz; \ 98# fi 99# 100# 101#debian/rules: 102# @wget http://marc.merlins.org/linux/exim/files/debian/sa-exim_diff.gz 103# @zcat sa-exim_diff.gz | patch -s -p1 104# @/bin/rm sa-exim_diff.gz 105# @chmod 755 debian/rules 106# 107 108