Makefile (1658B)
1.POSIX: 2 3NAME = sob 4VERSION = 0.2 5 6# paths 7PREFIX = /usr/local 8MANPREFIX = ${PREFIX}/man 9DOCPREFIX = ${PREFIX}/share/doc/${NAME} 10 11SOB_CFLAGS = ${CFLAGS} 12SOB_LDFLAGS = ${LDFLAGS} 13SOB_CPPFLAGS = -DVERSION=\"${VERSION}\" -D_POSIX_C_SOURCE=200809L\ 14 -D_BSD_SOURCE -D_XOPEN_SOURCE=700 15 16BIN = ${NAME} 17 18SRC = ${NAME}.c 19HDR = arg.h config.def.h 20 21OBJ = ${SRC:.c=.o} 22 23MAN1 = ${NAME}.1 24DOC = \ 25 LICENSE\ 26 README 27 28all: sob 29 30.c.o: 31 ${CC} -c ${SOB_CFLAGS} $< 32 33${OBJ}: config.h 34 35config.h: 36 cp config.def.h $@ 37 38sob: ${OBJ} 39 ${CC} -o $@ ${OBJ} ${SOB_LDFLAGS} 40 41dist: 42 rm -rf "${NAME}-${VERSION}" 43 mkdir -p "${NAME}-${VERSION}" 44 cp -f ${MAN1} ${DOC} ${HDR} \ 45 ${SRC} \ 46 Makefile \ 47 "${NAME}-${VERSION}" 48 # make tarball 49 tar -cf - "${NAME}-${VERSION}" | \ 50 gzip -c > "${NAME}-${VERSION}.tar.gz" 51 rm -rf "${NAME}-${VERSION}" 52 53clean: 54 rm -f ${BIN} ${OBJ} 55 56install: all 57 # installing executable files. 58 mkdir -p ${DESTDIR}${PREFIX}/bin 59 cp -f ${BIN} "${DESTDIR}${PREFIX}/bin" 60 for f in ${BIN}; do chmod 755 "${DESTDIR}${PREFIX}/bin/$$f"; done 61 # installing example files. 62 mkdir -p "${DESTDIR}${DOCPREFIX}" 63 cp -f README \ 64 "${DESTDIR}${DOCPREFIX}" 65 # installing manual pages. 66 mkdir -p ${DESTDIR}${MANPREFIX}/man1 67 cp -f ${MAN1} "${DESTDIR}${MANPREFIX}/man1" 68 for m in ${MAN1}; do chmod 644 "${DESTDIR}${MANPREFIX}/man1/$$m"; done 69 70uninstall: 71 # removing executable files. 72 for f in ${BIN}; do rm -f "${DESTDIR}${PREFIX}/bin/$$f"; done 73 # removing example files. 74 rm -f \ 75 "${DESTDIR}${DOCPREFIX}/README" 76 -rmdir "${DESTDIR}${DOCPREFIX}" 77 # removing manual pages. 78 for m in ${MAN1}; do rm -f "${DESTDIR}${MANPREFIX}/man1/$$m"; done 79 80.PHONY: all clean dist install uninstall