Makefile (2185B)
1 .POSIX: 2 3 NAME = sfeed_curses 4 VERSION = 0.9.3 5 6 # paths 7 PREFIX = /usr/local 8 MANPREFIX = ${PREFIX}/man 9 DOCPREFIX = ${PREFIX}/share/doc/${NAME} 10 11 # use system flags. 12 SFEED_CFLAGS = ${CFLAGS} 13 SFEED_LDFLAGS = ${LDFLAGS} -lcurses 14 SFEED_CPPFLAGS = -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_BSD_SOURCE 15 16 # Linux: some distros use ncurses and require -lncurses. 17 #SFEED_LDFLAGS = ${LDFLAGS} -lncurses 18 19 # Gentoo Linux: some distros might also require -ltinfo and -D_DEFAULT_SOURCE 20 # to prevent warnings about feature macros. 21 #SFEED_LDFLAGS = ${LDFLAGS} -lcurses -ltinfo 22 #SFEED_CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_BSD_SOURCE 23 24 BIN = sfeed_curses 25 SCRIPTS = sfeed_content sfeed_markread 26 27 SRC = ${BIN:=.c} 28 HDR = minicurses.h 29 30 MAN1 = ${BIN:=.1}\ 31 ${SCRIPTS:=.1} 32 DOC = \ 33 LICENSE\ 34 README 35 36 all: ${BIN} 37 38 ${BIN}: ${@:=.o} 39 40 OBJ = ${SRC:.c=.o} 41 42 ${OBJ}: 43 44 .o: 45 ${CC} -o $@ $< ${SFEED_LDFLAGS} 46 47 .c.o: 48 ${CC} ${SFEED_CFLAGS} ${SFEED_CPPFLAGS} -o $@ -c $< 49 50 dist: 51 rm -rf "${NAME}-${VERSION}" 52 mkdir -p "${NAME}-${VERSION}" 53 cp -f ${MAN1} ${DOC} ${HDR} ${SRC} ${SCRIPTS} Makefile \ 54 "${NAME}-${VERSION}" 55 # make tarball 56 tar cf - "${NAME}-${VERSION}" | \ 57 gzip -c > "${NAME}-${VERSION}.tar.gz" 58 rm -rf "${NAME}-${VERSION}" 59 60 clean: 61 rm -f ${BIN} ${OBJ} 62 63 install: all 64 # installing executable files and scripts. 65 mkdir -p "${DESTDIR}${PREFIX}/bin" 66 cp -f ${BIN} ${SCRIPTS} "${DESTDIR}${PREFIX}/bin" 67 for f in ${BIN} ${SCRIPTS}; do chmod 755 "${DESTDIR}${PREFIX}/bin/$$f"; done 68 # installing example files. 69 mkdir -p "${DESTDIR}${DOCPREFIX}" 70 cp -f README\ 71 "${DESTDIR}${DOCPREFIX}" 72 # installing manual pages for general commands: section 1. 73 mkdir -p "${DESTDIR}${MANPREFIX}/man1" 74 cp -f ${MAN1} "${DESTDIR}${MANPREFIX}/man1" 75 for m in ${MAN1}; do chmod 644 "${DESTDIR}${MANPREFIX}/man1/$$m"; done 76 77 uninstall: 78 # removing executable files and scripts. 79 for f in ${BIN} ${SCRIPTS}; do rm -f "${DESTDIR}${PREFIX}/bin/$$f"; done 80 # removing example files. 81 rm -f \ 82 "${DESTDIR}${DOCPREFIX}/README" 83 -rmdir "${DESTDIR}${DOCPREFIX}" 84 # removing manual pages. 85 for m in ${MAN1}; do rm -f "${DESTDIR}${MANPREFIX}/man1/$$m"; done 86 87 .PHONY: all clean dist install uninstall