5 # $Id: Makefile.OLD,v 1.2 2007/03/03 16:01:45 pdw Exp $
13 # Give the location of pcap.h here:
14 CFLAGS += -I/usr/include/pcap -g
15 # CFLAGS += -I/usr/pkg/include
18 # Give the location of libpcap here if it's not in one of the standard
20 # LDFLAGS += -L/usr/local/lib
23 # Do you want to use curses or ncurses? Probably ncurses, unless curses
24 # is ncurses on your machine.
29 # Name resolution. Sensible systems have gethostbyaddr_r, which is reentrant
30 # and can be called from several threads of a multithreaded program. Other
31 # systems don't, or their implementations don't work ([cough] FreeBSD). For
32 # these you can use gethostbyaddr (not recommended, since then only one thread
33 # can resolve a name at once), libresolv (not recommended and may not work
34 # depending on which header files you have), or ares, an asynchronous DNS
35 # resolution library from
36 # ftp://athena-dist.mit.edu/pub/ATHENA/ares/
37 # For systems without a working gethostbyaddr_r, this is recommended.
39 # Leave exactly one of these uncommented, or comment all of them out if you
40 # don't care about name resolution at all.
42 CFLAGS += -DUSE_GETHOSTBYADDR_R
43 #CFLAGS += -DUSE_GETHOSTBYADDR
44 #CFLAGS += -DUSE_LIBRESOLV
48 # On some machines, gethostbyaddr_r returns int; on others, struct hostent*.
49 # Comment out this line if you are using one of the latter.
51 #CFLAGS += -DGETHOSTBYADD_R_RETURNS_INT
54 # Uncomment if you are using libresolv.
56 #LDLIBS += -lresolv # or /usr/lib/libresolv.a on Linux?
59 # Uncomment if you are using ares.
62 # ... and uncomment these if your libares is in an unusual place.
63 #CFLAGS += -I/software/include
64 #LDFLAGS += -L/software/lib
67 # Solaris needs a library to make sockets go and lacks inet_aton.
69 #LDLIBS += -lsocket -lnsl
70 CFLAGS += -DFAKE_INET_ATON
72 # PREFIX specifies the base directory for the installation.
76 # BINDIR is where the binary lives relative to PREFIX (no leading /).
79 # MANDIR is where the manual page goes.
81 #MANDIR = share/man # FHS-ish
83 # You shouldn't need to change anything below this point.
84 CFLAGS += -g -Wall "-DIFTOP_VERSION=\"$(VERSION)\""
85 LDFLAGS += -g #-pthread
86 LDLIBS += -lpcap $(CURSES) -lm -lpthread
88 COMMON_SRCS = addr_hash.c hash.c ns_hash.c util.c sorted_list.c\
89 options.c serv_hash.c threadprof.c screenfilter.c cfgfile.c stringmap.c addrs_ioctl.c
90 IFTOP_ONLY_SRCS = iftop.c ui.c stringmap.c
91 IFTOPDUMP_ONLY_SRCS = iftop-dump.c counter_hash.c
92 SRCS = $(COMMON_SRCS) $(IFTOPDUMP_ONLY_SRCS) $(IFTOP_ONLY_SRCS)
93 IFTOP_SRCS = $(IFTOP_ONLY_SRCS) $(COMMON_SRCS)
94 IFTOPDUMP_SRCS = $(IFTOPDUMP_ONLY_SRCS) $(COMMON_SRCS)
95 HDRS = addr_hash.h hash.h iftop.h ns_hash.h resolver.h sorted_list.h ui.h options.h sll.h\
96 serv_hash.h threadprof.h ether.h ip.h tcp.h screenfilter.h token.h llc.h \
98 TXTS = README CHANGES INSTALL TODO iftop.8 COPYING
99 SPECFILE = iftop.spec iftop.spec.in
101 IFTOP_OBJS = $(IFTOP_SRCS:.c=.o)
102 IFTOPDUMP_OBJS = $(IFTOPDUMP_SRCS:.c=.o)
104 iftop: $(IFTOP_OBJS) Makefile
105 $(CC) $(LDFLAGS) -o $@ $(IFTOP_OBJS) $(LDLIBS)
107 iftop-dump: $(IFTOPDUMP_OBJS) Makefile
108 $(CC) $(LDFLAGS) -o $@ $(IFTOPDUMP_OBJS) $(LDLIBS)
110 #integers.h: integers
114 install -D iftop $(PREFIX)/$(BINDIR)/iftop
115 install -D iftop.8 $(PREFIX)/$(MANDIR)/man8/iftop.8
118 rm -f $(PREFIX)/$(BINDIR)/iftop $(PREFIX)/$(MANDIR)/man8/iftop.8
121 $(CC) $(CFLAGS) -c -o $@ $<
124 rm -f *~ *.o core iftop iftop.spec
126 tarball: depend $(SRCS) $(HDRS) $(TXTS) $(SPECFILE)
127 mkdir iftop-$(VERSION)
128 set -e ; for i in Makefile depend $(SRCS) $(HDRS) $(TXTS) $(SPECFILE) ; do cp $$i iftop-$(VERSION)/$$i ; done
129 tar cvf - iftop-$(VERSION) | gzip --best > iftop-$(VERSION).tar.gz
130 rm -rf iftop-$(VERSION)
136 $(CPP) $(CFLAGS) -MM $(SRCS) > depend
141 iftop.spec: iftop.spec.in Makefile
142 sed 's/__VERSION__/$(VERSION)/' < iftop.spec.in > iftop.spec