commit 224128893ea8d5cf834b9bbf1f2841b38114a350 parent bd3dc973cb3ad83ae58aaa48cfcc7be8090d9f24 Author: hhvn <hayden@haydenvh.com> Date: Sun, 22 Nov 2020 17:51:41 +0000 makefile: add target to install create.sh Diffstat:
A | makefile | | | 104 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 104 insertions(+), 0 deletions(-)
diff --git a/makefile b/makefile @@ -0,0 +1,104 @@ +.POSIX: + +NAME = stagit-gopher +VERSION = 0.9.4 + +# paths +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/man +DOCPREFIX = ${PREFIX}/share/doc/${NAME} + +LIBGIT_INC = -I/usr/local/include +LIBGIT_LIB = -L/usr/local/lib -lgit2 + +# use system flags. +STAGIT_CFLAGS = ${LIBGIT_INC} ${CFLAGS} +STAGIT_LDFLAGS = ${LIBGIT_LIB} ${LDFLAGS} +STAGIT_CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE + +SRC = \ + stagit-gopher.c\ + stagit-gopher-index.c +COMPATSRC = \ + reallocarray.c\ + strlcpy.c +BIN = \ + stagit-gopher\ + stagit-gopher-index +MAN1 = \ + stagit-gopher.1\ + stagit-gopher-index.1 +DOC = \ + LICENSE\ + README +HDR = compat.h + +COMPATOBJ = \ + reallocarray.o\ + strlcpy.o + +OBJ = ${SRC:.c=.o} ${COMPATOBJ} + +all: ${BIN} + +.o: + ${CC} -o $@ ${LDFLAGS} + +.c.o: + ${CC} -o $@ -c $< ${STAGIT_CFLAGS} ${STAGIT_CPPFLAGS} + +dist: + rm -rf ${NAME}-${VERSION} + mkdir -p ${NAME}-${VERSION} + cp -f ${MAN1} ${HDR} ${SRC} ${COMPATSRC} ${DOC} \ + Makefile \ + example_create.sh example_post-receive.sh \ + ${NAME}-${VERSION} + # make tarball + tar -cf - ${NAME}-${VERSION} | \ + gzip -c > ${NAME}-${VERSION}.tar.gz + rm -rf ${NAME}-${VERSION} + +${OBJ}: ${HDR} + +stagit-gopher: stagit-gopher.o ${COMPATOBJ} + ${CC} -o $@ stagit-gopher.o ${COMPATOBJ} ${STAGIT_LDFLAGS} + +stagit-gopher-index: stagit-gopher-index.o ${COMPATOBJ} + ${CC} -o $@ stagit-gopher-index.o ${COMPATOBJ} ${STAGIT_LDFLAGS} + +clean: + rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz + +install-sh: + install -m 755 create.sh $(DESTDIR)$(PREFIX)/bin/stagit-gopher-create + +install: all + # installing executable files. + mkdir -p ${DESTDIR}${PREFIX}/bin + cp -f ${BIN} ${DESTDIR}${PREFIX}/bin + for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done + # installing example files. + mkdir -p ${DESTDIR}${DOCPREFIX} + cp -f example_create.sh\ + example_post-receive.sh\ + README\ + ${DESTDIR}${DOCPREFIX} + # installing manual pages. + 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. + for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done + # removing example files. + rm -f \ + ${DESTDIR}${DOCPREFIX}/example_create.sh\ + ${DESTDIR}${DOCPREFIX}/example_post-receive.sh\ + ${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