Makefile (2132B)
1.POSIX: 2 3NAME = saait 4VERSION = 0.8 5 6# paths 7PREFIX = /usr/local 8MANPREFIX = ${PREFIX}/man 9DOCPREFIX = ${PREFIX}/share/doc/${NAME} 10 11# use system flags. 12SAAIT_CFLAGS = ${CFLAGS} 13SAAIT_LDFLAGS = ${LDFLAGS} 14SAAIT_CPPFLAGS = -D_DEFAULT_SOURCE 15 16SRC = \ 17 saait.c 18BIN = \ 19 saait 20MAN1 = \ 21 saait.1 22DOC = \ 23 LICENSE\ 24 README\ 25 Makefile.example 26 27OBJ = ${SRC:.c=.o} 28 29all: ${BIN} 30 31.o: 32 ${CC} ${SAAIT_LDFLAGS} -o $@ 33 34.c.o: 35 ${CC} ${SAAIT_CFLAGS} ${SAAIT_CPPFLAGS} -o $@ -c $< 36 37dist: 38 rm -rf ${NAME}-${VERSION} 39 mkdir -p ${NAME}-${VERSION} 40 cp -f ${MAN1} ${SRC} ${DOC} \ 41 Makefile \ 42 config.cfg print.css style.css \ 43 ${NAME}-${VERSION} 44 # pages and templates examples. 45 cp -rf pages templates ${NAME}-${VERSION} 46 # make tarball 47 tar -cf - ${NAME}-${VERSION} | \ 48 gzip -c > ${NAME}-${VERSION}.tar.gz 49 rm -rf ${NAME}-${VERSION} 50 51${OBJ}: 52 53saait: saait.o 54 ${CC} -o $@ saait.o ${LDFLAGS} 55 56clean: 57 rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz 58 59install: all 60 # installing executable files. 61 mkdir -p ${DESTDIR}${PREFIX}/bin 62 cp -f ${BIN} ${DESTDIR}${PREFIX}/bin 63 for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done 64 # installing example files. 65 mkdir -p ${DESTDIR}${DOCPREFIX} 66 cp -f \ 67 README\ 68 Makefile.example\ 69 print.css\ 70 style.css\ 71 config.cfg\ 72 ${DESTDIR}${DOCPREFIX} 73 # pages and templates examples. 74 cp -rf pages templates ${DESTDIR}${DOCPREFIX} 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 80uninstall: 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}${DOCPREFIX}/README\ 86 ${DESTDIR}${DOCPREFIX}/Makefile.example\ 87 ${DESTDIR}${DOCPREFIX}/print.css\ 88 ${DESTDIR}${DOCPREFIX}/style.css\ 89 ${DESTDIR}${DOCPREFIX}/config.cfg 90 # pages and templates examples. 91 rm -rf ${DESTDIR}${DOCPREFIX}/templates \ 92 ${DESTDIR}${DOCPREFIX}/pages 93 -rmdir ${DESTDIR}${DOCPREFIX} 94 # removing manual pages. 95 for m in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$m; done 96 97.PHONY: all clean dist install uninstall