1# Makefile for libpcap 2# $FreeBSD$ 3 4SHLIBDIR?= /lib 5 6.include <src.opts.mk> 7 8LIB= pcap 9SRCS= grammar.y tokdefs.h version.h pcap-bpf.c \ 10 pcap-netmap.c \ 11 pcap.c pcap-common.c inet.c fad-getad.c gencode.c optimize.c nametoaddr.c \ 12 etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c \ 13 scanner.l sf-pcap.c sf-pcap-ng.c version.c 14 15# Old compatibility headers 16INCS= pcap.h pcap-int.h pcap-namedb.h pcap-bpf.h 17 18PCAPINCS= pcap/pcap.h pcap/namedb.h pcap/bpf.h 19PCAPINCSDIR= ${INCLUDEDIR}/pcap 20INCSGROUPS= INCS PCAPINCS 21 22MAN= pcap.3 \ 23 pcap_activate.3 \ 24 pcap_breakloop.3 \ 25 pcap_can_set_rfmon.3 \ 26 pcap_close.3 \ 27 pcap_compile.3 \ 28 pcap_create.3 \ 29 pcap_datalink.3 \ 30 pcap_datalink_name_to_val.3 \ 31 pcap_datalink_val_to_name.3 \ 32 pcap_dump.3 \ 33 pcap_dump_close.3 \ 34 pcap_dump_file.3 \ 35 pcap_dump_flush.3 \ 36 pcap_dump_ftell.3 \ 37 pcap_dump_open.3 \ 38 pcap_file.3 \ 39 pcap_fileno.3 \ 40 pcap_findalldevs.3 \ 41 pcap_freecode.3 \ 42 pcap_get_selectable_fd.3 \ 43 pcap_geterr.3 \ 44 pcap_inject.3 \ 45 pcap_is_swapped.3 \ 46 pcap_lib_version.3 \ 47 pcap_list_datalinks.3 \ 48 pcap_list_tstamp_types.3 \ 49 pcap_lookupdev.3 \ 50 pcap_lookupnet.3 \ 51 pcap_loop.3 \ 52 pcap_major_version.3 \ 53 pcap_next_ex.3 \ 54 pcap_offline_filter.3 \ 55 pcap_open_dead.3 \ 56 pcap_open_live.3 \ 57 pcap_open_offline.3 \ 58 pcap_set_buffer_size.3 \ 59 pcap_set_datalink.3 \ 60 pcap_set_promisc.3 \ 61 pcap_set_rfmon.3 \ 62 pcap_set_snaplen.3 \ 63 pcap_set_timeout.3 \ 64 pcap_set_tstamp_type.3 \ 65 pcap_setdirection.3 \ 66 pcap_setfilter.3 \ 67 pcap_setnonblock.3 \ 68 pcap_snapshot.3 \ 69 pcap_stats.3 \ 70 pcap_statustostr.3 \ 71 pcap_strerror.3 \ 72 pcap-savefile.5 \ 73 pcap_tstamp_type_name_to_val.3 \ 74 pcap_tstamp_type_val_to_name.3 \ 75 pcap-filter.7 \ 76 pcap-linktype.7 77MLINKS= pcap_datalink_val_to_name.3 pcap_datalink_val_to_description.3 \ 78 pcap_dump_open.3 pcap_dump_fopen.3 \ 79 pcap_findalldevs.3 pcap_freealldevs.3 \ 80 pcap_geterr.3 pcap_perror.3 \ 81 pcap_inject.3 pcap_sendpacket.3 \ 82 pcap_list_datalinks.3 pcap_free_datalinks.3 \ 83 pcap_list_tstamp_types.3 pcap_free_tstamp_types.3 \ 84 pcap_loop.3 pcap_dispatch.3 \ 85 pcap_major_version.3 pcap_minor_version.3 \ 86 pcap_next_ex.3 pcap_next.3 \ 87 pcap_open_offline.3 pcap_fopen_offline.3 \ 88 pcap_setnonblock.3 pcap_getnonblock.3 89 90# Our man pages are a special copy from the distdir. See below. 91CLEANFILES+=${MAN} 92CLEANFILES+=tokdefs.h version.h version.c 93 94YFLAGS+=-p pcapyy 95LFLAGS+=-Ppcapyy 96CFLAGS+=-DHAVE_CONFIG_H -Dyylval=pcapyylval -I${.CURDIR} -I. 97CFLAGS+=-D_U_="__attribute__((unused))" 98CFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF 99.if ${MK_INET6_SUPPORT} != "no" 100CFLAGS+=-DINET6 101.endif 102.if ${MK_PF} != "no" 103CFLAGS+=-DHAVE_NET_PFVAR_H 104.endif 105 106WARNS?= 0 107 108SHLIB_MAJOR= 8 109 110# 111# Magic to grab sources out of src/contrib 112# 113PCAP_DISTDIR?=${.CURDIR}/../../contrib/libpcap 114CFLAGS+=-I${PCAP_DISTDIR} 115.PATH: ${PCAP_DISTDIR} 116.PATH: ${PCAP_DISTDIR}/bpf/net 117 118version.c: ${PCAP_DISTDIR}/VERSION 119 @rm -f $@ 120 sed 's/.*/char pcap_version[] = "&";/' ${PCAP_DISTDIR}/VERSION > $@ 121 122version.h: ${PCAP_DISTDIR}/VERSION 123 @rm -f $@ 124 sed 's/.*/char pcap_version_string[] = "libpcap version &";/' ${PCAP_DISTDIR}/VERSION > $@ 125 126tokdefs.h: grammar.h 127 ln -sf grammar.h tokdefs.h 128 129 130# 131# Magic to convert the man pages to something non Solarish 132# 133.for _page in ${MAN} 134${_page}: 135 if [ -f ${PCAP_DISTDIR}/${_page:S/3$/3pcap/} ]; then \ 136 F=${_page:S/3$/3pcap/}; \ 137 elif [ -f ${PCAP_DISTDIR}/${_page:S/5$/manfile/} ]; then \ 138 F=${_page:S/5$/manfile/}; \ 139 else \ 140 F=${_page:S/7$/manmisc/}; \ 141 fi; \ 142 sed -e 's/3PCAP/3/g' ${PCAP_DISTDIR}/$$F > ${_page} 143.endfor 144 145.include <bsd.lib.mk> 146