blob: 292af8e4175b287425650e6afc86c41e7125cb59 (
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
|
--- a/Makefile
+++ b/Makefile
@@ -5,15 +5,17 @@
#DESTDIR := /usr
DESTDIR := /usr/local
-sbin := $(DESTDIR)/sbin
-man8 := $(DESTDIR)/share/man/man8/
+sbin := $(DESTDIR)/usr/sbin
+man8 := $(DESTDIR)/usr/share/man/man8/
all: nethogs decpcap_test
# nethogs_testsum
-CFLAGS=-g -Wall -Wextra
-#CFLAGS=-O2
+CXXFLAGS+= -Wall -Wextra
OBJS=packet.o connection.o process.o refresh.o decpcap.o cui.o inode2prog.o conninode.o devices.o
+
+LIBS = $(shell $(PKG_CONFIG) --libs ncurses)
+
.PHONY: tgz
tgz: clean
@@ -30,33 +32,33 @@
install -m 644 nethogs.8 $(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 $(LIBS) -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) $(LDFLAGS) -g nethogs_testsum.cpp $(OBJS) -o nethogs_testsum -lpcap -lm $(LIBS) -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
+ $(CC) $(CXXFLAGS) -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
#devices.o: devices.cpp devices.h
-# $(CXX) $(CFLAGS) -c devices.cpp
+# $(CXX) $(CXXFLAGS) -c devices.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:
|