]> CyberLeo.Net >> Repos - FreeBSD/releng/9.1.git/blob - contrib/libpcap/Makefile.in
Fix a bug that allowed a tracing process (e.g. gdb) to write
[FreeBSD/releng/9.1.git] / contrib / libpcap / Makefile.in
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
27 prefix = @prefix@
28 exec_prefix = @exec_prefix@
29 datarootdir = @datarootdir@
30 # Pathname of directory to install the configure program
31 bindir = @bindir@
32 # Pathname of directory to install the include files
33 includedir = @includedir@
34 # Pathname of directory to install the library
35 libdir =  @libdir@
36 # Pathname of directory to install the man pages
37 mandir = @mandir@
38
39 # VPATH
40 srcdir = @srcdir@
41 VPATH = @srcdir@
42
43 #
44 # You shouldn't need to edit anything below.
45 #
46
47 LD = /usr/bin/ld
48 CC = @CC@
49 AR = @AR@
50 CCOPT = @V_CCOPT@
51 INCLS = -I. @V_INCLS@
52 DEFS = @DEFS@ @V_DEFS@
53 ADDLOBJS = @ADDLOBJS@
54 ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@
55 LIBS = @LIBS@
56 CFLAGS = @CFLAGS@
57 LDFLAGS = @LDFLAGS@
58 DYEXT = @DYEXT@
59 V_RPATH_OPT = @V_RPATH_OPT@
60 PROG=libpcap
61
62 # Standard CFLAGS
63 FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
64
65 INSTALL = @INSTALL@
66 INSTALL_PROGRAM = @INSTALL_PROGRAM@
67 INSTALL_DATA = @INSTALL_DATA@
68 RANLIB = @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 #
75 LEX = @V_LEX@
76 YACC = @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
85 PSRC =  pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@ @NETFILTER_SRC@
86 FSRC =  fad-@V_FINDALLDEVS@.c
87 SSRC =  @SSRC@
88 CSRC =  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
91 GENSRC = scanner.c grammar.c bpf_filter.c version.c
92 LIBOBJS = @LIBOBJS@
93
94 SRC =   $(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
98 OBJ =   $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
99 PUBHDR = \
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
112 HDR = $(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
128 TESTS = \
129         filtertest \
130         findalldevstest \
131         nonblocktest \
132         opentest \
133         selpolltest
134
135 TESTS_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
143 GENHDR = \
144         scanner.h tokdefs.h version.h
145
146 TAGFILES = \
147         $(SRC) $(HDR)
148
149 CLEANFILES = $(OBJ) libpcap.* $(TESTS) \
150         $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
151         lex.yy.c pcap-config
152
153 MAN1 = pcap-config.1
154
155 MAN3PCAP_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
166 MAN3PCAP_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
211 MAN3PCAP = $(MAN3PCAP_NOEXPAND) $(MAN3PCAP_EXPAND:.in=)
212
213 MANFILE = \
214         pcap-savefile.manfile.in
215
216 MANMISC = \
217         pcap-filter.manmisc.in \
218         pcap-linktype.manmisc.in \
219         pcap-tstamp.manmisc.in
220
221 EXTRA_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-config.in \
293         pcap-dag.c \
294         pcap-dag.h \
295         pcap-dlpi.c \
296         pcap-dos.c \
297         pcap-dos.h \
298         pcap-enet.c \
299         pcap-int.h \
300         pcap-libdlpi.c \
301         pcap-linux.c \
302         pcap-namedb.h \
303         pcap-netfilter-linux.c \
304         pcap-netfilter-linux.h \
305         pcap-nit.c \
306         pcap-null.c \
307         pcap-pf.c \
308         pcap-septel.c \
309         pcap-septel.h \
310         pcap-sita.h \
311         pcap-sita.c \
312         pcap-sita.html \
313         pcap-snf.c \
314         pcap-snf.h \
315         pcap-snit.c \
316         pcap-snoop.c \
317         pcap-usb-linux.c \
318         pcap-usb-linux.h \
319         pcap-win32.c \
320         runlex.sh \
321         scanner.l \
322         Win32/Include/Gnuc.h \
323         Win32/Include/addrinfo.h \
324         Win32/Include/bittypes.h \
325         Win32/Include/cdecl_ext.h \
326         Win32/Include/inetprivate.h \
327         Win32/Include/ip6_misc.h \
328         Win32/Include/sockstorage.h \
329         Win32/Include/arpa/nameser.h \
330         Win32/Include/net/if.h \
331         Win32/Include/net/netdb.h \
332         Win32/Include/net/paths.h \
333         Win32/Prj/libpcap.dsp \
334         Win32/Prj/libpcap.dsw \
335         Win32/Src/ffs.c \
336         Win32/Src/gai_strerror.c \
337         Win32/Src/getaddrinfo.c \
338         Win32/Src/getnetbynm.c \
339         Win32/Src/getnetent.c \
340         Win32/Src/getopt.c \
341         Win32/Src/getservent.c \
342         Win32/Src/inet_aton.c \
343         Win32/Src/inet_net.c \
344         Win32/Src/inet_pton.c
345
346 all: libpcap.a shared pcap-config
347
348 libpcap.a: $(OBJ)
349         @rm -f $@
350         $(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
351         $(RANLIB) $@
352
353 shared: libpcap.$(DYEXT)
354
355 libpcap.so: $(OBJ)
356         @rm -f $@
357         VER=`cat $(srcdir)/VERSION`; \
358         MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
359         @V_SHLIB_CMD@ @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER $(LDFLAGS) \
360             -o $@.$$VER $(OBJ) $(ADDLOBJS) $(LIBS)
361
362 #
363 # The following rule succeeds, but the result is untested.
364 #
365 # In Mac OS X, the libpcap dylib has the name "libpcap.A.dylib", with
366 # its full path as the install_name, and with the compatibility and
367 # current version both set to 1.  The compatibility version is set to
368 # 1 so that programs built with a newer version of the library will run
369 # against older versions; multi-platform software probably will fail if
370 # it uses APIs added in the newer version, but Mac OS X-specific software
371 # will use weak linking and check at run time whether those APIs are
372 # available.
373 #
374 # We also use "A" as the major version, and 1 as the compatibility version,
375 # but set the current version to the value in VERSION, with any non-numeric
376 # stuff stripped off (the compatibility and current version must be of the
377 # form X[.Y[.Z]], with Y and Z possibly absent, and with all components
378 # numeric).
379 #
380 libpcap.dylib: $(OBJ)
381         rm -f libpcap*.dylib
382         VER=`cat $(srcdir)/VERSION`; \
383         MAJOR_VER=A; \
384         COMPAT_VER=1; \
385         CURRENT_VER=`sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`; \
386         $(CC) -dynamiclib -undefined error $(LDFLAGS) \
387             -o libpcap.$$VER.dylib $(OBJ) $(ADDLOBJS) $(LIBS) \
388             -install_name $(libdir)/libpcap.$$MAJOR_VER.dylib \
389             -compatibility_version $$COMPAT_VER \
390             -current_version $$CURRENT_VER
391
392 #
393 # The HP-UX linker manual says that the convention for a versioned library
394 # is libXXX.{number}, not libXXX.sl.{number}.  That appears to be the case
395 # on at least one HP-UX 11.00 system; libXXX.sl is a symlink to
396 # libXXX.{number}.
397 #
398 # The manual also says "library-level versioning" (think "sonames") was
399 # added in HP-UX 10.0.
400 #
401 # XXX - this assumes we're using the HP linker, rather than the GNU
402 # linker, even with GCC.
403 #
404 libpcap.sl: $(OBJ)
405         @MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
406         rm -f libpcap.$$MAJOR_VER
407         MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
408         ld -b $(LDFLAGS) -o libpcap.$$MAJOR_VER +h libpcap.$$MAJOR_VER \
409             $(OBJ) $(ADDLOBJS) $(LIBS)
410
411 #
412 # AIX is different from everybody else.  A shared library is an archive
413 # library with one or more shared-object components.  We still build a
414 # normal static archive library on AIX, for the benefit of the traditional
415 # scheme of building libpcap and tcpdump in subdirectories of the
416 # same directory, with tcpdump statically linked with the libpcap
417 # in question, but we also build a shared library as "libpcap.shareda"
418 # and install *it*, rather than the static library, as "libpcap.a".
419 #
420 libpcap.shareda: $(OBJ)
421         @rm -f $@ shr.o
422         $(CC) @V_SHLIB_OPT@ -o shr.o $(OBJ) $(ADDLOBJS) $(LDFLAGS) $(LIBS)
423         $(AR) rc $@ shr.o
424
425 #
426 # For platforms that don't support shared libraries (or on which we
427 # don't support shared libraries).
428 #
429 libpcap.none:
430
431 scanner.c: $(srcdir)/scanner.l
432         @rm -f $@
433         $(srcdir)/runlex.sh $(LEX) -o$@ $<
434
435 scanner.o: scanner.c tokdefs.h
436         $(CC) $(FULL_CFLAGS) -c scanner.c
437
438 pcap.o: version.h
439
440 tokdefs.h: grammar.c
441 grammar.c: $(srcdir)/grammar.y
442         @rm -f grammar.c tokdefs.h
443         $(YACC) -d $<
444         mv y.tab.c grammar.c
445         mv y.tab.h tokdefs.h
446
447 grammar.o: grammar.c
448         @rm -f $@
449         $(CC) $(FULL_CFLAGS) -Dyylval=pcap_lval -c grammar.c
450
451 version.o: version.c
452         $(CC) $(FULL_CFLAGS) -c version.c
453
454 snprintf.o: $(srcdir)/missing/snprintf.c
455         $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
456
457 version.c: $(srcdir)/VERSION
458         @rm -f $@
459         if grep GIT ${srcdir}/VERSION >/dev/null; then \
460                 read ver <${srcdir}/VERSION; \
461                 echo $$ver | tr -d '\012'; \
462                 date +_%Y_%m_%d; \
463         else \
464                 cat ${srcdir}/VERSION; \
465         fi | sed -e 's/.*/char pcap_version[] = "&";/' > $@
466
467 #
468 # NOTE: this really is supposed to be static; importing a string
469 # from a shared library does not work very well on many
470 # versions of UNIX (Solaris, Linux, and the BSDs, for example),
471 # so we make the version string static and return it from
472 # a function, which does work.
473 #
474 version.h: $(srcdir)/VERSION
475         @rm -f $@
476         if grep GIT ${srcdir}/VERSION >/dev/null; then \
477                 read ver <${srcdir}/VERSION; \
478                 echo $$ver | tr -d '\012'; \
479                 date +_%Y_%m_%d; \
480         else \
481                 cat ${srcdir}/VERSION; \
482         fi | sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' > $@
483
484 bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
485         rm -f bpf_filter.c
486         ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
487
488 bpf_filter.o: bpf_filter.c
489         $(CC) $(FULL_CFLAGS) -c bpf_filter.c
490
491 #
492 # Generate the pcap-config script.
493 #
494 # Some Makes, e.g. AIX Make and Solaris Make, can't handle "--file=$@.tmp:$<";
495 # for example, the Solaris 9 make man page says
496 #
497 #       Because make assigns $< and $* as it would for implicit rules
498 #       (according to the suffixes list and the directory contents),
499 #       they may be unreliable when used within explicit target entries.
500 #
501 # and this is an explicit target entry.
502 #
503 # Therefore, instead of using $<, we explicitly put in $(srcdir)/pcap-config.in.
504 #
505 pcap-config: $(srcdir)/pcap-config.in ./config.status
506         @rm -f $@ $@.tmp
507         ./config.status --file=$@.tmp:$(srcdir)/pcap-config.in
508         mv $@.tmp $@
509         chmod a+x $@
510
511 #
512 # Test programs - not built by default, and not installed.
513 #
514 tests: $(TESTS)
515
516 filtertest: tests/filtertest.c libpcap.a
517         $(CC) $(FULL_CFLAGS) -I. -L. -o filtertest $(srcdir)/tests/filtertest.c libpcap.a $(LIBS)
518
519 findalldevstest: tests/findalldevstest.c libpcap.a
520         $(CC) $(FULL_CFLAGS) -I. -L. -o findalldevstest $(srcdir)/tests/findalldevstest.c libpcap.a $(LIBS)
521
522 nonblocktest: tests/nonblocktest.c libpcap.a
523         $(CC) $(FULL_CFLAGS) -I. -L. -o nonblocktest $(srcdir)/tests/nonblocktest.c libpcap.a $(LIBS)
524
525 opentest: tests/opentest.c libpcap.a
526         $(CC) $(FULL_CFLAGS) -I. -L. -o opentest $(srcdir)/tests/opentest.c libpcap.a $(LIBS)
527
528 selpolltest: tests/selpolltest.c libpcap.a
529         $(CC) $(FULL_CFLAGS) -I. -L. -o selpolltest $(srcdir)/tests/selpolltest.c libpcap.a $(LIBS)
530
531 install: install-shared install-archive pcap-config
532         [ -d $(DESTDIR)$(libdir) ] || \
533             (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
534         [ -d $(DESTDIR)$(includedir) ] || \
535             (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
536         [ -d $(DESTDIR)$(includedir)/pcap ] || \
537             (mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
538         [ -d $(DESTDIR)$(mandir)/man1 ] || \
539             (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
540         [ -d $(DESTDIR)$(mandir)/man3 ] || \
541             (mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
542         [ -d $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@ ] || \
543             (mkdir -p $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@)
544         [ -d $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@ ] || \
545             (mkdir -p $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@)
546         for i in $(PUBHDR); do \
547                 $(INSTALL_DATA) $(srcdir)/$$i \
548                     $(DESTDIR)$(includedir)/$$i; done
549         [ -d $(DESTDIR)$(bindir) ] || \
550             (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir))
551         $(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config
552         for i in $(MAN1); do \
553                 $(INSTALL_DATA) $(srcdir)/$$i \
554                     $(DESTDIR)$(mandir)/man1/$$i; done
555         for i in $(MAN3PCAP_NOEXPAND); do \
556                 $(INSTALL_DATA) $(srcdir)/$$i \
557                     $(DESTDIR)$(mandir)/man3/$$i; done
558         for i in $(MAN3PCAP_EXPAND:.in=); do \
559                 $(INSTALL_DATA) $$i \
560                     $(DESTDIR)$(mandir)/man3/$$i; done
561         rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
562         ln $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_name.3pcap \
563                  $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
564         rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
565         ln $(DESTDIR)$(mandir)/man3/pcap_dump_open.3pcap \
566                  $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
567         rm -f $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap
568         ln $(DESTDIR)$(mandir)/man3/pcap_findalldevs.3pcap \
569                  $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap
570         rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
571         ln $(DESTDIR)$(mandir)/man3/pcap_geterr.3pcap \
572                  $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
573         rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
574         ln $(DESTDIR)$(mandir)/man3/pcap_inject.3pcap \
575                  $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
576         rm -f $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap
577         ln $(DESTDIR)$(mandir)/man3/pcap_list_datalinks.3pcap \
578                  $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap
579         rm -f $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap
580         ln $(DESTDIR)$(mandir)/man3/pcap_list_tstamp_types.3pcap \
581                  $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap
582         rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
583         ln $(DESTDIR)$(mandir)/man3/pcap_loop.3pcap \
584                  $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
585         rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
586         ln $(DESTDIR)$(mandir)/man3/pcap_major_version.3pcap \
587                  $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
588         rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
589         ln $(DESTDIR)$(mandir)/man3/pcap_next_ex.3pcap \
590                  $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
591         rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
592         ln $(DESTDIR)$(mandir)/man3/pcap_open_offline.3pcap \
593                  $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
594         rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
595         ln $(DESTDIR)$(mandir)/man3/pcap_setnonblock.3pcap \
596                  $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
597         for i in $(MANFILE); do \
598                 $(INSTALL_DATA) `echo $$i | sed 's/.manfile.in/.manfile/'` \
599                     $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
600         for i in $(MANMISC); do \
601                 $(INSTALL_DATA) `echo $$i | sed 's/.manmisc.in/.manmisc/'` \
602                     $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
603
604 install-shared: install-shared-$(DYEXT)
605 install-shared-so: libpcap.so
606         [ -d $(DESTDIR)$(libdir) ] || \
607             (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
608         VER=`cat $(srcdir)/VERSION`; \
609         MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
610         $(INSTALL_PROGRAM) libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
611         ln -sf libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
612         ln -sf libpcap.so.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.so
613 install-shared-dylib: libpcap.dylib
614         [ -d $(DESTDIR)$(libdir) ] || \
615             (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
616         VER=`cat $(srcdir)/VERSION`; \
617         MAJOR_VER=A; \
618         $(INSTALL_PROGRAM) libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
619         ln -sf libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
620         ln -sf libpcap.$$MAJOR_VER.dylib $(DESTDIR)$(libdir)/libpcap.dylib
621 install-shared-sl: libpcap.sl
622         [ -d $(DESTDIR)$(libdir) ] || \
623             (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
624         MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
625         $(INSTALL_PROGRAM) libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)
626         ln -sf libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.sl
627 install-shared-shareda: libpcap.shareda
628         #
629         # AIX shared libraries are weird.  They're archive libraries
630         # with one or more shared object components.
631         #
632         [ -d $(DESTDIR)$(libdir) ] || \
633             (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
634         $(INSTALL_PROGRAM) libpcap.shareda $(DESTDIR)$(libdir)/libpcap.a
635 install-shared-none:
636
637 install-archive: install-archive-$(DYEXT)
638 install-archive-so install-archive-dylib install-archive-sl install-archive-none: libpcap.a
639         #
640         # Most platforms have separate suffixes for shared and
641         # archive libraries, so we install both.
642         #
643         [ -d $(DESTDIR)$(libdir) ] || \
644             (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
645         $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
646         $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
647 install-archive-shareda:
648         #
649         # AIX, however, doesn't, so we don't install the archive
650         # library on AIX.
651         #
652
653 uninstall: uninstall-shared
654         rm -f $(DESTDIR)$(libdir)/libpcap.a
655         for i in $(PUBHDR); do \
656                 rm -f $(DESTDIR)$(includedir)/$$i; done
657         -rmdir $(DESTDIR)$(includedir)/pcap
658         rm -f $(DESTDIR)/$(bindir)/pcap-config
659         for i in $(MAN1); do \
660                 rm -f $(DESTDIR)$(mandir)/man1/$$i; done
661         for i in $(MAN3PCAP); do \
662                 rm -f $(DESTDIR)$(mandir)/man3/$$i; done
663         rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
664         rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
665         rm -f $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap
666         rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
667         rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
668         rm -f $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap
669         rm -f $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap
670         rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
671         rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
672         rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
673         rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
674         rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
675         for i in $(MANFILE); do \
676                 rm -f $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
677         for i in $(MANMISC); do \
678                 rm -f $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
679
680 uninstall-shared: uninstall-shared-$(DYEXT)
681 uninstall-shared-so:
682         VER=`cat $(srcdir)/VERSION`; \
683         MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
684         rm -f $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
685         rm -f $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
686         rm -f $(DESTDIR)$(libdir)/libpcap.so
687 uninstall-shared-dylib:
688         VER=`cat $(srcdir)/VERSION`; \
689         MAJOR_VER=A; \
690         rm -f $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
691         rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
692         rm -f $(DESTDIR)$(libdir)/libpcap.dylib
693 uninstall-shared-sl:
694         MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
695         rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER; \
696         rm -f $(DESTDIR)$(libdir)/libpcap.sl
697 uninstall-shared-shareda:
698         rm -f $(DESTDIR)$(libdir)/libpcap.a
699 uninstall-shared-none:
700
701 clean:
702         rm -f $(CLEANFILES)
703
704 distclean: clean
705         rm -f Makefile config.cache config.log config.status \
706             config.h gnuc.h net os-proto.h bpf_filter.c pcap-config \
707             stamp-h stamp-h.in
708         rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=)
709         rm -rf autom4te.cache
710
711 tags: $(TAGFILES)
712         ctags -wtd $(TAGFILES)
713
714 packaging/pcap.spec: packaging/pcap.spec.in VERSION
715         RPMVERSION=`cat VERSION | sed s/-.*//g`; \
716                 sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $<   > $@
717
718 releasetar: 
719         @cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
720            mkdir $$name; \
721            tar cf - $(CSRC) $(HDR) $(MAN1) $(MAN3PCAP_EXPAND) \
722               $(MAN3PCAP_NOEXPAND) $(MANFILE) $(MANMISC) $(EXTRA_DIST) | \
723               (cd $$name; tar xf -); \
724            tar -c -z -f $$name.tar.gz $$name; \
725            rm -rf $$name
726
727 depend: $(GENSRC) $(GENHDR) bpf_filter.c
728         ./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
729
730 Makefile: Makefile.in config.status
731         ./config.status
732         @echo your Makefile was out of date, now run $(MAKE) again
733         exit 1