Create a header file for every packet-*.c file. Prune the packet.h file.
[obnox/wireshark/wip.git] / Makefile.am
1 # Makefile.am
2 # Automake file for Ethereal
3 #
4 # $Id: Makefile.am,v 1.167 2000/02/15 21:01:50 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 EXTRA_PROGRAMS = ethereal_static
26 bin_PROGRAMS = ethereal editcap tethereal
27
28 man_MANS = ethereal.1 editcap.1 tethereal.1
29
30 sysconf_DATA = manuf
31
32 # Any POSIX-compatible YACC should honor the -p flag
33 YFLAGS=-d -p dfilter_
34
35 DISSECTOR_SOURCES = \
36         packet-aarp.c  \
37         packet-aarp.h  \
38         packet-afs.c   \
39         packet-afs.h   \
40         packet-arp.c   \
41         packet-arp.h   \
42         packet-ascend.c\
43         packet-ascend.h\
44         packet-atalk.c \
45         packet-atalk.h \
46         packet-atm.c   \
47         packet-atm.h   \
48         packet-auto_rp.c   \
49         packet-auto_rp.h   \
50         packet-bgp.c   \
51         packet-bgp.h   \
52         packet-bootp.c \
53         packet-bootp.h \
54         packet-bootparams.c \
55         packet-bootparams.h \
56         packet-bpdu.c  \
57         packet-bpdu.h  \
58         packet-cdp.c   \
59         packet-cdp.h   \
60         packet-cgmp.c  \
61         packet-cgmp.h  \
62         packet-clip.c  \
63         packet-clip.h  \
64         packet-data.c  \
65         packet-dns.c   \
66         packet-dns.h   \
67         packet-eth.c   \
68         packet-eth.h   \
69         packet-fddi.c  \
70         packet-fddi.h  \
71         packet-ftp.c   \
72         packet-ftp.h   \
73         packet-giop.c  \
74         packet-giop.h  \
75         packet-gre.c   \
76         packet-gre.h   \
77         packet-hsrp.c  \
78         packet-hsrp.h  \
79         packet-http.c  \
80         packet-http.h  \
81         packet-icmpv6.c\
82         packet-icmpv6.h\
83         packet-icp.c   \
84         packet-icp.h   \
85         packet-icq.c   \
86         packet-icq.h   \
87         packet-imap.c   \
88         packet-imap.h   \
89         packet-ip.c    \
90         packet-ip.h    \
91         packet-ipp.c   \
92         packet-ipp.h   \
93         packet-ipsec.c \
94         packet-ipsec.h \
95         packet-ipv6.c  \
96         packet-ipv6.h  \
97         packet-ipx.c   \
98         packet-ipx.h   \
99         packet-irc.c   \
100         packet-irc.h   \
101         packet-isakmp.c\
102         packet-isakmp.h\
103         packet-isis.h  \
104         packet-isis.c  \
105         packet-isis-clv.h \
106         packet-isis-clv.c \
107         packet-isis-hello.h \
108         packet-isis-hello.c \
109         packet-isis-lsp.h \
110         packet-isis-lsp.c \
111         packet-isis-snp.h \
112         packet-isis-snp.c \
113         packet-isl.c   \
114         packet-isl.h   \
115         packet-l2tp.c  \
116         packet-l2tp.h  \
117         packet-lapb.c  \
118         packet-lapb.h  \
119         packet-lapd.c  \
120         packet-lapd.h  \
121         packet-ldap.c  \
122         packet-ldap.h  \
123         packet-llc.c   \
124         packet-llc.h   \
125         packet-lpd.c   \
126         packet-lpd.h   \
127         packet-mapi.c  \
128         packet-mapi.h  \
129         packet-mount.c \
130         packet-mount.h \
131         packet-nbipx.c \
132         packet-nbipx.h \
133         packet-nbns.c  \
134         packet-nbns.h  \
135         packet-ncp.c   \
136         packet-ncp.h   \
137         packet-netbios.c \
138         packet-netbios.h \
139         packet-nfs.c   \
140         packet-nfs.h   \
141         packet-nlm.c   \
142         packet-nlm.h   \
143         packet-nntp.c  \
144         packet-nntp.h  \
145         packet-ntp.c  \
146         packet-ntp.h  \
147         packet-null.c  \
148         packet-null.h  \
149         packet-osi.c   \
150         packet-osi.h   \
151         packet-ospf.c  \
152         packet-ospf.h  \
153         packet-pim.c   \
154         packet-pim.h   \
155         packet-pop.c   \
156         packet-pop.h   \
157         packet-portmap.c   \
158         packet-portmap.h   \
159         packet-ppp.c   \
160         packet-ppp.h   \
161         packet-pppoe.c \
162         packet-pppoe.h \
163         packet-pptp.c  \
164         packet-pptp.h  \
165         packet-q2931.c \
166         packet-q2931.h \
167         packet-q931.c  \
168         packet-q931.h  \
169         packet-radius.c\
170         packet-radius.h\
171         packet-raw.c   \
172         packet-raw.h   \
173         packet-rip.c   \
174         packet-rip.h   \
175         packet-ripng.c \
176         packet-ripng.h \
177         packet-rpc.c   \
178         packet-rpc.h   \
179         packet-rsvp.c  \
180         packet-rsvp.h  \
181         packet-rtsp.c  \
182         packet-rtsp.h  \
183         packet-rx.c  \
184         packet-rx.h  \
185         packet-sap.c   \
186         packet-sap.h   \
187         packet-sdp.c   \
188         packet-sdp.h   \
189         packet-smb.c   \
190         packet-smb.h   \
191         packet-smb-browse.c \
192         packet-smb-common.c \
193         packet-smb-common.h \
194         packet-smb-logon.c \
195         packet-smb-mailslot.c \
196         packet-smb-pipe.c \
197         packet-sna.c   \
198         packet-sna.h   \
199         packet-snmp.c   \
200         packet-snmp.h   \
201         packet-srvloc.c \
202         packet-srvloc.h \
203         packet-sscop.c \
204         packet-sscop.h \
205         packet-stat.c   \
206         packet-stat.h   \
207         packet-tacacs.c \
208         packet-tacacs.h \
209         packet-tcp.c   \
210         packet-tcp.h   \
211         packet-telnet.c\
212         packet-telnet.h\
213         packet-tftp.c  \
214         packet-tftp.h  \
215         packet-time.c  \
216         packet-time.h  \
217         packet-tns.c \
218         packet-tns.h \
219         packet-tr.c    \
220         packet-tr.h    \
221         packet-trmac.c \
222         packet-trmac.h \
223         packet-udp.c   \
224         packet-udp.h   \
225         packet-v120.c \
226         packet-v120.h \
227         packet-vines.c \
228         packet-vines.h \
229         packet-vlan.c \
230         packet-vlan.h \
231         packet-vrrp.c \
232         packet-vrrp.h \
233         packet-vtp.c  \
234         packet-vtp.h  \
235         packet-wccp.c\
236         packet-wccp.h\
237         packet-who.c\
238         packet-who.h\
239         packet-x25.c   \
240         packet-x25.h   \
241         packet-yhoo.c  \
242         packet-yhoo.h  \
243         packet-ypbind.c \
244         packet-ypbind.h \
245         packet-ypserv.c \
246         packet-ypserv.h \
247         packet-ypxfr.c \
248         packet-ypxfr.h 
249
250 ETHEREAL_COMMON_SOURCES = \
251         alignment.h    \
252         asn1.c         \
253         asn1.h         \
254         column.c       \
255         column.h       \
256         conversation.c \
257         conversation.h \
258         dfilter-int.h  \
259         dfilter-grammar.y \
260         dfilter-scanner.l \
261         dfilter.c      \
262         dfilter.h      \
263         ethertype.c    \
264         etypes.h       \
265         follow.c       \
266         follow.h       \
267         inet_v6defs.h  \
268         ipproto.c      \
269         ipv4.c         \
270         ipv4.h         \
271         nlpid.h        \
272         oui.h          \
273         packet.c       \
274         packet.h       \
275         plugins.c      \
276         plugins.h      \
277         prefs.c        \
278         prefs.h        \
279         print.c        \
280         print.h        \
281         proto.c        \
282         proto.h        \
283         ps.c           \
284         ps.h           \
285         register.c     \
286         register.h     \
287         resolv.c       \
288         resolv.h       \
289         smb.h          \
290         timestamp.h    \
291         util.c         \
292         util.h         \
293         xdlc.c         \
294         xdlc.h
295
296 ethereal_SOURCES = \
297         $(DISSECTOR_SOURCES) \
298         $(ETHEREAL_COMMON_SOURCES) \
299         capture.c      \
300         capture.h      \
301         file.c         \
302         file.h         \
303         globals.h      \
304         menu.h         \
305         simple_dialog.h \
306         summary.c      \
307         summary.h      \
308         ui_util.h
309
310 ethereal_static_SOURCES = \
311         $(ethereal_SOURCES)
312
313 EXTRA_ethereal_SOURCES = \
314         dfilter-grammar.c \
315         dfilter-grammar.h \
316         dfilter-scanner.c \
317         snprintf.c      \
318         snprintf.h      \
319         snprintf-imp.h  \
320         strerror.c      \
321         strerror.h      \
322         strncasecmp.c   \
323         mkstemp.c       \
324         mkstemp.h       \
325         inet_aton.c     \
326         inet_pton.c     \
327         inet_ntop.c
328
329 # Optional objects that I know how to build. These will be
330 # linked into the ethereal executable.
331 # They will also be linked into the tethereal executable; if this
332 # list ever grows to include something that can't be linked with
333 # tethereal, or if tethereal needs something that ethereal doesn't,
334 # we should probably split this into stuff needed both
335 # by ethereal and tethereal and stuff needed only by one or the
336 # other.
337 ethereal_optional_objects = @SNPRINTF_O@ @STRERROR_O@ \
338         @STRNCASECMP_O@ @MKSTEMP_O@ \
339         @INET_ATON_O@ @INET_PTON_O@ @INET_NTOP_O@ 
340
341 # Additional libs that I know how to build. These will be
342 # linked into the ethereal executable.
343 ethereal_additional_libs = wiretap/libwiretap.a gtk/libui.a
344
345 # This is the automake dependency variable for the executable
346 ethereal_DEPENDENCIES = \
347         $(ethereal_optional_objects)    \
348         $(ethereal_additional_libs)     \
349         plugins/gryphon/gryphon.la
350
351 ethereal_static_DEPENDENCIES = \
352         $(ethereal_optional_objects)    \
353         $(ethereal_additional_libs)
354
355 # This automake variable adds to the link-line for the executable.
356 #
357 # Note that Ethereal doesn't have to be linked with @GLIB_LIBS@, as
358 # they are included in @GTK_LIBS@, and doesn't have to be linked with
359 # @SOCKET_LIBS@ or @NSL_LIBS@, as those should also be included in
360 # @GTK_LIBS@ (as those are also needed for X applications, and GTK+
361 # applications are X applications).
362 ethereal_LDADD = \
363         $(ethereal_optional_objects)    \
364         $(ethereal_additional_libs)     \
365         @SNMP_LIBS@                     \
366         "-dlopen" self  \
367         "-dlopen" plugins/gryphon/gryphon.la @PCAP_LIBS@ @GTK_LIBS@
368
369 ethereal_static_LDADD = \
370         $(ethereal_optional_objects)    \
371         $(ethereal_additional_libs) \
372         @SNMP_LIBS@                     \
373         @PCAP_LIBS@ @GTK_LIBS@
374
375 ethereal_LDFLAGS = -export-dynamic
376 ethereal_static_LDFLAGS = -Wl,-static
377
378 tethereal_SOURCES = \
379         $(DISSECTOR_SOURCES) \
380         $(ETHEREAL_COMMON_SOURCES) \
381         tethereal.c
382
383 # Additional libs that I know how to build. These will be
384 # linked into the tethereal executable.
385 tethereal_additional_libs = wiretap/libwiretap.a
386
387 # This is the automake dependency variable for the executable
388 tethereal_DEPENDENCIES = \
389         $(ethereal_optional_objects)    \
390         $(tethereal_additional_libs)    \
391         plugins/gryphon/gryphon.la
392
393 # This automake variable adds to the link-line for the executable
394 tethereal_LDADD = wiretap/libwiretap.a  \
395         $(ethereal_optional_objects)    \
396         $(tethereal_additional_libs)    \
397         @SNMP_LIBS@                     \
398         "-dlopen" self  \
399         "-dlopen" plugins/gryphon/gryphon.la @GLIB_LIBS@ -lm \
400         @PCAP_LIBS@ @SOCKET_LIBS@ @NSL_LIBS@
401
402 tethereal_LDFLAGS = -export-dynamic
403
404 editcap_SOURCES = editcap.c
405
406 # This is the automake dependency variable for the executable
407 editcap_DEPENDENCIES = wiretap/libwiretap.a
408
409 # This automake variable adds to the link-line for the executable
410 editcap_LDADD = wiretap/libwiretap.a @GLIB_LIBS@
411
412 #
413 # Build "register.c", which contains a function "register_all_protocols()"
414 # that calls the register routines for all protocols.
415 #
416 # We do this by grepping through sources.  If that turns out to be too slow,
417 # maybe we could just require every .o file to have an register routine
418 # of a given name (packet-aarp.o -> proto_register_aarp, etc.).
419 #
420 # Formatting conventions:  The name of the proto_register_* routines must
421 # start in column zero, or must be preceded only by "void " starting in
422 # column zero, and must not be inside #if.
423 #
424 # We assume that all dissector routines are in "packet-XXX.c" files,
425 # or in "packet.c".
426 #
427 # For some unknown reason, having a big "for" loop in the Makefile
428 # to scan all the "packet-XXX.c" files doesn't work with some "make"s;
429 # they seem to pass only the first few names in the list to the shell,
430 # for some reason.
431 #
432 # Therefore, we have a script to generate the "register.c" file.
433 #
434 # The first argument is the directory in which the source files live.
435 # All subsequent arguments are the files to scan.
436 #
437 register.c: packet.c $(DISSECTOR_SOURCES)
438         @echo Making register.c
439         @$(srcdir)/make-reg-dotc $(srcdir) packet.c $(DISSECTOR_SOURCES)
440
441 ps.c: print.ps rdps
442         ./rdps $(srcdir)/print.ps ps.c
443
444 rdps: rdps.c
445         $(CC) $(CFLAGS) -o rdps $(srcdir)/rdps.c
446
447 randpkt.o: randpkt.c
448         $(CC) -DHAVE_CONFIG_H -I. `glib-config --cflags` -c $(srcdir)/randpkt.c
449
450 randpkt: randpkt.o wiretap/libwiretap.a
451         $(LINK) -o randpkt randpkt.o wiretap/libwiretap.a `glib-config --libs` -lz
452
453 DISTCLEANFILES =        \
454         register.c      \
455         rdps            \
456         ps.c            \
457         *~
458
459 EXTRA_DIST = \
460         config.h.win32          \
461         debian/README.debian    \
462         debian/changelog        \
463         debian/control          \
464         debian/copyright        \
465         debian/dirs             \
466         debian/docs             \
467         debian/menu             \
468         debian/postinst         \
469         debian/prerm            \
470         debian/rules            \
471         doc/Makefile.in         \
472         doc/Makefile.am         \
473         doc/dfilter2pod.in      \
474         doc/editcap.pod         \
475         doc/ethereal.pod.template \
476         doc/proto_tree          \
477         doc/randpkt.txt         \
478         doc/tethereal.pod.template \
479         editcap.c               \
480         ethereal.spec.in         \
481         image/ethereal48x48-trans.png  \
482         image/ethereal48x48.png \
483         image/icon-excl.xpm     \
484         image/icon-ethereal.xpm \
485         INSTALL.configure       \
486         Makefile.nmake          \
487         make-reg-dotc           \
488         manuf                   \
489         print.ps                \
490         README.aix              \
491         README.hpux             \
492         README.irix             \
493         README.linux            \
494         README.tru64            \
495         README.vmware           \
496         README.win32            \
497         randpkt.c               \
498         rdps.c                  \
499         TODO
500
501 if SETUID_INSTALL
502 install-exec-hook:
503         -chmod +s $(DESTDIR)$(bindir)/ethereal
504         -chmod +s $(DESTDIR)$(bindir)/tethereal
505         -chmod +s $(DESTDIR)$(bindir)/ethereal_static
506 endif
507
508 #
509 # Currently register.c can be included in the distribution because
510 # we always build all protocol dissectors. We used to have to check
511 # whether or not to build the snmp dissector. If we again need to
512 # variably build something, making register.c non-portable, uncomment
513 # the dist-hook line below.
514 #
515 # Oh, yuk.  We don't want to include "register.c" in the distribution, as
516 # its contents depend on the configuration, and therefore we want it
517 # to be built when the first "make" is done; however, Automake insists
518 # on putting *all* source into the distribution.
519 #
520 # We work around this by having a "dist-hook" rule that deletes
521 # "register.c", so that "dist" won't pick it up.
522 #
523 #dist-hook:
524 #       @rm -f $(distdir)/register.c
525
526 SUBDIRS = wiretap gtk plugins @ethereal_SUBDIRS@
527
528 ethereal.1: ethereal doc/ethereal.pod.template
529         (cd doc ; \
530         $(MAKE) ../ethereal.1 )
531
532 tethereal.1: tethereal doc/tethereal.pod.template
533         (cd doc ; \
534         $(MAKE) ../tethereal.1 )
535
536 editcap.1: doc/editcap.pod
537         (cd doc ; \
538         $(MAKE) ../editcap.1 )
539
540 dfilter-scanner.c : dfilter-scanner.l
541         $(LEX) -Pdfilter_ -t $(srcdir)/dfilter-scanner.l > dfilter-scanner.c
542
543 libtool: $(LIBTOOL_DEPS)
544         $(SHELL) ./config.status --recheck