From a0d3690aa64d0e54c75aa6fb2c12b43f9f76d2dc Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Fri, 26 Nov 2021 12:27:30 +0100 Subject: Makefile: merge contents of sfeed_curses Makefile sfeed_curses can be optionally compiled. Separate flags can be passed for example for the curses library. Also pass CFLAGS and LDFLAGS as a suffix. See commit 0a9c4460c15e90113607ff1928858dfa940df725 of sfeed_curses This is useful when passing -Wl,--as-needed or hardening flags. --- Makefile | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 9458874..06ce61d 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,9 @@ NAME = sfeed VERSION = 1.0 +# curses theme, see themes/ directory. +SFEED_THEME = mono + # paths PREFIX = /usr/local MANPREFIX = ${PREFIX}/man @@ -19,11 +22,31 @@ SFEED_CPPFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE #SFEED_CPPFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE \ # -DGETNEXT=getchar +# set $SFEED_CURSES to empty to not build sfeed_curses. +SFEED_CURSES = sfeed_curses +SFEED_CURSES_CFLAGS = ${CFLAGS} +SFEED_CURSES_CPPFLAGS =-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE \ + -DSFEED_THEME=\"themes/${SFEED_THEME}.h\" ${SFEED_CPPFLAGS} +SFEED_CURSES_LDFLAGS = ${LDFLAGS} -lcurses + +# Linux: some distros use ncurses and require -lncurses. +#SFEED_CURSES_LDFLAGS = ${LDFLAGS} -lncurses + +# Gentoo Linux: some distros might also require -ltinfo and -D_DEFAULT_SOURCE +# to prevent warnings about feature macros. +#SFEED_CURSES_LDFLAGS = ${LDFLAGS} -lcurses -ltinfo + +# use minicurses with hardcoded escape sequences (not the system curses). +#SFEED_CURSES_CPPFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE \ +# -DSFEED_THEME=\"themes/${SFEED_THEME}.h\" -DSFEED_MINICURSES +#SFEED_CURSES_LDFLAGS = ${LDFLAGS} + BIN = \ sfeed\ sfeed_atom\ + ${SFEED_CURSES}\ sfeed_frames\ - sfeed_gopher \ + sfeed_gopher\ sfeed_html\ sfeed_mbox\ sfeed_opml_import\ @@ -32,11 +55,14 @@ BIN = \ sfeed_web\ sfeed_xmlenc SCRIPTS = \ + sfeed_content\ + sfeed_markread\ sfeed_opml_export\ sfeed_update SRC = ${BIN:=.c} HDR = \ + minicurses.h\ util.h\ xml.h @@ -78,10 +104,16 @@ OBJ = ${SRC:.c=.o} ${LIBXMLOBJ} ${LIBUTILOBJ} ${COMPATOBJ} ${OBJ}: ${HDR} .o: - ${CC} ${SFEED_LDFLAGS} -o $@ $< ${LIB} + ${CC} -o $@ $< ${LIB} ${SFEED_LDFLAGS} .c.o: - ${CC} ${SFEED_CFLAGS} ${SFEED_CPPFLAGS} -o $@ -c $< + ${CC} -o $@ -c $< ${SFEED_CFLAGS} ${SFEED_CPPFLAGS} + +sfeed_curses.o: sfeed_curses.c + ${CC} -o $@ -c sfeed_curses.c ${SFEED_CURSES_CFLAGS} ${SFEED_CURSES_CPPFLAGS} + +sfeed_curses: ${LIB} sfeed_curses.o + ${CC} -o $@ sfeed_curses.o ${LIB} ${SFEED_CURSES_LDFLAGS} ${LIBUTIL}: ${LIBUTILOBJ} ${AR} -rc $@ $? @@ -94,9 +126,9 @@ ${LIBXML}: ${LIBXMLOBJ} dist: rm -rf "${NAME}-${VERSION}" mkdir -p "${NAME}-${VERSION}" - cp -f ${MAN1} ${MAN5} ${DOC} ${HDR} \ + cp -fR ${MAN1} ${MAN5} ${DOC} ${HDR} \ ${SRC} ${LIBXMLSRC} ${LIBUTILSRC} ${COMPATSRC} ${SCRIPTS} \ - Makefile \ + themes Makefile \ sfeedrc.example style.css \ "${NAME}-${VERSION}" # make tarball -- cgit v1.2.3