t

commit c87b79b854a4c9c3bce755521ad5ce4406d096ba

Author: Pedro Lucas Porcellis <pedrolucasporcellis@gmail.com>

Introduce installation script to Makefile

 .gitignore | 1 +
 Makefile | 14 ++++++++++++--


diff --git a/.gitignore b/.gitignore
index 95120a2e2298a6cd201fe7710604adbec8413331..9fa09caa8f4c97a62fc09f53cb13487bdbeb204c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 bin/*
 .go
 t
+docs/*.gz




diff --git a/Makefile b/Makefile
index e55a11d185802f8b0ca97ed1a77d918d9bd15a92..72549a83f0a05e9665ed72df31020f3d1900cac5 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,17 @@ PKGNAME = git.sr.ht/~porcellis/t
 GOPATH = $(realpath .go)
 PKGPATH = .go/src/$(PKGNAME)
 
-all: t
+PREFIX?=/usr/local
+_INSTDIR=$(DESTDIR)$(PREFIX)
+BINDIR?=$(_INSTDIR)/bin
+MANDIR?=$(_INSTDIR)/share/man
+
+all: t doc
+
+install: all
+	mkdir -m755 -p $(BINDIR) $(MANDIR)/man1
+	install -m755 t $(BINDIR)/t
+	install -m644 docs/t.1 $(MANDIR)/man1/t.1
 
 .go:
 		mkdir -p $(dir $(PKGPATH))
@@ -18,7 +28,7 @@ get: .go
 	env GOPATH=$(GOPATH) go get -d ./...
 
 clean:
-	rm -rf t
+	rm -rf t docs/*.gz
 
 .PHONY:
 	t get clean doc