summaryrefslogtreecommitdiff
blob: 5a3285a1cf9a451f3409a6f3aba79794d2417b0c (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
Replace CFLAGS for CXX target with CXXFLAGS. Add LDFLAGS to respect them.
Use DESTDIR correctly, and fix typing error of sbin. - ssuominen@gentoo.org

diff -ur nethogs.orig/Makefile nethogs/Makefile
--- nethogs.orig/Makefile	2009-03-12 23:08:17.000000000 +0000
+++ nethogs/Makefile	2009-04-29 09:41:11.000000000 +0000
@@ -2,17 +2,17 @@
 SUBVERSION   := 7
 MINORVERSION := 0
 
-#DESTDIR := /usr
-DESTDIR := /usr/local
-
-sbin  := $(DESTDIR)/sbin
-man8 := $(DESTDIR)/share/man/man8/
+prefix := /usr
+# prefix := /usr/local
+sbin   := $(prefix)/sbin
+man8   := $(prefix)/share/man/man8
 
 all: nethogs decpcap_test
 # nethogs_testsum
 
-CFLAGS=-g -Wall -Wextra
-#CFLAGS=-O2
+CFLAGS   += -Wall
+CXXFLAGS += -Wall
+
 OBJS=packet.o connection.o process.o refresh.o decpcap.o cui.o inode2prog.o conninode.o
 .PHONY: tgz
 
@@ -24,37 +24,37 @@
 	echo "Not implemented"
 
 install: nethogs nethogs.8
-	install -d -m 755 $(bin)
-	install -m 755 nethogs $(bin)
-	install -d -m 755 $(man8)
-	install -m 644 nethogs.8 $(man8)
+	install -d -m 755 $(DESTDIR)$(sbin)
+	install -m 755 nethogs $(DESTDIR)$(sbin)
+	install -d -m 755 $(DESTDIR)$(man8)
+	install -m 644 nethogs.8 $(DESTDIR)$(man8)
 
 nethogs: nethogs.cpp $(OBJS)
-	$(CXX) $(CFLAGS) nethogs.cpp $(OBJS) -o nethogs -lpcap -lm -lncurses -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) nethogs.cpp $(OBJS) -o nethogs -lpcap -lm -lncurses -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
 nethogs_testsum: nethogs_testsum.cpp $(OBJS)
-	$(CXX) $(CFLAGS) -g nethogs_testsum.cpp $(OBJS) -o nethogs_testsum -lpcap -lm -lncurses -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
+	$(CXX) $(CXXFLAGS) -g $(LDFLAGS) nethogs_testsum.cpp $(OBJS) -o nethogs_testsum -lpcap -lm -lncurses -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
 
 decpcap_test: decpcap_test.cpp decpcap.o
-	$(CXX) $(CFLAGS) decpcap_test.cpp decpcap.o -o decpcap_test -lpcap -lm
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) decpcap_test.cpp decpcap.o -o decpcap_test -lpcap -lm
 
 #-lefence
 
 refresh.o: refresh.cpp refresh.h nethogs.h
-	$(CXX) $(CFLAGS) -c refresh.cpp
+	$(CXX) $(CXXFLAGS) -c refresh.cpp
 process.o: process.cpp process.h nethogs.h
-	$(CXX) $(CFLAGS) -c process.cpp
+	$(CXX) $(CXXFLAGS) -c process.cpp
 packet.o: packet.cpp packet.h nethogs.h
-	$(CXX) $(CFLAGS) -c packet.cpp
+	$(CXX) $(CXXFLAGS) -c packet.cpp
 connection.o: connection.cpp connection.h nethogs.h
-	$(CXX) $(CFLAGS) -c connection.cpp
+	$(CXX) $(CXXFLAGS) -c connection.cpp
 decpcap.o: decpcap.c decpcap.h
 	$(CC) $(CFLAGS) -c decpcap.c
 inode2prog.o: inode2prog.cpp inode2prog.h nethogs.h
-	$(CXX) $(CFLAGS) -c inode2prog.cpp
+	$(CXX) $(CXXFLAGS) -c inode2prog.cpp
 conninode.o: conninode.cpp nethogs.h conninode.h
-	$(CXX) $(CFLAGS) -c conninode.cpp
+	$(CXX) $(CXXFLAGS) -c conninode.cpp
 cui.o: cui.cpp cui.h nethogs.h
-	$(CXX) $(CFLAGS) -c cui.cpp -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
+	$(CXX) $(CXXFLAGS) -c cui.cpp -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
 
 .PHONY: clean
 clean: