Makefile 2.4 KB

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