summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile26
1 files changed, 23 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index e0032f2..99ddf7e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,24 @@
-planr:
- go build -o planr ./cmd/main.go
+ifeq ($(PREFIX),)
+ PREFIX := /usr/local
+endif
-.PHONY: planr
+ifeq ($(BINDIR),)
+ BINDIR := /bin
+endif
+
+CMD := planr
+
+$(CMD):
+ go build -o $(CMD) ./cmd/main.go
+
+install:
+ mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR)/
+ install -D -m 755 $(CMD) $(DESTDIR)$(PREFIX)$(BINDIR)/
+
+uninstall:
+ rm -rf $(DESTDIR)$(PREFIX)$(BINDIR)/$(CMD)
+
+clean:
+ rm -rf $(CMD)
+
+.PHONY: clean install uninstall $(CMD)