sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

Makefile (4400B)


      1.POSIX:
      2
      3NAME = sfeed
      4VERSION = 2.0
      5
      6# curses theme, see themes/ directory.
      7SFEED_THEME = mono
      8
      9# paths
     10PREFIX = /usr/local
     11MANPREFIX = ${PREFIX}/man
     12DOCPREFIX = ${PREFIX}/share/doc/${NAME}
     13
     14RANLIB = ranlib
     15
     16# use system flags.
     17SFEED_CFLAGS = ${CFLAGS}
     18SFEED_LDFLAGS = ${LDFLAGS}
     19SFEED_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.
     26SFEED_CURSES = sfeed_curses
     27SFEED_CURSES_CFLAGS = ${CFLAGS}
     28SFEED_CURSES_CPPFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE \
     29	 -DSFEED_THEME=\"themes/${SFEED_THEME}.h\"
     30SFEED_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} -lncurses -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
     47BIN = \
     48	sfeed\
     49	sfeed_atom\
     50	${SFEED_CURSES}\
     51	sfeed_frames\
     52	sfeed_gopher\
     53	sfeed_html\
     54	sfeed_json\
     55	sfeed_mbox\
     56	sfeed_opml_import\
     57	sfeed_plain\
     58	sfeed_twtxt\
     59	sfeed_web\
     60	sfeed_xmlenc
     61SCRIPTS = \
     62	sfeed_content\
     63	sfeed_markread\
     64	sfeed_opml_export\
     65	sfeed_update
     66
     67SRC = ${BIN:=.c}
     68HDR = \
     69	minicurses.h\
     70	util.h\
     71	xml.h
     72
     73LIBUTIL = libutil.a
     74LIBUTILSRC = \
     75	util.c
     76LIBUTILOBJ = ${LIBUTILSRC:.c=.o}
     77
     78LIBXML = libxml.a
     79LIBXMLSRC = \
     80	xml.c
     81LIBXMLOBJ = ${LIBXMLSRC:.c=.o}
     82
     83COMPATSRC = \
     84	strlcat.c\
     85	strlcpy.c
     86COMPATOBJ =\
     87	strlcat.o\
     88	strlcpy.o
     89
     90LIB = ${LIBUTIL} ${LIBXML} ${COMPATOBJ}
     91
     92MAN1 = ${BIN:=.1}\
     93	${SCRIPTS:=.1}
     94MAN5 = \
     95	sfeed.5\
     96	sfeedrc.5
     97DOC = \
     98	LICENSE\
     99	README\
    100	README.xml
    101
    102all: ${BIN}
    103
    104${BIN}: ${LIB} ${@:=.o}
    105
    106OBJ = ${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
    116sfeed_curses.o: sfeed_curses.c themes/${SFEED_THEME}.h
    117	${CC} -o $@ -c sfeed_curses.c ${SFEED_CURSES_CFLAGS} ${SFEED_CURSES_CPPFLAGS}
    118
    119sfeed_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
    130dist:
    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
    143clean:
    144	rm -f ${BIN} ${OBJ} ${LIB}
    145
    146install: 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
    167uninstall:
    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