]> gitweb.fperrin.net Git - iftop.git/blob - Makefile.OLD
Import iftop-1.0pre4
[iftop.git] / Makefile.OLD
1 #
2 # Makefile:
3 # Makefile for iftop.
4 #
5 # $Id: Makefile.OLD,v 1.2 2007/03/03 16:01:45 pdw Exp $
6 #
7
8 VERSION = 0.11pre1
9
10 # C compiler to use.
11 #CC = gcc
12
13 # Give the location of pcap.h here:
14 CFLAGS += -I/usr/include/pcap -g
15 # CFLAGS += -I/usr/pkg/include
16 # CFLAGS += -pg -a
17
18 # Give the location of libpcap here if it's not in one of the standard
19 # directories:
20 # LDFLAGS += -L/usr/local/lib
21 # LDFLAGS += -pg -a
22
23 # Do you want to use curses or ncurses? Probably ncurses, unless curses
24 # is ncurses on your machine.
25 # CURSES = -lncurses
26 #CURSES = -lcurses
27
28 #
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.
38 #
39 # Leave exactly one of these uncommented, or comment all of them out if you
40 # don't care about name resolution at all.
41 #
42 CFLAGS += -DUSE_GETHOSTBYADDR_R
43 #CFLAGS += -DUSE_GETHOSTBYADDR
44 #CFLAGS += -DUSE_LIBRESOLV
45 #CFLAGS += -DUSE_ARES
46
47 #
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.
50 #
51 #CFLAGS += -DGETHOSTBYADD_R_RETURNS_INT
52
53 #
54 # Uncomment if you are using libresolv.
55 #
56 #LDLIBS += -lresolv # or /usr/lib/libresolv.a on Linux?
57
58 #
59 # Uncomment if you are using ares.
60 #
61 #LDLIBS += -lares 
62 # ... and uncomment these if your libares is in an unusual place.
63 #CFLAGS += -I/software/include
64 #LDFLAGS += -L/software/lib
65
66 #
67 # Solaris needs a library to make sockets go and lacks inet_aton.
68 #
69 #LDLIBS += -lsocket -lnsl
70 CFLAGS += -DFAKE_INET_ATON
71
72 # PREFIX specifies the base directory for the installation.
73 PREFIX = /usr/local
74 #PREFIX = /software
75
76 # BINDIR is where the binary lives relative to PREFIX (no leading /).
77 BINDIR = sbin
78
79 # MANDIR is where the manual page goes.
80 MANDIR = man
81 #MANDIR = share/man     # FHS-ish
82
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
87
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 \
97        extract.h ethertype.h
98 TXTS = README CHANGES INSTALL TODO iftop.8 COPYING
99 SPECFILE = iftop.spec iftop.spec.in
100
101 IFTOP_OBJS = $(IFTOP_SRCS:.c=.o)
102 IFTOPDUMP_OBJS = $(IFTOPDUMP_SRCS:.c=.o)
103
104 iftop: $(IFTOP_OBJS) Makefile
105         $(CC) $(LDFLAGS) -o $@ $(IFTOP_OBJS) $(LDLIBS) 
106
107 iftop-dump: $(IFTOPDUMP_OBJS) Makefile
108         $(CC) $(LDFLAGS) -o $@ $(IFTOPDUMP_OBJS) $(LDLIBS) 
109
110 #integers.h: integers
111 #       ./integers
112
113 install: iftop
114         install -D iftop   $(PREFIX)/$(BINDIR)/iftop
115         install -D iftop.8 $(PREFIX)/$(MANDIR)/man8/iftop.8
116
117 uninstall:
118         rm -f $(PREFIX)/$(BINDIR)/iftop $(PREFIX)/$(MANDIR)/man8/iftop.8
119
120 %.o: %.c Makefile
121         $(CC) $(CFLAGS) -c -o $@ $<
122
123 clean:
124         rm -f *~ *.o core iftop iftop.spec
125
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)
131
132 tags :
133         etags *.c *.h
134
135 depend: $(SRCS)
136         $(CPP) $(CFLAGS)  -MM $(SRCS) > depend
137
138 nodepend:
139         rm -f depend
140
141 iftop.spec: iftop.spec.in Makefile
142         sed 's/__VERSION__/$(VERSION)/' < iftop.spec.in > iftop.spec
143   
144         
145 include depend