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