xref: /freebsd/contrib/tcpdump/Makefile.in (revision fcb560670601b2a4d87bb31d7531c8dcc37ee71b)
1#  Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
2# 	The Regents of the University of California.  All rights reserved.
3#
4#  Redistribution and use in source and binary forms, with or without
5#  modification, are permitted provided that: (1) source code distributions
6#  retain the above copyright notice and this paragraph in its entirety, (2)
7#  distributions including binary code include the above copyright notice and
8#  this paragraph in its entirety in the documentation or other materials
9#  provided with the distribution, and (3) all advertising materials mentioning
10#  features or use of this software display the following acknowledgement:
11#  ``This product includes software developed by the University of California,
12#  Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13#  the University nor the names of its contributors may be used to endorse
14#  or promote products derived from this software without specific prior
15#  written permission.
16#  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17#  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19
20#
21# Various configurable paths (remember to edit Makefile.in, not Makefile)
22#
23
24# Top level hierarchy
25prefix = @prefix@
26exec_prefix = @exec_prefix@
27datarootdir = @datarootdir@
28# Pathname of directory to install the binary
29sbindir = @sbindir@
30# Pathname of directory to install the man page
31mandir = @mandir@
32
33# VPATH
34srcdir = @srcdir@
35VPATH = @srcdir@
36
37#
38# You shouldn't need to edit anything below here.
39#
40
41CC = @CC@
42AR = @AR@
43MKDEP = @MKDEP@
44PROG = tcpdump
45CCOPT = @V_CCOPT@
46INCLS = -I. @V_INCLS@
47DEFS = @DEFS@ @CPPFLAGS@ @V_DEFS@
48
49# Standard CFLAGS
50CFLAGS = @CFLAGS@
51FULL_CFLAGS = $(CCOPT) $(DEFS) $(INCLS) $(CFLAGS)
52
53# Standard LDFLAGS
54LDFLAGS = @LDFLAGS@
55
56# Standard LIBS
57LIBS = @LIBS@
58
59INSTALL = @INSTALL@
60INSTALL_PROGRAM = @INSTALL_PROGRAM@
61INSTALL_DATA = @INSTALL_DATA@
62RANLIB = @RANLIB@
63
64DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
65
66# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
67# Also, gcc does not remove the .o before forking 'as', which can be a
68# problem if you don't own the file but can write to the directory.
69.c.o:
70	@rm -f $@
71	$(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
72
73CSRC =	setsignal.c tcpdump.c
74
75LIBNETDISSECT_SRC=\
76	addrtoname.c \
77	af.c \
78	checksum.c \
79	cpack.c \
80	gmpls.c \
81	gmt2local.c \
82	in_cksum.c \
83	ipproto.c \
84	l2vpn.c \
85	machdep.c \
86	nlpid.c \
87	oui.c \
88	parsenfsfh.c \
89	print-802_11.c \
90	print-802_15_4.c \
91	print-ah.c \
92	print-ahcp.c \
93	print-aodv.c \
94	print-aoe.c \
95	print-ap1394.c \
96	print-arcnet.c \
97	print-arp.c \
98	print-ascii.c \
99	print-atalk.c \
100	print-atm.c \
101	print-beep.c \
102	print-bfd.c \
103	print-bgp.c \
104	print-bootp.c \
105	print-bt.c \
106	print-calm-fast.c \
107	print-carp.c \
108	print-cdp.c \
109	print-cfm.c \
110	print-chdlc.c \
111	print-cip.c \
112	print-cnfp.c \
113	print-dccp.c \
114	print-decnet.c \
115	print-domain.c \
116	print-dtp.c \
117	print-dvmrp.c \
118	print-eap.c \
119	print-egp.c \
120	print-eigrp.c \
121	print-enc.c \
122	print-esp.c \
123	print-ether.c \
124	print-fddi.c \
125	print-forces.c \
126	print-fr.c \
127	print-geonet.c \
128	print-gre.c \
129	print-hsrp.c \
130	print-icmp.c \
131	print-igmp.c \
132	print-igrp.c \
133	print-ip.c \
134	print-ipcomp.c \
135	print-ipfc.c \
136	print-ipnet.c \
137	print-ipx.c \
138	print-isakmp.c \
139	print-isoclns.c \
140	print-juniper.c \
141	print-krb.c \
142	print-l2tp.c \
143	print-lane.c \
144	print-ldp.c \
145	print-llc.c \
146	print-lldp.c \
147	print-lmp.c \
148	print-loopback.c \
149	print-lspping.c \
150	print-lwapp.c \
151	print-lwres.c \
152	print-m3ua.c \
153	print-mobile.c \
154	print-mpcp.c \
155	print-mpls.c \
156	print-mptcp.c \
157	print-msdp.c \
158	print-msnlb.c \
159	print-nflog.c \
160	print-nfs.c \
161	print-ntp.c \
162	print-null.c \
163	print-olsr.c \
164	print-openflow-1.0.c \
165	print-openflow.c \
166	print-ospf.c \
167	print-otv.c \
168	print-pgm.c \
169	print-pim.c \
170	print-pktap.c \
171	print-ppi.c \
172	print-ppp.c \
173	print-pppoe.c \
174	print-pptp.c \
175	print-radius.c \
176	print-raw.c \
177	print-rip.c \
178	print-rpki-rtr.c \
179	print-rrcp.c \
180	print-rsvp.c \
181	print-rx.c \
182	print-sctp.c \
183	print-sflow.c \
184	print-sip.c \
185	print-sl.c \
186	print-sll.c \
187	print-slow.c \
188	print-snmp.c \
189	print-stp.c \
190	print-sunatm.c \
191	print-sunrpc.c \
192	print-symantec.c \
193	print-syslog.c \
194	print-tcp.c \
195	print-telnet.c \
196	print-tftp.c \
197	print-timed.c \
198	print-tipc.c \
199	print-token.c \
200	print-udld.c \
201	print-udp.c \
202	print-usb.c \
203	print-vjc.c \
204	print-vqp.c \
205	print-vrrp.c \
206	print-vtp.c \
207	print-vxlan.c \
208	print-wb.c \
209	print-zephyr.c \
210	print-zeromq.c \
211	signature.c \
212	util.c
213
214LOCALSRC = @LOCALSRC@
215GENSRC = version.c
216LIBOBJS = @LIBOBJS@
217
218LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) ${LOCALSRC:.c=.o} ${LIBOBJS}
219LIBNETDISSECT=libnetdissect.a
220
221
222SRC =	$(CSRC) $(GENSRC) $(LOCALSRC) $(LIBNETDISSECT_SRC)
223
224# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
225# hack the extra indirection
226OBJ =	$(CSRC:.c=.o) $(GENSRC:.c=.o) $(LIBNETDISSECT_OBJ)
227HDR = \
228	addrtoname.h \
229	af.h \
230	ah.h \
231	appletalk.h \
232	atm.h \
233	atmuni31.h \
234	bootp.h \
235	chdlc.h \
236	cpack.h \
237	ether.h \
238	ethertype.h \
239	extract.h \
240	getopt_long.h \
241	gmpls.h \
242	gmt2local.h \
243	interface.h \
244	interface.h \
245	ip.h \
246	ip6.h \
247	ipproto.h \
248	l2vpn.h \
249	llc.h \
250	machdep.h \
251	mib.h \
252	mpls.h \
253	nameser.h \
254	netdissect.h \
255	nfs.h \
256	nfsfh.h \
257	nlpid.h \
258	openflow.h \
259	ospf.h \
260	oui.h \
261	pcap-missing.h \
262	ppp.h \
263	rpc_auth.h \
264	rpc_msg.h \
265	rpl.h \
266	setsignal.h \
267	signature.h \
268	slcompress.h \
269	smb.h \
270	tcp.h \
271	tcpdump-stdinc.h \
272	udp.h
273
274TAGHDR = \
275	/usr/include/arpa/tftp.h \
276	/usr/include/net/if_arp.h \
277	/usr/include/net/slip.h \
278	/usr/include/netinet/if_ether.h \
279	/usr/include/netinet/in.h \
280	/usr/include/netinet/ip_icmp.h \
281	/usr/include/netinet/tcp.h \
282	/usr/include/netinet/udp.h \
283	/usr/include/protocols/routed.h
284
285TAGFILES = $(SRC) $(HDR) $(TAGHDR)
286
287CLEANFILES = $(PROG) $(OBJ) $(GENSRC)
288
289EXTRA_DIST = \
290	CHANGES \
291	CREDITS \
292	INSTALL.txt \
293	LICENSE \
294	Makefile.in \
295	Makefile-devel-adds \
296	README.md \
297	Readme.Win32 \
298	VERSION \
299	aclocal.m4 \
300	atime.awk \
301	bpf_dump.c \
302	config.guess \
303	config.h.in \
304	config.sub \
305	configure \
306	configure.in \
307	install-sh \
308	lbl/os-osf4.h \
309	lbl/os-solaris2.h \
310	lbl/os-sunos4.h \
311	lbl/os-ultrix4.h \
312	makemib \
313	missing/addrinfo.h \
314	missing/dlnames.c \
315	missing/datalinks.c \
316	missing/getnameinfo.c \
317	missing/getopt_long.c \
318	missing/inet_aton.c \
319	missing/inet_ntop.c \
320	missing/inet_pton.c \
321	missing/snprintf.c \
322	missing/strdup.c \
323	missing/strlcat.c \
324	missing/strlcpy.c \
325	missing/strsep.c \
326	mkdep \
327	packetdat.awk \
328	pcap_dump_ftell.c \
329	print-babel.c \
330	print-dhcp6.c \
331	print-frag6.c \
332	print-icmp6.c \
333	print-ip6.c \
334	print-ip6opts.c \
335	print-mobility.c \
336	print-ospf6.c \
337	print-pflog.c \
338	print-ripng.c \
339	print-rt6.c \
340	print-smb.c \
341	send-ack.awk \
342	smbutil.c \
343	stime.awk \
344	strcasecmp.c \
345	tcpdump.1.in \
346	vfprintf.c \
347	win32/Include/w32_fzs.h \
348	win32/prj/GNUmakefile \
349	win32/prj/WinDump.dsp \
350	win32/prj/WinDump.dsw
351
352TEST_DIST= `find tests \( -name 'DIFF' -prune \) -o \( -name NEW -prune \) -o -type f \! -name '.*' \! -name '*~' -print`
353
354all: $(PROG) $(LIBNETDISSECT)
355
356$(PROG): $(OBJ) @V_PCAPDEP@
357	@rm -f $@
358	$(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
359
360$(LIBNETDISSECT): $(LIBNETDISSECT_OBJ)
361	@rm -f $@
362	$(AR) $(ARFLAGS) $@ $(LIBNETDISSECT_OBJ)
363	$(RANLIB) $@
364
365datalinks.o: $(srcdir)/missing/datalinks.c
366	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c
367dlnames.o: $(srcdir)/missing/dlnames.c
368	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/dlnames.c
369getnameinfo.o: $(srcdir)/missing/getnameinfo.c
370	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getnameinfo.c
371getopt_long.o: $(srcdir)/missing/getopt_long.c
372	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getopt_long.c
373inet_pton.o: $(srcdir)/missing/inet_pton.c
374	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_pton.c
375inet_ntop.o: $(srcdir)/missing/inet_ntop.c
376	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_ntop.c
377inet_aton.o: $(srcdir)/missing/inet_aton.c
378	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_aton.c
379snprintf.o: $(srcdir)/missing/snprintf.c
380	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
381strdup.o: $(srcdir)/missing/strdup.c
382	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strdup.c
383strlcat.o: $(srcdir)/missing/strlcat.c
384	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
385strlcpy.o: $(srcdir)/missing/strlcpy.c
386	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
387strsep.o: $(srcdir)/missing/strsep.c
388	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strsep.c
389
390version.o: version.c
391	$(CC) $(FULL_CFLAGS) -c version.c
392
393version.c: $(srcdir)/VERSION
394	@rm -f $@
395	if grep GIT ${srcdir}/VERSION >/dev/null; then \
396		read ver <${srcdir}/VERSION; \
397		echo $$ver | tr -d '\012'; \
398		date +_%Y_%m_%d; \
399	else \
400		cat ${srcdir}/VERSION; \
401	fi | sed -e 's/.*/const char version[] = "&";/' > $@
402
403install: all
404	[ -d $(DESTDIR)$(sbindir) ] || \
405	    (mkdir -p $(DESTDIR)$(sbindir); chmod 755 $(DESTDIR)$(sbindir))
406	$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG)
407	$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG).`cat ${srcdir}/VERSION`
408	[ -d $(DESTDIR)$(mandir)/man1 ] || \
409	    (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
410	$(INSTALL_DATA) $(PROG).1 $(DESTDIR)$(mandir)/man1/$(PROG).1
411
412uninstall:
413	rm -f $(DESTDIR)$(sbindir)/$(PROG)
414	rm -f $(DESTDIR)$(mandir)/man1/$(PROG).1
415
416lint: $(GENSRC)
417	lint -hbxn $(SRC) | \
418	    grep -v 'struct/union .* never defined' | \
419	    grep -v 'possible pointer alignment problem'
420
421clean:
422	rm -f $(CLEANFILES) $(PROG)-`cat VERSION`.tar.gz
423
424distclean:
425	rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
426	    config.h gnuc.h os-proto.h stamp-h stamp-h.in $(PROG).1 \
427	    libnetdissect.a tests/.failed tests/.passed \
428	    tests/failure-outputs.txt
429	rm -rf autom4te.cache tests/DIFF tests/NEW
430
431check: tcpdump
432	(cd tests && ./TESTrun.sh)
433
434tags: $(TAGFILES)
435	ctags -wtd $(TAGFILES)
436
437TAGS: $(TAGFILES)
438	etags $(TAGFILES)
439
440releasetar:
441	@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
442	   mkdir $$name; \
443	   tar cf - $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST) | (cd $$name; tar xf -); \
444	   tar -c -z -f $$name.tar.gz $$name; \
445	   rm -rf $$name
446
447testlist:
448	echo $(TEST_DIST)
449
450depend: $(GENSRC)
451	$(MKDEP) -c $(CC) -m $(DEPENDENCY_CFLAG) $(DEFS) $(INCLS) $(SRC)
452