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