Makefile (2226B)
1 include config.mk 2 3 NAME = stagit 4 VERSION = 0.8 5 SRC = \ 6 stagit.c\ 7 stagit-index.c 8 COMPATSRC = \ 9 reallocarray.c\ 10 strlcat.c\ 11 strlcpy.c 12 BIN = \ 13 stagit\ 14 stagit-index 15 MAN1 = \ 16 stagit.1\ 17 stagit-index.1 18 DOC = \ 19 LICENSE\ 20 README 21 HDR = compat.h 22 23 COMPATOBJ = \ 24 reallocarray.o\ 25 strlcat.o\ 26 strlcpy.o 27 28 OBJ = ${SRC:.c=.o} ${COMPATOBJ} 29 30 all: ${BIN} 31 32 .o: 33 ${CC} ${LDFLAGS} -o $@ ${LIBS} 34 35 .c.o: 36 ${CC} -c ${CFLAGS} ${CPPFLAGS} -o $@ -c $< 37 38 dist: 39 rm -rf ${NAME}-${VERSION} 40 mkdir -p ${NAME}-${VERSION} 41 cp -f ${MAN1} ${HDR} ${SRC} ${COMPATSRC} ${DOC} \ 42 Makefile config.mk favicon.png logo.png style.css \ 43 example_create.sh example_post-receive.sh \ 44 ${NAME}-${VERSION} 45 # make tarball 46 tar -cf - ${NAME}-${VERSION} | \ 47 gzip -c > ${NAME}-${VERSION}.tar.gz 48 rm -rf ${NAME}-${VERSION} 49 50 ${OBJ}: config.mk ${HDR} 51 52 stagit: stagit.o ${COMPATOBJ} 53 ${CC} -o $@ stagit.o ${COMPATOBJ} ${LDFLAGS} 54 55 stagit-index: stagit-index.o ${COMPATOBJ} 56 ${CC} -o $@ stagit-index.o ${COMPATOBJ} ${LDFLAGS} 57 58 clean: 59 rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz 60 61 install: all 62 # installing executable files. 63 mkdir -p ${DESTDIR}${PREFIX}/bin 64 cp -f ${BIN} ${DESTDIR}${PREFIX}/bin 65 for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done 66 # installing example files. 67 mkdir -p ${DESTDIR}${PREFIX}/share/${NAME} 68 cp -f style.css\ 69 favicon.png\ 70 logo.png\ 71 example_create.sh\ 72 example_post-receive.sh\ 73 README\ 74 ${DESTDIR}${PREFIX}/share/${NAME} 75 # installing manual pages. 76 mkdir -p ${DESTDIR}${MANPREFIX}/man1 77 cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1 78 for m in ${MAN1}; do chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$m; done 79 80 uninstall: 81 # removing executable files. 82 for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done 83 # removing example files. 84 rm -f \ 85 ${DESTDIR}${PREFIX}/share/${NAME}/style.css\ 86 ${DESTDIR}${PREFIX}/share/${NAME}/favicon.png\ 87 ${DESTDIR}${PREFIX}/share/${NAME}/logo.png\ 88 ${DESTDIR}${PREFIX}/share/${NAME}/example_create.sh\ 89 ${DESTDIR}${PREFIX}/share/${NAME}/example_post-receive.sh\ 90 ${DESTDIR}${PREFIX}/share/${NAME}/README 91 -rmdir ${DESTDIR}${PREFIX}/share/${NAME} 92 # removing manual pages. 93 for m in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$m; done 94 95 .PHONY: all clean dist install uninstall