summaryrefslogtreecommitdiff
blob: fe65a16caf9cd63a42a77a4e9cd9fbd7cef933bb (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
diff --git a/Makefile b/Makefile
index fc4d262..e2347bf 100644
--- a/Makefile
+++ b/Makefile
@@ -17,18 +17,18 @@
 
 #makefile updated from patch by anestling
 
-CFLAGSANY = -g -O0 -fomit-frame-pointer -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILD_MAIN -Wall
+CFLAGS += -O0 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILD_MAIN -Wall
 
 LBITS := $(shell getconf LONG_BIT)
 ifeq ($(LBITS),64)
-   CFLAGS = $(CFLAGSANY) -Dx64_BIT
+   CFLAGS += -Dx64_BIT
 else
-   CFLAGS = $(CFLAGSANY) -Dx86
+   CFLAGS += -Dx86
 endif
 
-CC       = gcc 
+CC       ?= gcc
 
-LDFLAGS  = -lncurses -lpthread -lrt
+LIBS  = -lncurses -lpthread -lrt
 INCLUDEFLAGS = 
 
 OBJS = helper_functions
@@ -36,15 +36,15 @@ OBJS = helper_functions
 BIN	= i7z
 SRC	= i7z.c helper_functions.c i7z_Single_Socket.c i7z_Dual_Socket.c
 
-sbindir = /usr/sbin
+sbindir = $(DESTDIR)/usr/sbin
 
-all: clean message bin
+all: clean bin
 
 message:
 	@echo "If the compilation complains about not finding ncurses.h, install ncurses (libncurses5-dev on ubuntu/debian)"
 
 bin:
-	$(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDEFLAGS) $(SRC) -o $(BIN)
+	$(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDEFLAGS) $(SRC) -o $(BIN) $(LIBS)
 
 clean:
 	rm -f *.o $(BIN)
@@ -52,6 +52,6 @@ clean:
 distclean: clean
 	rm -f *~ \#*
 
-install: all
-	install -m 755 $(BIN) $(sbindir)
+install:
+	install -D -m 755 $(BIN) $(sbindir)/$(BIN)