xref: /freebsd/contrib/tcpdump/Makefile.in (revision f6a3b357e9be4c6423c85eff9a847163a0d307c8)
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	addrtostr.c \
78	af.c \
79	ascii_strcasecmp.c \
80	checksum.c \
81	cpack.c \
82	gmpls.c \
83	gmt2local.c \
84	in_cksum.c \
85	ipproto.c \
86	l2vpn.c \
87	machdep.c \
88	nlpid.c \
89	oui.c \
90	parsenfsfh.c \
91	print.c \
92	print-802_11.c \
93	print-802_15_4.c \
94	print-ah.c \
95	print-ahcp.c \
96	print-aodv.c \
97	print-aoe.c \
98	print-ap1394.c \
99	print-arcnet.c \
100	print-arp.c \
101	print-ascii.c \
102	print-atalk.c \
103	print-atm.c \
104	print-babel.c \
105	print-beep.c \
106	print-bfd.c \
107	print-bgp.c \
108	print-bootp.c \
109	print-bt.c \
110	print-calm-fast.c \
111	print-carp.c \
112	print-cdp.c \
113	print-cfm.c \
114	print-chdlc.c \
115	print-cip.c \
116	print-cnfp.c \
117	print-dccp.c \
118	print-decnet.c \
119	print-dhcp6.c \
120	print-domain.c \
121	print-dtp.c \
122	print-dvmrp.c \
123	print-eap.c \
124	print-egp.c \
125	print-eigrp.c \
126	print-enc.c \
127	print-esp.c \
128	print-ether.c \
129	print-fddi.c \
130	print-forces.c \
131	print-fr.c \
132	print-frag6.c \
133	print-ftp.c \
134	print-geneve.c \
135	print-geonet.c \
136	print-gre.c \
137	print-hncp.c \
138	print-hsrp.c \
139	print-http.c \
140	print-icmp.c \
141	print-icmp6.c \
142	print-igmp.c \
143	print-igrp.c \
144	print-ip.c \
145	print-ip6.c \
146	print-ip6opts.c \
147	print-ipcomp.c \
148	print-ipfc.c \
149	print-ipnet.c \
150	print-ipx.c \
151	print-isakmp.c \
152	print-isoclns.c \
153	print-juniper.c \
154	print-krb.c \
155	print-l2tp.c \
156	print-lane.c \
157	print-ldp.c \
158	print-lisp.c \
159	print-llc.c \
160	print-lldp.c \
161	print-lmp.c \
162	print-loopback.c \
163	print-lspping.c \
164	print-lwapp.c \
165	print-lwres.c \
166	print-m3ua.c \
167	print-medsa.c \
168	print-mobile.c \
169	print-mobility.c \
170	print-mpcp.c \
171	print-mpls.c \
172	print-mptcp.c \
173	print-msdp.c \
174	print-msnlb.c \
175	print-nflog.c \
176	print-nfs.c \
177	print-nsh.c \
178	print-ntp.c \
179	print-null.c \
180	print-olsr.c \
181	print-openflow-1.0.c \
182	print-openflow.c \
183	print-ospf.c \
184	print-ospf6.c \
185	print-otv.c \
186	print-pgm.c \
187	print-pim.c \
188	print-pktap.c \
189	print-ppi.c \
190	print-ppp.c \
191	print-pppoe.c \
192	print-pptp.c \
193	print-radius.c \
194	print-raw.c \
195	print-resp.c \
196	print-rip.c \
197	print-ripng.c \
198	print-rpki-rtr.c \
199	print-rrcp.c \
200	print-rsvp.c \
201	print-rt6.c \
202	print-rtsp.c \
203	print-rx.c \
204	print-sctp.c \
205	print-sflow.c \
206	print-sip.c \
207	print-sl.c \
208	print-sll.c \
209	print-slow.c \
210	print-smtp.c \
211	print-snmp.c \
212	print-stp.c \
213	print-sunatm.c \
214	print-sunrpc.c \
215	print-symantec.c \
216	print-syslog.c \
217	print-tcp.c \
218	print-telnet.c \
219	print-tftp.c \
220	print-timed.c \
221	print-tipc.c \
222	print-token.c \
223	print-udld.c \
224	print-udp.c \
225	print-usb.c \
226	print-vjc.c \
227	print-vqp.c \
228	print-vrrp.c \
229	print-vtp.c \
230	print-vxlan.c \
231	print-vxlan-gpe.c \
232	print-wb.c \
233	print-zephyr.c \
234	print-zeromq.c \
235	netdissect.c \
236	signature.c \
237	strtoaddr.c \
238	util-print.c
239
240LOCALSRC = @LOCALSRC@
241GENSRC = version.c
242LIBOBJS = @LIBOBJS@
243
244LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) ${LOCALSRC:.c=.o} ${LIBOBJS}
245LIBNETDISSECT=libnetdissect.a
246
247
248SRC =	$(CSRC) $(GENSRC) $(LOCALSRC) $(LIBNETDISSECT_SRC)
249
250# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
251# hack the extra indirection
252OBJ =	$(CSRC:.c=.o) $(GENSRC:.c=.o) $(LIBNETDISSECT_OBJ)
253HDR = \
254	addrtoname.h \
255	addrtostr.h \
256	af.h \
257	ah.h \
258	appletalk.h \
259	ascii_strcasecmp.h \
260	atm.h \
261	chdlc.h \
262	cpack.h \
263	ether.h \
264	ethertype.h \
265	extract.h \
266	funcattrs.h \
267	getopt_long.h \
268	gmpls.h \
269	gmt2local.h \
270	interface.h \
271	ip.h \
272	ip6.h \
273	ipproto.h \
274	l2vpn.h \
275	llc.h \
276	machdep.h \
277	mib.h \
278	mpls.h \
279	nameser.h \
280	netdissect.h \
281	nfs.h \
282	nfsfh.h \
283	nlpid.h \
284	openflow.h \
285	ospf.h \
286	oui.h \
287	pcap-missing.h \
288	ppp.h \
289	print.h \
290	rpc_auth.h \
291	rpc_msg.h \
292	rpl.h \
293	setsignal.h \
294	signature.h \
295	slcompress.h \
296	smb.h \
297	strtoaddr.h \
298	tcp.h \
299	netdissect-stdinc.h \
300	timeval-operations.h \
301	udp.h
302
303TAGHDR = \
304	/usr/include/arpa/tftp.h \
305	/usr/include/net/if_arp.h \
306	/usr/include/netinet/if_ether.h \
307	/usr/include/netinet/in.h \
308	/usr/include/netinet/ip_icmp.h \
309	/usr/include/netinet/tcp.h \
310	/usr/include/netinet/udp.h \
311	/usr/include/protocols/routed.h
312
313TAGFILES = $(SRC) $(HDR) $(TAGHDR)
314
315CLEANFILES = $(PROG) $(OBJ) $(GENSRC)
316
317EXTRA_DIST = \
318	CHANGES \
319	CONTRIBUTING \
320	CREDITS \
321	INSTALL.txt \
322	LICENSE \
323	Makefile.in \
324	Makefile-devel-adds \
325	PLATFORMS \
326	README \
327	README.md \
328	Readme.Win32 \
329	VERSION \
330	aclocal.m4 \
331	atime.awk \
332	bpf_dump.c \
333	config.guess \
334	config.h.in \
335	config.sub \
336	configure \
337	configure.in \
338	install-sh \
339	lbl/os-osf4.h \
340	lbl/os-solaris2.h \
341	lbl/os-sunos4.h \
342	lbl/os-ultrix4.h \
343	makemib \
344	missing/dlnames.c \
345	missing/datalinks.c \
346	missing/getopt_long.c \
347	missing/snprintf.c \
348	missing/strdup.c \
349	missing/strlcat.c \
350	missing/strlcpy.c \
351	missing/strsep.c \
352	mkdep \
353	packetdat.awk \
354	pcap_dump_ftell.c \
355	print-pflog.c \
356	print-smb.c \
357	send-ack.awk \
358	smbutil.c \
359	stime.awk \
360	tcpdump.1.in \
361	vfprintf.c \
362	win32/prj/GNUmakefile \
363	win32/prj/WinDump.dsp \
364	win32/prj/WinDump.dsw \
365	win32/prj/WinDump.sln \
366	win32/prj/WinDump.vcproj \
367	win32/src/ether_ntohost.c
368
369TEST_DIST= `find tests \( -name 'DIFF' -prune \) -o \( -name NEW -prune \) -o -type f \! -name '.*' \! -name '*~' -print`
370
371all: $(PROG) $(LIBNETDISSECT)
372
373$(PROG): $(OBJ) @V_PCAPDEP@
374	@rm -f $@
375	$(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
376
377$(LIBNETDISSECT): $(LIBNETDISSECT_OBJ)
378	@rm -f $@
379	$(AR) cr $@ $(LIBNETDISSECT_OBJ)
380	$(RANLIB) $@
381
382datalinks.o: $(srcdir)/missing/datalinks.c
383	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c
384dlnames.o: $(srcdir)/missing/dlnames.c
385	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/dlnames.c
386getopt_long.o: $(srcdir)/missing/getopt_long.c
387	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getopt_long.c
388snprintf.o: $(srcdir)/missing/snprintf.c
389	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
390strdup.o: $(srcdir)/missing/strdup.c
391	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strdup.c
392strlcat.o: $(srcdir)/missing/strlcat.c
393	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
394strlcpy.o: $(srcdir)/missing/strlcpy.c
395	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
396strsep.o: $(srcdir)/missing/strsep.c
397	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strsep.c
398
399version.o: version.c
400	$(CC) $(FULL_CFLAGS) -c version.c
401
402version.c: $(srcdir)/VERSION
403	@rm -f $@
404	if grep GIT ${srcdir}/VERSION >/dev/null; then \
405		read ver <${srcdir}/VERSION; \
406		echo $$ver | tr -d '\012'; \
407		date +_%Y_%m_%d; \
408	else \
409		cat ${srcdir}/VERSION; \
410	fi | sed -e 's/.*/const char version[] = "&";/' > $@
411
412install: all
413	[ -d $(DESTDIR)$(sbindir) ] || \
414	    (mkdir -p $(DESTDIR)$(sbindir); chmod 755 $(DESTDIR)$(sbindir))
415	$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG)
416	$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG).`cat ${srcdir}/VERSION`
417	[ -d $(DESTDIR)$(mandir)/man1 ] || \
418	    (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
419	$(INSTALL_DATA) $(PROG).1 $(DESTDIR)$(mandir)/man1/$(PROG).1
420
421uninstall:
422	rm -f $(DESTDIR)$(sbindir)/$(PROG)
423	rm -f $(DESTDIR)$(mandir)/man1/$(PROG).1
424
425lint: $(GENSRC)
426	lint -hbxn $(SRC) | \
427	    grep -v 'struct/union .* never defined' | \
428	    grep -v 'possible pointer alignment problem'
429
430clean:
431	rm -f $(CLEANFILES) $(PROG)-`cat VERSION`.tar.gz
432
433distclean:
434	rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
435	    config.h gnuc.h os-proto.h stamp-h stamp-h.in $(PROG).1 \
436	    libnetdissect.a tests/.failed tests/.passed \
437	    tests/failure-outputs.txt
438	rm -rf autom4te.cache tests/DIFF tests/NEW
439
440check: tcpdump
441	(cd tests && ./TESTrun.sh)
442
443extags: $(TAGFILES)
444	ctags $(TAGFILES)
445
446tags: $(TAGFILES)
447	ctags -wtd $(TAGFILES)
448
449TAGS: $(TAGFILES)
450	etags $(TAGFILES)
451
452releasetar:
453	@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
454	   mkdir $$name; \
455	   tar cf - $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST) | (cd $$name; tar xf -); \
456	   tar -c -z -f $$name.tar.gz $$name; \
457	   rm -rf $$name
458
459testlist:
460	echo $(TEST_DIST)
461
462depend: $(GENSRC)
463	$(MKDEP) -c $(CC) -m $(DEPENDENCY_CFLAG) $(DEFS) $(INCLS) $(SRC)
464