Makefile (2657B)
1.POSIX: 2 3NAME = stagit 4VERSION = 1.2 5 6# paths 7PREFIX = /usr/local 8MANPREFIX = ${PREFIX}/man 9DOCPREFIX = ${PREFIX}/share/doc/${NAME} 10 11LIBGIT_INC = -I/usr/local/include 12LIBGIT_LIB = -L/usr/local/lib -lgit2 13 14# use system flags. 15STAGIT_CFLAGS = ${LIBGIT_INC} ${CFLAGS} 16STAGIT_LDFLAGS = ${LIBGIT_LIB} ${LDFLAGS} 17STAGIT_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 23SRC = \ 24 stagit.c\ 25 stagit-index.c 26COMPATSRC = \ 27 reallocarray.c\ 28 strlcat.c\ 29 strlcpy.c 30BIN = \ 31 stagit\ 32 stagit-index 33MAN1 = \ 34 stagit.1\ 35 stagit-index.1 36DOC = \ 37 LICENSE\ 38 README 39HDR = compat.h 40 41COMPATOBJ = \ 42 reallocarray.o\ 43 strlcat.o\ 44 strlcpy.o 45 46OBJ = ${SRC:.c=.o} ${COMPATOBJ} 47 48all: ${BIN} 49 50.o: 51 ${CC} -o $@ ${LDFLAGS} 52 53.c.o: 54 ${CC} -o $@ -c $< ${STAGIT_CFLAGS} ${STAGIT_CPPFLAGS} 55 56dist: 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 70stagit: stagit.o ${COMPATOBJ} 71 ${CC} -o $@ stagit.o ${COMPATOBJ} ${STAGIT_LDFLAGS} 72 73stagit-index: stagit-index.o ${COMPATOBJ} 74 ${CC} -o $@ stagit-index.o ${COMPATOBJ} ${STAGIT_LDFLAGS} 75 76clean: 77 rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz 78 79install: 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\ 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 98uninstall: 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 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