rohrpost

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

commit 94b0899daf7e43c5633f9ab31a48df53d3a1be6a
parent caa003e08ea18cf81edc2aaad4fa8d6af0afd159
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sun,  7 Jun 2020 12:06:45 +0200

Move build system to a simpler style.

Diffstat:
Makefile | 94+++++++++++++++++++++++++++++++++++++++++--------------------------------------
config.mk | 24------------------------
2 files changed, 49 insertions(+), 69 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,7 +1,28 @@ # rohrpost - a commandline mail client # See LICENSE file for copyright and license details. -include config.mk +NAME = rohrpost +VERSION = 0.5 + +# Customize below to fit your system + +# paths +PREFIX = /usr/local +SHAREPREFIX= ${PREFIX}/share/${NAME} +MANPREFIX = ${PREFIX}/share/man + +# includes and libs +INCS = -I. -I/usr/include +LIBS = -L/usr/lib -lc -lssl -lcrypto -lz -ldl + +# flags +CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE -D_XOPEN_SOURCE -D_GNU_SOURCE +CFLAGS = -g -std=gnu99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} +LDFLAGS = -g ${LIBS} +#LDFLAGS = -s ${LIBS} + +# compiler and linker +CC = cc SRC = ${NAME}.c ind.c llist.c cfg.c txtdb.c mark.c cur.c \ select.c sieve.c net.c base64.c strio.c parser.c pager.c \ @@ -11,58 +32,45 @@ SRC = ${NAME}.c ind.c llist.c cfg.c txtdb.c mark.c cur.c \ OBJ = ${SRC:.c=.o} -all: options ${NAME} - -options: - @echo ${NAME} build options: - @echo "CFLAGS = ${CFLAGS}" - @echo "LDFLAGS = ${LDFLAGS}" - @echo "CC = ${CC}" +all: ${NAME} .c.o: - @echo CC $< - @${CC} -c ${CFLAGS} $< + ${CC} -c ${CFLAGS} $< -${OBJ}: config.mk +${OBJ}: ${NAME}: ${OBJ} - @echo CC -o $@ - @${CC} -o $@ ${OBJ} ${LDFLAGS} + ${CC} -o $@ ${OBJ} ${LDFLAGS} clean: - @echo cleaning - @rm -f ${NAME} ${OBJ} ${NAME}-${VERSION}.tar.gz - @rm -f bin/${NAME} - @find bin -type l -exec rm {} \; + rm -f ${NAME} ${OBJ} ${NAME}-${VERSION}.tar.gz + rm -f bin/${NAME} + find bin -type l -exec rm {} \; dist: clean - @echo creating dist tarball - @mkdir -p ${NAME}-${VERSION} - @cp -R LICENSE Makefile README.md config.mk \ + mkdir -p ${NAME}-${VERSION} + cp -R LICENSE Makefile README.md config.mk \ ${SRC} *.h tmpl bin rfc examples ${NAME}-${VERSION} - @tar -cf ${NAME}-${VERSION}.tar ${NAME}-${VERSION} - @gzip ${NAME}-${VERSION}.tar - @rm -rf ${NAME}-${VERSION} + tar -cf ${NAME}-${VERSION}.tar ${NAME}-${VERSION} + gzip ${NAME}-${VERSION}.tar + rm -rf ${NAME}-${VERSION} etc: - @echo installing etc files into ${DESTDIR}/etc/${NAME} - @mkdir -p ${DESTDIR}/etc/${NAME} - @cp -R etc/${NAME}/* ${DESTDIR}/etc/${NAME} + mkdir -p ${DESTDIR}/etc/${NAME} + cp -R etc/${NAME}/* ${DESTDIR}/etc/${NAME} bin: ${NAME} - @echo creating ${NAME} symlinks in ./bin - @mkdir -p ./bin - @cp ${NAME} bin - @cd bin; \ + mkdir -p ./bin + cp ${NAME} bin + cd bin; \ for i in `./${NAME} -i`; \ do \ ln -sf ${NAME} $$i; \ done; true install: all bin - @echo installing executable files to ${DESTDIR}${PREFIX}/bin - @mkdir -p ${DESTDIR}${PREFIX}/bin - @cd bin; \ + mkdir -p ${DESTDIR}${PREFIX}/bin + cd bin; \ cp ${NAME} ${DESTDIR}${PREFIX}/bin; \ chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME}; \ for i in `ls -1`; \ @@ -82,17 +90,14 @@ install: all bin fi \ done; \ true; - @echo installing shared files to ${DESTDIR}${SHAREPREFIX} - @mkdir -p ${DESTDIR}${SHAREPREFIX} - @cp -rf tmpl ${DESTDIR}${SHAREPREFIX} - @chmod 644 ${DESTDIR}${SHAREPREFIX}/tmpl/* - @echo correcting the share prefix in rpinit - @sed "s,SHAREPREFIX,${SHAREPREFIX},g" < bin/rpinit > ${DESTDIR}${PREFIX}/bin/rpinit - @chmod 755 ${DESTDIR}${PREFIX}/bin/rpinit + mkdir -p ${DESTDIR}${SHAREPREFIX} + cp -rf tmpl ${DESTDIR}${SHAREPREFIX} + chmod 644 ${DESTDIR}${SHAREPREFIX}/tmpl/* + sed "s,SHAREPREFIX,${SHAREPREFIX},g" < bin/rpinit > ${DESTDIR}${PREFIX}/bin/rpinit + chmod 755 ${DESTDIR}${PREFIX}/bin/rpinit uninstall: clean - @echo removing executable files from ${DESTDIR}${PREFIX}/bin - @cd bin; \ + cd bin; \ for i in `ls -1`; \ do \ rm -f ${DESTDIR}${PREFIX}/bin/$$i; \ @@ -100,8 +105,7 @@ uninstall: clean [ -e ${DESTDIR}${PREFIX}/bin/${NAME} ] && \ rm ${DESTDIR}${PREFIX}/bin/${NAME}; \ true; - @echo removing shared files from ${DESTDIR}${PREFIX} - @rm -rf ${DESTDIR}${PREFIX} + rm -rf ${DESTDIR}${PREFIX} -.PHONY: all options clean dist install uninstall bin binclean +.PHONY: all clean dist install uninstall bin binclean diff --git a/config.mk b/config.mk @@ -1,24 +0,0 @@ -# rohrpost metadata -NAME = rohrpost -VERSION = 0.5 - -# Customize below to fit your system - -# paths -PREFIX = /usr/local -SHAREPREFIX= ${PREFIX}/share/${NAME} -MANPREFIX = ${PREFIX}/share/man - -# includes and libs -INCS = -I. -I/usr/include -LIBS = -L/usr/lib -lc -lssl -lcrypto -lz -ldl - -# flags -CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE -D_XOPEN_SOURCE -D_GNU_SOURCE -CFLAGS = -g -std=gnu99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} -LDFLAGS = -g ${LIBS} -#LDFLAGS = -s ${LIBS} - -# compiler and linker -CC = cc -