summary refs log tree commit diff
path: root/bin/Makefile
blob: 5691b0fc55247e938a2174c7decf32730aacf35d (plain) (blame)
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
PREFIX = ~/.local
MANDIR = ${PREFIX}/share/man

LIBS_PREFIX = /usr/local
CFLAGS += -I${LIBS_PREFIX}/include
LDFLAGS += -L${LIBS_PREFIX}/lib

CFLAGS += -Wall -Wextra -Wpedantic -Wno-gnu-case-range
LDLIBS.dtch = -lutil
LDLIBS.fbclock = -lz
LDLIBS.glitch = -lz
LDLIBS.hnel = -lutil
LDLIBS.modem = -lutil
LDLIBS.pngo = -lz
LDLIBS.ptee = -lutil
LDLIBS.relay = -ltls
LDLIBS.scheme = -lm
LDLIBS.title = -lcurl

-include config.mk

BINS += beef
BINS += bibsort
BINS += bit
BINS += c
BINS += dtch
BINS += glitch
BINS += hi
BINS += hnel
BINS += modem
BINS += nudge
BINS += order
BINS += pbd
BINS += pngo
BINS += psf2png
BINS += ptee
BINS += scheme
BINS += shotty
BINS += title
BINS += ttpre
BINS += up
BINS += when
BINS += xx

LINKS += open
LINKS += pbcopy
LINKS += pbpaste

BINS_BSD += ever
BINS_LINUX += bri
BINS_LINUX += fbatt
BINS_LINUX += fbclock
BINS_LINUX += psfed
BINS_TLS += relay

BINS_ALL = ${BINS} ${BINS_BSD} ${BINS_LINUX} ${BINS_TLS}
MANS_ALL = ${BINS_ALL:%=man1/%.1}

any: meta ${BINS} ${LINKS}

bsd: meta ${BINS_BSD}

linux: meta ${BINS_LINUX}

tls: meta ${BINS_TLS}

meta: .gitignore tags

.SUFFIXES: .pl

.c:
	${CC} ${CFLAGS} ${LDFLAGS} $< ${LDLIBS.$@} -o $@

.o:
	${CC} ${LDFLAGS} $< ${LDLIBS.$@} -o $@

.pl:
	cp -f $< $@
	chmod a+x $@

hi: hi.c
	${CC} ${CFLAGS} ${LDFLAGS} hi.c ${LDLIBS.$@} -o $@
	./hi -c

open pbcopy pbpaste: pbd
	ln -f pbd $@

fbatt.o fbclock.o: scheme.h

psf2png.o scheme.o: png.h

scheme.h: scheme
	./scheme -c > scheme.h

tags: *.h *.c
	ctags -w *.h *.c

IGNORE = *.o *.html ${BINS_ALL} ${LINKS} scheme.h tags

.gitignore: Makefile
	echo config.mk '${IGNORE}' | tr ' ' '\n' | sort > .gitignore

clean:
	rm -f ${IGNORE}

setuid: bri
	chown root bri
	chmod u+s bri

link:
	install -d ${PREFIX}/bin ${MANDIR}/man1
	ln -fs ${BINS_ALL:%=${PWD}/%} ${PREFIX}/bin
	ln -fs ${MANS_ALL:%=${PWD}/%} ${MANDIR}/man1
	ln -fs ${LINKS:%=${PWD}/%} ${PREFIX}/bin

unlink:
	rm -f ${BINS_ALL:%=${PREFIX}/bin/%}
	rm -f ${MANS_ALL:%=${MANDIR}/%}
	rm -f ${LINKS:%=${PREFIX}/bin/%}

HTMLS = index.html ${BINS_ALL:=.html} png.html
WEBROOT = /usr/local/www/causal.agency

html: ${HTMLS}
	@true

${HTMLS}: html.sh scheme hi ttpre

.SUFFIXES: .html

.c.html:
	sh html.sh $< man1/${<:.c=.1} > $@

.h.html:
	sh html.sh $< man3/${<:.h=.3} > $@

.y.html:
	sh html.sh $< man1/${<:.y=.1} > $@

.sh.html:
	sh html.sh $< man1/${<:.sh=.1} > $@

.pl.html:
	sh html.sh $< man1/${<:.pl=.1} > $@

index.html: Makefile README.7
	sh html.sh Makefile README.7 \
		| sed -E 's,([a-z0-9-]+)[(][1-9][)],<a href="\1.html">&</a>,' \
		> index.html

install-html: ${HTMLS}
	install -d ${WEBROOT}/bin
	install -C -m 644 ${HTMLS} ${WEBROOT}/bin
nned.h: mark strncpy() as banned e488b7aba743d23b830d239dcc33d9ca0745a9ad Signed-off-by: Christian Hesse <mail@eworm.de> 2018-08-28filters: generate anchor links from markdownChristian Hesse This makes the markdown filter generate anchor links for headings. Signed-off-by: Christian Hesse <mail@eworm.de> Tested-by: jean-christophe manciot <actionmystique@gmail.com> 2018-08-03Bump version.Jason A. Donenfeld Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> 2018-08-03clone: fix directory traversalJason A. Donenfeld This was introduced in the initial version of this code, way back when in 2008. $ curl http://127.0.0.1/cgit/repo/objects/?path=../../../../../../../../../etc/passwd root:x:0:0:root:/root:/bin/sh ... Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Reported-by: Jann Horn <jannh@google.com> 2018-08-03config: record repo.snapshot-prefix in the per-repo configKonstantin Ryabitsev