Makefile (4417B)
1 .POSIX: 2 3 NAME = sfeed 4 VERSION = 1.7 5 6 # curses theme, see themes/ directory. 7 SFEED_THEME = mono 8 9 # paths 10 PREFIX = /usr/local 11 MANPREFIX = ${PREFIX}/man 12 DOCPREFIX = ${PREFIX}/share/doc/${NAME} 13 14 RANLIB = ranlib 15 16 # use system flags. 17 SFEED_CFLAGS = ${CFLAGS} 18 SFEED_LDFLAGS = ${LDFLAGS} 19 SFEED_CPPFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE 20 21 # uncomment for conservative locked I/O. 22 #SFEED_CPPFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE \ 23 # -DGETNEXT=getchar 24 25 # set $SFEED_CURSES to empty to not build sfeed_curses. 26 SFEED_CURSES = sfeed_curses 27 SFEED_CURSES_CFLAGS = ${CFLAGS} 28 SFEED_CURSES_CPPFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE \ 29 -DSFEED_THEME=\"themes/${SFEED_THEME}.h\" ${SFEED_CPPFLAGS} 30 SFEED_CURSES_LDFLAGS = ${LDFLAGS} -lcurses 31 32 # Linux: some distros use ncurses and require -lncurses. 33 #SFEED_CURSES_LDFLAGS = ${LDFLAGS} -lncurses 34 35 # Gentoo Linux: some distros might also require -ltinfo and -D_DEFAULT_SOURCE 36 # to prevent warnings about feature test macros. 37 #SFEED_CURSES_LDFLAGS = ${LDFLAGS} -lcurses -ltinfo 38 39 # FreeBSD: unset feature test macros for SIGWINCH etc. 40 #SFEED_CURSES_CPPFLAGS = 41 42 # use minicurses with hardcoded escape sequences (not the system curses). 43 #SFEED_CURSES_CPPFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE \ 44 # -DSFEED_THEME=\"themes/${SFEED_THEME}.h\" -DSFEED_MINICURSES 45 #SFEED_CURSES_LDFLAGS = ${LDFLAGS} 46 47 BIN = \ 48 sfeed\ 49 sfeed_atom\ 50 ${SFEED_CURSES}\ 51 sfeed_frames\ 52 sfeed_gopher\ 53 sfeed_html\ 54 sfeed_mbox\ 55 sfeed_opml_import\ 56 sfeed_plain\ 57 sfeed_twtxt\ 58 sfeed_web\ 59 sfeed_xmlenc 60 SCRIPTS = \ 61 sfeed_content\ 62 sfeed_markread\ 63 sfeed_opml_export\ 64 sfeed_update\ 65 sfeed_read 66 67 SRC = ${BIN:=.c} 68 HDR = \ 69 minicurses.h\ 70 util.h\ 71 xml.h 72 73 LIBUTIL = libutil.a 74 LIBUTILSRC = \ 75 util.c 76 LIBUTILOBJ = ${LIBUTILSRC:.c=.o} 77 78 LIBXML = libxml.a 79 LIBXMLSRC = \ 80 xml.c 81 LIBXMLOBJ = ${LIBXMLSRC:.c=.o} 82 83 COMPATSRC = \ 84 strlcat.c\ 85 strlcpy.c 86 COMPATOBJ =\ 87 strlcat.o\ 88 strlcpy.o 89 90 LIB = ${LIBUTIL} ${LIBXML} ${COMPATOBJ} 91 92 MAN1 = ${BIN:=.1}\ 93 ${SCRIPTS:=.1} 94 MAN5 = \ 95 sfeed.5\ 96 sfeedrc.5 97 DOC = \ 98 LICENSE\ 99 README\ 100 README.xml 101 102 all: ${BIN} 103 104 ${BIN}: ${LIB} ${@:=.o} 105 106 OBJ = ${SRC:.c=.o} ${LIBXMLOBJ} ${LIBUTILOBJ} ${COMPATOBJ} 107 108 ${OBJ}: ${HDR} 109 110 .o: 111 ${CC} -o $@ $< ${LIB} ${SFEED_LDFLAGS} 112 113 .c.o: 114 ${CC} -o $@ -c $< ${SFEED_CFLAGS} ${SFEED_CPPFLAGS} 115 116 sfeed_curses.o: sfeed_curses.c themes/${SFEED_THEME}.h 117 ${CC} -o $@ -c sfeed_curses.c ${SFEED_CURSES_CFLAGS} ${SFEED_CURSES_CPPFLAGS} 118 119 sfeed_curses: ${LIB} sfeed_curses.o 120 ${CC} -o $@ sfeed_curses.o ${LIB} ${SFEED_CURSES_LDFLAGS} 121 122 ${LIBUTIL}: ${LIBUTILOBJ} 123 ${AR} -rc $@ $? 124 ${RANLIB} $@ 125 126 ${LIBXML}: ${LIBXMLOBJ} 127 ${AR} -rc $@ $? 128 ${RANLIB} $@ 129 130 dist: 131 rm -rf "${NAME}-${VERSION}" 132 mkdir -p "${NAME}-${VERSION}" 133 cp -fR ${MAN1} ${MAN5} ${DOC} ${HDR} \ 134 ${SRC} ${LIBXMLSRC} ${LIBUTILSRC} ${COMPATSRC} ${SCRIPTS} \ 135 themes Makefile \ 136 sfeedrc.example style.css \ 137 "${NAME}-${VERSION}" 138 # make tarball 139 tar cf - "${NAME}-${VERSION}" | \ 140 gzip -c > "${NAME}-${VERSION}.tar.gz" 141 rm -rf "${NAME}-${VERSION}" 142 143 clean: 144 rm -f ${BIN} ${OBJ} ${LIB} 145 146 install: all 147 # installing executable files and scripts. 148 mkdir -p "${DESTDIR}${PREFIX}/bin" 149 cp -f ${BIN} ${SCRIPTS} "${DESTDIR}${PREFIX}/bin" 150 for f in ${BIN} ${SCRIPTS}; do chmod 755 "${DESTDIR}${PREFIX}/bin/$$f"; done 151 # installing example files. 152 mkdir -p "${DESTDIR}${DOCPREFIX}" 153 cp -f sfeedrc.example\ 154 style.css\ 155 README\ 156 README.xml\ 157 "${DESTDIR}${DOCPREFIX}" 158 # installing manual pages for general commands: section 1. 159 mkdir -p "${DESTDIR}${MANPREFIX}/man1" 160 cp -f ${MAN1} "${DESTDIR}${MANPREFIX}/man1" 161 for m in ${MAN1}; do chmod 644 "${DESTDIR}${MANPREFIX}/man1/$$m"; done 162 # installing manual pages for file formats: section 5. 163 mkdir -p "${DESTDIR}${MANPREFIX}/man5" 164 cp -f ${MAN5} "${DESTDIR}${MANPREFIX}/man5" 165 for m in ${MAN5}; do chmod 644 "${DESTDIR}${MANPREFIX}/man5/$$m"; done 166 167 uninstall: 168 # removing executable files and scripts. 169 for f in ${BIN} ${SCRIPTS}; do rm -f "${DESTDIR}${PREFIX}/bin/$$f"; done 170 # removing example files. 171 rm -f \ 172 "${DESTDIR}${DOCPREFIX}/sfeedrc.example"\ 173 "${DESTDIR}${DOCPREFIX}/style.css"\ 174 "${DESTDIR}${DOCPREFIX}/README"\ 175 "${DESTDIR}${DOCPREFIX}/README.xml" 176 -rmdir "${DESTDIR}${DOCPREFIX}" 177 # removing manual pages. 178 for m in ${MAN1}; do rm -f "${DESTDIR}${MANPREFIX}/man1/$$m"; done 179 for m in ${MAN5}; do rm -f "${DESTDIR}${MANPREFIX}/man5/$$m"; done 180 181 .PHONY: all clean dist install uninstall