projects/aports·blob master · refs

43 lines · 1.1 KiB

1diff --git a/Makefile b/Makefile
2index 611b1c3..4f796dd 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -1,7 +1,18 @@
6+# Common prefix for installation directories, following GNU conventions.
7+# See https://www.gnu.org/prep/standards/html_node/Directory-Variables.html for details.
8+
9+# Installation prefix
10+PREFIX = /usr/local
11+DATAROOTDIR = $(PREFIX)/share
12+
13+# Where to put the executable.
14+BINDIR = $(PREFIX)/bin
15+# Where to put the manual pages.
16+MANDIR = $(DATAROOTDIR)/man
17+
18 TARGET = kabmat
19 SRC_DIR = src
20 BUILD_DIR = bin
21-INSTALL_DIR = /usr/bin/
22 DATA_DIR = ~/.local/share/kabmat
23
24 CFLAGS = -std=c++17 -Wall -Wextra
25@@ -31,7 +42,14 @@ clean:
26
27 .PHONY: install
28 install:
29- $(MAKE)
30- sudo cp ./$(TARGET) $(INSTALL_DIR)
31- sudo mkdir -p /usr/local/man/man1
32- sudo cp ./doc/kabmat.1 /usr/local/man/man1/
33+ mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
34+ cp ./$(TARGET) $(DESTDIR)$(BINDIR)
35+ chmod 0755 $(DESTDIR)$(BINDIR)/$(TARGET)
36+ cp ./doc/kabmat.1 $(DESTDIR)$(MANDIR)/man1
37+ chmod 0644 $(DESTDIR)$(MANDIR)/man1/kabmat.1
38+ $(MAKE) clean
39+
40+.PHONY: uninstall
41+uninstall:
42+ rm $(DESTDIR)$(BINDIR)/$(TARGET)
43+ rm $(DESTDIR)$(MANDIR)/man1/kabmat.1