makefile (2010B)
1 .POSIX: 2 3 NAME = stagit-gopher 4 VERSION = 0.9.4 5 6 # paths 7 PREFIX = /usr/local 8 MANPREFIX = ${PREFIX}/man 9 10 LIBGIT_INC = -I/usr/local/include 11 LIBGIT_LIB = -L/usr/local/lib -lgit2 12 13 # use system flags. 14 STAGIT_CFLAGS = ${LIBGIT_INC} ${CFLAGS} 15 STAGIT_LDFLAGS = ${LIBGIT_LIB} ${LDFLAGS} 16 STAGIT_CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE 17 18 SRC = \ 19 stagit-gopher.c\ 20 stagit-gopher-index.c 21 COMPATSRC = \ 22 reallocarray.c\ 23 strlcpy.c 24 BIN = \ 25 stagit-gopher\ 26 stagit-gopher-index 27 MAN1 = \ 28 stagit-gopher.1\ 29 stagit-gopher-index.1 30 DOC = \ 31 LICENSE\ 32 README 33 HDR = compat.h 34 35 COMPATOBJ = \ 36 reallocarray.o\ 37 strlcpy.o 38 39 OBJ = ${SRC:.c=.o} ${COMPATOBJ} 40 41 all: ${BIN} 42 43 .o: 44 ${CC} -o $@ ${LDFLAGS} 45 46 .c.o: 47 ${CC} -o $@ -c $< ${STAGIT_CFLAGS} ${STAGIT_CPPFLAGS} 48 49 dist: 50 rm -rf ${NAME}-${VERSION} 51 mkdir -p ${NAME}-${VERSION} 52 cp -f ${MAN1} ${HDR} ${SRC} ${COMPATSRC} ${DOC} \ 53 Makefile \ 54 ${NAME}-${VERSION} 55 # make tarball 56 tar -cf - ${NAME}-${VERSION} | \ 57 gzip -c > ${NAME}-${VERSION}.tar.gz 58 rm -rf ${NAME}-${VERSION} 59 60 ${OBJ}: ${HDR} 61 62 stagit-gopher: stagit-gopher.o ${COMPATOBJ} 63 ${CC} -o $@ stagit-gopher.o ${COMPATOBJ} ${STAGIT_LDFLAGS} 64 65 stagit-gopher-index: stagit-gopher-index.o ${COMPATOBJ} 66 ${CC} -o $@ stagit-gopher-index.o ${COMPATOBJ} ${STAGIT_LDFLAGS} 67 68 clean: 69 rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz 70 71 install-rc: 72 install -m 755 create.rc $(DESTDIR)$(PREFIX)/bin/stagit-gopher-create 73 74 install: all install-rc 75 # installing executable files. 76 mkdir -p ${DESTDIR}${PREFIX}/bin 77 cp -f ${BIN} ${DESTDIR}${PREFIX}/bin 78 for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done 79 # installing manual pages. 80 mkdir -p ${DESTDIR}${MANPREFIX}/man1 81 cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1 82 for m in ${MAN1}; do chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$m; done 83 84 uninstall: 85 # removing executable files. 86 for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done 87 # removing manual pages. 88 for m in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$m; done 89 90 .PHONY: all clean dist install uninstall