diff options
Diffstat (limited to '')
-rw-r--r-- | bin/Makefile | 192 |
1 files changed, 77 insertions, 115 deletions
diff --git a/bin/Makefile b/bin/Makefile index bf92d208..cd7f7c68 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -1,27 +1,12 @@ -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.fbclock = -lz -LDLIBS.freecell = -lcurses -LDLIBS.glitch = -lz -LDLIBS.hnel = -lutil -LDLIBS.modem = -lutil -LDLIBS.pngo = -lz -LDLIBS.ptee = -lutil -LDLIBS.relay = -ltls -LDLIBS.scheme = -lm -LDLIBS.title = -lcurl -LDLIBS.typer = -ltls - --include config.mk - BINS += beef BINS += bibsort BINS += bit @@ -47,147 +32,124 @@ BINS += up BINS += when BINS += xx -BINS_BSD += ever -BINS_LINUX += bri -BINS_LINUX += fbatt -BINS_LINUX += fbclock -BINS_LINUX += psfed -BINS_TLS += relay -BINS_TLS += typer +BSD += ever GAMES += freecell -BINS_ALL = ${BINS} ${BINS_BSD} ${BINS_LINUX} ${BINS_TLS} ${GAMES} +LINUX += bri +LINUX += fbatt +LINUX += fbclock +LINUX += psfed -MANS = ${BINS:%=man1/%.1} -MANS_BSD = ${BINS_BSD:%=man1/%.1} -MANS_GAMES = ${GAMES:%=man6/%.6} -MANS_LINUX = ${BINS_LINUX:%=man1/%.1} -MANS_TLS = ${BINS_TLS:%=man1/%.1} -MANS_ALL = ${MANS} ${MANS_BSD} ${MANS_LINUX} ${MANS_TLS} ${MANS_GAMES} +TLS += relay +TLS += typer -any: meta ${BINS} +MANS = ${BINS:%=man1/%.1} +MANS.BSD = ${BSD:%=man1/%.1} +MANS.GAMES = ${GAMES:%=man6/%.6} +MANS.LINUX = ${LINUX:%=man1/%.1} +MANS.TLS = ${TLS:%=man1/%.1} -bsd: meta ${BINS_BSD} +LDLIBS.dtch = -lutil +LDLIBS.fbclock = -lz +LDLIBS.freecell = -lcurses +LDLIBS.glitch = -lz +LDLIBS.hnel = -lutil +LDLIBS.modem = -lutil +LDLIBS.pngo = -lz +LDLIBS.ptee = -lutil +LDLIBS.relay = -ltls +LDLIBS.scheme = -lm +LDLIBS.title = -lcurl +LDLIBS.typer = -ltls -games: meta ${GAMES} +ALL ?= meta any -linux: meta ${BINS_LINUX} +-include config.mk -tls: meta ${BINS_TLS} +all: ${ALL} meta: .gitignore tags -.SUFFIXES: .pl +any: ${BINS} -.c: - ${CC} ${CFLAGS} ${LDFLAGS} $< ${LDLIBS.$@} -o $@ +bsd: ${BSD} -.o: - ${CC} ${LDFLAGS} $< ${LDLIBS.$@} -o $@ +games: ${GAMES} -.pl: - cp -f $< $@ - chmod a+x $@ - -OBJS.hilex += c11.o -OBJS.hilex += hilex.o -OBJS.hilex += make.o -OBJS.hilex += mdoc.o -OBJS.hilex += sh.o +linux: ${LINUX} -hilex: ${OBJS.hilex} - ${CC} ${LDFLAGS} ${OBJS.$@} ${LDLIBS.$@} -o $@ - -${OBJS.hilex}: hilex.h - -fbatt.o fbclock.o: scheme.h +tls: ${TLS} -psf2png.o scheme.o: png.h +IGNORE = *.o *.html +IGNORE += ${BINS} ${BSD} ${GAMES} ${LINUX} ${TLS} +IGNORE += scheme.h tags htmltags -scheme.h: scheme - ./scheme -c > scheme.h +.gitignore: Makefile + echo config.mk '${IGNORE}' | tr ' ' '\n' | sort > $@ tags: *.[chly] ctags -w *.[chly] -IGNORE = *.o *.html ${BINS_ALL} scheme.h tags htmltags - -.gitignore: Makefile - echo config.mk '${IGNORE}' | tr ' ' '\n' | sort > .gitignore - clean: rm -f ${IGNORE} -setuid: bri - chown root bri - chmod u+s bri +install: ${ALL:%=install-%} -install: ${BINS} ${MANS} +install-meta: install -d ${PREFIX}/bin ${MANDIR}/man1 + +install-any: install-meta ${BINS} ${MANS} install ${BINS} ${PREFIX}/bin install -m 644 ${MANS} ${MANDIR}/man1 -install-bsd: ${BINS_BSD} ${MANS_BSD} - install -d ${PREFIX}/bin ${MANDIR}/man1 - install ${BINS_BSD} ${PREFIX}/bin - install -m 644 ${MANS_BSD} ${MANDIR}/man1 +install-bsd: install-meta ${BSD} ${MANS.BSD} + install ${BSD} ${PREFIX}/bin + install -m 644 ${MANS.BSD} ${MANDIR}/man1 -install-games: ${GAMES} ${MANS_GAMES} - install -d ${PREFIX}/bin ${MANDIR}/man6 +install-games: install-meta ${GAMES} ${MANS.GAMES} install ${GAMES} ${PREFIX}/bin - install -m 644 ${MANS_GAMES} ${MANDIR}/man6 + install -m 644 ${MANS.GAMES} ${MANDIR}/man6 -install-linux: ${BINS_LINUX} ${MANS_BSD} - install -d ${PREFIX}/bin ${MANDIR}/man1 - install ${BINS_LINUX} ${PREFIX}/bin - install -m 644 ${MANS_LINUX} ${MANDIR}/man1 +install-linux: install-meta ${LINUX} ${MANS.LINUX} + install ${LINUX} ${PREFIX}/bin + install -m 644 ${MANS.LINUX} ${MANDIR}/man1 -install-tls: ${BINS_TLS} ${MANS_BSD} - install -d ${PREFIX}/bin ${MANDIR}/man1 - install ${BINS_TLS} ${PREFIX}/bin - install -m 644 ${MANS_TLS} ${MANDIR}/man1 +install-tls: install-meta ${TLS} ${MANS.TLS} + install ${TLS} ${PREFIX}/bin + install -m 644 ${MANS.TLS} ${MANDIR}/man1 uninstall: - rm -f ${BINS_ALL:%=${PREFIX}/bin/%} - rm -f ${MANS_ALL:%=${MANDIR}/%} - -HTMLS = index.html ${BINS_ALL:=.html} png.html -WEBROOT = /usr/local/www/causal.agency - -html: ${HTMLS} - @true + 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 ${LINUX:%=${PREFIX}/bin/%} ${MANS.LINUX:%=${MANDIR}/%} + rm -f ${TLS:%=${PREFIX}/bin/%} ${MANS.TLS:%=${MANDIR}/%} -${HTMLS}: html.sh scheme hilex htagml htmltags +.SUFFIXES: .pl -htmltags: *.[chly] mtags Makefile *.sh - rm -f $@ - for f in *.[chly]; do ctags -aw -f $@ $$f; done - ./mtags -a -f $@ Makefile *.sh +.c: + ${CC} ${CFLAGS} ${LDFLAGS} $< ${LDLIBS.$@} -o $@ -.SUFFIXES: .html +.o: + ${CC} ${LDFLAGS} $< ${LDLIBS.$@} -o $@ -.c.html: - sh html.sh man1/${<:.c=.1} $< > $@ +.pl: + cp -f $< $@ + chmod a+x $@ -.h.html: - sh html.sh man3/${<:.h=.3} $< > $@ +OBJS.hilex = c11.o hilex.o make.o mdoc.o sh.o -.y.html: - sh html.sh man1/${<:.y=.1} $< > $@ +hilex: ${OBJS.hilex} + ${CC} ${LDFLAGS} ${OBJS.$@} ${LDLIBS.$@} -o $@ -.sh.html: - sh html.sh man1/${<:.sh=.1} $< > $@ +${OBJS.hilex}: hilex.h -.pl.html: - sh html.sh man1/${<:.pl=.1} $< > $@ +fbatt.o fbclock.o: scheme.h -freecell.html: freecell.c man6/freecell.6 - sh html.sh man6/freecell.6 freecell.c > $@ +psf2png.o scheme.o: png.h -index.html: README.7 Makefile html.sh - sh html.sh README.7 Makefile html.sh > $@ +scheme.h: scheme + ./scheme -c > $@ -install-html: ${HTMLS} - install -d ${WEBROOT}/bin - install -C -m 644 ${HTMLS} ${WEBROOT}/bin +include html.mk |