summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-01-02 14:26:03 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-01-02 14:26:03 +0100
commit62cca4b3b1dc85b4bfffc7fcb6011c768dea6575 (patch)
tree2331df5861797fcd17fc985598d28e576bcb7d1a /Makefile
parent73f26923275761ab238d84451f886e2fa15db12f (diff)
Makefile: improve
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile172
1 files changed, 97 insertions, 75 deletions
diff --git a/Makefile b/Makefile
index d5089a1..0471765 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,58 @@
-# sfeed - simple RSS and Atom parser (and programs to add reader functionality).
-
include config.mk
NAME = sfeed
-SRC = sfeed.c sfeed_plain.c sfeed_html.c sfeed_opml_import.c sfeed_frames.c \
- sfeed_xmlenc.c sfeed_web.c xml.c util.c
-OBJ = ${SRC:.c=.o}
-
-all: options sfeed sfeed_plain sfeed_html sfeed_opml_import sfeed_frames \
- sfeed_xmlenc sfeed_web
+SRC = \
+ sfeed.c\
+ sfeed_plain.c\
+ sfeed_html.c\
+ sfeed_opml_import.c\
+ sfeed_frames.c\
+ sfeed_xmlenc.c\
+ sfeed_web.c\
+ xml.c\
+ util.c
+BIN = \
+ sfeed\
+ sfeed_plain\
+ sfeed_html\
+ sfeed_frames\
+ sfeed_opml_import\
+ sfeed_web\
+ sfeed_xmlenc
+SCRIPTS = \
+ sfeed_opml_export\
+ sfeed_update
+MAN1 = \
+ sfeed.1\
+ sfeed_frames.1\
+ sfeed_html.1\
+ sfeed_opml_export.1\
+ sfeed_opml_import.1\
+ sfeed_plain.1\
+ sfeed_update.1\
+ sfeed_web.1\
+ sfeed_xmlenc.1
+DOC = \
+ CHANGELOG\
+ CREDITS\
+ LICENSE\
+ README\
+ README.xml\
+ TODO
+HDR = \
+ util.h\
+ compat.h\
+ xml.h
+
+LIBCOMPAT = libcompat.a
+LIBCOMPATSRC = \
+ compat/strlcpy.c
+LIBCOMPATOBJ = $(LIBCOMPATSRC:.c=.o)
+
+OBJ = ${SRC:.c=.o} \
+ $(LIBCOMPATOBJ)
+
+all: options $(BIN)
options:
@echo ${NAME} build options:
@@ -17,104 +61,82 @@ options:
@echo "CC = ${CC}"
.c.o:
- @echo CC $<
- @${CC} -c ${CFLAGS} $<
+ ${CC} -c ${CFLAGS} $<
+
+dist: $(BIN)
+ mkdir -p release/${VERSION}
+ # legacy man-pages (add doc-oldman as dependency rule).
+ #for m in $(MAN1); do cp -f doc/man/$$m release/${VERSION}/; done
+ cp -f ${MAN1} ${HDR} ${SCRIPTS} ${SRC} ${DOC} \
+ Makefile config.mk \
+ sfeedrc.example style.css \
+ release/${VERSION}/
+ rm -f sfeed-${VERSION}.tar.gz
+ (cd release/${VERSION}; \
+ tar -czf ../../sfeed-${VERSION}.tar.gz .)
+
+doc-html: $(MAN1)
+ mkdir -p doc/html
+ for m in $(MAN1); do mandoc -Thtml -Ostyle=man.css $$m > doc/html/$$m.html; done
+
+# NOTE: legacy man pages, if you want semantic mandoc pages just copy ${MAN1}
+doc-oldman: $(MAN1)
+ mkdir -p doc/man
+ for m in $(MAN1); do mandoc -Tman $$m > doc/man/$$m; done
${OBJ}: config.mk
+$(LIBCOMPAT): $(LIBCOMPATDOBJ)
+ $(AR) -r -c $@ $?
+ $(RANLIB) $@
+
sfeed: sfeed.o xml.o util.o
- @echo CC -o $@
- @${CC} -o $@ sfeed.o xml.o util.o ${LDFLAGS}
+ ${CC} -o $@ sfeed.o xml.o util.o ${LDFLAGS}
sfeed_opml_import: sfeed_opml_import.o xml.o util.o
- @echo CC -o $@
- @${CC} -o $@ sfeed_opml_import.o xml.o util.o ${LDFLAGS}
+ ${CC} -o $@ sfeed_opml_import.o xml.o util.o ${LDFLAGS}
sfeed_plain: sfeed_plain.o util.o
- @echo CC -o $@
- @${CC} -o $@ sfeed_plain.o util.o ${LDFLAGS}
+ ${CC} -o $@ sfeed_plain.o util.o ${LDFLAGS}
sfeed_html: sfeed_html.o util.o
- @echo CC -o $@
- @${CC} -o $@ sfeed_html.o util.o ${LDFLAGS}
+ ${CC} -o $@ sfeed_html.o util.o ${LDFLAGS}
sfeed_frames: sfeed_frames.o util.o
- @echo CC -o $@
- @${CC} -o $@ sfeed_frames.o util.o ${LDFLAGS}
+ ${CC} -o $@ sfeed_frames.o util.o ${LDFLAGS}
sfeed_xmlenc: sfeed_xmlenc.o xml.o
- @echo CC -o $@
- @${CC} -o $@ sfeed_xmlenc.o xml.o ${LDFLAGS}
+ ${CC} -o $@ sfeed_xmlenc.o xml.o ${LDFLAGS}
sfeed_web: sfeed_web.o xml.o util.o
- @echo CC -o $@
- @${CC} -o $@ sfeed_web.o xml.o util.o ${LDFLAGS}
+ ${CC} -o $@ sfeed_web.o xml.o util.o ${LDFLAGS}
clean:
- @echo cleaning
- @rm -f sfeed sfeed_plain sfeed_html sfeed_frames sfeed_opml_import \
- sfeed_web sfeed_xmlenc ${OBJ}
+ rm -f ${BIN} ${OBJ}
install: all
@echo installing executable file to ${DESTDIR}${PREFIX}/bin
- @mkdir -p ${DESTDIR}${PREFIX}/bin
- @cp -f sfeed sfeed_update sfeed_plain sfeed_html sfeed_frames sfeed_xmlenc \
- sfeed_opml_import sfeed_opml_export sfeed_web ${DESTDIR}${PREFIX}/bin
- @chmod 755 ${DESTDIR}${PREFIX}/bin/sfeed \
- ${DESTDIR}${PREFIX}/bin/sfeed_update \
- ${DESTDIR}${PREFIX}/bin/sfeed_plain \
- ${DESTDIR}${PREFIX}/bin/sfeed_html \
- ${DESTDIR}${PREFIX}/bin/sfeed_frames \
- ${DESTDIR}${PREFIX}/bin/sfeed_xmlenc \
- ${DESTDIR}${PREFIX}/bin/sfeed_opml_import \
- ${DESTDIR}${PREFIX}/bin/sfeed_opml_export \
- ${DESTDIR}${PREFIX}/bin/sfeed_web
+ 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
@echo installing example files to ${DESTDIR}${PREFIX}/share/${NAME}
- @mkdir -p ${DESTDIR}${PREFIX}/share/${NAME}
- @cp -f sfeedrc.example ${DESTDIR}${PREFIX}/share/${NAME}
- @cp -f style.css ${DESTDIR}${PREFIX}/share/${NAME}
+ mkdir -p ${DESTDIR}${PREFIX}/share/${NAME}
+ cp -f sfeedrc.example ${DESTDIR}${PREFIX}/share/${NAME}
+ cp -f style.css ${DESTDIR}${PREFIX}/share/${NAME}
@echo installing manual pages to ${DESTDIR}${MANPREFIX}/man1
- @mkdir -p ${DESTDIR}${MANPREFIX}/man1
- @cp -f \
- sfeed.1 sfeed_update.1 sfeed_web.1 sfeed_plain.1 sfeed_html.1 \
- sfeed_frames.1 sfeed_xmlenc.1 sfeed_opml_import.1 \
- sfeed_opml_export.1 \
- ${DESTDIR}${MANPREFIX}/man1
- @chmod 644 ${DESTDIR}${MANPREFIX}/man1/sfeed.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_update.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_web.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_plain.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_html.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_frames.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_xmlenc.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_opml_import.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_opml_export.1
+ mkdir -p ${DESTDIR}${MANPREFIX}/man1
+ cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1
+ for m in $(MAN1); do chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$m; done
uninstall:
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
- @rm -f ${DESTDIR}${PREFIX}/bin/sfeed \
- ${DESTDIR}${PREFIX}/bin/sfeed_update \
- ${DESTDIR}${PREFIX}/bin/sfeed_plain \
- ${DESTDIR}${PREFIX}/bin/sfeed_html \
- ${DESTDIR}${PREFIX}/bin/sfeed_frames \
- ${DESTDIR}${PREFIX}/bin/sfeed_xmlenc \
- ${DESTDIR}${PREFIX}/bin/sfeed_opml_import \
- ${DESTDIR}${PREFIX}/bin/sfeed_opml_export \
- ${DESTDIR}${PREFIX}/bin/sfeed_web
+ for f in $(BIN) $(SCRIPTS); do @rm -f ${DESTDIR}${PREFIX}/bin/$$f; done
@echo removing example files from ${DESTDIR}${PREFIX}/share/${NAME}
@rm -f \
${DESTDIR}${PREFIX}/share/${NAME}/sfeedrc.example \
${DESTDIR}${PREFIX}/share/${NAME}/style.css
@-rmdir ${DESTDIR}${PREFIX}/share/${NAME}
@echo removing manual pages from ${DESTDIR}${MANPREFIX}/man1
- @rm -f ${DESTDIR}${MANPREFIX}/man1/sfeed.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_update.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_web.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_plain.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_html.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_frames.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_xmlenc.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_opml_import.1 \
- ${DESTDIR}${MANPREFIX}/man1/sfeed_opml_export.1
+ for m in $(MAN1); do @rm -f ${DESTDIR}${MANPREFIX}/man1/$$m; done
.PHONY: all options clean dist install uninstall