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 \
77313537Sglebius	addrtostr.c \
78276788Sdelphij	af.c \
79313537Sglebius	ascii_strcasecmp.c \
80276788Sdelphij	checksum.c \
81276788Sdelphij	cpack.c \
82276788Sdelphij	gmpls.c \
83276788Sdelphij	gmt2local.c \
84276788Sdelphij	in_cksum.c \
85276788Sdelphij	ipproto.c \
86276788Sdelphij	l2vpn.c \
87276788Sdelphij	machdep.c \
88276788Sdelphij	nlpid.c \
89276788Sdelphij	oui.c \
90276788Sdelphij	parsenfsfh.c \
91313537Sglebius	print.c \
92276788Sdelphij	print-802_11.c \
93276788Sdelphij	print-802_15_4.c \
94276788Sdelphij	print-ah.c \
95276788Sdelphij	print-ahcp.c \
96276788Sdelphij	print-aodv.c \
97276788Sdelphij	print-aoe.c \
98276788Sdelphij	print-ap1394.c \
99276788Sdelphij	print-arcnet.c \
100276788Sdelphij	print-arp.c \
101276788Sdelphij	print-ascii.c \
102276788Sdelphij	print-atalk.c \
103276788Sdelphij	print-atm.c \
104313537Sglebius	print-babel.c \
105276788Sdelphij	print-beep.c \
106276788Sdelphij	print-bfd.c \
107276788Sdelphij	print-bgp.c \
108276788Sdelphij	print-bootp.c \
109276788Sdelphij	print-bt.c \
110276788Sdelphij	print-calm-fast.c \
111276788Sdelphij	print-carp.c \
112276788Sdelphij	print-cdp.c \
113276788Sdelphij	print-cfm.c \
114276788Sdelphij	print-chdlc.c \
115276788Sdelphij	print-cip.c \
116276788Sdelphij	print-cnfp.c \
117276788Sdelphij	print-dccp.c \
118276788Sdelphij	print-decnet.c \
119313537Sglebius	print-dhcp6.c \
120276788Sdelphij	print-domain.c \
121276788Sdelphij	print-dtp.c \
122276788Sdelphij	print-dvmrp.c \
123276788Sdelphij	print-eap.c \
124276788Sdelphij	print-egp.c \
125276788Sdelphij	print-eigrp.c \
126276788Sdelphij	print-enc.c \
127276788Sdelphij	print-esp.c \
128276788Sdelphij	print-ether.c \
129276788Sdelphij	print-fddi.c \
130276788Sdelphij	print-forces.c \
131276788Sdelphij	print-fr.c \
132313537Sglebius	print-frag6.c \
133285275Spkelsey	print-ftp.c \
134285275Spkelsey	print-geneve.c \
135276788Sdelphij	print-geonet.c \
136276788Sdelphij	print-gre.c \
137313537Sglebius	print-hncp.c \
138276788Sdelphij	print-hsrp.c \
139285275Spkelsey	print-http.c \
140276788Sdelphij	print-icmp.c \
141313537Sglebius	print-icmp6.c \
142276788Sdelphij	print-igmp.c \
143276788Sdelphij	print-igrp.c \
144276788Sdelphij	print-ip.c \
145285275Spkelsey	print-ip6.c \
146313537Sglebius	print-ip6opts.c \
147276788Sdelphij	print-ipcomp.c \
148276788Sdelphij	print-ipfc.c \
149276788Sdelphij	print-ipnet.c \
150276788Sdelphij	print-ipx.c \
151276788Sdelphij	print-isakmp.c \
152276788Sdelphij	print-isoclns.c \
153276788Sdelphij	print-juniper.c \
154276788Sdelphij	print-krb.c \
155276788Sdelphij	print-l2tp.c \
156276788Sdelphij	print-lane.c \
157276788Sdelphij	print-ldp.c \
158313537Sglebius	print-lisp.c \
159276788Sdelphij	print-llc.c \
160276788Sdelphij	print-lldp.c \
161276788Sdelphij	print-lmp.c \
162276788Sdelphij	print-loopback.c \
163276788Sdelphij	print-lspping.c \
164276788Sdelphij	print-lwapp.c \
165276788Sdelphij	print-lwres.c \
166276788Sdelphij	print-m3ua.c \
167313537Sglebius	print-medsa.c \
168276788Sdelphij	print-mobile.c \
169313537Sglebius	print-mobility.c \
170276788Sdelphij	print-mpcp.c \
171276788Sdelphij	print-mpls.c \
172276788Sdelphij	print-mptcp.c \
173276788Sdelphij	print-msdp.c \
174276788Sdelphij	print-msnlb.c \
175276788Sdelphij	print-nflog.c \
176276788Sdelphij	print-nfs.c \
177313537Sglebius	print-nsh.c \
178276788Sdelphij	print-ntp.c \
179276788Sdelphij	print-null.c \
180276788Sdelphij	print-olsr.c \
181276788Sdelphij	print-openflow-1.0.c \
182276788Sdelphij	print-openflow.c \
183276788Sdelphij	print-ospf.c \
184313537Sglebius	print-ospf6.c \
185276788Sdelphij	print-otv.c \
186276788Sdelphij	print-pgm.c \
187276788Sdelphij	print-pim.c \
188276788Sdelphij	print-pktap.c \
189276788Sdelphij	print-ppi.c \
190276788Sdelphij	print-ppp.c \
191276788Sdelphij	print-pppoe.c \
192276788Sdelphij	print-pptp.c \
193276788Sdelphij	print-radius.c \
194276788Sdelphij	print-raw.c \
195313537Sglebius	print-resp.c \
196276788Sdelphij	print-rip.c \
197313537Sglebius	print-ripng.c \
198276788Sdelphij	print-rpki-rtr.c \
199276788Sdelphij	print-rrcp.c \
200276788Sdelphij	print-rsvp.c \
201313537Sglebius	print-rt6.c \
202285275Spkelsey	print-rtsp.c \
203276788Sdelphij	print-rx.c \
204276788Sdelphij	print-sctp.c \
205276788Sdelphij	print-sflow.c \
206276788Sdelphij	print-sip.c \
207276788Sdelphij	print-sl.c \
208276788Sdelphij	print-sll.c \
209276788Sdelphij	print-slow.c \
210285275Spkelsey	print-smtp.c \
211276788Sdelphij	print-snmp.c \
212276788Sdelphij	print-stp.c \
213276788Sdelphij	print-sunatm.c \
214276788Sdelphij	print-sunrpc.c \
215276788Sdelphij	print-symantec.c \
216276788Sdelphij	print-syslog.c \
217276788Sdelphij	print-tcp.c \
218276788Sdelphij	print-telnet.c \
219276788Sdelphij	print-tftp.c \
220276788Sdelphij	print-timed.c \
221276788Sdelphij	print-tipc.c \
222276788Sdelphij	print-token.c \
223276788Sdelphij	print-udld.c \
224276788Sdelphij	print-udp.c \
225276788Sdelphij	print-usb.c \
226276788Sdelphij	print-vjc.c \
227276788Sdelphij	print-vqp.c \
228276788Sdelphij	print-vrrp.c \
229276788Sdelphij	print-vtp.c \
230276788Sdelphij	print-vxlan.c \
231313537Sglebius	print-vxlan-gpe.c \
232276788Sdelphij	print-wb.c \
233276788Sdelphij	print-zephyr.c \
234276788Sdelphij	print-zeromq.c \
235313537Sglebius	netdissect.c \
236276788Sdelphij	signature.c \
237313537Sglebius	strtoaddr.c \
238313537Sglebius	util-print.c
239190207Srpaulo
24056893SfennerLOCALSRC = @LOCALSRC@
24117680SpstGENSRC = version.c
24256893SfennerLIBOBJS = @LIBOBJS@
24317680Spst
244276788SdelphijLIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) ${LOCALSRC:.c=.o} ${LIBOBJS}
245276788SdelphijLIBNETDISSECT=libnetdissect.a
246276788Sdelphij
247276788Sdelphij
248190207SrpauloSRC =	$(CSRC) $(GENSRC) $(LOCALSRC) $(LIBNETDISSECT_SRC)
24917680Spst
25017680Spst# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
25117680Spst# hack the extra indirection
252276788SdelphijOBJ =	$(CSRC:.c=.o) $(GENSRC:.c=.o) $(LIBNETDISSECT_OBJ)
253190207SrpauloHDR = \
254190207Srpaulo	addrtoname.h \
255313537Sglebius	addrtostr.h \
256190207Srpaulo	af.h \
257190207Srpaulo	ah.h \
258190207Srpaulo	appletalk.h \
259313537Sglebius	ascii_strcasecmp.h \
260190207Srpaulo	atm.h \
261190207Srpaulo	chdlc.h \
262190207Srpaulo	cpack.h \
263190207Srpaulo	ether.h \
264190207Srpaulo	ethertype.h \
265190207Srpaulo	extract.h \
266327234Semaste	funcattrs.h \
267276788Sdelphij	getopt_long.h \
268190207Srpaulo	gmpls.h \
269190207Srpaulo	gmt2local.h \
270190207Srpaulo	interface.h \
271190207Srpaulo	ip.h \
272190207Srpaulo	ip6.h \
273190207Srpaulo	ipproto.h \
274190207Srpaulo	l2vpn.h \
275190207Srpaulo	llc.h \
276190207Srpaulo	machdep.h \
277190207Srpaulo	mib.h \
278190207Srpaulo	mpls.h \
279190207Srpaulo	nameser.h \
280190207Srpaulo	netdissect.h \
281190207Srpaulo	nfs.h \
282190207Srpaulo	nfsfh.h \
283190207Srpaulo	nlpid.h \
284276788Sdelphij	openflow.h \
285190207Srpaulo	ospf.h \
286190207Srpaulo	oui.h \
287190207Srpaulo	pcap-missing.h \
288190207Srpaulo	ppp.h \
289313537Sglebius	print.h \
290190207Srpaulo	rpc_auth.h \
291190207Srpaulo	rpc_msg.h \
292276788Sdelphij	rpl.h \
29398524Sfenner	setsignal.h \
294214478Srpaulo	signature.h \
295190207Srpaulo	slcompress.h \
296190207Srpaulo	smb.h \
297313537Sglebius	strtoaddr.h \
298190207Srpaulo	tcp.h \
299313537Sglebius	netdissect-stdinc.h \
300313537Sglebius	timeval-operations.h \
301190207Srpaulo	udp.h
30217680Spst
30317680SpstTAGHDR = \
30417680Spst	/usr/include/arpa/tftp.h \
30526180Sfenner	/usr/include/net/if_arp.h \
30617680Spst	/usr/include/netinet/if_ether.h \
30717680Spst	/usr/include/netinet/in.h \
30817680Spst	/usr/include/netinet/ip_icmp.h \
30917680Spst	/usr/include/netinet/tcp.h \
31017680Spst	/usr/include/netinet/udp.h \
31117680Spst	/usr/include/protocols/routed.h
31217680Spst
31317680SpstTAGFILES = $(SRC) $(HDR) $(TAGHDR)
31417680Spst
31539297SfennerCLEANFILES = $(PROG) $(OBJ) $(GENSRC)
31617680Spst
317190207SrpauloEXTRA_DIST = \
318190207Srpaulo	CHANGES \
319313537Sglebius	CONTRIBUTING \
320190207Srpaulo	CREDITS \
321190207Srpaulo	INSTALL.txt \
322190207Srpaulo	LICENSE \
323190207Srpaulo	Makefile.in \
324214478Srpaulo	Makefile-devel-adds \
325313537Sglebius	PLATFORMS \
326313537Sglebius	README \
327276788Sdelphij	README.md \
328190207Srpaulo	Readme.Win32 \
329190207Srpaulo	VERSION \
330190207Srpaulo	aclocal.m4 \
331190207Srpaulo	atime.awk \
332190207Srpaulo	bpf_dump.c \
333190207Srpaulo	config.guess \
334190207Srpaulo	config.h.in \
335190207Srpaulo	config.sub \
336190207Srpaulo	configure \
337356341Scy	configure.ac \
338190207Srpaulo	install-sh \
339190207Srpaulo	lbl/os-osf4.h \
340190207Srpaulo	lbl/os-solaris2.h \
341190207Srpaulo	lbl/os-sunos4.h \
342190207Srpaulo	lbl/os-ultrix4.h \
343190207Srpaulo	makemib \
344190207Srpaulo	missing/dlnames.c \
345190207Srpaulo	missing/datalinks.c \
346276788Sdelphij	missing/getopt_long.c \
347190207Srpaulo	missing/snprintf.c \
348190207Srpaulo	missing/strdup.c \
349190207Srpaulo	missing/strlcat.c \
350190207Srpaulo	missing/strlcpy.c \
351190207Srpaulo	missing/strsep.c \
352190207Srpaulo	mkdep \
353190207Srpaulo	packetdat.awk \
354190207Srpaulo	pcap_dump_ftell.c \
355190207Srpaulo	print-pflog.c \
356190207Srpaulo	print-smb.c \
357190207Srpaulo	send-ack.awk \
358190207Srpaulo	smbutil.c \
359190207Srpaulo	stime.awk \
360214478Srpaulo	tcpdump.1.in \
361190207Srpaulo	vfprintf.c \
362190207Srpaulo	win32/prj/GNUmakefile \
363190207Srpaulo	win32/prj/WinDump.dsp \
364313537Sglebius	win32/prj/WinDump.dsw \
365313537Sglebius	win32/prj/WinDump.sln \
366313537Sglebius	win32/prj/WinDump.vcproj \
367313537Sglebius	win32/src/ether_ntohost.c
368190207Srpaulo
369356341ScyTEST_DIST= `git ls-files tests | grep -v 'tests/\..*'`
370251158Sdelphij
371276788Sdelphijall: $(PROG) $(LIBNETDISSECT)
37239297Sfenner
37339297Sfenner$(PROG): $(OBJ) @V_PCAPDEP@
37417680Spst	@rm -f $@
375235530Sdelphij	$(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
37617680Spst
377190207Srpaulo$(LIBNETDISSECT): $(LIBNETDISSECT_OBJ)
378190207Srpaulo	@rm -f $@
379313537Sglebius	$(AR) cr $@ $(LIBNETDISSECT_OBJ)
380190207Srpaulo	$(RANLIB) $@
381190207Srpaulo
382127668Sbmsdatalinks.o: $(srcdir)/missing/datalinks.c
383235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c
384127668Sbmsdlnames.o: $(srcdir)/missing/dlnames.c
385235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/dlnames.c
386276788Sdelphijgetopt_long.o: $(srcdir)/missing/getopt_long.c
387276788Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getopt_long.c
38875115Sfennersnprintf.o: $(srcdir)/missing/snprintf.c
389235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
390276788Sdelphijstrdup.o: $(srcdir)/missing/strdup.c
391276788Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strdup.c
39275115Sfennerstrlcat.o: $(srcdir)/missing/strlcat.c
393235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
39475115Sfennerstrlcpy.o: $(srcdir)/missing/strlcpy.c
395235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
396127668Sbmsstrsep.o: $(srcdir)/missing/strsep.c
397235530Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strsep.c
39856893Sfenner
39917680Spstversion.o: version.c
400235530Sdelphij	$(CC) $(FULL_CFLAGS) -c version.c
40156893Sfenner
40226180Sfennerversion.c: $(srcdir)/VERSION
40317680Spst	@rm -f $@
404214478Srpaulo	if grep GIT ${srcdir}/VERSION >/dev/null; then \
405190207Srpaulo		read ver <${srcdir}/VERSION; \
406190207Srpaulo		echo $$ver | tr -d '\012'; \
407190207Srpaulo		date +_%Y_%m_%d; \
408190207Srpaulo	else \
409190207Srpaulo		cat ${srcdir}/VERSION; \
410214478Srpaulo	fi | sed -e 's/.*/const char version[] = "&";/' > $@
41117680Spst
412190207Srpauloinstall: all
41375115Sfenner	[ -d $(DESTDIR)$(sbindir) ] || \
41475115Sfenner	    (mkdir -p $(DESTDIR)$(sbindir); chmod 755 $(DESTDIR)$(sbindir))
41575115Sfenner	$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG)
416190207Srpaulo	$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG).`cat ${srcdir}/VERSION`
41775115Sfenner	[ -d $(DESTDIR)$(mandir)/man1 ] || \
41875115Sfenner	    (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
419214478Srpaulo	$(INSTALL_DATA) $(PROG).1 $(DESTDIR)$(mandir)/man1/$(PROG).1
42017680Spst
42175115Sfenneruninstall:
42275115Sfenner	rm -f $(DESTDIR)$(sbindir)/$(PROG)
42375115Sfenner	rm -f $(DESTDIR)$(mandir)/man1/$(PROG).1
42417680Spst
42575115Sfennerlint: $(GENSRC)
42617680Spst	lint -hbxn $(SRC) | \
42717680Spst	    grep -v 'struct/union .* never defined' | \
42817680Spst	    grep -v 'possible pointer alignment problem'
42917680Spst
43017680Spstclean:
431214478Srpaulo	rm -f $(CLEANFILES) $(PROG)-`cat VERSION`.tar.gz
43217680Spst
43317680Spstdistclean:
43417680Spst	rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
435276788Sdelphij	    config.h gnuc.h os-proto.h stamp-h stamp-h.in $(PROG).1 \
436276788Sdelphij	    libnetdissect.a tests/.failed tests/.passed \
437276788Sdelphij	    tests/failure-outputs.txt
438276788Sdelphij	rm -rf autom4te.cache tests/DIFF tests/NEW
43917680Spst
440214478Srpaulocheck: tcpdump
441356341Scy	(mkdir -p tests && SRCDIR=`cd ${srcdir}; pwd` && export SRCDIR && $$SRCDIR/tests/TESTrun.sh )
442214478Srpaulo
443313537Sglebiusextags: $(TAGFILES)
444313537Sglebius	ctags $(TAGFILES)
445313537Sglebius
44639297Sfennertags: $(TAGFILES)
44717680Spst	ctags -wtd $(TAGFILES)
44817680Spst
449190207SrpauloTAGS: $(TAGFILES)
450190207Srpaulo	etags $(TAGFILES)
451190207Srpaulo
452172683Smlaierreleasetar:
45339297Sfenner	@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
454190207Srpaulo	   mkdir $$name; \
455251158Sdelphij	   tar cf - $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST) | (cd $$name; tar xf -); \
456190207Srpaulo	   tar -c -z -f $$name.tar.gz $$name; \
457190207Srpaulo	   rm -rf $$name
45817680Spst
459251158Sdelphijtestlist:
460251158Sdelphij	echo $(TEST_DIST)
461251158Sdelphij
46275115Sfennerdepend: $(GENSRC)
463276788Sdelphij	$(MKDEP) -c $(CC) -m $(DEPENDENCY_CFLAG) $(DEFS) $(INCLS) $(SRC)
464