1#  Copyright (c) 1993, 1994, 1995, 1996
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 configure program
29bindir = @bindir@
30# Pathname of directory to install the rpcapd daemon
31sbindir = @sbindir@
32# Pathname of directory to install the include files
33includedir = @includedir@
34# Pathname of directory to install the library
35libdir =  @libdir@
36# Pathname of directory to install the man pages
37mandir = @mandir@
38
39# VPATH
40srcdir = @srcdir@
41VPATH = @srcdir@
42
43#
44# You shouldn't need to edit anything below.
45#
46
47LD = /usr/bin/ld
48CC = @CC@
49AR = @AR@
50LN_S = @LN_S@
51MKDEP = @MKDEP@
52CCOPT = @V_CCOPT@
53SHLIB_CCOPT = @V_SHLIB_CCOPT@
54INCLS = -I. @V_INCLS@
55DEFS = -DBUILDING_PCAP -Dpcap_EXPORTS @DEFS@ @V_DEFS@
56ADDLOBJS = @ADDLOBJS@
57ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@
58LIBS = @LIBS@
59CROSSFLAGS=
60CFLAGS = @CFLAGS@   ${CROSSFLAGS}
61LDFLAGS = @LDFLAGS@ ${CROSSFLAGS}
62DYEXT = @DYEXT@
63V_RPATH_OPT = @V_RPATH_OPT@
64DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
65PROG=libpcap
66PTHREAD_LIBS=@PTHREAD_LIBS@
67BUILD_RPCAPD=@BUILD_RPCAPD@
68INSTALL_RPCAPD=@INSTALL_RPCAPD@
69EXTRA_NETWORK_LIBS=@EXTRA_NETWORK_LIBS@
70
71# Standard CFLAGS for building members of a shared library
72FULL_CFLAGS = -I. $(CCOPT) @V_LIB_CCOPT_FAT@ $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
73
74INSTALL = @INSTALL@
75INSTALL_PROGRAM = @INSTALL_PROGRAM@
76INSTALL_DATA = @INSTALL_DATA@
77RANLIB = @RANLIB@
78
79# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
80# Also, gcc does not remove the .o before forking 'as', which can be a
81# problem if you don't own the file but can write to the directory.
82.c.o:
83	@rm -f $@
84	$(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
85
86PSRC =	pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @NETFILTER_SRC@ @DBUS_SRC@ @NETMAP_SRC@ @RDMA_SRC@
87FSRC =  @V_FINDALLDEVS@
88SSRC =  @SSRC@
89CSRC =	pcap.c gencode.c optimize.c nametoaddr.c etherent.c \
90	fmtutils.c \
91	savefile.c sf-pcap.c sf-pcapng.c pcap-common.c \
92	bpf_image.c bpf_filter.c bpf_dump.c
93GENSRC = scanner.c grammar.c
94LIBOBJS = @LIBOBJS@
95
96SRC =	$(PSRC) $(FSRC) $(CSRC) $(SSRC) $(GENSRC)
97
98# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
99# hack the extra indirection
100OBJ =	$(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
101PUBHDR = \
102	pcap.h \
103	pcap-bpf.h \
104	pcap-namedb.h \
105	pcap/bpf.h \
106	pcap/bluetooth.h \
107	pcap/can_socketcan.h \
108	pcap/compiler-tests.h \
109	pcap/dlt.h \
110	pcap/funcattrs.h \
111	pcap/pcap-inttypes.h \
112	pcap/ipnet.h \
113	pcap/namedb.h \
114	pcap/nflog.h \
115	pcap/pcap.h \
116	pcap/sll.h \
117	pcap/socket.h \
118	pcap/vlan.h \
119	pcap/usb.h
120
121HDR = $(PUBHDR) \
122	arcnet.h \
123	atmuni31.h \
124	diag-control.h \
125	ethertype.h \
126	extract.h \
127	fmtutils.h \
128	ftmacros.h \
129	gencode.h \
130	ieee80211.h \
131	llc.h \
132	nametoaddr.h \
133	nlpid.h \
134	optimize.h \
135	pcap-common.h \
136	pcap-int.h \
137	pcap-rpcap.h \
138	pcap-types.h \
139	portability.h \
140	ppp.h \
141	rpcap-protocol.h \
142	sf-pcap.h \
143	sf-pcapng.h \
144	sunatmpos.h \
145	varattrs.h
146
147GENHDR = \
148	scanner.h grammar.h
149
150TAGFILES = \
151	$(SRC) $(HDR)
152
153CLEANFILES = $(OBJ) libpcap.a libpcap.so.`cat $(srcdir)/VERSION` \
154	$(PROG)-`cat $(srcdir)/VERSION`.tar.gz \
155	lex.yy.c pcap-config libpcap.pc
156
157MAN1 = pcap-config.1
158
159MAN3PCAP_EXPAND = \
160	pcap.3pcap.in \
161	pcap_compile.3pcap.in \
162	pcap_datalink.3pcap.in \
163	pcap_dump_open.3pcap.in \
164	pcap_get_tstamp_precision.3pcap.in \
165	pcap_list_datalinks.3pcap.in \
166	pcap_list_tstamp_types.3pcap.in \
167	pcap_open_dead.3pcap.in \
168	pcap_open_offline.3pcap.in \
169	pcap_set_immediate_mode.3pcap.in \
170	pcap_set_tstamp_precision.3pcap.in \
171	pcap_set_tstamp_type.3pcap.in
172
173MAN3PCAP_NOEXPAND = \
174	pcap_activate.3pcap \
175	pcap_breakloop.3pcap \
176	pcap_can_set_rfmon.3pcap \
177	pcap_close.3pcap \
178	pcap_create.3pcap \
179	pcap_datalink_name_to_val.3pcap \
180	pcap_datalink_val_to_name.3pcap \
181	pcap_dump.3pcap \
182	pcap_dump_close.3pcap \
183	pcap_dump_file.3pcap \
184	pcap_dump_flush.3pcap \
185	pcap_dump_ftell.3pcap \
186	pcap_file.3pcap \
187	pcap_fileno.3pcap \
188	pcap_findalldevs.3pcap \
189	pcap_freecode.3pcap \
190	pcap_get_required_select_timeout.3pcap \
191	pcap_get_selectable_fd.3pcap \
192	pcap_geterr.3pcap \
193	pcap_inject.3pcap \
194	pcap_is_swapped.3pcap \
195	pcap_lib_version.3pcap \
196	pcap_lookupdev.3pcap \
197	pcap_lookupnet.3pcap \
198	pcap_loop.3pcap \
199	pcap_major_version.3pcap \
200	pcap_next_ex.3pcap \
201	pcap_offline_filter.3pcap \
202	pcap_open_live.3pcap \
203	pcap_set_buffer_size.3pcap \
204	pcap_set_datalink.3pcap \
205	pcap_set_promisc.3pcap \
206	pcap_set_protocol_linux.3pcap \
207	pcap_set_rfmon.3pcap \
208	pcap_set_snaplen.3pcap \
209	pcap_set_timeout.3pcap \
210	pcap_setdirection.3pcap \
211	pcap_setfilter.3pcap \
212	pcap_setnonblock.3pcap \
213	pcap_snapshot.3pcap \
214	pcap_stats.3pcap \
215	pcap_statustostr.3pcap \
216	pcap_strerror.3pcap \
217	pcap_tstamp_type_name_to_val.3pcap \
218	pcap_tstamp_type_val_to_name.3pcap
219
220MAN3PCAP = $(MAN3PCAP_NOEXPAND) $(MAN3PCAP_EXPAND:.in=)
221
222MANFILE = \
223	pcap-savefile.manfile.in
224
225MANMISC = \
226	pcap-filter.manmisc.in \
227	pcap-linktype.manmisc.in \
228	pcap-tstamp.manmisc.in
229
230EXTRA_DIST = \
231	CHANGES \
232	ChmodBPF/ChmodBPF \
233	ChmodBPF/StartupParameters.plist \
234	CREDITS \
235	CMakeLists.txt \
236	INSTALL.md \
237	LICENSE \
238	Makefile.in \
239	Makefile-devel-adds \
240	README.md \
241	doc \
242	CONTRIBUTING.md \
243	TODO \
244	VERSION \
245	aclocal.m4 \
246	chmod_bpf \
247	cmake_uninstall.cmake.in \
248	cmakeconfig.h.in \
249	cmake/Modules/FindDAG.cmake \
250	cmake/Modules/FindFseeko.cmake \
251	cmake/Modules/FindLFS.cmake \
252	cmake/Modules/FindPacket.cmake \
253	cmake/Modules/FindSNF.cmake \
254	cmake/Modules/FindTC.cmake \
255	cmake/have_siocglifconf.c \
256	config.guess \
257	config.h.in \
258	config.sub \
259	configure \
260	configure.ac \
261	dlpisubs.c \
262	dlpisubs.h \
263	fad-getad.c \
264	fad-gifc.c \
265	fad-glifc.c \
266	grammar.y \
267	install-sh \
268	lbl/os-aix4.h \
269	lbl/os-aix7.h \
270	lbl/os-hpux11.h \
271	lbl/os-osf4.h \
272	lbl/os-osf5.h \
273	lbl/os-solaris2.h \
274	lbl/os-sunos4.h \
275	lbl/os-ultrix4.h \
276	libpcap.pc.in \
277	missing/asprintf.c \
278	missing/getopt.c \
279	missing/getopt.h \
280	missing/snprintf.c \
281	missing/strlcat.c \
282	missing/strlcpy.c \
283	missing/strtok_r.c \
284	missing/win_asprintf.c \
285	missing/win_snprintf.c \
286	mkdep \
287	msdos/bin2c.c \
288	msdos/makefile \
289	msdos/makefile.dj \
290	msdos/makefile.wc \
291	msdos/pkt_rx0.asm \
292	msdos/pkt_rx1.s \
293	msdos/pktdrvr.c \
294	msdos/pktdrvr.h \
295	msdos/readme.dos \
296	nomkdep \
297	org.tcpdump.chmod_bpf.plist \
298	pcap-bpf.c \
299	pcap-bt-linux.c \
300	pcap-bt-linux.h \
301	pcap-bt-monitor-linux.c \
302	pcap-bt-monitor-linux.h \
303	pcap-config.in \
304	pcap-dag.c \
305	pcap-dag.h \
306	pcap-dbus.c \
307	pcap-dbus.h \
308	pcap-dll.rc \
309	pcap-dlpi.c \
310	pcap-dos.c \
311	pcap-dos.h \
312	pcap-enet.c \
313	pcap-int.h \
314	pcap-libdlpi.c \
315	pcap-linux.c \
316	pcap-namedb.h \
317	pcap-new.c \
318	pcap-netfilter-linux.c \
319	pcap-netfilter-linux.h \
320	pcap-netmap.c \
321	pcap-netmap.h \
322	pcap-nit.c \
323	pcap-npf.c \
324	pcap-null.c \
325	pcap-pf.c \
326	pcap-rdmasniff.c \
327	pcap-rdmasniff.h \
328	pcap-rpcap.c \
329	pcap-rpcap-int.h \
330	pcap-septel.c \
331	pcap-septel.h \
332	pcap-sita.h \
333	pcap-sita.c \
334	pcap-sita.html \
335	pcap-snf.c \
336	pcap-snf.h \
337	pcap-snit.c \
338	pcap-snoop.c \
339	pcap-tc.c \
340	pcap-tc.h \
341	pcap-usb-linux.c \
342	pcap-usb-linux.h \
343	rpcap-protocol.c \
344	rpcapd/CMakeLists.txt \
345	rpcapd/Makefile.in \
346	rpcapd/config_params.h \
347	rpcapd/daemon.h \
348	rpcapd/daemon.c \
349	rpcapd/fileconf.c \
350	rpcapd/fileconf.h \
351	rpcapd/log.h \
352	rpcapd/log.c \
353	rpcapd/org.tcpdump.rpcapd.plist \
354	rpcapd/rpcapd.c \
355	rpcapd/rpcapd.h \
356	rpcapd/rpcapd.inetd.conf \
357	rpcapd/rpcapd.manadmin.in \
358	rpcapd/rpcapd-config.manfile.in \
359	rpcapd/rpcapd.rc \
360	rpcapd/rpcapd.socket \
361	rpcapd/rpcapd.xinetd.conf \
362	rpcapd/rpcapd@.service \
363	rpcapd/win32-svc.c \
364	rpcapd/win32-svc.h \
365	sockutils.c \
366	sockutils.h \
367	scanner.l \
368	testprogs/CMakeLists.txt \
369	testprogs/Makefile.in \
370	testprogs/can_set_rfmon_test.c \
371	testprogs/capturetest.c \
372	testprogs/filtertest.c \
373	testprogs/findalldevstest.c \
374	testprogs/opentest.c \
375	testprogs/reactivatetest.c \
376	testprogs/selpolltest.c \
377	testprogs/threadsignaltest.c \
378	testprogs/unix.h \
379	testprogs/valgrindtest.c \
380	tests/shb-option-too-long.pcapng \
381	Win32/Prj/wpcap.sln \
382	Win32/Prj/wpcap.vcxproj \
383	Win32/Prj/wpcap.vcxproj.filters
384
385all: libpcap.a shared $(BUILD_RPCAPD) libpcap.pc pcap-config
386
387# Inhibit implicit rule Make seems to have for using yacc/lex to
388# recompile new scanner.c/grammar.c -- we ship ones which we want to
389# use instead.
390grammar.c:
391	echo "Not rebuilding grammar.c"
392
393scanner.c:
394	echo "Not rebuilding scanner.c"
395
396libpcap.a: $(OBJ)
397	@rm -f $@
398	$(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
399	$(RANLIB) $@
400
401shared: libpcap.$(DYEXT)
402
403libpcap.so: $(OBJ)
404	@rm -f $@
405	VER=`cat $(srcdir)/VERSION`; \
406	MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
407	@V_SHLIB_CMD@ $(LDFLAGS) @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER \
408	    -o $@.$$VER $(OBJ) $(ADDLOBJS) $(LIBS)
409
410#
411# The following rule succeeds, but the result is untested.
412#
413# In macOS, the libpcap dylib has the name "libpcap.A.dylib", with its
414# full path as the install_name, and with the compatibility and current
415# version both set to 1.  The compatibility version is set to 1 so that
416# programs built with a newer version of the library will run against
417# older versions if they don't use APIs available in the newer version
418# but not in the older version.
419#
420# We also use "A" as the major version, and 1 as the compatibility version,
421# but set the current version to the value in VERSION, with any non-numeric
422# stuff stripped off (the compatibility and current version must be of the
423# form X[.Y[.Z]], with Y and Z possibly absent, and with all components
424# numeric).
425#
426libpcap.dylib: $(OBJ)
427	rm -f libpcap*.dylib
428	VER=`cat $(srcdir)/VERSION`; \
429	MAJOR_VER=A; \
430	COMPAT_VER=1; \
431	CURRENT_VER=`sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`; \
432	$(CC) -dynamiclib -undefined error $(LDFLAGS) @V_LIB_LDFLAGS_FAT@ \
433	    -o libpcap.$$VER.dylib $(OBJ) $(ADDLOBJS) $(LIBS) \
434	    -install_name $(libdir)/libpcap.$$MAJOR_VER.dylib \
435	    -compatibility_version $$COMPAT_VER \
436	    -current_version $$CURRENT_VER
437
438#
439# The HP-UX linker manual says that the convention for a versioned library
440# is libXXX.{number}, not libXXX.sl.{number}.  That appears to be the case
441# on at least one HP-UX 11.00 system; libXXX.sl is a symlink to
442# libXXX.{number}.
443#
444# The manual also says "library-level versioning" (think "sonames") was
445# added in HP-UX 10.0.
446#
447# XXX - this assumes we're using the HP linker, rather than the GNU
448# linker, even with GCC.
449#
450libpcap.sl: $(OBJ)
451	@MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
452	rm -f libpcap.$$MAJOR_VER
453	MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
454	ld -b $(LDFLAGS) -o libpcap.$$MAJOR_VER +h libpcap.$$MAJOR_VER \
455	    $(OBJ) $(ADDLOBJS) $(LIBS)
456
457#
458# AIX is different from everybody else.  A shared library is an archive
459# library with one or more shared-object components.  We still build a
460# normal static archive library on AIX, for the benefit of the traditional
461# scheme of building libpcap and tcpdump in subdirectories of the
462# same directory, with tcpdump statically linked with the libpcap
463# in question, but we also build a shared library as "libpcap.shareda"
464# and install *it*, rather than the static library, as "libpcap.a".
465#
466libpcap.shareda: $(OBJ)
467	@rm -f $@ shr.o
468	$(CC) $(LDFLAGS) @V_SHLIB_OPT@ -o shr.o $(OBJ) $(ADDLOBJS) $(LIBS)
469	$(AR) rc $@ shr.o
470
471#
472# For platforms that don't support shared libraries (or on which we
473# don't support shared libraries).
474#
475libpcap.none:
476
477scanner.o: scanner.c grammar.h
478	$(CC) $(FULL_CFLAGS) -c scanner.c
479
480grammar.o: grammar.c scanner.h
481	$(CC) $(FULL_CFLAGS) -c grammar.c
482
483gencode.o: $(srcdir)/gencode.c grammar.h scanner.h
484	$(CC) $(FULL_CFLAGS) -c $(srcdir)/gencode.c
485
486asprintf.o: $(srcdir)/missing/asprintf.c
487	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/asprintf.c
488
489snprintf.o: $(srcdir)/missing/snprintf.c
490	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
491
492strlcat.o: $(srcdir)/missing/strlcat.c
493	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
494
495strlcpy.o: $(srcdir)/missing/strlcpy.c
496	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
497
498strtok_r.o: $(srcdir)/missing/strtok_r.c
499	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strtok_r.c
500
501#
502# Generate the libpcap.pc file.
503#
504# Some Makes, e.g. AIX Make and Solaris Make, can't handle "--file=$@.tmp:$<";
505# for example, the Solaris 9 make man page says
506#
507#	Because make assigns $< and $* as it would for implicit rules
508#	(according to the suffixes list and the directory contents),
509#	they may be unreliable when used within explicit target entries.
510#
511# and this is an explicit target entry.
512#
513# Therefore, instead of using $<, we explicitly put in $(srcdir)/libpcap.pc.in.
514#
515libpcap.pc: $(srcdir)/libpcap.pc.in ./config.status
516	@rm -f $@ $@.tmp
517	./config.status --file=$@.tmp:$(srcdir)/libpcap.pc.in
518	mv $@.tmp $@
519	chmod a+x $@
520
521#
522# Generate the pcap-config script.  See above.
523#
524pcap-config: $(srcdir)/pcap-config.in ./config.status
525	@rm -f $@ $@.tmp
526	./config.status --file=$@.tmp:$(srcdir)/pcap-config.in
527	mv $@.tmp $@
528	chmod a+x $@
529
530#
531# Remote pcap daemon.
532#
533build-rpcapd: libpcap.a
534	cd rpcapd; $(MAKE)
535
536#
537# Test programs - not built by default, and not installed.
538#
539testprogs: FORCE
540	cd testprogs; $(MAKE)
541
542FORCE:
543
544install: install-shared install-archive libpcap.pc pcap-config @INSTALL_RPCAPD@
545	[ -d $(DESTDIR)$(libdir) ] || \
546	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
547	[ -d $(DESTDIR)$(includedir) ] || \
548	    (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
549	[ -d $(DESTDIR)$(includedir)/pcap ] || \
550	    (mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
551	[ -d $(DESTDIR)$(mandir)/man1 ] || \
552	    (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
553	[ -d $(DESTDIR)$(mandir)/man3 ] || \
554	    (mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
555	[ -d $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@ ] || \
556	    (mkdir -p $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@)
557	[ -d $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@ ] || \
558	    (mkdir -p $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@)
559	for i in $(PUBHDR); do \
560		$(INSTALL_DATA) $(srcdir)/$$i \
561		    $(DESTDIR)$(includedir)/$$i; done
562	[ -d $(DESTDIR)$(bindir) ] || \
563	    (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir))
564	$(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config
565	[ -d $(DESTDIR)$(libdir)/pkgconfig ] || \
566	    (mkdir -p $(DESTDIR)$(libdir)/pkgconfig; chmod 755 $(DESTDIR)$(libdir)/pkgconfig)
567	$(INSTALL_DATA) libpcap.pc $(DESTDIR)$(libdir)/pkgconfig/libpcap.pc
568	for i in $(MAN1); do \
569		$(INSTALL_DATA) $(srcdir)/$$i \
570		    $(DESTDIR)$(mandir)/man1/$$i; done
571	for i in $(MAN3PCAP_NOEXPAND); do \
572		$(INSTALL_DATA) $(srcdir)/$$i \
573		    $(DESTDIR)$(mandir)/man3/$$i; done
574	for i in $(MAN3PCAP_EXPAND:.in=); do \
575		$(INSTALL_DATA) $$i \
576		    $(DESTDIR)$(mandir)/man3/$$i; done
577	(cd $(DESTDIR)$(mandir)/man3 && \
578	rm -f pcap_datalink_val_to_description.3pcap && \
579	$(LN_S) pcap_datalink_val_to_name.3pcap \
580		 pcap_datalink_val_to_description.3pcap && \
581	rm -f pcap_datalink_val_to_description_or_dlt.3pcap && \
582	$(LN_S) pcap_datalink_val_to_name.3pcap \
583		 pcap_datalink_val_to_description_or_dlt.3pcap && \
584	rm -f pcap_dump_fopen.3pcap && \
585	$(LN_S) pcap_dump_open.3pcap pcap_dump_fopen.3pcap && \
586	rm -f pcap_freealldevs.3pcap && \
587	$(LN_S) pcap_findalldevs.3pcap pcap_freealldevs.3pcap && \
588	rm -f pcap_perror.3pcap && \
589	$(LN_S) pcap_geterr.3pcap pcap_perror.3pcap && \
590	rm -f pcap_sendpacket.3pcap && \
591	$(LN_S) pcap_inject.3pcap pcap_sendpacket.3pcap && \
592	rm -f pcap_free_datalinks.3pcap && \
593	$(LN_S) pcap_list_datalinks.3pcap pcap_free_datalinks.3pcap && \
594	rm -f pcap_free_tstamp_types.3pcap && \
595	$(LN_S) pcap_list_tstamp_types.3pcap pcap_free_tstamp_types.3pcap && \
596	rm -f pcap_dispatch.3pcap && \
597	$(LN_S) pcap_loop.3pcap pcap_dispatch.3pcap && \
598	rm -f pcap_minor_version.3pcap && \
599	$(LN_S) pcap_major_version.3pcap pcap_minor_version.3pcap && \
600	rm -f pcap_next.3pcap && \
601	$(LN_S) pcap_next_ex.3pcap pcap_next.3pcap && \
602	rm -f pcap_open_dead_with_tstamp_precision.3pcap && \
603	$(LN_S) pcap_open_dead.3pcap \
604		 pcap_open_dead_with_tstamp_precision.3pcap && \
605	rm -f pcap_open_offline_with_tstamp_precision.3pcap && \
606	$(LN_S) pcap_open_offline.3pcap pcap_open_offline_with_tstamp_precision.3pcap && \
607	rm -f pcap_fopen_offline.3pcap && \
608	$(LN_S) pcap_open_offline.3pcap pcap_fopen_offline.3pcap && \
609	rm -f pcap_fopen_offline_with_tstamp_precision.3pcap && \
610	$(LN_S) pcap_open_offline.3pcap pcap_fopen_offline_with_tstamp_precision.3pcap && \
611	rm -f pcap_tstamp_type_val_to_description.3pcap && \
612	$(LN_S) pcap_tstamp_type_val_to_name.3pcap pcap_tstamp_type_val_to_description.3pcap && \
613	rm -f pcap_getnonblock.3pcap && \
614	$(LN_S) pcap_setnonblock.3pcap pcap_getnonblock.3pcap)
615	for i in $(MANFILE); do \
616		$(INSTALL_DATA) `echo $$i | sed 's/.manfile.in/.manfile/'` \
617		    $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
618	for i in $(MANMISC); do \
619		$(INSTALL_DATA) `echo $$i | sed 's/.manmisc.in/.manmisc/'` \
620		    $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
621
622install-shared: install-shared-$(DYEXT)
623install-shared-so: libpcap.so
624	[ -d $(DESTDIR)$(libdir) ] || \
625	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
626	VER=`cat $(srcdir)/VERSION`; \
627	MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
628	$(INSTALL_PROGRAM) libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
629	ln -sf libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
630	ln -sf libpcap.so.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.so
631install-shared-dylib: libpcap.dylib
632	[ -d $(DESTDIR)$(libdir) ] || \
633	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
634	VER=`cat $(srcdir)/VERSION`; \
635	MAJOR_VER=A; \
636	$(INSTALL_PROGRAM) libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
637	ln -sf libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
638	ln -sf libpcap.$$MAJOR_VER.dylib $(DESTDIR)$(libdir)/libpcap.dylib
639install-shared-sl: libpcap.sl
640	[ -d $(DESTDIR)$(libdir) ] || \
641	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
642	MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
643	$(INSTALL_PROGRAM) libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)
644	ln -sf libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.sl
645install-shared-shareda: libpcap.shareda
646	#
647	# AIX shared libraries are weird.  They're archive libraries
648	# with one or more shared object components.
649	#
650	[ -d $(DESTDIR)$(libdir) ] || \
651	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
652	$(INSTALL_PROGRAM) libpcap.shareda $(DESTDIR)$(libdir)/libpcap.a
653install-shared-none:
654
655install-archive: install-archive-$(DYEXT)
656install-archive-so install-archive-dylib install-archive-sl install-archive-none: libpcap.a
657	#
658	# Most platforms have separate suffixes for shared and
659	# archive libraries, so we install both.
660	#
661	[ -d $(DESTDIR)$(libdir) ] || \
662	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
663	$(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
664	$(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
665install-archive-shareda:
666	#
667	# AIX, however, doesn't, so we don't install the archive
668	# library on AIX.
669	#
670
671install-rpcapd:
672	cd rpcapd; $(MAKE) DESTDIR=$(DESTDIR) install
673
674uninstall: uninstall-shared uninstall-rpcapd
675	rm -f $(DESTDIR)$(libdir)/libpcap.a
676	for i in $(PUBHDR); do \
677		rm -f $(DESTDIR)$(includedir)/$$i; done
678	-rmdir $(DESTDIR)$(includedir)/pcap
679	rm -f $(DESTDIR)/$(libdir)/pkgconfig/libpcap.pc
680	rm -f $(DESTDIR)/$(bindir)/pcap-config
681	for i in $(MAN1); do \
682		rm -f $(DESTDIR)$(mandir)/man1/$$i; done
683	for i in $(MAN3PCAP); do \
684		rm -f $(DESTDIR)$(mandir)/man3/$$i; done
685	rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
686	rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
687	rm -f $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap
688	rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
689	rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
690	rm -f $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap
691	rm -f $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap
692	rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
693	rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
694	rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
695	rm -f $(DESTDIR)$(mandir)/man3/pcap_open_dead_with_tstamp_precision.3pcap
696	rm -f $(DESTDIR)$(mandir)/man3/pcap_open_offline_with_tstamp_precision.3pcap
697	rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
698	rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline_with_tstamp_precision.3pcap
699	rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
700	rm -f $(DESTDIR)$(mandir)/man3/pcap_tstamp_type_val_to_description.3pcap
701	for i in $(MANFILE); do \
702		rm -f $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
703	for i in $(MANMISC); do \
704		rm -f $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
705
706uninstall-shared: uninstall-shared-$(DYEXT)
707uninstall-shared-so:
708	VER=`cat $(srcdir)/VERSION`; \
709	MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
710	rm -f $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
711	rm -f $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
712	rm -f $(DESTDIR)$(libdir)/libpcap.so
713uninstall-shared-dylib:
714	VER=`cat $(srcdir)/VERSION`; \
715	MAJOR_VER=A; \
716	rm -f $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
717	rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
718	rm -f $(DESTDIR)$(libdir)/libpcap.dylib
719uninstall-shared-sl:
720	MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
721	rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER; \
722	rm -f $(DESTDIR)$(libdir)/libpcap.sl
723uninstall-shared-shareda:
724	rm -f $(DESTDIR)$(libdir)/libpcap.a
725uninstall-shared-none:
726
727uninstall-rpcapd:
728	cd rpcapd; $(MAKE) DESTDIR=$(DESTDIR) uninstall
729
730clean:
731	rm -f $(CLEANFILES)
732
733distclean: clean
734	rm -f Makefile config.cache config.log config.status \
735	    config.h gnuc.h net os-proto.h libpcap.pc \
736	    pcap-config stamp-h stamp-h.in
737	rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=)
738	rm -rf autom4te.cache
739
740extags: $(TAGFILES)
741	ctags $(TAGFILES)
742
743tags: $(TAGFILES)
744	ctags -wtd $(TAGFILES)
745
746releasetar:
747	@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
748	   mkdir $$name; \
749	   tar -c --exclude='*~' -f - $(CSRC) $(HDR) $(MAN1) $(MAN3PCAP_EXPAND) \
750	      $(MAN3PCAP_NOEXPAND) $(MANFILE) $(MANMISC) $(EXTRA_DIST) | \
751	      (cd $$name; tar xf -); \
752	   tar -c -z -f $$name.tar.gz $$name; \
753	   rm -rf $$name
754
755depend:	$(GENSRC) $(GENHDR)
756	$(MKDEP) -c "$(CC)" -m "$(DEPENDENCY_CFLAG)" $(CFLAGS) $(DEFS) $(INCLS) $(SRC)
757