about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-11-15 13:53:29 +0530
committerAndinus <andinus@nand.sh>2020-11-15 13:53:29 +0530
commit0b7d78d7c2d18ae4dc88580856a8de25f5ba1471 (patch)
treedc8ce41f10053679791029bc4f43df88609238c4
parentc1d012ecabd95d489c73e6da19284d59ede95781 (diff)
downloadleo-0b7d78d7c2d18ae4dc88580856a8de25f5ba1471.tar.gz
Improve Makefile, update README
Now on OpenBSD, Makefile will install the man page to
/usr/local/man/man1 instead of /usr/local/share/man/man1 which is not
indexed by default.

It'll also install the example configuration & README.
-rw-r--r--Makefile21
-rw-r--r--README19
2 files changed, 21 insertions, 19 deletions
diff --git a/Makefile b/Makefile
index e646a32..7030f2e 100644
--- a/Makefile
+++ b/Makefile
@@ -9,18 +9,33 @@ INSTALL_DATA=$(INSTALL) -Dm 644
 bindir=$(DESTDIR)$(PREFIX)/bin
 sharedir=$(DESTDIR)$(PREFIX)/share
 
+# OpenBSD doesn't index /usr/local/share/man by default so
+# /usr/local/man will be used.
+platform_id != uname -s
+mandir != if [ $(platform_id) = OpenBSD ]; then \
+    echo $(DESTDIR)$(PREFIX)/man; \
+else \
+    echo $(DESTDIR)$(PREFIX)/share/man; \
+fi
+
 help:
 	@echo "targets:"
 	@awk -F '#' '/^[a-zA-Z0-9_-]+:.*?#/ { print $0 }' $(MAKEFILE_LIST) \
 	| sed -n 's/^\(.*\): \(.*\)#\(.*\)/  \1|-\3/p' \
 	| column -t  -s '|'
 
-install: leo.pl leo.1 # system install
+install: leo.pl leo.1 share/leo.conf README # system install
 	$(INSTALL_PROGRAM) leo.pl $(bindir)/leo
-	$(INSTALL_DATA) leo.1 $(sharedir)/man/man1/leo.1
+
+	$(INSTALL_DATA) leo.1 $(mandir)/man1/leo.1
+	$(INSTALL_DATA) share/leo.conf $(sharedir)/leo/leo.conf
+	$(INSTALL_DATA) README $(sharedir)/doc/leo/README
+
 
 uninstall: # system uninstall
 	rm -f $(bindir)/leo
-	rm -f $(sharedir)/man/man1/leo.1
+	rm -f $(mandir)/man1/leo.1
+	rm -fr $(sharedir)/leo/
+	rm -fr $(sharedir)/doc/leo/
 
 .PHONY: install uninstall help
diff --git a/README b/README
index 4fa56de..f05b18b 100644
--- a/README
+++ b/README
@@ -9,7 +9,6 @@ Table of Contents
 ─────────────────
 
 1. Installation
-.. 1. OpenBSD
 2. Demo
 
 
@@ -33,6 +32,9 @@ with signify(1).
   │ # Install dependencies with cpanm.
   │ cpanm --installdeps .

+  │ # Install all the dependencies.
+  │ doas pkg_add p5-IPC-Run3 p5-Config-Tiny p5-Path-Tiny # OpenBSD only.
+  │
   │ # Copy the config.
   │ cp share/leo.conf $HOME/.config/leo.conf

@@ -41,21 +43,6 @@ with signify(1).
   └────
 
 
-1.1 OpenBSD
-───────────
-
-  Clone & copy the config as shown above, then run these to install
-  dependencies & leo.
-  ┌────
-  │ # Install all the dependencies. (OpenBSD)
-  │ doas pkg_add p5-IPC-Run3 p5-Config-Tiny p5-Path-Tiny
-  │
-  │ # The man-path `/usr/local/share/man` is not indexed by default on
-  │ # openbsd. Using the `/usr` prefix works around this issue.
-  │ doas make PREFIX=/usr install
-  └────
-
-
 2 Demo
 ══════