Makefile (2457B) [raw]
1 .POSIX: 2 3 NAME = stagit 4 VERSION = 0.9.6 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 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 SRC = \ 20 stagit.c\ 21 stagit-index.c 22 COMPATSRC = \ 23 reallocarray.c\ 24 strlcat.c\ 25 strlcpy.c 26 BIN = \ 27 stagit\ 28 stagit-index 29 MAN1 = \ 30 stagit.1\ 31 stagit-index.1 32 DOC = \ 33 LICENSE\ 34 README 35 HDR = compat.h 36 37 COMPATOBJ = \ 38 reallocarray.o\ 39 strlcat.o\ 40 strlcpy.o 41 42 OBJ = ${SRC:.c=.o} ${COMPATOBJ} 43 44 all: ${BIN} 45 46 .o: 47 ${CC} -o $@ ${LDFLAGS} 48 49 .c.o: 50 ${CC} -o $@ -c $< ${STAGIT_CFLAGS} ${STAGIT_CPPFLAGS} 51 52 dist: 53 rm -rf ${NAME}-${VERSION} 54 mkdir -p ${NAME}-${VERSION} 55 cp -f ${MAN1} ${HDR} ${SRC} ${COMPATSRC} ${DOC} \ 56 Makefile favicon.png logo.png style.css \ 57 example_create.sh example_post-receive.sh \ 58 ${NAME}-${VERSION} 59 # make tarball 60 tar -cf - ${NAME}-${VERSION} | \ 61 gzip -c > ${NAME}-${VERSION}.tar.gz 62 rm -rf ${NAME}-${VERSION} 63 64 ${OBJ}: ${HDR} 65 66 stagit: stagit.o ${COMPATOBJ} 67 ${CC} -o $@ stagit.o ${COMPATOBJ} ${STAGIT_LDFLAGS} 68 69 stagit-index: stagit-index.o ${COMPATOBJ} 70 ${CC} -o $@ stagit-index.o ${COMPATOBJ} ${STAGIT_LDFLAGS} 71 72 clean: 73 rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz 74 75 install: all 76 # installing executable files. 77 mkdir -p ${DESTDIR}${PREFIX}/bin 78 cp -f ${BIN} ${DESTDIR}${PREFIX}/bin 79 for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done 80 # installing example files. 81 mkdir -p ${DESTDIR}${DOCPREFIX} 82 cp -f style.css\ 83 favicon.png\ 84 logo.png\ 85 example_create.sh\ 86 example_post-receive.sh\ 87 README\ 88 ${DESTDIR}${DOCPREFIX} 89 # installing manual pages. 90 mkdir -p ${DESTDIR}${MANPREFIX}/man1 91 cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1 92 for m in ${MAN1}; do chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$m; done 93 94 uninstall: 95 # removing executable files. 96 for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done 97 # removing example files. 98 rm -f \ 99 ${DESTDIR}${DOCPREFIX}/style.css\ 100 ${DESTDIR}${DOCPREFIX}/favicon.png\ 101 ${DESTDIR}${DOCPREFIX}/logo.png\ 102 ${DESTDIR}${DOCPREFIX}/example_create.sh\ 103 ${DESTDIR}${DOCPREFIX}/example_post-receive.sh\ 104 ${DESTDIR}${DOCPREFIX}/README 105 -rmdir ${DESTDIR}${DOCPREFIX} 106 # removing manual pages. 107 for m in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$m; done 108 109 .PHONY: all clean dist install uninstall