summaryrefslogtreecommitdiffstats
path: root/testing/dhex/makefile.patch
blob: 9e7788b4099cf858fd35ac7e67a374c7f545a608 (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
--- ./Makefile.orig
+++ ./Makefile
@@ -1,12 +1,22 @@
-CC=		gcc
-LDFLAGS=	-L/usr/lib	-L/usr/local/lib  	-L/usr/lib/ncurses	-L/usr/local/lib/ncurses
+CC?=		gcc
+LDFLAGS?=	-L/usr/lib	-L/usr/local/lib  	-L/usr/lib/ncurses	-L/usr/local/lib/ncurses
 CPPFLAGS=	-I/usr/include	-I/usr/local/include	-I/usr/include/ncurses	-I/usr/local/include/ncurses
-CFLAGS=		-O3 -Wall -std=c99 
+CFLAGS?=		-O3 -Wall -std=c99 
 #CFLAGS+= -ffunction-sections -fdata-sections
 #LDFLAGS+= --gc-sections 
 LIBS=		-lncurses
-DESTDIR=	/usr/local/
 
+prefix=		/usr/local
+bindir=		$(prefix)/bin
+mandir=		$(prefix)/man
+man1dir=	$(mandir)/man1
+man5dir=	$(mandir)/man5
+DESTDIR=
+
+MKDIR_P=	install -d
+INSTALL=	install
+
+
 OFILES=buffers.o \
 	configfile.o \
 	correlation.o \
@@ -27,14 +37,11 @@
 	$(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS)
 
 install:all
-	strip dhex
-	cp dhex $(DESTDIR)/bin
-	cp dhex.1 $(DESTDIR)/man/man1
-	cp dhexrc.5 $(DESTDIR)/man/man5
-	cp dhex_markers.5 $(DESTDIR)/man/man5
-	cp dhex_searchlog.5 $(DESTDIR)/man/man5
-
-	
+	$(MKDIR_P) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) $(DESTDIR)$(man5dir)
+	$(INSTALL) -m755  dhex $(DESTDIR)$(bindir)
+	$(INSTALL) -m644 dhex.1 $(DESTDIR)$(man1dir)
+	$(INSTALL) -m644 dhexrc.5 dhex_markers.5 dhex_searchlog.5 \
+		$(DESTDIR)$(man5dir)
 
 .c.o:
 	$(CC) $< -c -I. $(CPPFLAGS) $(CFLAGS) $(OPTIONS)