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_freecode.3 \ 41 pcap_get_selectable_fd.3 \ 42 pcap_geterr.3 \ 43 pcap_inject.3 \ 44 pcap_is_swapped.3 \ 45 pcap_lib_version.3 \ 46 pcap_list_datalinks.3 \ 47 pcap_list_tstamp_types.3 \ 48 pcap_lookupdev.3 \ 49 pcap_lookupnet.3 \ 50 pcap_loop.3 \ 51 pcap_major_version.3 \ 52 pcap_next_ex.3 \ 53 pcap_offline_filter.3 \ 54 pcap_open_dead.3 \ 55 pcap_open_live.3 \ 56 pcap_open_offline.3 \ 57 pcap_set_buffer_size.3 \ 58 pcap_set_datalink.3 \ 59 pcap_set_promisc.3 \ 60 pcap_set_rfmon.3 \ 61 pcap_set_snaplen.3 \ 62 pcap_set_timeout.3 \ 63 pcap_set_tstamp_type.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_tstamp_type_name_to_val.3 \ 73 pcap_tstamp_type_val_to_name.3 \ 74 pcap-filter.7 \ 75 pcap-linktype.7 76MLINKS= pcap_datalink_val_to_name.3 pcap_datalink_val_to_description.3 \ 77 pcap_dump_open.3 pcap_dump_fopen.3 \ 78 pcap_findalldevs.3 pcap_freealldevs.3 \ 79 pcap_geterr.3 pcap_perror.3 \ 80 pcap_inject.3 pcap_sendpacket.3 \ 81 pcap_list_datalinks.3 pcap_free_datalinks.3 \ 82 pcap_list_tstamp_types.3 pcap_free_tstamp_types.3 \ 83 pcap_loop.3 pcap_dispatch.3 \ 84 pcap_major_version.3 pcap_minor_version.3 \ 85 pcap_next_ex.3 pcap_next.3 \ 86 pcap_open_offline.3 pcap_fopen_offline.3 \ 87 pcap_setnonblock.3 pcap_getnonblock.3 88 89# Our man pages are a special copy from the distdir. See below. 90CLEANFILES+=${MAN} 91CLEANFILES+=tokdefs.h version.h version.c 92 93YFLAGS+=-p pcapyy 94LFLAGS+=-Ppcapyy 95CFLAGS+=-DHAVE_CONFIG_H -Dyylval=pcapyylval -I${.CURDIR} -I. 96CFLAGS+=-D_U_="__attribute__((unused))" 97CFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF 98.if ${MK_INET6_SUPPORT} != "no" 99CFLAGS+=-DINET6 100.endif 101.if ${MK_PF} != "no" 102CFLAGS+=-DHAVE_NET_PFVAR_H 103.endif 104 105WARNS?= 0 106 107SHLIB_MAJOR= 8 108 109# 110# Magic to grab sources out of src/contrib 111# 112PCAP_DISTDIR?=${.CURDIR}/../../contrib/libpcap 113CFLAGS+=-I${PCAP_DISTDIR} 114.PATH: ${PCAP_DISTDIR} 115.PATH: ${PCAP_DISTDIR}/bpf/net 116 117version.c: ${PCAP_DISTDIR}/VERSION 118 @rm -f $@ 119 sed 's/.*/char pcap_version[] = "&";/' ${PCAP_DISTDIR}/VERSION > $@ 120 121version.h: ${PCAP_DISTDIR}/VERSION 122 @rm -f $@ 123 sed 's/.*/char pcap_version_string[] = "libpcap version &";/' ${PCAP_DISTDIR}/VERSION > $@ 124 125tokdefs.h: grammar.h 126 ln -sf grammar.h tokdefs.h 127 128 129# 130# Magic to convert the man pages to something non Solarish 131# 132.for _page in ${MAN} 133${_page}: 134 if [ -f ${PCAP_DISTDIR}/${_page:S/3$/3pcap/} ]; then \ 135 F=${_page:S/3$/3pcap/}; \ 136 elif [ -f ${PCAP_DISTDIR}/${_page:S/5$/manfile/} ]; then \ 137 F=${_page:S/5$/manfile/}; \ 138 else \ 139 F=${_page:S/7$/manmisc/}; \ 140 fi; \ 141 sed -e 's/3PCAP/3/g' ${PCAP_DISTDIR}/$$F > ${_page} 142.endfor 143 144.include <bsd.lib.mk> 145