summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile22
-rw-r--r--README.715
-rwxr-xr-xconfigure1
-rw-r--r--sandman.1 (renamed from scripts/sandman.1)0
-rw-r--r--sandman.m (renamed from scripts/sandman.m)0
-rw-r--r--scripts/.gitignore1
-rw-r--r--scripts/Makefile22
8 files changed, 26 insertions, 36 deletions
diff --git a/.gitignore b/.gitignore
index b31d1c5..519791d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,5 @@ catgirl
 chroot.tar
 config.mk
 root/
+sandman
 tags
diff --git a/Makefile b/Makefile
index 3abba03..66fb408 100644
--- a/Makefile
+++ b/Makefile
@@ -8,9 +8,13 @@ CFLAGS += ${CEXTS:%=-Wno-%}
 LDADD.libtls = -ltls
 LDADD.ncursesw = -lncursesw
 
+BINS = catgirl
+MANS = ${BINS:=.1}
+
 -include config.mk
 
 LDLIBS = ${LDADD.libtls} ${LDADD.ncursesw}
+LDLIBS.sandman = -framework Cocoa
 
 OBJS += buffer.o
 OBJS += chat.o
@@ -28,11 +32,13 @@ OBJS += url.o
 OBJS += window.o
 OBJS += xdg.o
 
+OBJS.sandman = sandman.o
+
 TESTS += edit.t
 
 dev: tags all check
 
-all: catgirl
+all: ${BINS}
 
 catgirl: ${OBJS}
 	${CC} ${LDFLAGS} ${OBJS} ${LDLIBS} -o $@
@@ -41,6 +47,9 @@ ${OBJS}: chat.h
 
 edit.o edit.t input.o: edit.h
 
+sandman: ${OBJS.sandman}
+	${CC} ${LDFLAGS} ${OBJS.$@} ${LDLIBS.$@} -o $@
+
 check: ${TESTS}
 
 .SUFFIXES: .t
@@ -53,15 +62,16 @@ tags: *.[ch]
 	ctags -w *.[ch]
 
 clean:
-	rm -f catgirl ${OBJS} ${TESTS} tags
+	rm -f ${BINS} ${OBJS} ${OBJS.sandman} ${TESTS} tags
 
-install: catgirl catgirl.1
+install: ${BINS} ${MANS}
 	install -d ${DESTDIR}${BINDIR} ${DESTDIR}${MANDIR}/man1
-	install catgirl ${DESTDIR}${BINDIR}
-	install -m 644 catgirl.1 ${DESTDIR}${MANDIR}/man1
+	install ${BINS} ${DESTDIR}${BINDIR}
+	install -m 644 ${MANS} ${DESTDIR}${MANDIR}/man1
 
 uninstall:
-	rm -f ${DESTDIR}${BINDIR}/catgirl ${DESTDIR}${MANDIR}/man1/catgirl.1
+	rm -f ${BINS:%=${DESTDIR}${BINDIR}/%}
+	rm -f ${MANS:%=${DESTDIR}${MANDIR}/man1/%}
 
 CHROOT_USER = chat
 CHROOT_GROUP = ${CHROOT_USER}
diff --git a/README.7 b/README.7
index 6c3a536..a26d270 100644
--- a/README.7
+++ b/README.7
@@ -1,5 +1,5 @@
 .\" To view this file: $ man ./README.7
-.Dd July 30, 2022
+.Dd July  9, 2023
 .Dt README 7
 .Os "Causal Agency"
 .
@@ -173,10 +173,10 @@ wrapper is provided for macOS
 to stop and start
 .Nm
 on system sleep and wake.
-Install it as follows:
+To enable it,
+configure with:
 .Bd -literal -offset indent
-$ make -C scripts sandman
-# make -C scripts install
+$ ./configure --enable-sandman
 .Ed
 .
 .Sh FILES
@@ -213,6 +213,8 @@ chat logging
 configuration parsing
 .It Pa xdg.c
 XDG base directories
+.It Pa sandman.m
+sleep/wake wrapper for macOS
 .El
 .
 .Pp
@@ -222,8 +224,6 @@ example
 .Xr tmux 1
 configuration for multiple networks
 and automatic reconnects
-.It Pa scripts/sandman.m
-sleep/wake wrapper for macOS
 .It Pa scripts/notify-send.scpt
 .Xr notify-send 1
 in AppleScript
@@ -257,7 +257,8 @@ Monetary contributions can be
 .Lk https://liberapay.com/june/donate "donated via Liberapay" .
 .
 .Sh SEE ALSO
-.Xr catgirl 1
+.Xr catgirl 1 ,
+.Xr sandman 1
 .
 .Pp
 IRC bouncer:
diff --git a/configure b/configure
index 9465b77..07e3245 100755
--- a/configure
+++ b/configure
@@ -29,6 +29,7 @@ for opt; do
 		(--prefix=*) echo "PREFIX = ${opt#*=}" ;;
 		(--bindir=*) echo "BINDIR = ${opt#*=}" ;;
 		(--mandir=*) echo "MANDIR = ${opt#*=}" ;;
+		(--enable-sandman) echo 'BINS += sandman' ;;
 		(*) echo "warning: unsupported option ${opt}" >&2 ;;
 	esac
 done
diff --git a/scripts/sandman.1 b/sandman.1
index 92828c0..92828c0 100644
--- a/scripts/sandman.1
+++ b/sandman.1
diff --git a/scripts/sandman.m b/sandman.m
index 2e5c4db..2e5c4db 100644
--- a/scripts/sandman.m
+++ b/sandman.m
diff --git a/scripts/.gitignore b/scripts/.gitignore
deleted file mode 100644
index f6dc107..0000000
--- a/scripts/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-sandman
diff --git a/scripts/Makefile b/scripts/Makefile
deleted file mode 100644
index 179a2d3..0000000
--- a/scripts/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-PREFIX ?= /usr/local
-BINDIR ?= ${PREFIX}/bin
-MANDIR ?= ${PREFIX}/man
-
-CFLAGS += -Wall -Wextra
-
--include ../config.mk
-
-LDLIBS = -framework Cocoa
-
-all: sandman
-
-clean:
-	rm -f sandman
-
-install: sandman sandman.1
-	install -d ${DESTDIR}${BINDIR} ${DESTDIR}${MANDIR}/man1
-	install sandman ${DESTDIR}${BINDIR}
-	install -m 644 sandman.1 ${DESTDIR}${MANDIR}/man1
-
-uninstall:
-	rm -f ${DESTDIR}${BINDIR}/sandman ${DESTDIR}/man/man1/sandman.1