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