rohrpost

A commandline mail client to change the world as we see it.
git clone git://r-36.net/rohrpost
Log | Files | Refs | LICENSE

Makefile (2730B)


      1 # rohrpost - a commandline mail client
      2 # See LICENSE file for copyright and license details.
      3 
      4 include config.mk
      5 
      6 SRC = ${NAME}.c ind.c llist.c cfg.c txtdb.c mark.c cur.c \
      7 	select.c sieve.c net.c base64.c strio.c parser.c pager.c \
      8 	mime.c folder.c imap.c inc.c stats.c capability.c pick.c \
      9 	flag.c copy.c remove.c scan.c quote.c view.c \
     10 	param.c part.c add.c ids.c util.c path.c dos.c
     11 
     12 OBJ = ${SRC:.c=.o}
     13 
     14 all: options ${NAME}
     15 
     16 options:
     17 	@echo ${NAME} build options:
     18 	@echo "CFLAGS   = ${CFLAGS}"
     19 	@echo "LDFLAGS  = ${LDFLAGS}"
     20 	@echo "CC       = ${CC}"
     21 
     22 .c.o:
     23 	@echo CC $<
     24 	@${CC} -c ${CFLAGS} $<
     25 
     26 ${OBJ}: config.mk
     27 
     28 ${NAME}: ${OBJ}
     29 	@echo CC -o $@
     30 	@${CC} -o $@ ${OBJ} ${LDFLAGS}
     31 
     32 clean:
     33 	@echo cleaning
     34 	@rm -f ${NAME} ${OBJ} ${NAME}-${VERSION}.tar.gz
     35 	@rm -f bin/${NAME}
     36 	@find bin -type l -exec rm {} \;
     37 
     38 dist: clean
     39 	@echo creating dist tarball
     40 	@mkdir -p ${NAME}-${VERSION}
     41 	@cp -R LICENSE Makefile README.md config.mk \
     42 		${SRC} *.h tmpl bin rfc examples ${NAME}-${VERSION}
     43 	@tar -cf ${NAME}-${VERSION}.tar ${NAME}-${VERSION}
     44 	@gzip ${NAME}-${VERSION}.tar
     45 	@rm -rf ${NAME}-${VERSION}
     46 
     47 etc:
     48 	@echo installing etc files into ${DESTDIR}/etc/${NAME}
     49 	@mkdir -p ${DESTDIR}/etc/${NAME}
     50 	@cp -R etc/${NAME}/* ${DESTDIR}/etc/${NAME}
     51 
     52 bin: ${NAME}
     53 	@echo creating ${NAME} symlinks in ./bin
     54 	@mkdir -p ./bin
     55 	@cp ${NAME} bin
     56 	@cd bin; \
     57 	for i in `./${NAME} -i`; \
     58 	do \
     59 		ln -sf ${NAME} $$i; \
     60 	done; true
     61 
     62 install: all bin
     63 	@echo installing executable files to ${DESTDIR}${PREFIX}/bin
     64 	@mkdir -p ${DESTDIR}${PREFIX}/bin
     65 	@cd bin; \
     66 	cp ${NAME} ${DESTDIR}${PREFIX}/bin; \
     67 	chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME}; \
     68 	for i in `ls -1`; \
     69 	do \
     70 		if [ -e ${DESTDIR}${PREFIX}/bin/$$i ]; \
     71 		then \
     72 			rm -f ${DESTDIR}${PREFIX}/bin/$$i; \
     73 		fi; \
     74 		\
     75 		if [ ! -L $$i ]; \
     76 		then \
     77 			cp $$i ${DESTDIR}${PREFIX}/bin; \
     78 			chmod 755 ${DESTDIR}${PREFIX}/bin/$$i; \
     79 		else \
     80 			ln -sf ${DESTDIR}${PREFIX}/bin/${NAME} \
     81 				${DESTDIR}${PREFIX}/bin/$$i; \
     82 		fi \
     83 	done; \
     84 	true;
     85 	@echo installing shared files to ${DESTDIR}${SHAREPREFIX}
     86 	@mkdir -p ${DESTDIR}${SHAREPREFIX}
     87 	@cp -rf tmpl ${DESTDIR}${SHAREPREFIX}
     88 	@chmod 644 ${DESTDIR}${SHAREPREFIX}/tmpl/*
     89 	@echo correcting the share prefix in rpinit
     90 	@sed "s,SHAREPREFIX,${SHAREPREFIX},g" < bin/rpinit > ${DESTDIR}${PREFIX}/bin/rpinit
     91 	@chmod 755 ${DESTDIR}${PREFIX}/bin/rpinit
     92 
     93 uninstall: clean
     94 	@echo removing executable files from ${DESTDIR}${PREFIX}/bin
     95 	@cd bin; \
     96 	for i in `ls -1`; \
     97 	do \
     98 		rm -f ${DESTDIR}${PREFIX}/bin/$$i; \
     99 	done; \
    100 	[ -e ${DESTDIR}${PREFIX}/bin/${NAME} ] && \
    101 		rm ${DESTDIR}${PREFIX}/bin/${NAME}; \
    102 	true;
    103 	@echo removing shared files from ${DESTDIR}${PREFIX}
    104 	@rm -rf ${DESTDIR}${PREFIX}
    105 
    106 .PHONY: all options clean dist install uninstall bin binclean
    107