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