139297Sfenner#  Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
217680Spst# 	The Regents of the University of California.  All rights reserved.
317680Spst#
417680Spst#  Redistribution and use in source and binary forms, with or without
517680Spst#  modification, are permitted provided that: (1) source code distributions
617680Spst#  retain the above copyright notice and this paragraph in its entirety, (2)
717680Spst#  distributions including binary code include the above copyright notice and
817680Spst#  this paragraph in its entirety in the documentation or other materials
917680Spst#  provided with the distribution, and (3) all advertising materials mentioning
1017680Spst#  features or use of this software display the following acknowledgement:
1117680Spst#  ``This product includes software developed by the University of California,
1217680Spst#  Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
1317680Spst#  the University nor the names of its contributors may be used to endorse
1417680Spst#  or promote products derived from this software without specific prior
1517680Spst#  written permission.
1617680Spst#  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
1717680Spst#  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
1817680Spst#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1917680Spst
2017680Spst#
2117680Spst# Various configurable paths (remember to edit Makefile.in, not Makefile)
2217680Spst#
2317680Spst
2417680Spst# Top level hierarchy
2517680Spstprefix = @prefix@
2617680Spstexec_prefix = @exec_prefix@
27235530Sdelphijdatarootdir = @datarootdir@
2817680Spst# Pathname of directory to install the binary
2975115Sfennersbindir = @sbindir@
3017680Spst# Pathname of directory to install the man page
3175115Sfennermandir = @mandir@
3217680Spst
3326180Sfenner# VPATH
3426180Sfennersrcdir = @srcdir@
3526180SfennerVPATH = @srcdir@
3626180Sfenner
3717680Spst#
3817680Spst# You shouldn't need to edit anything below here.
3917680Spst#
4017680Spst
4117680SpstCC = @CC@
42276788SdelphijAR = @AR@
43276788SdelphijMKDEP = @MKDEP@
4439297SfennerPROG = tcpdump
4517680SpstCCOPT = @V_CCOPT@
4617680SpstINCLS = -I. @V_INCLS@
47146773SsamDEFS = @DEFS@ @CPPFLAGS@ @V_DEFS@
4817680Spst
4917680Spst# Standard CFLAGS
50235530SdelphijCFLAGS = @CFLAGS@
51235530SdelphijFULL_CFLAGS = $(CCOPT) $(DEFS) $(INCLS) $(CFLAGS)
5217680Spst
5339297Sfenner# Standard LDFLAGS
5439297SfennerLDFLAGS = @LDFLAGS@
5539297Sfenner
5617680Spst# Standard LIBS
5717680SpstLIBS = @LIBS@
5817680Spst
5917680SpstINSTALL = @INSTALL@
6075115SfennerINSTALL_PROGRAM = @INSTALL_PROGRAM@
6175115SfennerINSTALL_DATA = @INSTALL_DATA@
62190207SrpauloRANLIB = @RANLIB@
6317680Spst
64276788SdelphijDEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
65276788Sdelphij
6617680Spst# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
6717680Spst# Also, gcc does not remove the .o before forking 'as', which can be a
6817680Spst# problem if you don't own the file but can write to the directory.
6917680Spst.c.o:
7017680Spst	@rm -f $@
71235530Sdelphij	$(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
7217680Spst
73276788SdelphijCSRC =	setsignal.c tcpdump.c
7475115Sfenner
75276788SdelphijLIBNETDISSECT_SRC=\
76276788Sdelphij	addrtoname.c \
77276788Sdelphij	af.c \
78276788Sdelphij	checksum.c \
79276788Sdelphij	cpack.c \
80276788Sdelphij	gmpls.c \
81276788Sdelphij	gmt2local.c \
82276788Sdelphij	in_cksum.c \
83276788Sdelphij	ipproto.c \
84276788Sdelphij	l2vpn.c \
85276788Sdelphij	machdep.c \
86276788Sdelphij	nlpid.c \
87276788Sdelphij	oui.c \
88276788Sdelphij	parsenfsfh.c \
89276788Sdelphij	print-802_11.c \
90276788Sdelphij	print-802_15_4.c \
91276788Sdelphij	print-ah.c \
92276788Sdelphij	print-ahcp.c \
93276788Sdelphij	print-aodv.c \
94276788Sdelphij	print-aoe.c \
95276788Sdelphij	print-ap1394.c \
96276788Sdelphij	print-arcnet.c \
97276788Sdelphij	print-arp.c \
98276788Sdelphij	print-ascii.c \
99276788Sdelphij	print-atalk.c \
100276788Sdelphij	print-atm.c \
101276788Sdelphij	print-beep.c \
102276788Sdelphij	print-bfd.c \
103276788Sdelphij	print-bgp.c \
104276788Sdelphij	print-bootp.c \
105276788Sdelphij	print-bt.c \
106276788Sdelphij	print-calm-fast.c \
107276788Sdelphij	print-carp.c \
108276788Sdelphij	print-cdp.c \
109276788Sdelphij	print-cfm.c \
110276788Sdelphij	print-chdlc.c \
111276788Sdelphij	print-cip.c \
112276788Sdelphij	print-cnfp.c \
113276788Sdelphij	print-dccp.c \
114276788Sdelphij	print-decnet.c \
115276788Sdelphij	print-domain.c \
116276788Sdelphij	print-dtp.c \
117276788Sdelphij	print-dvmrp.c \
118276788Sdelphij	print-eap.c \
119276788Sdelphij	print-egp.c \
120276788Sdelphij	print-eigrp.c \
121276788Sdelphij	print-enc.c \
122276788Sdelphij	print-esp.c \
123276788Sdelphij	print-ether.c \
124276788Sdelphij	print-fddi.c \
125276788Sdelphij	print-forces.c \
126276788Sdelphij	print-fr.c \
127285275Spkelsey	print-ftp.c \
128285275Spkelsey	print-geneve.c \
129276788Sdelphij	print-geonet.c \
130276788Sdelphij	print-gre.c \
131276788Sdelphij	print-hsrp.c \
132285275Spkelsey	print-http.c \
133276788Sdelphij	print-icmp.c \
134276788Sdelphij	print-igmp.c \
135276788Sdelphij	print-igrp.c \
136276788Sdelphij	print-ip.c \
137285275Spkelsey	print-ip6.c \
138276788Sdelphij	print-ipcomp.c \
139276788Sdelphij	print-ipfc.c \
140276788Sdelphij	print-ipnet.c \
141276788Sdelphij	print-ipx.c \
142276788Sdelphij	print-isakmp.c \
143276788Sdelphij	print-isoclns.c \
144276788Sdelphij	print-juniper.c \
145276788Sdelphij	print-krb.c \
146276788Sdelphij	print-l2tp.c \
147276788Sdelphij	print-lane.c \
148276788Sdelphij	print-ldp.c \
149276788Sdelphij	print-llc.c \
150276788Sdelphij	print-lldp.c \
151276788Sdelphij	print-lmp.c \
152276788Sdelphij	print-loopback.c \
153276788Sdelphij	print-lspping.c \
154276788Sdelphij	print-lwapp.c \
155276788Sdelphij	print-lwres.c \
156276788Sdelphij	print-m3ua.c \
157276788Sdelphij	print-mobile.c \
158276788Sdelphij	print-mpcp.c \
159276788Sdelphij	print-mpls.c \
160276788Sdelphij	print-mptcp.c \
161276788Sdelphij	print-msdp.c \
162276788Sdelphij	print-msnlb.c \
163276788Sdelphij	print-nflog.c \
164276788Sdelphij	print-nfs.c \
165276788Sdelphij	print-ntp.c \
166276788Sdelphij	print-null.c \
167276788Sdelphij	print-olsr.c \
168276788Sdelphij	print-openflow-1.0.c \
169276788Sdelphij	print-openflow.c \
170276788Sdelphij	print-ospf.c \
171276788Sdelphij	print-otv.c \
172276788Sdelphij	print-pgm.c \
173276788Sdelphij	print-pim.c \
174276788Sdelphij	print-pktap.c \
175276788Sdelphij	print-ppi.c \
176276788Sdelphij	print-ppp.c \
177276788Sdelphij	print-pppoe.c \
178276788Sdelphij	print-pptp.c \
179276788Sdelphij	print-radius.c \
180276788Sdelphij	print-raw.c \
181276788Sdelphij	print-rip.c \
182276788Sdelphij	print-rpki-rtr.c \
183276788Sdelphij	print-rrcp.c \
184276788Sdelphij	print-rsvp.c \
185285275Spkelsey	print-rtsp.c \
186276788Sdelphij	print-rx.c \
187276788Sdelphij	print-sctp.c \
188276788Sdelphij	print-sflow.c \
189276788Sdelphij	print-sip.c \
190276788Sdelphij	print-sl.c \
191276788Sdelphij	print-sll.c \
192276788Sdelphij	print-slow.c \
193285275Spkelsey	print-smtp.c \
194276788Sdelphij	print-snmp.c \
195276788Sdelphij	print-stp.c \
196276788Sdelphij	print-sunatm.c \
197276788Sdelphij	print-sunrpc.c \
198276788Sdelphij	print-symantec.c \
199276788Sdelphij	print-syslog.c \
200276788Sdelphij	print-tcp.c \
201276788Sdelphij	print-telnet.c \
202276788Sdelphij	print-tftp.c \
203276788Sdelphij	print-timed.c \
204276788Sdelphij	print-tipc.c \
205276788Sdelphij	print-token.c \
206276788Sdelphij	print-udld.c \
207276788Sdelphij	print-udp.c \
208276788Sdelphij	print-usb.c \
209276788Sdelphij	print-vjc.c \
210276788Sdelphij	print-vqp.c \
211276788Sdelphij	print-vrrp.c \
212276788Sdelphij	print-vtp.c \
213276788Sdelphij	print-vxlan.c \
214276788Sdelphij	print-wb.c \
215276788Sdelphij	print-zephyr.c \
216276788Sdelphij	print-zeromq.c \
217276788Sdelphij	signature.c \
218276788Sdelphij	util.c
219190207Srpaulo
22056893SfennerLOCALSRC = @LOCALSRC@
22117680SpstGENSRC = version.c
22256893SfennerLIBOBJS = @LIBOBJS@
22317680Spst
224276788SdelphijLIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) ${LOCALSRC:.c=.o} ${LIBOBJS}
225276788SdelphijLIBNETDISSECT=libnetdissect.a
226276788Sdelphij
227276788Sdelphij
228190207SrpauloSRC =	$(CSRC) $(GENSRC) $(LOCALSRC) $(LIBNETDISSECT_SRC)
22917680Spst
23017680Spst# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
23117680Spst# hack the extra indirection
232276788SdelphijOBJ =	$(CSRC:.c=.o) $(GENSRC:.c=.o) $(LIBNETDISSECT_OBJ)
233190207SrpauloHDR = \
234190207Srpaulo	addrtoname.h \
235190207Srpaulo	af.h \
236190207Srpaulo	ah.h \
237190207Srpaulo	appletalk.h \
238190207Srpaulo	atm.h \
239190207Srpaulo	atmuni31.h \
240190207Srpaulo	chdlc.h \
241190207Srpaulo	cpack.h \
242190207Srpaulo	ether.h \
243190207Srpaulo	ethertype.h \
244190207Srpaulo	extract.h \
245276788Sdelphij	getopt_long.h \
246190207Srpaulo	gmpls.h \
247190207Srpaulo	gmt2local.h \
248190207Srpaulo	interface.h \
249190207Srpaulo	ip.h \
250190207Srpaulo	ip6.h \
251190207Srpaulo	ipproto.h \
252190207Srpaulo	l2vpn.h \
253190207Srpaulo	llc.h \
254190207Srpaulo	machdep.h \
255190207Srpaulo	mib.h \
256190207Srpaulo	mpls.h \
257190207Srpaulo	nameser.h \
258190207Srpaulo	netdissect.h \
259190207Srpaulo	nfs.h \
260190207Srpaulo	nfsfh.h \
261190207Srpaulo	nlpid.h \
262276788Sdelphij	openflow.h \
263190207Srpaulo	ospf.h \
264190207Srpaulo	oui.h \
265190207Srpaulo	pcap-missing.h \
266190207Srpaulo	ppp.h \
267190207Srpaulo	rpc_auth.h \
268190207Srpaulo	rpc_msg.h \
269276788Sdelphij	rpl.h \
27098524Sfenner	setsignal.h \
271214478Srpaulo	signature.h \
272190207Srpaulo	slcompress.h \
273190207Srpaulo	smb.h \
274190207Srpaulo	tcp.h \
275190207Srpaulo	tcpdump-stdinc.h \
276190207Srpaulo	udp.h
27717680Spst
27817680SpstTAGHDR = \
27917680Spst	/usr/include/arpa/tftp.h \
28026180Sfenner	/usr/include/net/if_arp.h \
28117680Spst	/usr/include/net/slip.h \
28217680Spst	/usr/include/netinet/if_ether.h \
28317680Spst	/usr/include/netinet/in.h \
28417680Spst	/usr/include/netinet/ip_icmp.h \
28517680Spst	/usr/include/netinet/tcp.h \
28617680Spst	/usr/include/netinet/udp.h \
28717680Spst	/usr/include/protocols/routed.h
28817680Spst
28917680SpstTAGFILES = $(SRC) $(HDR) $(TAGHDR)
29017680Spst
29139297SfennerCLEANFILES = $(PROG) $(OBJ) $(GENSRC)
29217680Spst
293190207SrpauloEXTRA_DIST = \
294190207Srpaulo	CHANGES \
295190207Srpaulo	CREDITS \
296190207Srpaulo	INSTALL.txt \
297190207Srpaulo	LICENSE \
298190207Srpaulo	Makefile.in \
299214478Srpaulo	Makefile-devel-adds \
300276788Sdelphij	README.md \
301190207Srpaulo	Readme.Win32 \
302190207Srpaulo	VERSION \
303190207Srpaulo	aclocal.m4 \
304190207Srpaulo	atime.awk \
305190207Srpaulo	bpf_dump.c \
306190207Srpaulo	config.guess \
307190207Srpaulo	config.h.in \
308190207Srpaulo	config.sub \
309190207Srpaulo	configure \
310190207Srpaulo	configure.in \
311190207Srpaulo	install-sh \
312190207Srpaulo	lbl/os-osf4.h \
313190207Srpaulo	lbl/os-solaris2.h \
314190207Srpaulo	lbl/os-sunos4.h \
315190207Srpaulo	lbl/os-ultrix4.h \
316190207Srpaulo	makemib \
317190207Srpaulo	missing/addrinfo.h \
318190207Srpaulo	missing/dlnames.c \
319190207Srpaulo	missing/datalinks.c \
320190207Srpaulo	missing/getnameinfo.c \
321276788Sdelphij	missing/getopt_long.c \
322190207Srpaulo	missing/inet_aton.c \
323190207Srpaulo	missing/inet_ntop.c \
324190207Srpaulo	missing/inet_pton.c \
325190207Srpaulo	missing/snprintf.c \
326190207Srpaulo	missing/strdup.c \
327190207Srpaulo	missing/strlcat.c \
328190207Srpaulo	missing/strlcpy.c \
329190207Srpaulo	missing/strsep.c \
330190207Srpaulo	mkdep \
331190207Srpaulo	packetdat.awk \
332190207Srpaulo	pcap_dump_ftell.c \
333235530Sdelphij	print-babel.c \
334190207Srpaulo	print-dhcp6.c \
335190207Srpaulo	print-frag6.c \
336190207Srpaulo	print-icmp6.c \
337190207Srpaulo	print-ip6opts.c \
338190207Srpaulo	print-mobility.c \
339190207Srpaulo	print-ospf6.c \
340190207Srpaulo	print-pflog.c \
341190207Srpaulo	print-ripng.c \
342190207Srpaulo	print-rt6.c \
343190207Srpaulo	print-smb.c \
344190207Srpaulo	send-ack.awk \
345190207Srpaulo	smbutil.c \
346190207Srpaulo	stime.awk \
347190207Srpaulo	strcasecmp.c \
348214478Srpaulo	tcpdump.1.in \
349190207Srpaulo	vfprintf.c \
350190207Srpaulo	win32/Include/w32_fzs.h \
351190207Srpaulo	win32/prj/GNUmakefile \
352190207Srpaulo	win32/prj/WinDump.dsp \
353190207Srpaulo	win32/prj/WinDump.dsw
354190207Srpaulo
355251158SdelphijTEST_DIST= `find tests \( -name 'DIFF' -prune \) -o \( -name NEW -prune \) -o -type f \! -name '.*' \! -name '*~' -print`
356251158Sdelphij
357276788Sdelphijall: $(PROG) $(LIBNETDISSECT)
35839297Sfenner
35939297Sfenner$(PROG): $(OBJ) @V_PCAPDEP@
36017680Spst	@rm -f $@
361235530Sdelphij	$(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
36217680Spst
363190207Srpaulo$(LIBNETDISSECT): $(LIBNETDISSECT_OBJ)
364190207Srpaulo	@rm -f $@
365276788Sdelphij	$(AR) $(ARFLAGS) $@ $(LIBNETDISSECT_OBJ)
366190207Srpaulo	$(RANLIB) $@
367190207Srpaulo
368127668Sbmsdatalinks.o: $(srcdir)/missing/datalinks.c
369235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c
370127668Sbmsdlnames.o: $(srcdir)/missing/dlnames.c
371235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/dlnames.c
37256893Sfennergetnameinfo.o: $(srcdir)/missing/getnameinfo.c
373235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getnameinfo.c
374276788Sdelphijgetopt_long.o: $(srcdir)/missing/getopt_long.c
375276788Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getopt_long.c
37656893Sfennerinet_pton.o: $(srcdir)/missing/inet_pton.c
377235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_pton.c
37856893Sfennerinet_ntop.o: $(srcdir)/missing/inet_ntop.c
379235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_ntop.c
38056893Sfennerinet_aton.o: $(srcdir)/missing/inet_aton.c
381235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_aton.c
38275115Sfennersnprintf.o: $(srcdir)/missing/snprintf.c
383235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
384276788Sdelphijstrdup.o: $(srcdir)/missing/strdup.c
385276788Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strdup.c
38675115Sfennerstrlcat.o: $(srcdir)/missing/strlcat.c
387235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
38875115Sfennerstrlcpy.o: $(srcdir)/missing/strlcpy.c
389235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
390127668Sbmsstrsep.o: $(srcdir)/missing/strsep.c
391235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strsep.c
39256893Sfenner
39317680Spstversion.o: version.c
394235530Sdelphij	$(CC) $(FULL_CFLAGS) -c version.c
39556893Sfenner
39626180Sfennerversion.c: $(srcdir)/VERSION
39717680Spst	@rm -f $@
398214478Srpaulo	if grep GIT ${srcdir}/VERSION >/dev/null; then \
399190207Srpaulo		read ver <${srcdir}/VERSION; \
400190207Srpaulo		echo $$ver | tr -d '\012'; \
401190207Srpaulo		date +_%Y_%m_%d; \
402190207Srpaulo	else \
403190207Srpaulo		cat ${srcdir}/VERSION; \
404214478Srpaulo	fi | sed -e 's/.*/const char version[] = "&";/' > $@
40517680Spst
406190207Srpauloinstall: all
40775115Sfenner	[ -d $(DESTDIR)$(sbindir) ] || \
40875115Sfenner	    (mkdir -p $(DESTDIR)$(sbindir); chmod 755 $(DESTDIR)$(sbindir))
40975115Sfenner	$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG)
410190207Srpaulo	$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG).`cat ${srcdir}/VERSION`
41175115Sfenner	[ -d $(DESTDIR)$(mandir)/man1 ] || \
41275115Sfenner	    (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
413214478Srpaulo	$(INSTALL_DATA) $(PROG).1 $(DESTDIR)$(mandir)/man1/$(PROG).1
41417680Spst
41575115Sfenneruninstall:
41675115Sfenner	rm -f $(DESTDIR)$(sbindir)/$(PROG)
41775115Sfenner	rm -f $(DESTDIR)$(mandir)/man1/$(PROG).1
41817680Spst
41975115Sfennerlint: $(GENSRC)
42017680Spst	lint -hbxn $(SRC) | \
42117680Spst	    grep -v 'struct/union .* never defined' | \
42217680Spst	    grep -v 'possible pointer alignment problem'
42317680Spst
42417680Spstclean:
425214478Srpaulo	rm -f $(CLEANFILES) $(PROG)-`cat VERSION`.tar.gz
42617680Spst
42717680Spstdistclean:
42817680Spst	rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
429276788Sdelphij	    config.h gnuc.h os-proto.h stamp-h stamp-h.in $(PROG).1 \
430276788Sdelphij	    libnetdissect.a tests/.failed tests/.passed \
431276788Sdelphij	    tests/failure-outputs.txt
432276788Sdelphij	rm -rf autom4te.cache tests/DIFF tests/NEW
43317680Spst
434214478Srpaulocheck: tcpdump
435214478Srpaulo	(cd tests && ./TESTrun.sh)
436214478Srpaulo
43739297Sfennertags: $(TAGFILES)
43817680Spst	ctags -wtd $(TAGFILES)
43917680Spst
440190207SrpauloTAGS: $(TAGFILES)
441190207Srpaulo	etags $(TAGFILES)
442190207Srpaulo
443172683Smlaierreleasetar:
44439297Sfenner	@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
445190207Srpaulo	   mkdir $$name; \
446251158Sdelphij	   tar cf - $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST) | (cd $$name; tar xf -); \
447190207Srpaulo	   tar -c -z -f $$name.tar.gz $$name; \
448190207Srpaulo	   rm -rf $$name
44917680Spst
450251158Sdelphijtestlist:
451251158Sdelphij	echo $(TEST_DIST)
452251158Sdelphij
45375115Sfennerdepend: $(GENSRC)
454276788Sdelphij	$(MKDEP) -c $(CC) -m $(DEPENDENCY_CFLAG) $(DEFS) $(INCLS) $(SRC)
455