-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (44 loc) · 1.21 KB
/
Makefile
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
.POSIX:
NAME = sic
VERSION = 1.3
# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
# use system flags.
SIC_CFLAGS = ${CFLAGS}
SIC_LDFLAGS = ${LDFLAGS}
SIC_CPPFLAGS = ${LDFLAGS} -DVERSION=\"${VERSION}\" -D_GNU_SOURCE
BIN = sic
SRC = ${BIN:=.c}
OBJ = ${SRC:.c=.o}
MAN1 = ${BIN:=.1}
all: ${BIN}
${BIN}: ${@:=.o}
${OBJ}: config.h strlcpy.c util.c
.o:
${CC} -o $@ $< ${SIC_LDFLAGS}
.c.o:
${CC} -c ${SIC_CFLAGS} ${SIC_CPPFLAGS} -o $@ -c $<
config.h:
cp config.def.h $@
clean:
rm -f ${BIN} ${OBJ} "${NAME}-${VERSION}.tar.gz"
dist:
mkdir -p "${NAME}-${VERSION}"
cp -fR LICENSE Makefile README arg.h config.def.h \
${MAN1} ${SRC} util.c strlcpy.c "${NAME}-${VERSION}"
tar -cf - "${NAME}-${VERSION}" | \
gzip -c > "${NAME}-${VERSION}.tar.gz"
rm -rf "${NAME}-${VERSION}"
install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
cp -f ${BIN} "${DESTDIR}${PREFIX}/bin"
chmod 755 "${DESTDIR}${PREFIX}/bin/${BIN}"
mkdir -p "${DESTDIR}${MANPREFIX}/man1"
sed "s/VERSION/${VERSION}/g" < ${MAN1} > "${DESTDIR}${MANPREFIX}/man1/${MAN1}"
chmod 644 "${DESTDIR}${MANPREFIX}/man1/${MAN1}"
uninstall:
rm -f \
"${DESTDIR}${PREFIX}/bin/${BIN}"\
"${DESTDIR}${MANPREFIX}/man1/${MAN1}"
.PHONY: all clean dist install uninstall