summary refs log tree commit diff
path: root/bin/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'bin/Makefile')
-rw-r--r--bin/Makefile172
1 files changed, 86 insertions, 86 deletions
diff --git a/bin/Makefile b/bin/Makefile
index 09ec952e..bb1535d6 100644
--- a/bin/Makefile
+++ b/bin/Makefile
@@ -1,142 +1,142 @@
-PREFIX = ~/.local
-MANDIR = ${PREFIX}/share/man
+PREFIX ?= ~/.local
+MANDIR ?= ${PREFIX}/share/man
 
-LIBS_PREFIX = /usr/local
+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.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 += dehtml
 BINS += dtch
-BINS += edit
+BINS += enc
+BINS += git-comment
 BINS += glitch
-BINS += hi
-BINS += hnel
+BINS += hilex
+BINS += htagml
 BINS += modem
+BINS += mtags
+BINS += nudge
 BINS += order
 BINS += pbd
 BINS += pngo
 BINS += psf2png
 BINS += ptee
+BINS += qf
+BINS += quick
 BINS += scheme
 BINS += shotty
+BINS += sup
 BINS += title
-BINS += ttpre
 BINS += up
 BINS += when
 BINS += xx
 
-LINKS += open
-LINKS += pbcopy
-LINKS += pbpaste
+BSD += ever
 
-BINS_BSD += ever
-BINS_LINUX += bri
-BINS_LINUX += fbatt
-BINS_LINUX += fbclock
-BINS_LINUX += psfed
-BINS_TLS += relay
+GAMES += freecell
 
-BINS_ALL = ${BINS} ${BINS_BSD} ${BINS_LINUX} ${BINS_TLS}
-MANS_ALL = ${BINS_ALL:%=man1/%.1}
+TLS += downgrade
+TLS += relay
 
-any: meta ${BINS} ${LINKS}
+MANS = ${BINS:%=man1/%.1}
+MANS.BSD = ${BSD:%=man1/%.1}
+MANS.GAMES = ${GAMES:%=man6/%.6}
+MANS.TLS = ${TLS:%=man1/%.1}
 
-bsd: meta ${BINS_BSD}
-
-linux: meta ${BINS_LINUX}
-
-tls: meta ${BINS_TLS}
-
-meta: .gitignore tags
+LDLIBS.downgrade = -ltls
+LDLIBS.dtch = -lutil
+LDLIBS.fbclock = -lz
+LDLIBS.freecell = -lcurses
+LDLIBS.glitch = -lz
+LDLIBS.modem = -lutil
+LDLIBS.pngo = -lz
+LDLIBS.ptee = -lutil
+LDLIBS.qf = -lcurses
+LDLIBS.relay = -ltls
+LDLIBS.scheme = -lm
+LDLIBS.title = -lcurl
+LDLIBS.typer = -ltls
 
-.c:
-	${CC} ${CFLAGS} ${LDFLAGS} $< ${LDLIBS.$@} -o $@
+ALL ?= meta any
 
-.o:
-	${CC} ${LDFLAGS} $< ${LDLIBS.$@} -o $@
+-include config.mk
 
-hi: hi.c
-	${CC} ${CFLAGS} ${LDFLAGS} hi.c ${LDLIBS.$@} -o $@
-	./hi -c
+all: ${ALL}
 
-open pbcopy pbpaste: pbd
-	ln -f pbd $@
+meta: .gitignore tags
 
-fbatt.o fbclock.o: scheme.h
+any: ${BINS}
 
-psf2png.o scheme.o: png.h
+bsd: ${BSD}
 
-scheme.h: scheme
-	./scheme -c > scheme.h
+games: ${GAMES}
 
-tags: *.h *.c
-	ctags -w *.h *.c
+tls: ${TLS}
 
-IGNORE = *.o *.html ${BINS_ALL} ${LINKS} scheme.h tags
+IGNORE = *.o *.html
+IGNORE += ${BINS} ${BSD} ${GAMES} ${TLS}
+IGNORE += tags htmltags
 
 .gitignore: Makefile
-	echo config.mk '${IGNORE}' | tr ' ' '\n' | sort > .gitignore
+	echo config.mk '${IGNORE}' | tr ' ' '\n' | sort > $@
+
+tags: *.[chly]
+	ctags -w *.[chly]
 
 clean:
 	rm -f ${IGNORE}
 
-setuid: bri
-	chown root bri
-	chmod u+s bri
+install: ${ALL:%=install-%}
 
-link:
+install-meta:
 	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/%}
+install-any: install-meta ${BINS} ${MANS}
+	install ${BINS} ${PREFIX}/bin
+	install -m 644 ${MANS} ${MANDIR}/man1
 
-HTMLS = index.html ${BINS_ALL:=.html} png.html
-WEBROOT = /usr/local/www/causal.agency
+install-bsd: install-meta ${BSD} ${MANS.BSD}
+	install ${BSD} ${PREFIX}/bin
+	install -m 644 ${MANS.BSD} ${MANDIR}/man1
 
-html: ${HTMLS}
-	@true
+install-games: install-meta ${GAMES} ${MANS.GAMES}
+	install ${GAMES} ${PREFIX}/bin
+	install -m 644 ${MANS.GAMES} ${MANDIR}/man6
 
-${HTMLS}: html.sh hi ttpre
+install-tls: install-meta ${TLS} ${MANS.TLS}
+	install ${TLS} ${PREFIX}/bin
+	install -m 644 ${MANS.TLS} ${MANDIR}/man1
 
-.SUFFIXES: .html
+uninstall:
+	rm -f ${BINS:%=${PREFIX}/bin/%} ${MANS:%=${MANDIR}/%}
+	rm -f ${BSD:%=${PREFIX}/bin/%} ${MANS.BSD:%=${MANDIR}/%}
+	rm -f ${GAMES:%=${PREFIX}/bin/%} ${MANS.GAMES:%=${MANDIR}/%}
+	rm -f ${TLS:%=${PREFIX}/bin/%} ${MANS.TLS:%=${MANDIR}/%}
 
-.c.html:
-	sh html.sh $< man1/${<:.c=.1} > $@
+.SUFFIXES: .pl
 
-.h.html:
-	sh html.sh $< man3/${<:.h=.3} > $@
+.c:
+	${CC} ${CFLAGS} ${LDFLAGS} $< ${LDLIBS.$@} -o $@
 
-.sh.html:
-	sh html.sh $< man1/${<:.sh=.1} > $@
+.o:
+	${CC} ${LDFLAGS} $< ${LDLIBS.$@} -o $@
 
-.y.html:
-	sh html.sh $< man1/${<:.y=.1} > $@
+.pl:
+	cp -f $< $@
+	chmod a+x $@
 
-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
+OBJS.hilex = c11.o hilex.o make.o mdoc.o sh.o
+
+hilex: ${OBJS.hilex}
+	${CC} ${LDFLAGS} ${OBJS.$@} ${LDLIBS.$@} -o $@
+
+${OBJS.hilex}: hilex.h
+
+psf2png.o scheme.o: png.h
 
-install-html: ${HTMLS}
-	install -d ${WEBROOT}/bin
-	install -C -m 644 ${HTMLS} ${WEBROOT}/bin
+include html.mk