1 .POSIX: 2 3 NAME = stagit 4 VERSION = 1.2 5 6 # paths 7 PREFIX = /usr/local 8 MANPREFIX = ${PREFIX}/man 9 DOCPREFIX = ${PREFIX}/share/doc/${NAME} 10 11 LIBGIT_INC = -I/usr/local/include 12 LIBGIT_LIB = -L/usr/local/lib -lgit2 -lmd4c-html 13 14 # use system flags. 15 STAGIT_CFLAGS = ${LIBGIT_INC} ${CFLAGS} 16 STAGIT_LDFLAGS = ${LIBGIT_LIB} ${LDFLAGS} 17 STAGIT_CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE 18 19 # Uncomment to enable workaround for older libgit2 which don't support this 20 # option. This workaround will be removed in the future *pinky promise*. 21 # STAGIT_CFLAGS += -DGIT_OPT_SET_OWNER_VALIDATION=-1 22 23 SRC = \ 24 stagit.c\ 25 stagit-index.c 26 COMPATSRC = \ 27 reallocarray.c\ 28 strlcat.c\ 29 strlcpy.c 30 BIN = \ 31 stagit\ 32 stagit-index 33 MAN1 = \ 34 stagit.1\ 35 stagit-index.1 36 DOC = \ 37 LICENSE\ 38 README.md 39 HDR = compat.h 40 41 COMPATOBJ = \ 42 reallocarray.o\ 43 strlcat.o\ 44 strlcpy.o 45 46 OBJ = ${SRC:.c=.o} ${COMPATOBJ} 47 48 all: ${BIN} 49 50 .o: 51 ${CC} -o $@ ${LDFLAGS} 52 53 .c.o: 54 ${CC} -o $@ -c $< ${STAGIT_CFLAGS} ${STAGIT_CPPFLAGS} 55 56 dist: 57 rm -rf ${NAME}-${VERSION} 58 mkdir -p ${NAME}-${VERSION} 59 cp -f ${MAN1} ${HDR} ${SRC} ${COMPATSRC} ${DOC} \ 60 Makefile favicon.png logo.png style.css \ 61 example_create.sh example_post-receive.sh \ 62 ${NAME}-${VERSION} 63 # make tarball 64 tar -cf - ${NAME}-${VERSION} | \ 65 gzip -c > ${NAME}-${VERSION}.tar.gz 66 rm -rf ${NAME}-${VERSION} 67 68 ${OBJ}: ${HDR} 69 70 stagit: stagit.o ${COMPATOBJ} 71 ${CC} -o $@ stagit.o ${COMPATOBJ} ${STAGIT_LDFLAGS} 72 73 stagit-index: stagit-index.o ${COMPATOBJ} 74 ${CC} -o $@ stagit-index.o ${COMPATOBJ} ${STAGIT_LDFLAGS} 75 76 clean: 77 rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz 78 79 install: all 80 # installing executable files. 81 mkdir -p ${DESTDIR}${PREFIX}/bin 82 cp -f ${BIN} ${DESTDIR}${PREFIX}/bin 83 for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done 84 # installing example files. 85 mkdir -p ${DESTDIR}${DOCPREFIX} 86 cp -f style.css\ 87 favicon.png\ 88 logo.png\ 89 example_create.sh\ 90 example_post-receive.sh\ 91 README.md\ 92 ${DESTDIR}${DOCPREFIX} 93 # installing manual pages. 94 mkdir -p ${DESTDIR}${MANPREFIX}/man1 95 cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1 96 for m in ${MAN1}; do chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$m; done 97 98 uninstall: 99 # removing executable files. 100 for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done 101 # removing example files. 102 rm -f \ 103 ${DESTDIR}${DOCPREFIX}/style.css\ 104 ${DESTDIR}${DOCPREFIX}/favicon.png\ 105 ${DESTDIR}${DOCPREFIX}/logo.png\ 106 ${DESTDIR}${DOCPREFIX}/example_create.sh\ 107 ${DESTDIR}${DOCPREFIX}/example_post-receive.sh\ 108 ${DESTDIR}${DOCPREFIX}/README.md 109 -rmdir ${DESTDIR}${DOCPREFIX} 110 # removing manual pages. 111 for m in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$m; done 112 113 .PHONY: all clean dist install uninstall