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