1# $Id: Makefile.in,v 1.75 2013/09/02 03:54:35 manu Exp $ 2 3# 4# Copyright (c) 2004 Emmanuel Dreyfus 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions 9# are met: 10# 1. Redistributions of source code must retain the above copyright 11# notice, this list of conditions and the following disclaimer. 12# 2. Redistributions in binary form must reproduce the above copyright 13# notice, this list of conditions and the following disclaimer in the 14# documentation and/or other materials provided with the distribution. 15# 3. All advertising materials mentioning features or use of this software 16# must display the following acknowledgement: 17# This product includes software developed by Emmanuel Dreyfus 18# 19# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 20# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 23# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29# OF THE POSSIBILITY OF SUCH DAMAGE. 30# 31 32CFLAGS= @CFLAGS@ -D_BSD_SOURCE -DYY_NO_INPUT -I. -I${SRCDIR} @CPPFLAGS@ 33LDFLAGS= @LDFLAGS@ 34LIBS= @LIBS@ 35prefix= @prefix@ 36datarootdir= @datarootdir@ 37exec_prefix= @exec_prefix@ 38SYSCONFDIR= @sysconfdir@ 39LOCALSTATEDIR= @localstatedir@ 40SRCDIR= @srcdir@ 41BINDIR= @bindir@ 42SBINDIR= @sbindir@ 43MANDIR= @mandir@ 44USER= @USER@ 45CONFFILE= @CONFFILE@ 46DUMPFILE= @DUMPFILE@ 47 48# If your make complains about -j, try --disable-parallel-make 49MAKESEQ= $(MAKE) @MAKE_J1@ 50 51CC= @CC@ 52MKDEP= @MKDEP@ 53RM= @RM@ 54MV= @MV@ 55TEST= @TEST@ 56SED= @SED@ 57INSTALL= @INSTALL@ 58LEX= @LEX@ 59YACC= @YACC@ 60TRUE= @TRUE@ 61TOUCH= @TOUCH@ 62 63OBJ= milter-greylist.o pending.o sync.o dnsrbl.o list.o macro.o \ 64 conf.o store.o dump.o spf.o acl.o urlcheck.o stat.o clock.o \ 65 geoip.o fd_pool.o prop.o ldapcheck.o dkimcheck.o p0f.o \ 66 spamd.o mx.o ratelimit.o nsupdate.o brokenmfapi.o geoip2.o 67OBJ_SEQ= conf_yacc.o dump_yacc.o 68OBJ_SEQ_FLAG= .objseq-built 69SRC= milter-greylist.c pending.c sync.c conf.c macro.c stat.c \ 70 clock.c store.c dump.c spf.c acl.c dnsrbl.c list.c \ 71 urlcheck.c geoip.c prop.c ldapcheck.c dkimcheck.c p0f.c \ 72 spamd.c mx.c ratelimit.c nsupdate.c brokenmfapi.c geoip2.c 73GENSRC= conf_yacc.c conf_lex.c dump_yacc.c dump_lex.c 74 75VPATH= ${SRCDIR} 76 77all: milter-greylist rc-bsd.sh rc-redhat.sh \ 78 rc-solaris.sh rc-debian.sh rc-gentoo.sh rc-suse.sh 79 80# GNU make: targets which are not expected to produce same-named files 81.PHONY: bld-milter-greylist obj-seq bld-seq all-seq 82 83milter-greylist: ${OBJ} ${OBJ_SEQ_FLAG} 84 @echo "=== Linking $@:" 85 ${CC} -o $@ ${OBJ} ${OBJ_SEQ} ${LDFLAGS} ${LIBS} 86 87# The idea is that a successful obj-seq build would produce the flag-file, 88# thus "milter-greylist"'s verifiable dependencies are satisfied and the 89# binary is not relinked on every make run. However, code updates that can 90# cause rebuilds of ${OBJ_SEQ} files might require a "gmake rebuild" now. 91${OBJ_SEQ_FLAG}: obj-seq 92 sync || $(TRUE) 93 94all-seq: obj-seq 95obj-seq: 96 @echo "=== Call make sequential for objects sensitive to that (current make='$(MAKE)' MAKEFLAGS='$(MAKEFLAGS)'):" 97 $(MAKESEQ) bld-seq 98 99bld-seq: ${OBJ_SEQ} 100 $(TEST) -f ${OBJ_SEQ_FLAG} || $(TOUCH) ${OBJ_SEQ_FLAG} 101 102sync_yacc.o: sync_yacc.c sync_lex.c 103conf_yacc.o: conf_yacc.c conf_lex.c 104dump_yacc.o: dump_yacc.c dump_lex.c 105 106sed_subst = "s|@BINDIR[@]|${BINDIR}|g; s|@SBINDIR[@]|${SBINDIR}|g; s|@USER[@]|${USER}|g" 107 108rc-bsd.sh: rc-bsd.sh.in 109 ${SED} ${sed_subst} ${SRCDIR}/$< > $@ 110rc-redhat.sh: rc-redhat.sh.in 111 ${SED} ${sed_subst} ${SRCDIR}/$< > $@ 112rc-solaris.sh: rc-solaris.sh.in 113 ${SED} ${sed_subst} ${SRCDIR}/$< > $@ 114rc-debian.sh: rc-debian.sh.in 115 ${SED} ${sed_subst} ${SRCDIR}/$< > $@ 116rc-gentoo.sh: rc-gentoo.sh.in 117 ${SED} ${sed_subst} ${SRCDIR}/$< > $@ 118rc-suse.sh: rc-suse.sh.in 119 ${SED} ${sed_subst} ${SRCDIR}/$< > $@ 120 121install-daemon-to-bin: milter-greylist 122 ${INSTALL} -d -m 755 ${DESTDIR}${BINDIR} 123 ${INSTALL} -m 755 milter-greylist ${DESTDIR}${BINDIR} 124 125install-sbin: milter-greylist 126 ${INSTALL} -d -m 755 ${DESTDIR}${SBINDIR} 127 ${INSTALL} -m 755 milter-greylist ${DESTDIR}${SBINDIR} 128 129install-man: 130 ${INSTALL} -d -m 755 ${DESTDIR}${MANDIR}/man8 131 ${INSTALL} -d -m 755 ${DESTDIR}${MANDIR}/man5 132 ${INSTALL} -m 644 ${SRCDIR}/milter-greylist.8 ${DESTDIR}${MANDIR}/man8 133 ${INSTALL} -m 644 ${SRCDIR}/greylist.conf.5 ${DESTDIR}${MANDIR}/man5 134 135install-conf: 136 ${INSTALL} -d -m 755 ${DESTDIR}`dirname ${CONFFILE}` 137 ${TEST} -f ${DESTDIR}${CONFFILE} -o \ 138 -f ${DESTDIR}/etc/mail/greylist.except || \ 139 ${INSTALL} -m 644 ${SRCDIR}/greylist.conf ${DESTDIR}${CONFFILE} 140 @${TEST} -f ${DESTDIR}/etc/mail/greylist.except && ( \ 141 echo " ================================================"; \ 142 echo " WARNING: the config file name has changed, "; \ 143 echo " Please rename /etc/mail/greylist.except, the "; \ 144 echo " default name is now in ${CONFFILE} "; \ 145 echo " ================================================"; \ 146 ) || ${TRUE} 147 148install-db: 149 ${INSTALL} -d -m 755 -o ${USER} ${DESTDIR}`dirname ${DUMPFILE}` 150 @${TEST} -f ${DESTDIR}/var/db/greylist.db && ( \ 151 echo " ================================================"; \ 152 echo " WARNING: the dump file location has changed, "; \ 153 echo " Please move /var/db/greylist.db, the default "; \ 154 echo " location is now in ${DUMPFILE} "; \ 155 echo " ================================================"; \ 156 ) || ${TRUE} 157 158install: install-daemon-to-bin install-man install-conf install-db 159 160depend: 161 ${MKDEP} ${CPPFLAGS} ${CFLAGS} ${SRC} 162 163clean: 164 ${RM} -f milter-greylist ${OBJ} ${OBJ_SEQ} ${OBJ_SEQ_FLAG} ${GENSRC} \ 165 rc-redhat.sh rc-bsd.sh rc-solaris.sh rc-debian.sh rc-gentoo.sh \ 166 rc-suse.sh y.tab.c 167 sync || $(TRUE) 168 169realclean: clean 170 ${RM} -Rf Makefile config.h config.log config.status \ 171 autom4te.cache configure.lineno *.orig *.bak autoscan.log 172 sync || $(TRUE) 173 174distclean: realclean 175 176rebuild: clean 177 @echo "=== Making all. MAKEFLAGS=$(MAKEFLAGS)" 178 @$(MAKE) all || ( \ 179 echo "==============================================================="; \ 180 echo "=== First build failed. Making all sequentially just in case..."; \ 181 echo "==============================================================="; \ 182 sync || $(TRUE); \ 183 $(MAKESEQ) all ) 184 185.SUFFIXES: .o .c .h .y .l 186.l.c: 187 ${LEX} -o$@ $< 188.y.c: 189 ${YACC} -p`echo $@|${SED} 's/^\([^_]\{1,\}_\).*$$/\1/'` $< 190 ${MV} y.tab.c $@ 191 192# This is a target for debugging 193start: milter-greylist 194 ./milter-greylist -D -v -p milter-greylist.sock 195