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