Makefile (2575B)
1 # rohrpost - a commandline mail client 2 # See LICENSE file for copyright and license details. 3 .POSIX: 4 5 NAME = rohrpost 6 VERSION = 0.5 7 8 # Customize below to fit your system 9 10 # paths 11 PREFIX = /usr/local 12 SHAREPREFIX = ${PREFIX}/share/${NAME} 13 14 # includes and libs 15 LIBS = -ltls 16 # OpenBSD 17 #LIBS = -ltls -lcrypto -liconv 18 19 # flags 20 RP_CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE -D_XOPEN_SOURCE -D_GNU_SOURCE ${CPPFLAGS} 21 # Beware, -O1 will cause problems in flag.c. 22 RP_CFLAGS = ${CFLAGS} -g -pedantic -Wall -O0 ${RP_CPPFLAGS} 23 RP_LDFLAGS = -g ${LDFLAGS} 24 #RP_LDFLAGS = -s 25 26 SRC = ${NAME}.c ind.c llist.c cfg.c txtdb.c mark.c cur.c \ 27 select.c sieve.c net.c base64.c strio.c parser.c pager.c \ 28 mime.c folder.c imap.c inc.c stats.c capability.c pick.c \ 29 flag.c copy.c remove.c scan.c quote.c view.c \ 30 param.c part.c add.c ids.c util.c path.c dos.c 31 32 OBJ = ${SRC:.c=.o} 33 34 all: ${NAME} 35 36 .c.o: 37 ${CC} ${RP_CFLAGS} -c $< 38 39 ${OBJ}: 40 41 ${NAME}: ${OBJ} 42 ${CC} ${RP_LDFLAGS} -o $@ ${OBJ} ${LIBS} 43 44 clean: 45 rm -f ${NAME} ${OBJ} ${NAME}-${VERSION}.tar.gz 46 rm -f bin/${NAME} 47 find bin -type l -exec rm -f {} + 48 49 dist: clean 50 mkdir -p ${NAME}-${VERSION} 51 cp -R LICENSE Makefile README.md config.mk \ 52 ${SRC} *.h tmpl bin rfc examples ${NAME}-${VERSION} 53 tar -cf ${NAME}-${VERSION}.tar ${NAME}-${VERSION} 54 gzip ${NAME}-${VERSION}.tar 55 rm -rf ${NAME}-${VERSION} 56 57 bin: ${NAME} 58 cp ${NAME} bin 59 cd bin; \ 60 for i in `./${NAME} -i`; \ 61 do \ 62 ln -sf ${NAME} $$i; \ 63 done 64 65 install: all bin 66 mkdir -p '${DESTDIR}${PREFIX}/bin' 67 cd bin; \ 68 cp ${NAME} '${DESTDIR}${PREFIX}/bin'; \ 69 for i in `ls -1`; \ 70 do \ 71 if [ -e '${DESTDIR}${PREFIX}/bin/'$$i ]; \ 72 then \ 73 rm -f '${DESTDIR}${PREFIX}/bin/'$$i; \ 74 fi; \ 75 \ 76 if [ ! -L $$i ]; \ 77 then \ 78 cp $$i '${DESTDIR}${PREFIX}/bin'; \ 79 else \ 80 ln -sf ${NAME} \ 81 '${DESTDIR}${PREFIX}/bin/'$$i; \ 82 fi \ 83 done; \ 84 mkdir -p '${DESTDIR}${SHAREPREFIX}' 85 cp -rf tmpl '${DESTDIR}${SHAREPREFIX}' 86 sed 's,SHAREPREFIX,${SHAREPREFIX},g' < bin/rpinit > '${DESTDIR}${PREFIX}/bin/rpinit' 87 chmod 755 '${DESTDIR}${PREFIX}/bin/rpinit' 88 89 uninstall: clean 90 ( cd '${DESTDIR}${PREFIX}/bin' && \ 91 for i in $$(./${NAME} -i); \ 92 do \ 93 rm -f $$i; \ 94 done ) 95 ( cd bin; \ 96 for i in `ls -1`; \ 97 do \ 98 rm -f "${DESTDIR}${PREFIX}/bin/$$i"; \ 99 done; \ 100 if [ -e '${DESTDIR}${PREFIX}/bin/${NAME}' ]; \ 101 then \ 102 rm -f '${DESTDIR}${PREFIX}/bin/${NAME}'; \ 103 fi ) 104 ( cd tmpl; \ 105 for i in $$(ls -1); \ 106 do \ 107 rm -f '${DESTDIR}${SHAREPREFIX}/tmpl/'$$i; \ 108 done ) 109 -rmdir '${DESTDIR}${SHAREPREFIX}/tmpl' \ 110 '${DESTDIR}${SHAREPREFIX}' 111 112 .PHONY: all clean dist install uninstall bin 113