- fix potential buffer overflow problems.
[obnox/wireshark/wip.git] / Makefile.am
1 # Makefile.am
2 # Automake file for Ethereal
3 #
4 # $Id: Makefile.am,v 1.222 2000/08/18 15:26:51 gram Exp $
5 #
6 # Ethereal - Network traffic analyzer
7 # By Gerald Combs <gerald@zing.org>
8 # Copyright 1998 Gerald Combs
9 #
10
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License
13 # as published by the Free Software Foundation; either version 2
14 # of the License, or (at your option) any later version.
15
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24
25 ACLOCAL_AMFLAGS = `./aclocal-flags`
26
27 EXTRA_PROGRAMS = ethereal_static
28 bin_PROGRAMS = ethereal editcap tethereal
29
30 man_MANS = ethereal.1 editcap.1 tethereal.1
31
32 sysconf_DATA = manuf
33
34 # Any POSIX-compatible YACC should honor the -p flag
35 YFLAGS=-d -p dfilter_
36
37 DISSECTOR_SOURCES = \
38         packet-aarp.c  \
39         packet-afs.c   \
40         packet-arp.c   \
41         packet-ascend.c\
42         packet-atalk.c \
43         packet-atm.c   \
44         packet-auto_rp.c   \
45         packet-bgp.c   \
46         packet-bootp.c \
47         packet-bootparams.c \
48         packet-bpdu.c  \
49         packet-cdp.c   \
50         packet-cgmp.c  \
51         packet-clip.c  \
52         packet-clnp.c  \
53         packet-cops.c  \
54         packet-data.c  \
55         packet-ddtp.c  \
56         packet-diameter.c \
57         packet-dns.c   \
58         packet-eigrp.c \
59         packet-esis.c  \
60         packet-eth.c   \
61         packet-ethertype.c   \
62         packet-fddi.c  \
63         packet-ftp.c   \
64         packet-giop.c  \
65         packet-gre.c   \
66         packet-h1.c    \
67         packet-hsrp.c  \
68         packet-http.c  \
69         packet-icmpv6.c\
70         packet-icp.c   \
71         packet-icq.c   \
72         packet-imap.c   \
73         packet-ip.c    \
74         packet-ipp.c   \
75         packet-ipsec.c \
76         packet-ipv6.c  \
77         packet-ipx.c   \
78         packet-irc.c   \
79         packet-isakmp.c\
80         packet-isis.c  \
81         packet-isis-clv.c \
82         packet-isis-hello.c \
83         packet-isis-lsp.c \
84         packet-isis-snp.c \
85         packet-isl.c   \
86         packet-kerberos.c \
87         packet-l2tp.c  \
88         packet-lapb.c  \
89         packet-lapd.c  \
90         packet-ldap.c  \
91         packet-llc.c   \
92         packet-lpd.c   \
93         packet-mapi.c  \
94         packet-mip.c  \
95         packet-mount.c \
96         packet-mpls.c \
97         packet-msproxy.c \
98         packet-nbipx.c \
99         packet-nbns.c  \
100         packet-ncp.c   \
101         packet-ncp2222.c   \
102         packet-netbios.c \
103         packet-nfs.c   \
104         packet-nlm.c   \
105         packet-nntp.c  \
106         packet-ntp.c  \
107         packet-null.c  \
108         packet-osi.c   \
109         packet-osi-options.c \
110         packet-ospf.c  \
111         packet-pim.c   \
112         packet-pop.c   \
113         packet-portmap.c   \
114         packet-ppp.c   \
115         packet-pppoe.c \
116         packet-pptp.c  \
117         packet-q2931.c \
118         packet-q931.c  \
119         packet-quake.c \
120         packet-radius.c\
121         packet-raw.c   \
122         packet-rip.c   \
123         packet-ripng.c \
124         packet-rlogin.c \
125         packet-rpc.c   \
126         packet-rsh.c   \
127         packet-rsvp.c  \
128         packet-rtcp.c  \
129         packet-rtp.c   \
130         packet-rtsp.c  \
131         packet-rx.c  \
132         packet-sap.c   \
133         packet-sctp.c   \
134         packet-sdp.c   \
135         packet-smb.c   \
136         packet-smb-browse.c \
137         packet-smb-common.c \
138         packet-smb-logon.c \
139         packet-smb-mailslot.c \
140         packet-smb-pipe.c \
141         packet-sna.c   \
142         packet-snmp.c   \
143         packet-socks.c \
144         packet-srvloc.c \
145         packet-sscop.c \
146         packet-stat.c   \
147         packet-syslog.c \
148         packet-tacacs.c \
149         packet-tcp.c   \
150         packet-telnet.c\
151         packet-tftp.c  \
152         packet-time.c  \
153         packet-tns.c \
154         packet-tr.c    \
155         packet-trmac.c \
156         packet-udp.c   \
157         packet-v120.c \
158         packet-vines.c \
159         packet-vlan.c \
160         packet-vrrp.c \
161         packet-vtp.c  \
162         packet-wccp.c \
163         packet-who.c  \
164         packet-x11.c   \
165         packet-x25.c   \
166         packet-yhoo.c  \
167         packet-ypbind.c \
168         packet-ypserv.c \
169         packet-ypxfr.c \
170         packet-zebra.c
171
172 noinst_HEADERS = \
173         packet-afs.h   \
174         packet-arp.h   \
175         packet-ascend.h\
176         packet-atalk.h \
177         packet-atm.h   \
178         packet-bgp.h   \
179         packet-bootparams.h \
180         packet-bpdu.h  \
181         packet-cdp.h   \
182         packet-cgmp.h  \
183         packet-clip.h  \
184         packet-clnp.h  \
185         packet-ddtp.h  \
186         packet-diameter.h \
187         packet-diameter-defs.h \
188         packet-dns.h   \
189         packet-esis.h  \
190         packet-eth.h   \
191         packet-fddi.h  \
192         packet-http.h  \
193         packet-ip.h    \
194         packet-ipp.h   \
195         packet-ipsec.h \
196         packet-ipv6.h  \
197         packet-ipx.h   \
198         packet-isis.h  \
199         packet-isis-clv.h \
200         packet-isis-hello.h \
201         packet-isis-lsp.h \
202         packet-isis-snp.h \
203         packet-isl.h   \
204         packet-kerberos.h \
205         packet-lapb.h  \
206         packet-lapd.h  \
207         packet-ldap.h  \
208         packet-llc.h   \
209         packet-mount.h \
210         packet-nbipx.h \
211         packet-ncp-int.h \
212         packet-netbios.h \
213         packet-nfs.h   \
214         packet-nlm.h   \
215         packet-ntp.h  \
216         packet-null.h  \
217         packet-osi.h   \
218         packet-osi-options.h \
219         packet-ospf.h  \
220         packet-portmap.h   \
221         packet-ppp.h   \
222         packet-q2931.h \
223         packet-q931.h  \
224         packet-raw.h   \
225         packet-rip.h   \
226         packet-ripng.h \
227         packet-rpc.h   \
228         packet-rtcp.h  \
229         packet-rtp.h   \
230         packet-rx.h  \
231         packet-sdp.h   \
232         packet-smb.h   \
233         packet-smb-common.h \
234         packet-sna.h   \
235         packet-snmp.h   \
236         packet-sscop.h \
237         packet-stat.h   \
238         packet-tcp.h   \
239         packet-tftp.h  \
240         packet-tns.h \
241         packet-tr.h    \
242         packet-trmac.h \
243         packet-udp.h   \
244         packet-v120.h \
245         packet-vines.h \
246         packet-vlan.h \
247         packet-vtp.h  \
248         packet-x11-declarations.h       \
249         packet-x11-register-info.h      \
250         packet-x11-keysym.h     \
251         packet-x25.h   \
252         packet-yhoo.h  \
253         packet-ypbind.h \
254         packet-ypserv.h \
255         packet-ypxfr.h 
256
257 ETHEREAL_COMMON_SOURCES = \
258         alignment.h    \
259         asn1.c         \
260         asn1.h         \
261         column.c       \
262         column.h       \
263         conversation.c \
264         conversation.h \
265         dfilter-int.h  \
266         dfilter-grammar.y \
267         dfilter-scanner.l \
268         dfilter.c      \
269         dfilter.h      \
270         etypes.h       \
271         except.c        \
272         except.h        \
273         exceptions.h    \
274         follow.c       \
275         follow.h       \
276         inet_aton.h    \
277         inet_v6defs.h  \
278         ipproto.c      \
279         ipv4.c         \
280         ipv4.h         \
281         llcsaps.h      \
282         ncp2222.h       \
283         nlpid.h        \
284         oui.h          \
285         packet.c       \
286         packet.h       \
287         plugins.c      \
288         plugins.h      \
289         ppptypes.h     \
290         prefs.c        \
291         prefs.h        \
292         prefs-int.h    \
293         print.c        \
294         print.h        \
295         proto.c        \
296         proto.h        \
297         ps.c           \
298         ps.h           \
299         ptvcursor.c     \
300         ptvcursor.h     \
301         register.c     \
302         register.h     \
303         resolv.c       \
304         resolv.h       \
305         smb.h          \
306         timestamp.h    \
307         tvbuff.c        \
308         tvbuff.h        \
309         util.c         \
310         util.h         \
311         xdlc.c         \
312         xdlc.h
313
314 ethereal_SOURCES = \
315         $(DISSECTOR_SOURCES) \
316         $(ETHEREAL_COMMON_SOURCES) \
317         capture.c      \
318         capture.h      \
319         file.c         \
320         file.h         \
321         globals.h      \
322         menu.h         \
323         simple_dialog.h \
324         summary.c      \
325         summary.h      \
326         ui_util.h
327
328 ethereal_static_SOURCES = \
329         $(ethereal_SOURCES)
330
331 EXTRA_ethereal_SOURCES = \
332         dfilter-grammar.c \
333         dfilter-grammar.h \
334         dfilter-scanner.c \
335         snprintf.c      \
336         snprintf.h      \
337         snprintf-imp.h  \
338         strerror.c      \
339         strerror.h      \
340         strcasecmp.c    \
341         strncasecmp.c   \
342         mkstemp.c       \
343         mkstemp.h       \
344         inet_aton.c     \
345         inet_pton.c     \
346         inet_ntop.c
347
348 # Optional objects that I know how to build. These will be
349 # linked into the ethereal executable.
350 # They will also be linked into the tethereal executable; if this
351 # list ever grows to include something that can't be linked with
352 # tethereal, or if tethereal needs something that ethereal doesn't,
353 # we should probably split this into stuff needed both
354 # by ethereal and tethereal and stuff needed only by one or the
355 # other.
356 ethereal_optional_objects = @SNPRINTF_O@ @STRERROR_O@ \
357         @STRCASECMP_O@ @STRNCASECMP_O@ @MKSTEMP_O@ \
358         @INET_ATON_O@ @INET_PTON_O@ @INET_NTOP_O@ 
359
360 # Additional libs that I know how to build. These will be
361 # linked into the ethereal executable.
362 ethereal_additional_libs = wiretap/libwiretap.a gtk/libui.a
363
364 # This is the automake dependency variable for the executable
365 ethereal_DEPENDENCIES = \
366         $(ethereal_optional_objects)    \
367         $(ethereal_additional_libs)     \
368         plugins/gryphon/gryphon.la
369
370 ethereal_static_DEPENDENCIES = \
371         $(ethereal_optional_objects)    \
372         $(ethereal_additional_libs)
373
374 # This automake variable adds to the link-line for the executable.
375 #
376 # Note that Ethereal doesn't have to be linked with @GLIB_LIBS@, as
377 # they are included in @GTK_LIBS@, and doesn't have to be linked with
378 # @SOCKET_LIBS@ or @NSL_LIBS@, as those should also be included in
379 # @GTK_LIBS@ (as those are also needed for X applications, and GTK+
380 # applications are X applications).
381 ethereal_LDADD = \
382         $(ethereal_optional_objects)    \
383         $(ethereal_additional_libs)     \
384         @SNMP_LIBS@                     \
385         "-dlopen" self  \
386         "-dlopen" plugins/gryphon/gryphon.la @PCAP_LIBS@ @GTK_LIBS@
387
388 ethereal_static_LDADD = \
389         $(ethereal_optional_objects)    \
390         $(ethereal_additional_libs) \
391         @SNMP_LIBS@                     \
392         @PCAP_LIBS@ @GTK_LIBS@
393
394 ethereal_LDFLAGS = -export-dynamic
395 ethereal_static_LDFLAGS = -Wl,-static
396
397 tethereal_SOURCES = \
398         $(DISSECTOR_SOURCES) \
399         $(ETHEREAL_COMMON_SOURCES) \
400         tethereal.c
401
402 # Additional libs that I know how to build. These will be
403 # linked into the tethereal executable.
404 tethereal_additional_libs = wiretap/libwiretap.a
405
406 # This is the automake dependency variable for the executable
407 tethereal_DEPENDENCIES = \
408         $(ethereal_optional_objects)    \
409         $(tethereal_additional_libs)    \
410         plugins/gryphon/gryphon.la
411
412 # This automake variable adds to the link-line for the executable
413 tethereal_LDADD = wiretap/libwiretap.a  \
414         $(ethereal_optional_objects)    \
415         $(tethereal_additional_libs)    \
416         @SNMP_LIBS@                     \
417         "-dlopen" self  \
418         "-dlopen" plugins/gryphon/gryphon.la @GLIB_LIBS@ -lm \
419         @PCAP_LIBS@ @SOCKET_LIBS@ @NSL_LIBS@
420
421 tethereal_LDFLAGS = -export-dynamic
422
423 editcap_SOURCES = editcap.c
424
425 # This is the automake dependency variable for the executable
426 editcap_DEPENDENCIES = wiretap/libwiretap.a
427
428 # This automake variable adds to the link-line for the executable
429 editcap_LDADD = wiretap/libwiretap.a @GLIB_LIBS@
430
431 #
432 # Build "register.c", which contains a function "register_all_protocols()"
433 # that calls the register routines for all protocols.
434 #
435 # We do this by grepping through sources.  If that turns out to be too slow,
436 # maybe we could just require every .o file to have an register routine
437 # of a given name (packet-aarp.o -> proto_register_aarp, etc.).
438 #
439 # Formatting conventions:  The name of the proto_register_* routines must
440 # start in column zero, or must be preceded only by "void " starting in
441 # column zero, and must not be inside #if.
442 #
443 # We assume that all dissector routines are in "packet-XXX.c" files,
444 # or in "packet.c".
445 #
446 # For some unknown reason, having a big "for" loop in the Makefile
447 # to scan all the "packet-XXX.c" files doesn't work with some "make"s;
448 # they seem to pass only the first few names in the list to the shell,
449 # for some reason.
450 #
451 # Therefore, we have a script to generate the "register.c" file.
452 #
453 # The first argument is the directory in which the source files live.
454 # All subsequent arguments are the files to scan.
455 #
456 register.c: packet.c $(DISSECTOR_SOURCES) $(srcdir)/make-reg-dotc
457         @echo Making register.c
458         @$(srcdir)/make-reg-dotc $(srcdir) packet.c $(DISSECTOR_SOURCES)
459
460 ps.c: print.ps rdps
461         ./rdps $(srcdir)/print.ps ps.c
462
463 rdps: rdps.c
464         $(CC) $(CFLAGS) -o rdps $(srcdir)/rdps.c
465
466 randpkt.o: randpkt.c
467         $(CC) -DHAVE_CONFIG_H -I. `glib-config --cflags` -c $(srcdir)/randpkt.c
468
469 randpkt: randpkt.o wiretap/libwiretap.a
470         $(LINK) -o randpkt randpkt.o wiretap/libwiretap.a `glib-config --libs` -lz
471
472 tvbtest: tvbtest.o tvbuff.o except.o
473         $(LINK) -o tvbtest tvbtest.o tvbuff.o except.o `glib-config --libs`
474
475 DISTCLEANFILES =        \
476         register.c      \
477         rdps            \
478         ps.c            \
479         *~
480
481 EXTRA_DIST = \
482         aclocal-flags           \
483         config.h.win32          \
484         config.nmake            \
485         debian/README.debian    \
486         debian/changelog        \
487         debian/control          \
488         debian/copyright        \
489         debian/dirs             \
490         debian/docs             \
491         debian/menu             \
492         debian/postinst         \
493         debian/prerm            \
494         debian/rules            \
495         doc/README.developer    \
496         doc/Makefile.in         \
497         doc/Makefile.am         \
498         doc/README.regression   \
499         doc/README.tvbuff       \
500         doc/dfilter2pod.pl      \
501         doc/editcap.pod         \
502         doc/ethereal.pod.template \
503         doc/randpkt.txt         \
504         doc/tethereal.pod.template \
505         editcap.c               \
506         getopt.c                \
507         getopt.h                \
508         ieee-float.h            \
509         image/editcap.rc        \
510         image/ethereal48x48-trans.png  \
511         image/ethereal48x48.png \
512         image/ethereal.ico      \
513         image/ethereal.rc       \
514         image/icon-excl.xpm     \
515         image/icon-ethereal.xpm \
516         image/tethereal.rc      \
517         INSTALL.configure       \
518         libpcap-0.4.HPUX.HPUXPAC.patch \
519         libpcap-0.4.HPUX.LBL.patch \
520         libpcap-0.5.HPUX.tcpdump.org.patch \
521         Makefile.nmake          \
522         make-reg-dotc           \
523         manuf                   \
524         ncp2222.py              \
525         print.ps                \
526         README.aix              \
527         README.bsd              \
528         README.hpux             \
529         README.irix             \
530         README.linux            \
531         README.tru64            \
532         README.vmware           \
533         README.win32            \
534         randpkt.c               \
535         rdps.c                  \
536         tvbtest.c               \
537         TODO
538
539 if SETUID_INSTALL
540 install-exec-hook:
541         -chmod +s $(DESTDIR)$(bindir)/ethereal
542         -chmod +s $(DESTDIR)$(bindir)/tethereal
543         -chmod +s $(DESTDIR)$(bindir)/ethereal_static
544 else
545 install-exec-hook:
546 endif
547
548 #
549 # Currently register.c can be included in the distribution because
550 # we always build all protocol dissectors. We used to have to check
551 # whether or not to build the snmp dissector. If we again need to
552 # variably build something, making register.c non-portable, uncomment
553 # the dist-hook line below.
554 #
555 # Oh, yuk.  We don't want to include "register.c" in the distribution, as
556 # its contents depend on the configuration, and therefore we want it
557 # to be built when the first "make" is done; however, Automake insists
558 # on putting *all* source into the distribution.
559 #
560 # We work around this by having a "dist-hook" rule that deletes
561 # "register.c", so that "dist" won't pick it up.
562 #
563 #dist-hook:
564 #       @rm -f $(distdir)/register.c
565
566 SUBDIRS = wiretap gtk plugins packaging @ethereal_SUBDIRS@
567
568 ethereal.1: ethereal doc/ethereal.pod.template
569         (cd doc ; \
570         $(MAKE) ../ethereal.1 )
571
572 tethereal.1: tethereal doc/tethereal.pod.template
573         (cd doc ; \
574         $(MAKE) ../tethereal.1 )
575
576 editcap.1: doc/editcap.pod
577         (cd doc ; \
578         $(MAKE) ../editcap.1 )
579
580 dfilter-scanner.c : dfilter-scanner.l
581         $(LEX) -Pdfilter_ -odfilter-scanner.c $(srcdir)/dfilter-scanner.l
582
583 packet-ncp2222.c : ncp2222.py
584         $(PYTHON) $(srcdir)/ncp2222.py > $@
585
586 libtool: $(LIBTOOL_DEPS)
587         $(SHELL) ./config.status --recheck
588
589 # We load top_stagedir with an explicit path so that libtool doesn't freak.
590 top_stagedir=`cd $(top_srcdir) && pwd`/packaging/svr4.stage
591 stagedir=$(top_stagedir)/$(PACKAGE).stage
592 host_cpu=@host_cpu@
593 host_os=@host_os@
594
595 svr4-package: $(bin_SCRIPTS) $(lib_LTLIBRARIES)
596         if test x$(HAVE_SVR4_PACKAGING) = xyes ; then \
597                 rm -rf $(stagedir) ; \
598                 $(MAKE) DESTDIR=$(stagedir) install-strip; \
599                 $(srcdir)/packaging/svr4/mkpkg \
600                         $(PACKAGE) \
601                         $(PACKAGE)-$(VERSION)-$(host_os)-$(host_cpu)-local \
602                         $(prefix) \
603                         $(top_stagedir) ; \
604         else \
605                 echo "Error: SVR4 packaging tools not found." ; \
606                 echo "Package build abandoned." ; \
607         fi
608
609 solaris-package: svr4-package
610
611 specfile=$(top_srcdir)/packaging/rpm/ethereal.spec
612
613 rpm-package: dist
614         if test x$(HAVE_RPM_PACKAGING) = xyes ; then \
615                 cp $(top_srcdir)/$(distdir).tar.gz $(RPM_SOURCEDIR) ; \
616                 rpm -bb --clean --rmsource $(specfile) ; \
617         else \
618                 echo "Error: RPM executable and/or source directory not found." ; \
619                 echo "Package build abandoned." ; \
620         fi
621
622 srpm-package: dist
623         if test x$(HAVE_RPM_PACKAGING) = xyes ; then \
624                 cp $(top_srcdir)/$(distdir).tar.gz $(RPM_SOURCEDIR) ; \
625                 rpm -bs --clean --rmsource $(specfile) ; \
626         else \
627                 echo "Error: RPM executable and/or source directory not found." ; \
628                 echo "Package build abandoned." ; \
629         fi
630
631 debian-package: debian/rules
632         dpkg-buildpackage -rfakeroot -us -uc
633
634 clean-local:
635         rm -rf $(top_stagedir)
636