webdump

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/webdump.git
Log | Files | Refs | README | LICENSE

commit 09d3f6928ca9f9936b86c0a82a06551f15cbb6ee
parent b82529ac7152b6326161c23b267d7719090ba168
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun, 22 Sep 2019 19:14:58 +0200

initial Makefile

Diffstat:
Makefile | 93++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
config.mk | 16++++++++++++++++
2 files changed, 106 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,5 +1,92 @@ -build: clean - cc -ggdb -O0 -Wall xml.c main.c -o main +.POSIX: + +include config.mk + +NAME = webdump +VERSION = 0.1 + +BIN = \ + webdump +SCRIPTS = + +SRC = ${BIN:=.c} +HDR = xml.h + +LIBXML = libxml.a +LIBXMLSRC = \ + xml.c +LIBXMLOBJ = ${LIBXMLSRC:.c=.o} + +COMPATSRC = \ + strlcat.c\ + strlcpy.c +COMPATOBJ =\ + strlcat.o\ + strlcpy.o + +LIB = ${LIBXML} ${COMPATOBJ} + +MAN1 = ${BIN:=.1}\ + ${SCRIPTS:=.1} + +DOC = \ + LICENSE\ + README\ + README.xml + +all: ${BIN} + +${BIN}: ${LIB} ${@:=.o} + +OBJ = ${SRC:.c=.o} ${LIBXMLOBJ} ${COMPATOBJ} + +${OBJ}: config.mk ${HDR} + +.o: + ${CC} ${SFEED_LDFLAGS} -o $@ $< ${LIB} + +.c.o: + ${CC} ${SFEED_CFLAGS} ${SFEED_CPPFLAGS} -o $@ -c $< + +${LIBXML}: ${LIBXMLOBJ} + ${AR} rc $@ $? + ${RANLIB} $@ + +dist: + rm -rf "${NAME}-${VERSION}" + mkdir -p "${NAME}-${VERSION}" + cp -f ${MAN1} ${DOC} ${HDR} \ + ${SRC} ${LIBXMLSRC} ${COMPATSRC} ${SCRIPTS} \ + Makefile config.mk \ + "${NAME}-${VERSION}" + # make tarball + tar -cf - "${NAME}-${VERSION}" | \ + gzip -c > "${NAME}-${VERSION}.tar.gz" + rm -rf "${NAME}-${VERSION}" clean: - rm -f main *.o + rm -f ${BIN} ${OBJ} ${LIB} + +install: all + # installing executable files and scripts. + 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 + # installing example files. + mkdir -p "${DESTDIR}${DOCPREFIX}" + cp -f README "${DESTDIR}${DOCPREFIX}" + # installing manual pages for general commands: section 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: + # removing executable files and scripts. + for f in ${BIN} ${SCRIPTS}; do rm -f "${DESTDIR}${PREFIX}/bin/$$f"; done + # removing example files. + rm -f "${DESTDIR}${DOCPREFIX}/README" + -rmdir "${DESTDIR}${DOCPREFIX}" + # removing manual pages. + for m in ${MAN1}; do rm -f "${DESTDIR}${MANPREFIX}/man1/$$m"; done + +.PHONY: all clean dist install uninstall diff --git a/config.mk b/config.mk @@ -0,0 +1,16 @@ +# customize below to fit your system + +# paths +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/man +DOCPREFIX = ${PREFIX}/share/doc/sfeed + +# compiler and linker +CC = cc +AR = ar +RANLIB = ranlib + +# use system flags. +WEBDUMP_CFLAGS = ${CFLAGS} +WEBDUMP_LDFLAGS = ${LDFLAGS} +WEBDUMP_CPPFLAGS = -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_BSD_SOURCE