xref: /freebsd/contrib/tcpdump/Makefile.in (revision a90b9d0159070121c221b966469c3e36d912bf82)
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
29bindir = @bindir@
30# Pathname of directory to install the man page
31mandir = @mandir@
32
33# VPATH
34srcdir = @srcdir@
35top_srcdir = @top_srcdir@
36VPATH = @srcdir@
37
38#
39# You shouldn't need to edit anything below here.
40#
41
42CC = @CC@
43AR = @AR@
44MKDEP = @MKDEP@
45PROG = tcpdump
46CCOPT = @V_CCOPT@
47INCLS = -I. @V_INCLS@
48DEFS = @DEFS@ @CPPFLAGS@ @V_DEFS@
49
50# Standard CFLAGS
51CFLAGS = @CFLAGS@
52FULL_CFLAGS = $(CCOPT) $(DEFS) $(INCLS) $(CFLAGS)
53
54# Standard LDFLAGS
55LDFLAGS = @LDFLAGS@
56
57# Standard LIBS
58LIBS = @LIBS@
59
60INSTALL = @INSTALL@
61INSTALL_PROGRAM = @INSTALL_PROGRAM@
62INSTALL_DATA = @INSTALL_DATA@
63RANLIB = @RANLIB@
64
65DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
66
67# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
68# Also, gcc does not remove the .o before forking 'as', which can be a
69# problem if you don't own the file but can write to the directory.
70.c.o:
71	@rm -f $@
72	$(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
73
74CSRC =	fptype.c tcpdump.c
75
76LIBNETDISSECT_SRC=\
77	addrtoname.c \
78	addrtostr.c \
79	af.c \
80	ascii_strcasecmp.c \
81	checksum.c \
82	cpack.c \
83	gmpls.c \
84	in_cksum.c \
85	ipproto.c \
86	l2vpn.c \
87	machdep.c \
88	netdissect.c \
89	netdissect-alloc.c \
90	nlpid.c \
91	ntp.c \
92	oui.c \
93	parsenfsfh.c \
94	print.c \
95	print-802_11.c \
96	print-802_15_4.c \
97	print-ah.c \
98	print-ahcp.c \
99	print-aodv.c \
100	print-aoe.c \
101	print-ap1394.c \
102	print-arcnet.c \
103	print-arista.c \
104	print-arp.c \
105	print-ascii.c \
106	print-atalk.c \
107	print-atm.c \
108	print-babel.c \
109	print-bcm-li.c \
110	print-beep.c \
111	print-bfd.c \
112	print-bgp.c \
113	print-bootp.c \
114	print-brcmtag.c \
115	print-bt.c \
116	print-calm-fast.c \
117	print-carp.c \
118	print-cdp.c \
119	print-cfm.c \
120	print-chdlc.c \
121	print-cip.c \
122	print-cnfp.c \
123	print-dccp.c \
124	print-decnet.c \
125	print-dhcp6.c \
126	print-domain.c \
127	print-dsa.c \
128	print-dtp.c \
129	print-dvmrp.c \
130	print-eap.c \
131	print-egp.c \
132	print-eigrp.c \
133	print-enc.c \
134	print-esp.c \
135	print-ether.c \
136	print-fddi.c \
137	print-forces.c \
138	print-fr.c \
139	print-frag6.c \
140	print-ftp.c \
141	print-geneve.c \
142	print-geonet.c \
143	print-gre.c \
144	print-hncp.c \
145	print-hsrp.c \
146	print-http.c \
147	print-icmp.c \
148	print-icmp6.c \
149	print-igmp.c \
150	print-igrp.c \
151	print-ip-demux.c \
152	print-ip.c \
153	print-ip6.c \
154	print-ip6opts.c \
155	print-ipcomp.c \
156	print-ipfc.c \
157	print-ipnet.c \
158	print-ipoib.c \
159	print-ipx.c \
160	print-isakmp.c \
161	print-isoclns.c \
162	print-juniper.c \
163	print-krb.c \
164	print-l2tp.c \
165	print-lane.c \
166	print-ldp.c \
167	print-lisp.c \
168	print-llc.c \
169	print-lldp.c \
170	print-lmp.c \
171	print-loopback.c \
172	print-lspping.c \
173	print-lwapp.c \
174	print-lwres.c \
175	print-m3ua.c \
176	print-macsec.c \
177	print-mobile.c \
178	print-mobility.c \
179	print-mpcp.c \
180	print-mpls.c \
181	print-mptcp.c \
182	print-msdp.c \
183	print-msnlb.c \
184	print-nflog.c \
185	print-nfs.c \
186	print-nsh.c \
187	print-ntp.c \
188	print-null.c \
189	print-olsr.c \
190	print-openflow-1.0.c \
191	print-openflow-1.3.c \
192	print-openflow.c \
193	print-ospf.c \
194	print-ospf6.c \
195	print-otv.c \
196	print-pflog.c \
197	print-pgm.c \
198	print-pim.c \
199	print-pktap.c \
200	print-ppi.c \
201	print-ppp.c \
202	print-pppoe.c \
203	print-pptp.c \
204	print-ptp.c \
205	print-radius.c \
206	print-raw.c \
207	print-realtek.c \
208	print-resp.c \
209	print-rip.c \
210	print-ripng.c \
211	print-rpki-rtr.c \
212	print-rsvp.c \
213	print-rt6.c \
214	print-rtsp.c \
215	print-rx.c \
216	print-sctp.c \
217	print-sflow.c \
218	print-sip.c \
219	print-sl.c \
220	print-sll.c \
221	print-slow.c \
222	print-smtp.c \
223	print-snmp.c \
224	print-someip.c \
225	print-ssh.c \
226	print-stp.c \
227	print-sunatm.c \
228	print-sunrpc.c \
229	print-symantec.c \
230	print-syslog.c \
231	print-tcp.c \
232	print-telnet.c \
233	print-tftp.c \
234	print-timed.c \
235	print-tipc.c \
236	print-token.c \
237	print-udld.c \
238	print-udp.c \
239	print-unsupported.c \
240	print-usb.c \
241	print-vjc.c \
242	print-vqp.c \
243	print-vrrp.c \
244	print-vsock.c \
245	print-vtp.c \
246	print-vxlan-gpe.c \
247	print-vxlan.c \
248	print-wb.c \
249	print-whois.c \
250	print-zep.c \
251	print-zephyr.c \
252	print-zeromq.c \
253	signature.c \
254	strtoaddr.c \
255	util-print.c
256
257LOCALSRC = @LOCALSRC@
258LIBOBJS = @LIBOBJS@
259
260LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) ${LOCALSRC:.c=.o} ${LIBOBJS}
261LIBNETDISSECT=libnetdissect.a
262
263
264SRC =	$(CSRC) $(LOCALSRC)
265
266# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
267# hack the extra indirection
268OBJ =	$(CSRC:.c=.o)
269HDR = \
270	addrtoname.h \
271	addrtostr.h \
272	af.h \
273	ah.h \
274	appletalk.h \
275	ascii_strcasecmp.h \
276	atm.h \
277	chdlc.h \
278	compiler-tests.h \
279	cpack.h \
280	diag-control.h \
281	ethertype.h \
282	extract.h \
283	fptype.h \
284	ftmacros.h \
285	funcattrs.h \
286	getservent.h \
287	gmpls.h \
288	interface.h \
289	ip.h \
290	ip6.h \
291	ipproto.h \
292	l2vpn.h \
293	llc.h \
294	machdep.h \
295	mib.h \
296	mpls.h \
297	nameser.h \
298	netdissect.h \
299	netdissect-alloc.h \
300	netdissect-ctype.h \
301	netdissect-stdinc.h \
302	nfs.h \
303	nfsfh.h \
304	nlpid.h \
305	ntp.h \
306	openflow.h \
307	ospf.h \
308	oui.h \
309	pcap-missing.h \
310	pflog.h \
311	ppp.h \
312	print.h \
313	rpc_auth.h \
314	rpc_msg.h \
315	signature.h \
316	slcompress.h \
317	smb.h \
318	status-exit-codes.h \
319	strtoaddr.h \
320	tcp.h \
321	timeval-operations.h \
322	udp.h \
323	varattrs.h
324
325TAGHDR = \
326	/usr/include/netinet/if_ether.h \
327	/usr/include/netinet/in.h
328
329TAGFILES = $(SRC) $(HDR) $(TAGHDR) $(LIBNETDISSECT_SRC) \
330	print-smb.c smbutil.c
331
332CLEANFILES = $(PROG) $(OBJ) $(LIBNETDISSECT_OBJ) print-smb.o smbutil.o
333
334EXTRA_DIST = \
335	CHANGES \
336	CMakeLists.txt \
337	CONTRIBUTING.md \
338	CREDITS \
339	INSTALL.md \
340	LICENSE \
341	Makefile-devel-adds \
342	Makefile.in \
343	README.md \
344	VERSION \
345	aclocal.m4 \
346	atime.awk \
347	bpf_dump.c \
348	cmake/Modules/FindCRYPTO.cmake \
349	cmake/Modules/FindPCAP.cmake \
350	cmake/Modules/FindSMI.cmake \
351	cmake_uninstall.cmake.in \
352	cmakeconfig.h.in \
353	config.guess \
354	config.h.in \
355	config.sub \
356	configure \
357	configure.ac \
358	doc/README.aix.md \
359	doc/README.NetBSD.md \
360	doc/README.solaris.md \
361	doc/README.Win32.md \
362	install-sh \
363	lbl/os-osf4.h \
364	lbl/os-solaris2.h \
365	lbl/os-sunos4.h \
366	lbl/os-ultrix4.h \
367	makemib \
368	missing/datalinks.c \
369	missing/dlnames.c \
370	missing/getopt_long.c \
371	missing/getopt_long.h \
372	missing/getservent.c \
373	missing/pcap_dump_ftell.c \
374	missing/snprintf.c \
375	missing/strdup.c \
376	missing/strlcat.c \
377	missing/strlcpy.c \
378	missing/strsep.c \
379	mkdep \
380	packetdat.awk \
381	print-smb.c \
382	send-ack.awk \
383	smbutil.c \
384	stime.awk \
385	tcpdump.1.in
386
387TEST_DIST= `git ls-files tests | grep -v 'tests/\..*'`
388
389RELEASE_FILES = $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST)
390
391all: $(PROG)
392
393$(PROG): $(OBJ) @V_PCAPDEP@ $(LIBNETDISSECT)
394	@rm -f $@
395	$(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBNETDISSECT) $(LIBS)
396
397$(LIBNETDISSECT): $(LIBNETDISSECT_OBJ)
398	@rm -f $@
399	$(AR) cr $@ $(LIBNETDISSECT_OBJ)
400	$(RANLIB) $@
401
402datalinks.o: $(srcdir)/missing/datalinks.c
403	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c
404dlnames.o: $(srcdir)/missing/dlnames.c
405	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/dlnames.c
406getservent.o: $(srcdir)/missing/getservent.c
407	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getservent.c
408getopt_long.o: $(srcdir)/missing/getopt_long.c
409	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getopt_long.c
410snprintf.o: $(srcdir)/missing/snprintf.c
411	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
412strdup.o: $(srcdir)/missing/strdup.c
413	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strdup.c
414strlcat.o: $(srcdir)/missing/strlcat.c
415	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
416strlcpy.o: $(srcdir)/missing/strlcpy.c
417	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
418strsep.o: $(srcdir)/missing/strsep.c
419	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strsep.c
420pcap_dump_ftell.o: $(srcdir)/missing/pcap_dump_ftell.c
421	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/pcap_dump_ftell.c
422
423install: all
424	[ -d $(DESTDIR)$(bindir) ] || \
425	    (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir))
426	$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(bindir)/$(PROG)
427	$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(bindir)/$(PROG).`cat ${srcdir}/VERSION`
428	[ -d $(DESTDIR)$(mandir)/man1 ] || \
429	    (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
430	$(INSTALL_DATA) $(PROG).1 $(DESTDIR)$(mandir)/man1/$(PROG).1
431
432uninstall:
433	rm -f $(DESTDIR)$(bindir)/$(PROG)
434	rm -f $(DESTDIR)$(bindir)/$(PROG).`cat ${srcdir}/VERSION`
435	rm -f $(DESTDIR)$(mandir)/man1/$(PROG).1
436
437lint:
438	lint -hbxn $(SRC) $(LIBNETDISSECT_SRC) | \
439	    grep -v 'struct/union .* never defined' | \
440	    grep -v 'possible pointer alignment problem'
441
442clean:
443	rm -f $(CLEANFILES) $(PROG)-`cat ${srcdir}/VERSION`.tar.gz
444
445distclean:
446	rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
447	    config.h os-proto.h stamp-h stamp-h.in $(PROG).1 \
448	    libnetdissect.a tests/.failed tests/.passed \
449	    tests/failure-outputs.txt
450	rm -rf autom4te.cache tests/DIFF tests/NEW
451
452check: tcpdump
453	$(srcdir)/tests/TESTrun
454
455extags: $(TAGFILES)
456	ctags $(TAGFILES)
457
458tags: $(TAGFILES)
459	ctags -wtd $(TAGFILES)
460
461TAGS: $(TAGFILES)
462	etags $(TAGFILES)
463
464releasetar:
465	@TAG=$(PROG)-`cat VERSION` && \
466	if git show-ref --tags --quiet --verify -- "refs/tags/$$TAG"; then \
467	    git archive --prefix="$$TAG"/ -o "$$TAG".tar.gz "$$TAG" \
468	    $(RELEASE_FILES) && \
469	    echo "Archive build from tag $$TAG."; \
470	else \
471	    git archive --prefix="$$TAG"/ -o "$$TAG".tar.gz HEAD \
472	    $(RELEASE_FILES) && \
473	    echo "No $$TAG tag. Archive build from HEAD."; \
474	fi
475
476releasecheck: releasetar
477	@TAG=$(PROG)-`cat VERSION` && \
478	INSTALL_DIR=/tmp/install_"$$TAG"_$$$$ && \
479	DIR=`pwd` && \
480	cd /tmp && \
481	rm -rf "$$TAG" && \
482	rm -rf "$$INSTALL_DIR" && \
483	tar xf "$$DIR"/"$$TAG".tar.gz && \
484	cd "$$TAG" && \
485	echo "[$@] $$ ./configure --enable-smb --quiet --prefix=$$INSTALL_DIR" && \
486	./configure --enable-smb --quiet --prefix="$$INSTALL_DIR" && \
487	echo '[$@] $$ make -s all check' && \
488	make -s all check >/dev/null && \
489	echo '[$@] $$ make -s install' && \
490	make -s install && \
491	cd .. && \
492	rm -rf "$$TAG" && \
493	rm -rf "$$INSTALL_DIR" && \
494	tar xf "$$DIR"/"$$TAG".tar.gz && \
495	cd "$$TAG" && \
496	mkdir build && \
497	cd build && \
498	echo '[$@] $$ cmake -DENABLE_SMB=yes [...] ..' && \
499	cmake -DENABLE_SMB=yes \
500	    -DCMAKE_INSTALL_PREFIX="$$INSTALL_DIR" \
501	    -DCMAKE_MESSAGE_LOG_LEVEL=NOTICE \
502	    -DCMAKE_RULE_MESSAGES=OFF \
503	    -DCMAKE_INSTALL_MESSAGE=NEVER \
504	    .. && \
505	echo '[$@] $$ make -s all check' && \
506	make -s all check >/dev/null && \
507	echo '[$@] $$ make -s install' && \
508	make -s install && \
509	cd ../.. && \
510	rm -rf "$$TAG" && \
511	rm -rf "$$INSTALL_DIR" && \
512	echo '[$@] Done.'
513
514whitespacecheck:
515	@# trailing space(s)?
516	@if git grep -I -n ' $$' $$(git ls-files|grep -v '^tests/'); then \
517	    echo 'Error: Trailing space(s).'; \
518	    exit 1; \
519	fi
520	@# trailing tab(s)?
521	@# install-sh has a tab at the end of one line
522	@if git grep -I -n '	$$' $$(git ls-files|grep -vE '^(tests/|install-sh$$)'); then \
523	    echo 'Error: Trailing tabs(s).'; \
524	    exit 1; \
525	fi
526	@# space(s) before tab(s)?
527	@if git grep -I -n '[ ][	]' $$(git ls-files|grep -v '^tests/'); then \
528	    echo 'Error: space(s) before tab(s).'; \
529	    exit 1; \
530	fi
531
532testlist:
533	echo $(TEST_DIST)
534
535depend:
536	$(MKDEP) -c "$(CC)" -m "$(DEPENDENCY_CFLAG)" -s "$(srcdir)" $(DEFS) $(INCLS) $(SRC) $(LIBNETDISSECT_SRC)
537
538shellcheck:
539	shellcheck -f gcc -e SC2006 build.sh build_matrix.sh build_common.sh
540