Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 3 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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