bmf

bmf (Bayesian Mail Filter) 0.9.4 fork + patches
git clone git://git.codemadness.org/bmf
Log | Files | Refs | README | LICENSE

commit f368a24da9457e4d269ca281bbc07f0eef08751e
parent 486c23d144116c1794e3800c0c0e051b2f3469e3
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 29 Sep 2018 13:15:26 +0200

improve Makefile

Diffstat:
MMakefile | 105++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 77 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,39 +1,88 @@ -BINDIR=/usr/local/bin -MANDIR=/usr/local/share/man +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/man +NAME = bmf +VERSION = 0.9.4 +BIN = bmf +MAN1 = bmf.1 -VERSION=0.9.4 +SRC = \ + bmf.c \ + dbg.c \ + dbh.c \ + dbtext.c \ + filt.c \ + lex.c \ + str.c \ + vec.c -all: bmf +SCRIPTS = -bmf: bmf.o dbg.o dbh.o dbtext.o filt.o lex.o str.o vec.o - $(CC) -o $@ bmf.o filt.o dbtext.o dbh.o lex.o vec.o str.o dbg.o $(LDFLAGS) $(SYSLIBS) +HDR = \ + config.h \ + dbg.h \ + dbh.h \ + dbtext.h \ + filt.h \ + lex.h \ + str.h \ + vec.h -bmf.o: bmf.c - $(CC) $(CFLAGS) -DPACKAGE=\"bmf\" -DVERSION=\"$(VERSION)\" -c $< +DOC = \ + AUTHORS \ + ChangeLog \ + LICENSE \ + README \ + TODO -install: checkroot bmf bmf.1 - mkdir -p $(DESTDIR)$(BINDIR) - mkdir -p $(DESTDIR)$(MANDIR)/man1 - cp bmf $(DESTDIR)$(BINDIR) - cp bmf.1 $(DESTDIR)$(MANDIR)/man1 +all: ${BIN} -uninstall: checkroot - rm -f $(DESTDIR)$(BINDIR)/bmf - rm -f $(DESTDIR)$(MANDIR)/man1/bmf.1 +OBJ = ${SRC:.c=.o} -clean: - rm -f core *.o bmf +bmf: ${OBJ} + $(CC) -o $@ ${OBJ} $(LDFLAGS) $(SYSLIBS) + +bmf.o: bmf.c + $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c $< + +dist: + rm -rf "${NAME}-${VERSION}" + mkdir -p "${NAME}-${VERSION}" + cp -f ${MAN1} ${DOC} ${HDR} \ + ${SRC} ${SCRIPTS} \ + Makefile \ + bmf.spec.in \ + "${NAME}-${VERSION}" + # make tarball + tar -cf - "${NAME}-${VERSION}" | \ + gzip -c > "${NAME}-${VERSION}.tar.gz" + rm -rf "${NAME}-${VERSION}" -distclean: clean - rm -f Makefile +clean: + rm -f ${BIN} ${OBJ} -dist: tarball +install: all + # installing executable files and scripts. + mkdir -p "${DESTDIR}${PREFIX}/bin" + cp -f ${BIN} ${SCRIPTS} "${DESTDIR}${PREFIX}/bin" + for f in ${BIN} ${SCRIPTS}; do chmod 755 "${DESTDIR}${PREFIX}/bin/$$f"; done + # installing example files. + mkdir -p "${DESTDIR}${PREFIX}/share/${NAME}" + cp -f \ + README\ + "${DESTDIR}${PREFIX}/share/${NAME}" + # installing manual pages for tools. + mkdir -p "${DESTDIR}${MANPREFIX}/man1" + cp -f ${MAN1} "${DESTDIR}${MANPREFIX}/man1" + for m in ${MAN1}; do chmod 644 "${DESTDIR}${MANPREFIX}/man1/$$m"; done -tarball: distclean - (cd ..; \ - cp -ar bmf bmf-$(VERSION); \ - tar czvf bmf-$(VERSION).tar.gz `find bmf-$(VERSION) -type f | egrep -v "CVS|debian"`; \ - rm -rf bmf-$(VERSION); \ - cd $(PWD)) +uninstall: + # removing executable files and scripts. + for f in ${BIN} ${SCRIPTS}; do rm -f "${DESTDIR}${PREFIX}/bin/$$f"; done + # removing example files. + rm -f \ + "${DESTDIR}${PREFIX}/share/${NAME}/README" + -rmdir "${DESTDIR}${PREFIX}/share/${NAME}" + # removing manual pages. + for m in ${MAN1}; do rm -f "${DESTDIR}${MANPREFIX}/man1/$$m"; done -checkroot: +.PHONY: all clean dist install uninstall