summary refs log tree commit diff stats
path: root/Makefile
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-11-19 00:42:29 +0530
committerAndinus <andinus@nand.sh>2020-11-19 00:42:29 +0530
commit79a9c99ec8598b4e6c84118fc26298d201686055 (patch)
tree7ce81065006911b97f07e9420a53eeba3d156bba /Makefile
parentb30de261361636a723613bfc43e41299c854746f (diff)
downloaddraco-79a9c99ec8598b4e6c84118fc26298d201686055.tar.gz
Initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile39
1 files changed, 39 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1319c6f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,39 @@
+# Install to /usr/local unless otherwise specified, such as `make
+# PREFIX=/app`.
+PREFIX?=/usr/local
+
+INSTALL?=install
+INSTALL_PROGRAM=$(INSTALL) -Dm 755
+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: draco.pl draco.1 README.org # system install
+	$(INSTALL_PROGRAM) draco.pl $(bindir)/draco
+
+	$(INSTALL_DATA) draco.1 $(mandir)/man1/draco.1
+	$(INSTALL_DATA) README.org $(sharedir)/doc/draco/README.org
+
+
+uninstall: # system uninstall
+	rm -f $(bindir)/draco
+	rm -f $(mandir)/man1/draco.1
+	rm -fr $(sharedir)/doc/draco/
+
+.PHONY: install uninstall help