summaryrefslogtreecommitdiff
path: root/textproc/aha/patches/patch-Makefile
blob: 3a9cb03808469856436b249fa01cfe2f65e00d87 (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
$NetBSD: patch-Makefile,v 1.1 2016/01/12 22:06:03 kamil Exp $

Sent upstream: https://github.com/theZiz/aha/pull/15

Allow to overwrite MANDIR, it's OS specific and configurable in pkgsrc. It's
usually share/man (GNU) or man (BSD).

Files must be installed with specific file mode. Previously man-page was
installed with executable bit.

BIN:= and MAN:= didn't work well with overwrittable MANDIR, go for canonical
way of using these paths.

--- Makefile.orig	2015-01-24 12:12:35.000000000 +0000
+++ Makefile
@@ -1,22 +1,22 @@
 .PHONY: all clean install
 
-ifndef PREFIX
-    PREFIX=/usr/local
-endif
+PREFIX?=/usr/local
 
-BIN:=$(DESTDIR)$(PREFIX)/bin
-MAN:=$(DESTDIR)$(PREFIX)/man/man1
+MANDIR?=man
+
+BINMODE?=0755
+MANMODE?=644
 
 all: aha
 
 aha: aha.c
-	gcc -std=c99 $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) aha.c -o aha
+	$(CC) -std=c99 $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) aha.c -o aha
 
 clean:
 	rm -f aha
 
 install: aha
-	install -d $(BIN)
-	install aha $(BIN)
-	install -d $(MAN)
-	install aha.1 $(MAN)
+	install -d $(DESTDIR)$(PREFIX)/bin
+	install -m ${BINMODE} aha $(DESTDIR)$(PREFIX)/bin
+	install -d $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
+	install -m ${MANMODE} aha.1 $(DESTDIR)$(PREFIX)/$(MANDIR)/man1