commit ee6c07ec89043ba45acad95e9311792cde932f0b
parent 7c4e3a80cdf1c966820d76fa3e059e1272006c2e
Author: hhvn <dev@hhvn.uk>
Date: Sun, 14 Nov 2021 16:19:37 +0000
Makefile: install/uninstall targets
Diffstat:
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
@@ -2,11 +2,13 @@
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
+MANDIR = $(PREFIX)/share/man
BIN = hirc
OBJ = main.o handle.o hist.o nick.o \
chan.o serv.o ui.o commands.o \
config.o
MAN = hirc.1
+COMMIT = $(shell git log HEAD...HEAD~1 --pretty=format:%h)
# Comment to disable TLS
LDTLS = -ltls
@@ -23,6 +25,17 @@ $(BIN): $(OBJ)
$(MAN): $(BIN) $(MAN).header $(MAN).footer
./$(BIN) -d | cat $(MAN).header - $(MAN).footer > $(MAN)
+install: all
+ mkdir -p $(BINDIR) $(MANDIR)/man1
+ install -m0755 $(BIN) $(BINDIR)/$(BIN)
+ sed 's/COMMIT/$(COMMIT)/' \
+ < $(MAN) \
+ > $(MANDIR)/man1/$(MAN)
+
+uninstall:
+ -rm -f $(BINDIR)/$(BIN)
+ -rm -f $(MANDIR)/man1/$(MAN)
+
clean:
-rm -f $(OBJ) $(MAN) $(BIN)