summaryrefslogtreecommitdiff
blob: c64473d4092b489449ec76b7521d36b0a68ad4aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
Upstream-PR: https://github.com/lecram/rover/pull/40
From bceeabdf443d5e03ac38a80a195383d3ef800ffa Mon Sep 17 00:00:00 2001
From: orbea <orbea@riseup.net>
Date: Tue, 3 May 2022 09:29:28 -0700
Subject: [PATCH 1/3] build: Use standard install variables

This removes DESTDIR from both BINDIR and MANDIR and adds it directly
to the intall and uninstall rules.

This also moves 'man1' directly to the rules as it should not be
configurable by the user.

And lastly this removes the non-standard and now useless MANPREFIX.
---
 Makefile | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 8fea662..43c90f4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,7 @@
 LDLIBS=-lncursesw
 PREFIX=/usr/local
-MANPREFIX=$(PREFIX)/man
-BINDIR=$(DESTDIR)$(PREFIX)/bin
-MANDIR=$(DESTDIR)$(MANPREFIX)/man1
+BINDIR=$(PREFIX)/bin
+MANDIR=$(PREFIX)/man
 
 all: rover
 
@@ -10,15 +9,15 @@ rover: rover.c config.h
 	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDLIBS)
 
 install: rover
-	rm -f $(BINDIR)/rover
-	mkdir -p $(BINDIR)
-	cp rover $(BINDIR)/rover
-	mkdir -p $(MANDIR)
-	cp rover.1 $(MANDIR)/rover.1
+	rm -f $(DESTDIR)$(BINDIR)/rover
+	mkdir -p $(DESTDIR)$(BINDIR)
+	cp rover $(DESTDIR)$(BINDIR)/rover
+	mkdir -p $(DESTDIR)$(MANDIR)/man1
+	cp rover.1 $(DESTDIR)$(MANDIR)/man1/rover.1
 
 uninstall:
-	rm -f $(BINDIR)/rover
-	rm -f $(MANDIR)/rover.1
+	rm -f $(DESTDIR)$(BINDIR)/rover
+	rm -f $(DESTDIR)$(MANDIR)/man1/rover.1
 
 clean:
 	rm -f rover

From 91dfa8e9b37b1433ebc3210a06779fd5163c70fb Mon Sep 17 00:00:00 2001
From: orbea <orbea@riseup.net>
Date: Tue, 3 May 2022 10:13:19 -0700
Subject: [PATCH 2/3] build: Explicitly set variables

---
 Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 43c90f4..b54fc88 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
-LDLIBS=-lncursesw
-PREFIX=/usr/local
-BINDIR=$(PREFIX)/bin
-MANDIR=$(PREFIX)/man
+LDLIBS := -lncursesw
+PREFIX ?= /usr/local
+BINDIR ?= $(PREFIX)/bin
+MANDIR ?= $(PREFIX)/man
 
 all: rover
 

From f0518c52fef6f0822dc553e261b37db8075ca07e Mon Sep 17 00:00:00 2001
From: orbea <orbea@riseup.net>
Date: Tue, 3 May 2022 09:29:58 -0700
Subject: [PATCH 3/3] build: Use FHS and GNU paths for MANDIR

The FHS path for MANDIR is /usr/share/man.

https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s11.html#usrsharemanManualPages

While GNU directory variables show MANDIR to be DATADIR/man

https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index b54fc88..291a7b3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,9 @@
 LDLIBS := -lncursesw
 PREFIX ?= /usr/local
 BINDIR ?= $(PREFIX)/bin
-MANDIR ?= $(PREFIX)/man
+DATAROOTDIR ?= $(PREFIX)/share
+DATADIR ?= $(DATAROOTDIR)
+MANDIR ?= $(DATADIR)/man
 
 all: rover