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
84
85
86
87
88
89
90
91
92
93
94
95
|
$Id$
--- iptraf-3.0.1.orig/src/Makefile 2005-09-13 11:11:17.000000000 +0200
+++ iptraf-3.0.1/src/Makefile 2014-06-25 16:51:56.160654472 +0200
@@ -17,8 +17,9 @@ VERSION = -DVERSION=\"$(VERNUMBER)\"
#
BINDIR = ../../iptraf-$(VERNUMBER).bin.$(ARCH)
-CC = gcc
-LIBS = -L../support -ltextbox -lpanel -lncurses # in this order!
+CC ?= gcc
+LIBS ?=
+LIBS += -ltextbox -lpanel -lncurses # in this order!
# comment this one out to omit debug code when done.
@@ -31,15 +32,17 @@ PROF = #-pg
# options to be passed to the compiler. I don't believe they need to be
# modified (except for -m486 on non-Intel x86 platforms).
-CFLAGS = -Wall #-O2 #-m486
+CFLAGS ?= -Wall #-O2 #-m486
DIRS = -DWORKDIR=\"$(WORKDIR)\" \
-DLOGDIR=\"$(LOGDIR)\" -DEXECDIR=\"$(TARGET)\"
-LDOPTS = #-static
+LDFLAGS ?=
+LDFLAGS += -L../support
# you may want to change this to point to your ncurses include directory
# if the ncurses include files are not in the default location.
-INCLUDEDIR = -I/usr/include/ncurses -I../support
+CPPFLAGS ?=
+CPPFLAGS += -I../support
# You can uncomment this one to disable the backspace key in input fields.
# This means you must use the Del key or Ctrl+H combination to erase the
@@ -98,7 +101,7 @@ LOCKDIR = /var/run/iptraf
# Object file names
OBJS = iptraf.o itrafmon.o packet.o tcptable.o othptab.o ifstats.o deskman.o \
-ipcsum.o hostmon.o fltedit.o tr.o cidr.o \
+ipcsum.o hostmon.o fltedit.o cidr.o \
fltselect.o ipfilter.o fltmgr.o ipfrag.o serv.o servname.o instances.o \
timer.o revname.o pktsize.o landesc.o isdntab.o options.o promisc.o ifaces.o \
error.o log.o mode.o getpath.o bar.o parseproto.o
@@ -106,33 +109,31 @@ error.o log.o mode.o getpath.o bar.o par
BINS = iptraf rvnamed rawtime
all: $(BINS)
- @echo
- @size $(BINS)
iptraf: $(OBJS) textlib
- $(CC) $(LDOPTS) $(PROF) -o iptraf $(OBJS) $(LIBS)
+ $(CC) $(LDFLAGS) -o iptraf $(OBJS) $(LIBS)
textlib:
- make -C ../support
+ $(MAKE) -C ../support
%.o: %.c *.h version
- $(CC) $(CFLAGS) $(DIRS) $(INCLUDEDIR) $(VERSION) $(PLATFORM) $(PROF) $(DEBUG) $(EXECPERM) $(BSSETTING) -c -o $*.o $<
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(DIRS) $(VERSION) $(PLATFORM) $(EXECPERM) $(BSSETTING) -c -o $*.o $<
rvnamed: rvnamed.o getpath.o
- $(CC) $(LDOPTS) $(PROF) -o rvnamed rvnamed.o getpath.o
+ $(CC) $(LDFLAGS) -o $@ $^
rvnamed.o: rvnamed.c rvnamed.h
- $(CC) $(CFLAGS) $(PROF) $(DEBUG) -c -o rvnamed.o rvnamed.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ rvnamed.c
rawtime: rawtime.c
- $(CC) $(CFLAGS) $(LDOPTS) $(PROF) $(DEBUG) -o rawtime rawtime.c
+ $(CC) $(CFLAGS) $(LDFLAGS) -o rawtime rawtime.c
# rule to clear out all object files and the executables (pow!)
clean:
rm -f *.o *~ core $(BINS)
- make -C ../support clean
+ $(MAKE) -C ../support clean
# I just included this rule to clear out the .o files, leaving the
# executables, stripped and ready for packing.
@@ -162,7 +163,7 @@ install:
# and the compiled programs for release as a ready-to-run distribution.
dist-bin: all
- $(CC) $(LDOPTS) $(PROF) -o iptraf $(OBJS) -L../support -ltextbox /usr/lib/libpanel.a /usr/lib/libncurses.a
+ $(CC) $(LDFLAGS) -o iptraf $(OBJS) -L../support -ltextbox -lpanel -lncurses
rm -rf $(BINDIR)
mkdir $(BINDIR)
/bin/cp -p ../CHANGES ../LICENSE ../FAQ ../INSTALL ../README* \
|