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#
20214478Srpaulo# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.325 2008-11-21 23:17:26 guy Exp $ (LBL)
2117680Spst
2217680Spst#
2317680Spst# Various configurable paths (remember to edit Makefile.in, not Makefile)
2417680Spst#
2517680Spst
2617680Spst# Top level hierarchy
2717680Spstprefix = @prefix@
2817680Spstexec_prefix = @exec_prefix@
29236192Sdelphijdatarootdir = @datarootdir@
3017680Spst# Pathname of directory to install the binary
3175115Sfennersbindir = @sbindir@
3217680Spst# Pathname of directory to install the man page
3375115Sfennermandir = @mandir@
3417680Spst
3526180Sfenner# VPATH
3626180Sfennersrcdir = @srcdir@
3726180SfennerVPATH = @srcdir@
3826180Sfenner
3917680Spst#
4017680Spst# You shouldn't need to edit anything below here.
4117680Spst#
4217680Spst
4317680SpstCC = @CC@
4439297SfennerPROG = tcpdump
4517680SpstCCOPT = @V_CCOPT@
4617680SpstINCLS = -I. @V_INCLS@
47146773SsamDEFS = @DEFS@ @CPPFLAGS@ @V_DEFS@
4817680Spst
4917680Spst# Standard CFLAGS
50236192SdelphijCFLAGS = @CFLAGS@
51236192SdelphijFULL_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
6417680Spst# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
6517680Spst# Also, gcc does not remove the .o before forking 'as', which can be a
6617680Spst# problem if you don't own the file but can write to the directory.
6717680Spst.c.o:
6817680Spst	@rm -f $@
69236192Sdelphij	$(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
7017680Spst
71190207SrpauloCSRC =	addrtoname.c af.c checksum.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c \
72236192Sdelphij        nlpid.c l2vpn.c machdep.c parsenfsfh.c in_cksum.c \
73236192Sdelphij	print-802_11.c print-802_15_4.c print-ap1394.c print-ah.c \
74236192Sdelphij	print-arcnet.c print-aodv.c print-arp.c print-ascii.c print-atalk.c \
75236192Sdelphij	print-atm.c print-beep.c print-bfd.c print-bgp.c \
76236192Sdelphij	print-bootp.c print-bt.c print-carp.c print-cdp.c print-cfm.c \
77236192Sdelphij	print-chdlc.c print-cip.c print-cnfp.c print-dccp.c print-decnet.c \
78190207Srpaulo	print-domain.c print-dtp.c print-dvmrp.c print-enc.c print-egp.c \
79146773Ssam	print-eap.c print-eigrp.c\
80242485Sdelphij	print-esp.c print-ether.c print-fddi.c print-forces.c print-fr.c \
81127668Sbms	print-gre.c print-hsrp.c print-icmp.c print-igmp.c \
82214478Srpaulo	print-igrp.c print-ip.c print-ipcomp.c print-ipfc.c print-ipnet.c \
83190207Srpaulo	print-ipx.c print-isoclns.c print-juniper.c print-krb.c \
84190207Srpaulo	print-l2tp.c print-lane.c print-ldp.c print-lldp.c print-llc.c \
85190207Srpaulo        print-lmp.c print-lspping.c print-lwapp.c \
86190207Srpaulo	print-lwres.c print-mobile.c print-mpcp.c print-mpls.c print-msdp.c \
87252283Sdelphij	print-msnlb.c print-nfs.c print-ntp.c print-null.c print-olsr.c print-ospf.c \
88236192Sdelphij	print-pgm.c print-pim.c \
89236192Sdelphij	print-ppi.c print-ppp.c print-pppoe.c print-pptp.c \
90236192Sdelphij	print-radius.c print-raw.c print-rip.c print-rpki-rtr.c print-rrcp.c print-rsvp.c \
91190207Srpaulo	print-rx.c print-sctp.c print-sflow.c print-sip.c print-sl.c print-sll.c \
92162017Ssam	print-slow.c print-snmp.c print-stp.c print-sunatm.c print-sunrpc.c \
93146773Ssam	print-symantec.c print-syslog.c print-tcp.c print-telnet.c print-tftp.c \
94242485Sdelphij	print-timed.c print-tipc.c print-token.c print-udld.c print-udp.c \
95242485Sdelphij	print-usb.c print-vjc.c print-vqp.c print-vrrp.c print-vtp.c \
96252283Sdelphij	print-wb.c print-zephyr.c print-zeromq.c print-vxlan.c print-otv.c signature.c setsignal.c tcpdump.c util.c
9775115Sfenner
98190207SrpauloLIBNETDISSECT_SRC=print-isakmp.c
99190207SrpauloLIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o)
100190207SrpauloLIBNETDISSECT=libnetdissect.a
101190207Srpaulo
10256893SfennerLOCALSRC = @LOCALSRC@
10317680SpstGENSRC = version.c
10456893SfennerLIBOBJS = @LIBOBJS@
10517680Spst
106190207SrpauloSRC =	$(CSRC) $(GENSRC) $(LOCALSRC) $(LIBNETDISSECT_SRC)
10717680Spst
10817680Spst# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
10917680Spst# hack the extra indirection
110190207SrpauloOBJ =	$(CSRC:.c=.o) $(GENSRC:.c=.o) $(LOCALSRC:.c=.o) $(LIBOBJS) $(LIBNETDISSECT_OBJ)
111190207SrpauloHDR = \
112190207Srpaulo	acconfig.h \
113190207Srpaulo	addrtoname.h \
114190207Srpaulo	af.h \
115190207Srpaulo	ah.h \
116190207Srpaulo	aodv.h \
117190207Srpaulo	appletalk.h \
118190207Srpaulo	arcnet.h \
119190207Srpaulo	atm.h \
120190207Srpaulo	atmuni31.h \
121190207Srpaulo	bootp.h \
122190207Srpaulo	bgp.h \
123190207Srpaulo	chdlc.h \
124190207Srpaulo	cpack.h \
125190207Srpaulo	dccp.h \
126190207Srpaulo	decnet.h \
127190207Srpaulo	decode_prefix.h \
128190207Srpaulo	enc.h \
129190207Srpaulo	esp.h \
130190207Srpaulo	ether.h \
131190207Srpaulo	ethertype.h \
132190207Srpaulo	extract.h \
133190207Srpaulo	fddi.h \
134214478Srpaulo	forces.h \
135190207Srpaulo	gmpls.h \
136190207Srpaulo	gmt2local.h \
137190207Srpaulo	icmp6.h \
138190207Srpaulo	ieee802_11.h \
139190207Srpaulo	ieee802_11_radio.h \
140190207Srpaulo	igrp.h \
141190207Srpaulo	interface.h \
142190207Srpaulo	interface.h \
143190207Srpaulo	ip.h \
144190207Srpaulo	ip6.h \
145190207Srpaulo	ipfc.h \
146214478Srpaulo	ipnet.h \
147190207Srpaulo	ipproto.h \
148190207Srpaulo	ipsec_doi.h \
149190207Srpaulo	ipx.h \
150190207Srpaulo	isakmp.h \
151190207Srpaulo	l2tp.h \
152190207Srpaulo	l2vpn.h \
153190207Srpaulo	lane.h \
154190207Srpaulo	llc.h \
155190207Srpaulo	machdep.h \
156190207Srpaulo	mib.h \
157190207Srpaulo	mpls.h \
158190207Srpaulo	nameser.h \
159190207Srpaulo	netbios.h \
160190207Srpaulo	netdissect.h \
161190207Srpaulo	nfs.h \
162190207Srpaulo	nfsfh.h \
163190207Srpaulo	nlpid.h \
164190207Srpaulo	ntp.h \
165190207Srpaulo	oakley.h \
166190207Srpaulo	ospf.h \
167190207Srpaulo	ospf6.h \
168190207Srpaulo	oui.h \
169190207Srpaulo	pcap-missing.h \
170190207Srpaulo	pmap_prot.h \
171236192Sdelphij	ppi.h \
172190207Srpaulo	ppp.h \
173190207Srpaulo	route6d.h \
174190207Srpaulo	rpc_auth.h \
175190207Srpaulo	rpc_msg.h \
176190207Srpaulo	rx.h \
177190207Srpaulo	sctpConstants.h \
178190207Srpaulo	sctpHeader.h \
17998524Sfenner	setsignal.h \
180214478Srpaulo	signature.h \
181190207Srpaulo	slcompress.h \
182190207Srpaulo	slip.h \
183190207Srpaulo	sll.h \
184190207Srpaulo	smb.h \
185190207Srpaulo	tcp.h \
186190207Srpaulo	tcpdump-stdinc.h \
187190207Srpaulo	telnet.h \
188190207Srpaulo	tftp.h \
189190207Srpaulo	timed.h \
190190207Srpaulo	token.h \
191190207Srpaulo	udp.h
19217680Spst
19317680SpstTAGHDR = \
19417680Spst	/usr/include/arpa/tftp.h \
19526180Sfenner	/usr/include/net/if_arp.h \
19617680Spst	/usr/include/net/slip.h \
19717680Spst	/usr/include/netinet/if_ether.h \
19817680Spst	/usr/include/netinet/in.h \
19917680Spst	/usr/include/netinet/ip_icmp.h \
20017680Spst	/usr/include/netinet/tcp.h \
20117680Spst	/usr/include/netinet/udp.h \
20217680Spst	/usr/include/protocols/routed.h
20317680Spst
20417680SpstTAGFILES = $(SRC) $(HDR) $(TAGHDR)
20517680Spst
20639297SfennerCLEANFILES = $(PROG) $(OBJ) $(GENSRC)
20717680Spst
208190207SrpauloEXTRA_DIST = \
209190207Srpaulo	CHANGES \
210190207Srpaulo	CREDITS \
211190207Srpaulo	INSTALL.txt \
212190207Srpaulo	LICENSE \
213190207Srpaulo	Makefile.in \
214214478Srpaulo	Makefile-devel-adds \
215190207Srpaulo	README \
216190207Srpaulo	Readme.Win32 \
217190207Srpaulo	VERSION \
218190207Srpaulo	aclocal.m4 \
219190207Srpaulo	atime.awk \
220190207Srpaulo	bpf_dump.c \
221190207Srpaulo	config.guess \
222190207Srpaulo	config.h.in \
223190207Srpaulo	config.sub \
224190207Srpaulo	configure \
225190207Srpaulo	configure.in \
226190207Srpaulo	install-sh \
227190207Srpaulo	lbl/os-osf4.h \
228190207Srpaulo	lbl/os-solaris2.h \
229190207Srpaulo	lbl/os-sunos4.h \
230190207Srpaulo	lbl/os-ultrix4.h \
231190207Srpaulo	makemib \
232190207Srpaulo	missing/addrinfo.h \
233190207Srpaulo	missing/dlnames.c \
234190207Srpaulo	missing/datalinks.c \
235190207Srpaulo	missing/getnameinfo.c \
236190207Srpaulo	missing/inet_aton.c \
237190207Srpaulo	missing/inet_ntop.c \
238190207Srpaulo	missing/inet_pton.c \
239190207Srpaulo	missing/snprintf.c \
240190207Srpaulo	missing/sockstorage.h \
241190207Srpaulo	missing/strdup.c \
242190207Srpaulo	missing/strlcat.c \
243190207Srpaulo	missing/strlcpy.c \
244190207Srpaulo	missing/strsep.c \
245190207Srpaulo	mkdep \
246190207Srpaulo	packetdat.awk \
247190207Srpaulo	pcap_dump_ftell.c \
248236192Sdelphij	print-babel.c \
249190207Srpaulo	print-dhcp6.c \
250190207Srpaulo	print-frag6.c \
251190207Srpaulo	print-icmp6.c \
252190207Srpaulo	print-ip6.c \
253190207Srpaulo	print-ip6opts.c \
254190207Srpaulo	print-mobility.c \
255190207Srpaulo	print-netbios.c \
256190207Srpaulo	print-ospf6.c \
257190207Srpaulo	print-pflog.c \
258190207Srpaulo	print-ripng.c \
259190207Srpaulo	print-rt6.c \
260190207Srpaulo	print-smb.c \
261190207Srpaulo	send-ack.awk \
262190207Srpaulo	smbutil.c \
263190207Srpaulo	stime.awk \
264190207Srpaulo	strcasecmp.c \
265214478Srpaulo	tcpdump.1.in \
266190207Srpaulo	vfprintf.c \
267252283Sdelphij	win32/Include/bittypes.h \
268190207Srpaulo	win32/Include/errno.h \
269190207Srpaulo	win32/Include/getopt.h \
270190207Srpaulo	win32/Include/w32_fzs.h \
271190207Srpaulo	win32/Src/getopt.c \
272190207Srpaulo	win32/prj/GNUmakefile \
273190207Srpaulo	win32/prj/WinDump.dsp \
274190207Srpaulo	win32/prj/WinDump.dsw
275190207Srpaulo
276252283SdelphijTEST_DIST= `find tests \( -name 'DIFF' -prune \) -o \( -name NEW -prune \) -o -type f \! -name '.*' \! -name '*~' -print`
277252283Sdelphij
27839297Sfennerall: $(PROG)
27939297Sfenner
28039297Sfenner$(PROG): $(OBJ) @V_PCAPDEP@
28117680Spst	@rm -f $@
282236192Sdelphij	$(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
28317680Spst
284190207Srpaulo$(LIBNETDISSECT): $(LIBNETDISSECT_OBJ)
285190207Srpaulo	@rm -f $@
286252283Sdelphij	$(AR) $(ARFLAGS) $@ $(LIBNETDISSECT_OBJ) 
287190207Srpaulo	$(RANLIB) $@
288190207Srpaulo
289127668Sbmsdatalinks.o: $(srcdir)/missing/datalinks.c
290236192Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c
291127668Sbmsdlnames.o: $(srcdir)/missing/dlnames.c
292236192Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/dlnames.c
29356893Sfennergetnameinfo.o: $(srcdir)/missing/getnameinfo.c
294236192Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getnameinfo.c
29556893Sfennergetaddrinfo.o: $(srcdir)/missing/getaddrinfo.c
296236192Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getaddrinfo.c
29756893Sfennerinet_pton.o: $(srcdir)/missing/inet_pton.c
298236192Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_pton.c
29956893Sfennerinet_ntop.o: $(srcdir)/missing/inet_ntop.c
300236192Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_ntop.c
30156893Sfennerinet_aton.o: $(srcdir)/missing/inet_aton.c
302236192Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_aton.c
30375115Sfennersnprintf.o: $(srcdir)/missing/snprintf.c
304236192Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
30575115Sfennerstrlcat.o: $(srcdir)/missing/strlcat.c
306236192Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
30775115Sfennerstrlcpy.o: $(srcdir)/missing/strlcpy.c
308236192Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
309127668Sbmsstrsep.o: $(srcdir)/missing/strsep.c
310236192Sdelphij	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strsep.c
31156893Sfenner
31217680Spstversion.o: version.c
313236192Sdelphij	$(CC) $(FULL_CFLAGS) -c version.c
31456893Sfenner
31526180Sfennerversion.c: $(srcdir)/VERSION
31617680Spst	@rm -f $@
317214478Srpaulo	if grep GIT ${srcdir}/VERSION >/dev/null; then \
318190207Srpaulo		read ver <${srcdir}/VERSION; \
319190207Srpaulo		echo $$ver | tr -d '\012'; \
320190207Srpaulo		date +_%Y_%m_%d; \
321190207Srpaulo	else \
322190207Srpaulo		cat ${srcdir}/VERSION; \
323214478Srpaulo	fi | sed -e 's/.*/const char version[] = "&";/' > $@
32417680Spst
325190207Srpauloinstall: all
32675115Sfenner	[ -d $(DESTDIR)$(sbindir) ] || \
32775115Sfenner	    (mkdir -p $(DESTDIR)$(sbindir); chmod 755 $(DESTDIR)$(sbindir))
32875115Sfenner	$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG)
329190207Srpaulo	$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG).`cat ${srcdir}/VERSION`
33075115Sfenner	[ -d $(DESTDIR)$(mandir)/man1 ] || \
33175115Sfenner	    (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
332214478Srpaulo	$(INSTALL_DATA) $(PROG).1 $(DESTDIR)$(mandir)/man1/$(PROG).1
33317680Spst
33475115Sfenneruninstall:
33575115Sfenner	rm -f $(DESTDIR)$(sbindir)/$(PROG)
33675115Sfenner	rm -f $(DESTDIR)$(mandir)/man1/$(PROG).1
33717680Spst
33875115Sfennerlint: $(GENSRC)
33917680Spst	lint -hbxn $(SRC) | \
34017680Spst	    grep -v 'struct/union .* never defined' | \
34117680Spst	    grep -v 'possible pointer alignment problem'
34217680Spst
34317680Spstclean:
344214478Srpaulo	rm -f $(CLEANFILES) $(PROG)-`cat VERSION`.tar.gz
34517680Spst
34617680Spstdistclean:
34717680Spst	rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
348214478Srpaulo	    config.h gnuc.h os-proto.h stamp-h stamp-h.in $(PROG).1
349236192Sdelphij	rm -rf autom4te.cache
35017680Spst
351214478Srpaulocheck: tcpdump
352214478Srpaulo	(cd tests && ./TESTrun.sh)
353214478Srpaulo
35439297Sfennertags: $(TAGFILES)
35517680Spst	ctags -wtd $(TAGFILES)
35617680Spst
357190207SrpauloTAGS: $(TAGFILES)
358190207Srpaulo	etags $(TAGFILES)
359190207Srpaulo
360172683Smlaierreleasetar:
36139297Sfenner	@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
362190207Srpaulo	   mkdir $$name; \
363252283Sdelphij	   tar cf - $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST) | (cd $$name; tar xf -); \
364190207Srpaulo	   tar -c -z -f $$name.tar.gz $$name; \
365190207Srpaulo	   rm -rf $$name
36617680Spst
367252283Sdelphijtestlist:
368252283Sdelphij	echo $(TEST_DIST)
369252283Sdelphij
37075115Sfennerdepend: $(GENSRC)
37175115Sfenner	${srcdir}/mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
372