Makefile.in revision 214518
1278139Smarkj#  Copyright (c) 1993, 1994, 1995, 1996
2210753Srpaulo# 	The Regents of the University of California.  All rights reserved.
3210753Srpaulo#
4210753Srpaulo#  Redistribution and use in source and binary forms, with or without
5210753Srpaulo#  modification, are permitted provided that: (1) source code distributions
6210753Srpaulo#  retain the above copyright notice and this paragraph in its entirety, (2)
7210753Srpaulo#  distributions including binary code include the above copyright notice and
8210753Srpaulo#  this paragraph in its entirety in the documentation or other materials
9210753Srpaulo#  provided with the distribution, and (3) all advertising materials mentioning
10210753Srpaulo#  features or use of this software display the following acknowledgement:
11210753Srpaulo#  ``This product includes software developed by the University of California,
12210753Srpaulo#  Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13210753Srpaulo#  the University nor the names of its contributors may be used to endorse
14210753Srpaulo#  or promote products derived from this software without specific prior
15210753Srpaulo#  written permission.
16210753Srpaulo#  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17210753Srpaulo#  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18210753Srpaulo#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19210753Srpaulo#
20210753Srpaulo# @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.142 2008-11-22 17:30:24 guy Exp $ (LBL)
21210753Srpaulo
22210753Srpaulo#
23210753Srpaulo# Various configurable paths (remember to edit Makefile.in, not Makefile)
24210753Srpaulo#
25210753Srpaulo
26210753Srpaulo# Top level hierarchy
27210753Srpauloprefix = @prefix@
28210753Srpauloexec_prefix = @exec_prefix@
29210753Srpaulodatarootdir = @datarootdir@
30# Pathname of directory to install the configure program
31bindir = @bindir@
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@
49CCOPT = @V_CCOPT@
50INCLS = -I. @V_INCLS@
51DEFS = @DEFS@ @V_DEFS@
52ADDLOBJS = @ADDLOBJS@
53ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@
54LIBS = @LIBS@
55LDFLAGS = @LDFLAGS@
56DYEXT = @DYEXT@
57V_RPATH_OPT = @V_RPATH_OPT@
58PROG=libpcap
59
60# Standard CFLAGS
61CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
62
63INSTALL = @INSTALL@
64INSTALL_PROGRAM = @INSTALL_PROGRAM@
65INSTALL_DATA = @INSTALL_DATA@
66RANLIB = @RANLIB@
67
68#
69# Flex and bison allow you to specify the prefixes of the global symbols
70# used by the generated parser.  This allows programs to use lex/yacc
71# and link against libpcap.  If you don't have flex or bison, get them.
72#
73LEX = @V_LEX@
74YACC = @V_YACC@
75
76# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
77# Also, gcc does not remove the .o before forking 'as', which can be a
78# problem if you don't own the file but can write to the directory.
79.c.o:
80	@rm -f $@
81	$(CC) $(CFLAGS) -c $(srcdir)/$*.c
82
83PSRC =	pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@
84FSRC =  fad-@V_FINDALLDEVS@.c
85SSRC =  @SSRC@
86CSRC =	pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c \
87	savefile.c sf-pcap.c sf-pcap-ng.c pcap-common.c \
88	bpf_image.c bpf_dump.c
89GENSRC = scanner.c grammar.c bpf_filter.c version.c
90LIBOBJS = @LIBOBJS@
91
92SRC =	$(PSRC) $(FSRC) $(CSRC) $(SSRC) $(GENSRC)
93
94# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
95# hack the extra indirection
96OBJ =	$(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
97PUBHDR = \
98	pcap.h \
99	pcap-bpf.h \
100	pcap-namedb.h \
101	pcap/bpf.h \
102	pcap/bluetooth.h \
103	pcap/ipnet.h \
104	pcap/namedb.h \
105	pcap/pcap.h \
106	pcap/sll.h \
107	pcap/vlan.h \
108	pcap/usb.h
109
110HDR = $(PUBHDR) \
111	arcnet.h \
112	atmuni31.h \
113	ethertype.h \
114	gencode.h \
115	ieee80211.h \
116	llc.h \
117	nlpid.h \
118	pcap-common.h \
119	pcap-int.h \
120	pcap-stdinc.h \
121	ppp.h \
122	sf-pcap.h \
123	sf-pcap-ng.h \
124	sunatmpos.h
125
126GENHDR = \
127	scanner.h tokdefs.h version.h
128
129TAGFILES = \
130	$(SRC) $(HDR)
131
132CLEANFILES = $(OBJ) libpcap.* filtertest findalldevstest selpolltest \
133	opentest $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
134	lex.yy.c pcap-config
135
136MAN1 = pcap-config.1
137
138MAN3PCAP_EXPAND = \
139	pcap.3pcap.in \
140	pcap_compile.3pcap.in \
141	pcap_datalink.3pcap.in \
142	pcap_dump_open.3pcap.in \
143	pcap_list_datalinks.3pcap.in \
144	pcap_open_dead.3pcap.in \
145	pcap_open_offline.3pcap.in
146
147MAN3PCAP_NOEXPAND = \
148	pcap_activate.3pcap \
149	pcap_breakloop.3pcap \
150	pcap_can_set_rfmon.3pcap \
151	pcap_close.3pcap \
152	pcap_create.3pcap \
153	pcap_datalink_name_to_val.3pcap \
154	pcap_datalink_val_to_name.3pcap \
155	pcap_dump.3pcap \
156	pcap_dump_close.3pcap \
157	pcap_dump_file.3pcap \
158	pcap_dump_flush.3pcap \
159	pcap_dump_ftell.3pcap \
160	pcap_file.3pcap \
161	pcap_fileno.3pcap \
162	pcap_findalldevs.3pcap \
163	pcap_freealldevs.3pcap \
164	pcap_freecode.3pcap \
165	pcap_free_datalinks.3pcap \
166	pcap_get_selectable_fd.3pcap \
167	pcap_geterr.3pcap \
168	pcap_inject.3pcap \
169	pcap_is_swapped.3pcap \
170	pcap_lib_version.3pcap \
171	pcap_lookupdev.3pcap \
172	pcap_lookupnet.3pcap \
173	pcap_loop.3pcap \
174	pcap_major_version.3pcap \
175	pcap_next_ex.3pcap \
176	pcap_offline_filter.3pcap \
177	pcap_open_live.3pcap \
178	pcap_set_buffer_size.3pcap \
179	pcap_set_datalink.3pcap \
180	pcap_set_promisc.3pcap \
181	pcap_set_rfmon.3pcap \
182	pcap_set_snaplen.3pcap \
183	pcap_set_timeout.3pcap \
184	pcap_setdirection.3pcap \
185	pcap_setfilter.3pcap \
186	pcap_setnonblock.3pcap \
187	pcap_snapshot.3pcap \
188	pcap_stats.3pcap \
189	pcap_statustostr.3pcap \
190	pcap_strerror.3pcap
191
192MAN3PCAP = $(MAN3PCAP_NOEXPAND) $(MAN3PCAP_EXPAND:.in=)
193
194MANFILE = \
195	pcap-savefile.manfile.in
196
197MANMISC = \
198	pcap-filter.manmisc.in \
199	pcap-linktype.manmisc.in
200
201EXTRA_DIST = \
202	CHANGES \
203	ChmodBPF/ChmodBPF \
204	ChmodBPF/StartupParameters.plist \
205	CREDITS \
206	INSTALL.txt \
207	LICENSE \
208	Makefile.in \
209	README \
210	README.aix \
211	README.dag \
212	README.hpux \
213	README.linux \
214	README.macosx \
215	README.septel \
216	README.sita \
217	README.tru64 \
218	README.Win32 \
219	SUNOS4/nit_if.o.sparc \
220	SUNOS4/nit_if.o.sun3 \
221	SUNOS4/nit_if.o.sun4c.4.0.3c \
222	TODO \
223	VERSION \
224	aclocal.m4 \
225	bpf/net/bpf_filter.c \
226	chmod_bpf \
227	config.guess \
228	config.h.in \
229	config.sub \
230	configure \
231	configure.in \
232	dlpisubs.c \
233	dlpisubs.h \
234	fad-getad.c \
235	fad-gifc.c \
236	fad-glifc.c \
237	fad-null.c \
238	fad-sita.c \
239	fad-win32.c \
240	filtertest.c \
241	findalldevstest.c \
242	grammar.y \
243	install-sh \
244	lbl/os-aix4.h \
245	lbl/os-hpux11.h \
246	lbl/os-osf4.h \
247	lbl/os-osf5.h \
248	lbl/os-solaris2.h \
249	lbl/os-sunos4.h \
250	lbl/os-ultrix4.h \
251	missing/snprintf.c \
252	mkdep \
253	msdos/bin2c.c \
254	msdos/common.dj \
255	msdos/makefile \
256	msdos/makefile.dj \
257	msdos/makefile.wc \
258	msdos/ndis2.c \
259	msdos/ndis2.h \
260	msdos/ndis_0.asm \
261	msdos/pkt_rx0.asm \
262	msdos/pkt_rx1.s \
263	msdos/pktdrvr.c \
264	msdos/pktdrvr.h \
265	msdos/readme.dos \
266	opentest.c \
267	org.tcpdump.chmod_bpf.plist \
268	packaging/pcap.spec.in \
269	pcap-bpf.c \
270	pcap-bt-linux.c \
271	pcap-bt-linux.h \
272	pcap-can-linux.c \
273	pcap-can-linux.h \
274	pcap-config.in \
275	pcap-dag.c \
276	pcap-dag.h \
277	pcap-dlpi.c \
278	pcap-dos.c \
279	pcap-dos.h \
280	pcap-enet.c \
281	pcap-int.h \
282	pcap-libdlpi.c \
283	pcap-linux.c \
284	pcap-namedb.h \
285	pcap-nit.c \
286	pcap-null.c \
287	pcap-pf.c \
288	pcap-septel.c \
289	pcap-septel.h \
290	pcap-sita.h \
291	pcap-sita.c \
292	pcap-sita.html \
293	pcap-snf.c \
294	pcap-snf.h \
295	pcap-snit.c \
296	pcap-snoop.c \
297	pcap-usb-linux.c \
298	pcap-usb-linux.h \
299	pcap-win32.c \
300	runlex.sh \
301	scanner.l \
302	selpolltest.c \
303	Win32/Include/Gnuc.h \
304	Win32/Include/addrinfo.h \
305	Win32/Include/bittypes.h \
306	Win32/Include/cdecl_ext.h \
307	Win32/Include/inetprivate.h \
308	Win32/Include/ip6_misc.h \
309	Win32/Include/sockstorage.h \
310	Win32/Include/arpa/nameser.h \
311	Win32/Include/net/if.h \
312	Win32/Include/net/netdb.h \
313	Win32/Include/net/paths.h \
314	Win32/Prj/libpcap.dsp \
315	Win32/Prj/libpcap.dsw \
316	Win32/Src/ffs.c \
317	Win32/Src/gai_strerror.c \
318	Win32/Src/getaddrinfo.c \
319	Win32/Src/getnetbynm.c \
320	Win32/Src/getnetent.c \
321	Win32/Src/getopt.c \
322	Win32/Src/getservent.c \
323	Win32/Src/inet_aton.c \
324	Win32/Src/inet_net.c \
325	Win32/Src/inet_pton.c
326
327all: libpcap.a shared pcap-config
328
329libpcap.a: $(OBJ)
330	@rm -f $@
331	ar rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
332	$(RANLIB) $@
333
334shared: libpcap.$(DYEXT)
335
336libpcap.so: $(OBJ)
337	@rm -f $@
338	VER=`cat $(srcdir)/VERSION`; \
339	MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
340	@V_SHLIB_CMD@ @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER $(LDFLAGS) \
341	    -o $@.$$VER $(OBJ) $(ADDLOBJS) $(LIBS)
342
343#
344# The following rule succeeds, but the result is untested.
345#
346# In Mac OS X, the libpcap dylib has the name "libpcap.A.dylib", with
347# its full path as the install_name, and with the compatibility and
348# current version both set to 1.  The compatibility version is set to
349# 1 so that programs built with a newer version of the library will run
350# against older versions; multi-platform software probably will fail if
351# it uses APIs added in the newer version, but Mac OS X-specific software
352# will use weak linking and check at run time whether those APIs are
353# available.
354#
355# We also use "A" as the major version, and 1 as the compatibility version,
356# but set the current version to the value in VERSION, with any non-numeric
357# stuff stripped off (the compatibility and current version must be of the
358# form X[.Y[.Z]], with Y and Z possibly absent, and with all components
359# numeric).
360#
361libpcap.dylib: $(OBJ)
362	rm -f libpcap*.dylib
363	VER=`cat $(srcdir)/VERSION`; \
364	MAJOR_VER=A; \
365	COMPAT_VER=1; \
366	CURRENT_VER=`sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`; \
367	$(CC) -dynamiclib -undefined error $(LDFLAGS) \
368	    -o libpcap.$$VER.dylib $(OBJ) $(ADDLOBJS) $(LIBS) \
369	    -install_name $(libdir)/libpcap.$$MAJOR_VER.dylib \
370	    -compatibility_version $$COMPAT_VER \
371	    -current_version $$CURRENT_VER
372
373#
374# The HP-UX linker manual says that the convention for a versioned library
375# is libXXX.{number}, not libXXX.sl.{number}.  That appears to be the case
376# on at least one HP-UX 11.00 system; libXXX.sl is a symlink to
377# libXXX.{number}.
378#
379# The manual also says "library-level versioning" (think "sonames") was
380# added in HP-UX 10.0.
381#
382# XXX - this assumes we're using the HP linker, rather than the GNU
383# linker, even with GCC.
384#
385libpcap.sl: $(OBJ)
386	@MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
387	rm -f libpcap.$$MAJOR_VER
388	MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
389	ld -b $(LDFLAGS) -o libpcap.$$MAJOR_VER +h libpcap.$$MAJOR_VER \
390	    $(OBJ) $(ADDLOBJS) $(LIBS)
391
392#
393# AIX is different from everybody else.  A shared library is an archive
394# library with one or more shared-object components.  We still build a
395# normal static archive library on AIX, for the benefit of the traditional
396# scheme of building libpcap and tcpdump in subdirectories of the
397# same directory, with tcpdump statically linked with the libpcap
398# in question, but we also build a shared library as "libpcap.shareda"
399# and install *it*, rather than the static library, as "libpcap.a".
400#
401libpcap.shareda: $(OBJ)
402	@rm -f $@ shr.o
403	$(CC) @V_SHLIB_OPT@ -o shr.o $(OBJ) $(ADDLOBJS) $(LDFLAGS) $(LIBS)
404	ar rc $@ shr.o
405
406#
407# For platforms that don't support shared libraries (or on which we
408# don't support shared libraries).
409#
410libpcap.none:
411
412scanner.c: $(srcdir)/scanner.l
413	@rm -f $@
414	$(srcdir)/runlex.sh $(LEX) -o$@ $<
415
416scanner.o: scanner.c tokdefs.h
417	$(CC) $(CFLAGS) -c scanner.c
418
419pcap.o: version.h
420
421tokdefs.h: grammar.c
422grammar.c: $(srcdir)/grammar.y
423	@rm -f grammar.c tokdefs.h
424	$(YACC) -d $<
425	mv y.tab.c grammar.c
426	mv y.tab.h tokdefs.h
427
428grammar.o: grammar.c
429	@rm -f $@
430	$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
431
432version.o: version.c
433	$(CC) $(CFLAGS) -c version.c
434
435snprintf.o: $(srcdir)/missing/snprintf.c
436	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
437
438version.c: $(srcdir)/VERSION
439	@rm -f $@
440	if grep GIT ${srcdir}/VERSION >/dev/null; then \
441		read ver <${srcdir}/VERSION; \
442		echo $$ver | tr -d '\012'; \
443		date +_%Y_%m_%d; \
444	else \
445		cat ${srcdir}/VERSION; \
446	fi | sed -e 's/.*/char pcap_version[] = "&";/' > $@
447
448#
449# NOTE: this really is supposed to be static; importing a string
450# from a shared library does not work very well on many
451# versions of UNIX (Solaris, Linux, and the BSDs, for example),
452# so we make the version string static and return it from
453# a function, which does work.
454#
455version.h: $(srcdir)/VERSION
456	@rm -f $@
457	if grep GIT ${srcdir}/VERSION >/dev/null; then \
458		read ver <${srcdir}/VERSION; \
459		echo $$ver | tr -d '\012'; \
460		date +_%Y_%m_%d; \
461	else \
462		cat ${srcdir}/VERSION; \
463	fi | sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' > $@
464
465bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
466	rm -f bpf_filter.c
467	ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
468
469bpf_filter.o: bpf_filter.c
470	$(CC) $(CFLAGS) -c bpf_filter.c
471
472#
473# Generate the pcap-config script.
474#
475pcap-config: $(srcdir)/pcap-config.in
476	@rm -f $@ $@.tmp
477	sed -e 's|@includedir[@]|$(includedir)|g' \
478	    -e 's|@libdir[@]|$(libdir)|g' \
479	    -e 's|@LIBS[@]|$(LIBS)|g' \
480	    -e 's|@V_RPATH_OPT[@]|$(V_RPATH_OPT)|g' \
481	    $(srcdir)/pcap-config.in >$@.tmp
482	mv $@.tmp $@
483	chmod a+x $@
484
485#
486# Test programs - not built by default, and not installed.
487#
488filtertest: filtertest.c libpcap.a
489	$(CC) $(CFLAGS) -I. -L. -o filtertest $(srcdir)/filtertest.c libpcap.a $(LIBS)
490
491findalldevstest: findalldevstest.c libpcap.a
492	$(CC) $(CFLAGS) -I. -L. -o findalldevstest $(srcdir)/findalldevstest.c libpcap.a $(LIBS)
493
494selpolltest: selpolltest.c libpcap.a
495	$(CC) $(CFLAGS) -I. -L. -o selpolltest $(srcdir)/selpolltest.c libpcap.a $(LIBS)
496
497opentest: opentest.c libpcap.a
498	$(CC) $(CFLAGS) -I. -L. -o opentest $(srcdir)/opentest.c libpcap.a $(LIBS)
499
500install: install-shared install-archive pcap-config
501	[ -d $(DESTDIR)$(libdir) ] || \
502	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
503	[ -d $(DESTDIR)$(includedir) ] || \
504	    (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
505	[ -d $(DESTDIR)$(includedir)/pcap ] || \
506	    (mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
507	[ -d $(DESTDIR)$(mandir)/man1 ] || \
508	    (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
509	[ -d $(DESTDIR)$(mandir)/man3 ] || \
510	    (mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
511	[ -d $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@ ] || \
512	    (mkdir -p $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@)
513	[ -d $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@ ] || \
514	    (mkdir -p $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@)
515	for i in $(PUBHDR); do \
516		$(INSTALL_DATA) $(srcdir)/$$i \
517		    $(DESTDIR)$(includedir)/$$i; done
518	[ -d $(DESTDIR)$(bindir) ] || \
519	    (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir))
520	$(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config
521	for i in $(MAN1); do \
522		$(INSTALL_DATA) $(srcdir)/$$i \
523		    $(DESTDIR)$(mandir)/man1/$$i; done
524	for i in $(MAN3PCAP_NOEXPAND); do \
525		$(INSTALL_DATA) $(srcdir)/$$i \
526		    $(DESTDIR)$(mandir)/man3/$$i; done
527	for i in $(MAN3PCAP_EXPAND:.in=); do \
528		$(INSTALL_DATA) $$i \
529		    $(DESTDIR)$(mandir)/man3/$$i; done
530	rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
531	ln $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_name.3pcap \
532		 $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
533	rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
534	ln $(DESTDIR)$(mandir)/man3/pcap_dump_open.3pcap \
535		 $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
536	rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
537	ln $(DESTDIR)$(mandir)/man3/pcap_geterr.3pcap \
538		 $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
539	rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
540	ln $(DESTDIR)$(mandir)/man3/pcap_inject.3pcap \
541		 $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
542	rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
543	ln $(DESTDIR)$(mandir)/man3/pcap_loop.3pcap \
544		 $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
545	rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
546	ln $(DESTDIR)$(mandir)/man3/pcap_major_version.3pcap \
547		 $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
548	rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
549	ln $(DESTDIR)$(mandir)/man3/pcap_next_ex.3pcap \
550		 $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
551	rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
552	ln $(DESTDIR)$(mandir)/man3/pcap_open_offline.3pcap \
553		 $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
554	rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
555	ln $(DESTDIR)$(mandir)/man3/pcap_setnonblock.3pcap \
556		 $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
557	for i in $(MANFILE); do \
558		$(INSTALL_DATA) `echo $$i | sed 's/.manfile.in/.manfile/'` \
559		    $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
560	for i in $(MANMISC); do \
561		$(INSTALL_DATA) `echo $$i | sed 's/.manmisc.in/.manmisc/'` \
562		    $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
563
564install-shared: install-shared-$(DYEXT)
565install-shared-so: libpcap.so
566	[ -d $(DESTDIR)$(libdir) ] || \
567	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
568	VER=`cat $(srcdir)/VERSION`; \
569	MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
570	$(INSTALL_PROGRAM) libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
571	ln -sf libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
572	ln -sf libpcap.so.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.so
573install-shared-dylib: libpcap.dylib
574	[ -d $(DESTDIR)$(libdir) ] || \
575	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
576	VER=`cat $(srcdir)/VERSION`; \
577	MAJOR_VER=A; \
578	$(INSTALL_PROGRAM) libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
579	ln -sf libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
580	ln -sf libpcap.$$MAJOR_VER.dylib $(DESTDIR)$(libdir)/libpcap.dylib
581install-shared-sl: libpcap.sl
582	[ -d $(DESTDIR)$(libdir) ] || \
583	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
584	MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
585	$(INSTALL_PROGRAM) libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)
586	ln -sf libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.sl
587install-shared-shareda: libpcap.shareda
588	#
589	# AIX shared libraries are weird.  They're archive libraries
590	# with one or more shared object components.
591	#
592	[ -d $(DESTDIR)$(libdir) ] || \
593	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
594	$(INSTALL_PROGRAM) libpcap.shareda $(DESTDIR)$(libdir)/libpcap.a
595install-shared-none:
596
597install-archive: install-archive-$(DYEXT)
598install-archive-so install-archive-dylib install-archive-sl install-archive-none: libpcap.a
599	#
600	# Most platforms have separate suffixes for shared and
601	# archive libraries, so we install both.
602	#
603	[ -d $(DESTDIR)$(libdir) ] || \
604	    (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
605	$(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
606	$(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
607install-archive-shareda:
608	#
609	# AIX, however, doesn't, so we don't install the archive
610	# library on AIX.
611	#
612
613uninstall: uninstall-shared
614	rm -f $(DESTDIR)$(libdir)/libpcap.a
615	for i in $(PUBHDR); do \
616		rm -f $(DESTDIR)$(includedir)/$$i; done
617	-rmdir $(DESTDIR)$(includedir)/pcap
618	rm -f $(DESTDIR)/$(bindir)/pcap-config
619	for i in $(MAN1); do \
620		rm -f $(DESTDIR)$(mandir)/man1/$$i; done
621	for i in $(MAN3PCAP); do \
622		rm -f $(DESTDIR)$(mandir)/man3/$$i; done
623	rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
624	rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
625	rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
626	rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
627	rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
628	rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
629	rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
630	rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
631	rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
632	for i in $(MANFILE); do \
633		rm -f $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
634	for i in $(MANMISC); do \
635		rm -f $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
636
637uninstall-shared: uninstall-shared-$(DYEXT)
638uninstall-shared-so:
639	VER=`cat $(srcdir)/VERSION`; \
640	MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
641	rm -f $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
642	rm -f $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
643	rm -f $(DESTDIR)$(libdir)/libpcap.so
644uninstall-shared-dylib:
645	VER=`cat $(srcdir)/VERSION`; \
646	MAJOR_VER=A; \
647	rm -f $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
648	rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
649	rm -f $(DESTDIR)$(libdir)/libpcap.dylib
650uninstall-shared-sl:
651	MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
652	rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER; \
653	rm -f $(DESTDIR)$(libdir)/libpcap.sl
654uninstall-shared-shareda:
655	rm -f $(DESTDIR)$(libdir)/libpcap.a
656uninstall-shared-none:
657
658clean:
659	rm -f $(CLEANFILES)
660
661distclean: clean
662	rm -f Makefile config.cache config.log config.status \
663	    config.h gnuc.h os-proto.h bpf_filter.c pcap-config \
664	    stamp-h stamp-h.in
665	rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=)
666	rm -rf autom4te.cache
667
668tags: $(TAGFILES)
669	ctags -wtd $(TAGFILES)
670
671packaging/pcap.spec: packaging/pcap.spec.in VERSION
672	RPMVERSION=`cat VERSION | sed s/-.*//g`; \
673		sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $<   > $@
674
675releasetar: 
676	@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
677	   mkdir $$name; \
678	   tar cf - $(CSRC) $(HDR) $(MAN1) $(MAN3PCAP_EXPAND) \
679	      $(MAN3PCAP_NOEXPAND) $(MANFILE) $(MANMISC) $(EXTRA_DIST) | \
680	      (cd $$name; tar xf -); \
681	   tar -c -z -f $$name.tar.gz $$name; \
682	   rm -rf $$name
683
684depend:	$(GENSRC) $(GENHDR) bpf_filter.c
685	./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
686
687Makefile: Makefile.in config.status
688	./config.status
689	@echo your Makefile was out of date, now run $(MAKE) again
690	exit 1
691