summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile11
1 files changed, 11 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index a7ba555..eae91ce 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+PREFIX = /usr/local
+MANDIR = ${PREFIX}/share/man
 LIBS_PREFIX = /usr/local
 
 CFLAGS += -std=c11 -Wall -Wextra -Wpedantic
@@ -7,6 +9,7 @@ LDLIBS = -lsqlite3
 LDLIBS_litterbox = -ltls
 
 BINS = litterbox scoop unscoop
+MANS = ${BINS:=.1}
 
 -include config.mk
 
@@ -24,3 +27,11 @@ tags: *.c *.h
 
 clean:
 	rm -f tags ${BINS} ${BINS:=.o}
+
+install: ${BINS} ${MANS}
+	install -d ${PREFIX}/bin ${MANDIR}/man1
+	install ${BINS} ${PREFIX}/bin
+	for man in ${MANS}; do gzip -c $$man > ${MANDIR}/man1/$$man.gz; done
+
+uninstall:
+	rm -f ${BINS:%=${PREFIX}/bin/%} ${MANS:%=${MANDIR}/man1/%.gz}