From 8bb628f9022b9937543595a3009a4763ff05731f Mon Sep 17 00:00:00 2001
From: Luke Bratch <luke@bratch.co.uk>
Date: Sat, 24 Oct 2020 18:00:07 +0100
Subject: Add install and uninstall recipes to Makefile.

---
 Makefile | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Makefile b/Makefile
index 4866dfc..391a278 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,16 @@
 CC=gcc
+ifeq ($(PREFIX),)
+	PREFIX := /usr/local
+endif
 
 blabouncer: blabouncer.c functions.c sockets.c config.c replay.c logging.c message.c
 	$(CC) -D_DEFAULT_SOURCE -D_BSD_SOURCE -std=gnu99 -Wall -Wextra -lssl -lcrypto -o blabouncer blabouncer.c functions.c sockets.c config.c replay.c logging.c message.c
+
+.PHONY: install
+install: blabouncer
+	install -d $(DESTDIR)$(PREFIX)/bin/
+	install -m 755 blabouncer $(DESTDIR)$(PREFIX)/bin/
+
+.PHONY: uninstall
+uninstall:
+	rm -f $(DESTDIR)$(PREFIX)/bin/blabouncer
-- 
cgit v1.2.3