# $Cambridge: hermes/src/2hermes/Makefile,v 1.19 2004/07/21 15:56:24 fanf2 Exp $ # # Build imapupload DOCS= doc/index.html OBJS= imapupload.o err.o PROGS= imapupload stunnel BINDIR= /opt/2hermes/bin ETCDIR= /opt/2hermes/etc # Location of dependent libraries IMAP= imap-2002e IMAPBUILD= ${IMAP}/bundled IMAPCONF= Config-imap C= ${IMAP}/c-client CCLIENT= $C/c-client.a OPENSSL= /opt/openssl_0.9.7c # dependent utilities STUNNEL= stunnel-3.26 STUNNELBUILD= ${STUNNEL}/Makefile STUNNELBIN= ${STUNNEL}/stunnel STUNNELPREFIX= ${OPENSSL} # Get build settings from c-client directory CC= `cat $C/CCTYPE` CFLAGS= -I$C `cat $C/CFLAGS` ${EXTRACFLAGS} LDLIBS= ${CCLIENT} `cat $C/LDFLAGS` # main rules all: ${PROGS} # dunno why I can't just rely on the implicit rule's command here imapupload: ${CCLIENT} imapupload.o err.o ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o $@ imapupload.o err.o ${LDLIBS} imapupload.o: imapupload.c err.h list.h stdbool.h err.o: err.c err.h docs ${DOCS}: mkdir -p doc doxygen # auxiliary rules install: case `hostname` in \ hermes*.csi.cam.ac.uk) \ : now handled by hermes build system \ ;; \ *) \ mkdir -p ${BINDIR} ${ETCDIR} ; \ cp cert.pem ${ETCDIR}/cert.pem ; \ cp imapupload ${BINDIR}/imapupload ; \ cp ${STUNNELBIN} ${BINDIR}/stunnel ; \ cp 2hermes ${BINDIR}/2hermes.real ; \ cp 2hermes.notnow ${BINDIR}/2hermes.notnow ; \ if [ ! -h ${BINDIR}/2hermes ] ; \ then \ rm -f ${BINDIR}/2hermes ${BINDIR}/pop2hermes ; \ ln -s 2hermes.real ${BINDIR}/2hermes ; \ ln -s 2hermes.real ${BINDIR}/pop2hermes ; \ fi \ ;; \ esac clean: rm -rf ${OBJS} ${PROGS} ${DOCS} realclean: clean rm -rf ${IMAP} ${IMAP}.* ${STUNNEL} ${STUNNEL}.* # Frob the build configuration # and build with gcc on Solaris ${CCLIENT}: ${IMAPBUILD} ${IMAPCONF} echo SSLDIR=${OPENSSL} >${IMAP}/SPECIALS cd ${IMAP}; make gso # Unpack the source distribution and # prevent the bundled software from being built ${IMAPBUILD}: ${IMAP}.tar.Z zcat <${IMAP}.tar.Z | tar fx - touch ${IMAPBUILD} ${IMAP}.tar.Z: .keep/${IMAP}.tar.Z ln .keep/${IMAP}.tar.Z ${IMAP}.tar.Z # similar stuff for stunnel stunnel: ${STUNNELBIN} cp ${STUNNELBIN} stunnel ${STUNNELBIN}: ${STUNNELBUILD} cd ${STUNNEL}; \ make stunnel ${STUNNELBUILD}: ${STUNNEL}.tar.gz gzip -dc ${STUNNEL}.tar.gz | tar fx - cd ${STUNNEL}; \ ./configure --with-ssl=${OPENSSL} --prefix=${STUNNELPREFIX} ${STUNNEL}.tar.gz: .keep/${STUNNEL}.tar.gz ln .keep/${STUNNEL}.tar.gz ${STUNNEL}.tar.gz # eof