dotfiles

My PC Dotfiles & Website

site/git/stagit/Makefile (2378B)


 1.POSIX:
 2
 3NAME = stagit
 4VERSION = 1.2
 5
 6# paths
 7PREFIX = /usr/local
 8MANPREFIX = ${PREFIX}/man
 9DOCPREFIX = ${PREFIX}/share/doc/${NAME}
10
11LIBGIT_INC = -I/usr/local/include
12LIBGIT_LIB = -L/usr/local/lib -lgit2
13
14# use system flags.
15STAGIT_CFLAGS = ${LIBGIT_INC} ${CFLAGS}
16STAGIT_LDFLAGS = ${LIBGIT_LIB} ${LDFLAGS}
17STAGIT_CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE
18
19# Uncomment to enable workaround for older libgit2 which don't support this
20# option. This workaround will be removed in the future *pinky promise*.
21#STAGIT_CFLAGS += -DGIT_OPT_SET_OWNER_VALIDATION=-1
22
23SRC = \
24	stagit.c\
25	stagit-index.c
26COMPATSRC = \
27	reallocarray.c\
28	strlcat.c\
29	strlcpy.c
30BIN = \
31	stagit\
32	stagit-index
33DOC = \
34	README.md
35HDR = compat.h
36
37COMPATOBJ = \
38	reallocarray.o\
39	strlcat.o\
40	strlcpy.o
41
42OBJ = ${SRC:.c=.o} ${COMPATOBJ}
43
44all: ${BIN}
45
46.o:
47	${CC} -o $@ ${LDFLAGS}
48
49.c.o:
50	${CC} -o $@ -c $< ${STAGIT_CFLAGS} ${STAGIT_CPPFLAGS}
51
52dist:
53	rm -rf ${NAME}-${VERSION}
54	mkdir -p ${NAME}-${VERSION}
55	cp -f ${HDR} ${SRC} ${COMPATSRC} ${DOC} \
56		Makefile favicon.png render.py stagit.1 stagit-index.1 \
57		${NAME}-${VERSION}
58	# make tarball
59	tar -cf - ${NAME}-${VERSION} | \
60		gzip -c > ${NAME}-${VERSION}.tar.gz
61	rm -rf ${NAME}-${VERSION}
62
63${OBJ}: ${HDR}
64
65stagit: stagit.o ${COMPATOBJ}
66	${CC} -o $@ stagit.o ${COMPATOBJ} ${STAGIT_LDFLAGS}
67
68stagit-index: stagit-index.o ${COMPATOBJ}
69	${CC} -o $@ stagit-index.o ${COMPATOBJ} ${STAGIT_LDFLAGS}
70
71clean:
72	rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz
73
74install: all
75	# installing executable files.
76	mkdir -p ${DESTDIR}${PREFIX}/bin
77	cp -f ${BIN} ${DESTDIR}${PREFIX}/bin
78	cp -f render.py ${DESTDIR}${PREFIX}/bin/render
79	chmod 755 ${DESTDIR}${PREFIX}/bin/render
80	for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done
81	# installing example files.
82	mkdir -p ${DESTDIR}${DOCPREFIX}
83	cp -f favicon.png README.md ${DESTDIR}${DOCPREFIX}
84	mkdir -p ${DESTDIR}${MANPREFIX}/man1
85	cp -f stagit.1 stagit-index.1 ${DESTDIR}${MANPREFIX}/man1
86
87uninstall:
88	# removing executable files.
89	for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done
90	rm -f ${DESTDIR}${PREFIX}/bin/render
91	rm -f ${DESTDIR}${MANPREFIX}/man1/stagit.1 ${DESTDIR}${MANPREFIX}/man1/stagit-index.1
92	# removing example files.
93	rm -f \
94		${DESTDIR}${DOCPREFIX}/favicon.png\
95		${DESTDIR}${DOCPREFIX}/README.md
96	-rmdir ${DESTDIR}${DOCPREFIX}
97
98.PHONY: all clean dist install uninstall