-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile.bsd
96 lines (77 loc) · 2.7 KB
/
Makefile.bsd
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
RUBOCOP ?= rubocop
CLANG_FORMAT ?= clang-format
PREFIX ?= /usr/local
MANPREFIX ?= ${PREFIX}/man
RELEASE = 3.1
RSET_COMPONENTS = rutils input execute worker
RSET_OBJS = ${RSET_COMPONENTS:=.o} compat.o rset.o
RSET_INC = ${RSET_COMPONENTS:=.h} config.h missing/compat.h
QUARK_COMPONENTS = sock http
QUARK_OBJS = ${QUARK_COMPONENTS:=.o} compat.o miniquark.o
QUARK_INC = ${QUARK_COMPONENTS:=.h} missing/compat.h
PROGS = rset miniquark rinstall rsub labelgrep renv rexec-summary
all: ${PROGS}
.c.o:
${CC} ${CFLAGS} ${CPPFLAGS} -c $<
compat.c: missing/*
cat /dev/null ${EXTRA_SRC} > compat.c
rset.o: ${RSET_INC} rset.c
${CC} ${CFLAGS} ${CPPFLAGS} -DRELEASE=\"${RELEASE}\" -c rset.c
rset: ${RSET_COMPONENTS:=.h} ${RSET_OBJS}
${CC} ${CFLAGS} ${CPPFLAGS} -o $@ ${RSET_OBJS} ${LDFLAGS}
miniquark.o: ${QUARK_INC} miniquark.c
${CC} ${CFLAGS} ${CPPFLAGS} -DRELEASE=\"${RELEASE}\" -c miniquark.c
miniquark: ${QUARK_COMPONENTS:=.h} ${QUARK_OBJS}
${CC} ${CFLAGS} ${CPPFLAGS} -o $@ ${QUARK_OBJS} ${LDFLAGS}
.sh:
sed -e 's/$${release}/${RELEASE}/' $< > $@
@chmod +x $@
.SUFFIXES: .awk
.awk:
sed -e 's/$${release}/${RELEASE}/' $< > $@
@chmod +x $@
install: ${PROGS}
@mkdir -p ${DESTDIR}${PREFIX}/bin
@mkdir -p ${DESTDIR}${MANPREFIX}/man1
@mkdir -p ${DESTDIR}${MANPREFIX}/man5
install -m 644 labelgrep.1 ${DESTDIR}${MANPREFIX}/man1
install -m 644 miniquark.1 ${DESTDIR}${MANPREFIX}/man1
install -m 644 pln.5 ${DESTDIR}${MANPREFIX}/man5
install -m 644 renv.1 ${DESTDIR}${MANPREFIX}/man1
install -m 644 rinstall.1 ${DESTDIR}${MANPREFIX}/man1
install -m 644 rset.1 ${DESTDIR}${MANPREFIX}/man1
install -m 644 rsub.1 ${DESTDIR}${MANPREFIX}/man1
install labelgrep ${DESTDIR}${PREFIX}/bin
install miniquark ${DESTDIR}${PREFIX}/bin
install renv ${DESTDIR}${PREFIX}/bin
install rexec-summary ${DESTDIR}${PREFIX}/bin
install rinstall ${DESTDIR}${PREFIX}/bin
install rset ${DESTDIR}${PREFIX}/bin
install rsub ${DESTDIR}${PREFIX}/bin
uninstall:
rm ${DESTDIR}${MANPREFIX}/man1/labelgrep.1
rm ${DESTDIR}${MANPREFIX}/man1/miniquark.1
rm ${DESTDIR}${MANPREFIX}/man1/renv.1
rm ${DESTDIR}${MANPREFIX}/man1/rinstall.1
rm ${DESTDIR}${MANPREFIX}/man1/rset.1
rm ${DESTDIR}${MANPREFIX}/man1/rsub.1
rm ${DESTDIR}${MANPREFIX}/man5/pln.5
rm ${DESTDIR}${PREFIX}/bin/labelgrep
rm ${DESTDIR}${PREFIX}/bin/miniquark
rm ${DESTDIR}${PREFIX}/bin/renv
rm ${DESTDIR}${PREFIX}/bin/rexec-summary
rm ${DESTDIR}${PREFIX}/bin/rinstall
rm ${DESTDIR}${PREFIX}/bin/rset
rm ${DESTDIR}${PREFIX}/bin/rsub
test: ${PROGS}
make -C tests
format:
${RUBOCOP} -A
${CLANG_FORMAT} -i *.c *.h tests/*.c
clean:
rm -f compat.c *.o *.core ${PROGS}
make -C tests clean
distclean:
rm -f tests/Makefile
rm -f Makefile
.PHONY: all clean distclean format install test uninstall