1# Makefile for libpcap 2# $FreeBSD$ 3 4SHLIBDIR?= /lib 5 6.include <src.opts.mk> 7 8LIB= pcap 9 10SRCS= bpf_dump.c \ 11 bpf_filter.c \ 12 bpf_image.c \ 13 etherent.c \ 14 fad-getad.c \ 15 fmtutils.c \ 16 gencode.c \ 17 grammar.y \ 18 nametoaddr.c \ 19 optimize.c \ 20 pcap-bpf.c \ 21 pcap-common.c \ 22 pcap-netmap.c \ 23 pcap.c \ 24 savefile.c \ 25 scanner.l \ 26 sf-pcap.c \ 27 sf-pcapng.c \ 28 tokdefs.h 29 30# Old compatibility headers 31INCS= fmtutils.h \ 32 pcap-bpf.h \ 33 pcap-namedb.h \ 34 pcap-netmap.h \ 35 pcap.h 36 37PCAPINCS= \ 38 pcap/bluetooth.h \ 39 pcap/bpf.h \ 40 pcap/can_socketcan.h \ 41 pcap/compiler-tests.h \ 42 pcap/dlt.h \ 43 pcap/funcattrs.h \ 44 pcap/ipnet.h \ 45 pcap/namedb.h \ 46 pcap/nflog.h \ 47 pcap/pcap-inttypes.h \ 48 pcap/pcap.h \ 49 pcap/sll.h \ 50 pcap/usb.h \ 51 pcap/vlan.h 52 53PCAPINCSDIR= ${INCLUDEDIR}/pcap 54INCSGROUPS= INCS PCAPINCS 55 56MAN= pcap.3 \ 57 pcap_activate.3 \ 58 pcap_breakloop.3 \ 59 pcap_can_set_rfmon.3 \ 60 pcap_close.3 \ 61 pcap_compile.3 \ 62 pcap_create.3 \ 63 pcap_datalink.3 \ 64 pcap_datalink_name_to_val.3 \ 65 pcap_datalink_val_to_name.3 \ 66 pcap_dump.3 \ 67 pcap_dump_close.3 \ 68 pcap_dump_file.3 \ 69 pcap_dump_flush.3 \ 70 pcap_dump_ftell.3 \ 71 pcap_dump_open.3 \ 72 pcap_file.3 \ 73 pcap_fileno.3 \ 74 pcap_findalldevs.3 \ 75 pcap_freecode.3 \ 76 pcap_get_required_select_timeout.3 \ 77 pcap_get_selectable_fd.3 \ 78 pcap_get_tstamp_precision.3 \ 79 pcap_geterr.3 \ 80 pcap_inject.3 \ 81 pcap_is_swapped.3 \ 82 pcap_lib_version.3 \ 83 pcap_list_datalinks.3 \ 84 pcap_list_tstamp_types.3 \ 85 pcap_lookupdev.3 \ 86 pcap_lookupnet.3 \ 87 pcap_loop.3 \ 88 pcap_major_version.3 \ 89 pcap_next_ex.3 \ 90 pcap_offline_filter.3 \ 91 pcap_open_dead.3 \ 92 pcap_open_live.3 \ 93 pcap_open_offline.3 \ 94 pcap_set_buffer_size.3 \ 95 pcap_set_datalink.3 \ 96 pcap_set_immediate_mode.3 \ 97 pcap_set_promisc.3 \ 98 pcap_set_protocol.3 \ 99 pcap_set_rfmon.3 \ 100 pcap_set_snaplen.3 \ 101 pcap_set_timeout.3 \ 102 pcap_set_tstamp_precision.3 \ 103 pcap_set_tstamp_type.3 \ 104 pcap_setdirection.3 \ 105 pcap_setfilter.3 \ 106 pcap_setnonblock.3 \ 107 pcap_snapshot.3 \ 108 pcap_stats.3 \ 109 pcap_statustostr.3 \ 110 pcap_strerror.3 \ 111 pcap_tstamp_type_name_to_val.3 \ 112 pcap_tstamp_type_val_to_name.3 113 114MLINKS= \ 115 pcap_datalink_val_to_name.3 pcap_datalink_val_to_description.3 \ 116 pcap_dump_open.3 pcap_dump_fopen.3 \ 117 pcap_findalldevs.3 pcap_freealldevs.3 \ 118 pcap_geterr.3 pcap_perror.3 \ 119 pcap_inject.3 pcap_sendpacket.3 \ 120 pcap_list_datalinks.3 pcap_free_datalinks.3 \ 121 pcap_list_tstamp_types.3 pcap_free_tstamp_types.3 \ 122 pcap_loop.3 pcap_dispatch.3 \ 123 pcap_major_version.3 pcap_minor_version.3 \ 124 pcap_next_ex.3 pcap_next.3 \ 125 pcap_open_offline.3 pcap_fopen_offline.3 \ 126 pcap_setnonblock.3 pcap_getnonblock.3 127 128# Our man pages are a special copy from the distdir. See below. 129CLEANFILES+=${MAN} 130CLEANFILES+=tokdefs.h scanner.h 131 132YFLAGS+=-p pcap_ 133LFLAGS+=-Ppcap_ --header-file=${.OBJDIR}/scanner.h --nounput 134CFLAGS+=-DHAVE_CONFIG_H -I${.CURDIR} -I${.OBJDIR} 135CFLAGS+=-D_U_="__attribute__((unused))" 136CFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF 137CFLAGS+=-DBUILDING_PCAP 138.if ${MK_INET6_SUPPORT} != "no" 139CFLAGS+=-DINET6 140.endif 141.if ${MK_PF} != "no" 142CFLAGS+=-DHAVE_NET_PFVAR_H 143.endif 144 145CFLAGS+= -DPCAP_SUPPORT_NETMAP 146 147.if ${MK_OFED} != "no" 148SRCS+= pcap-rdmasniff.c 149LIBADD+= ibverbs 150LIBADD+= mlx5 151CFLAGS+= -DPCAP_SUPPORT_RDMASNIFF 152.endif 153 154WARNS?= 0 155 156SHLIB_MAJOR= 8 157 158# 159# Magic to grab sources out of src/contrib 160# 161PCAP_DISTDIR?=${SRCTOP}/contrib/libpcap 162CFLAGS+=-I${PCAP_DISTDIR} 163.PATH: ${PCAP_DISTDIR} 164.PATH: ${PCAP_DISTDIR}/bpf/net 165 166tokdefs.h: grammar.h .NOMETA 167 ln -sf ${.ALLSRC} ${.TARGET} 168 169# 170# Magic to convert the man pages to something non Solarish 171# 172.for _page in ${MAN} 173${_page}: 174 if [ -f ${PCAP_DISTDIR}/${_page:S/3$/3pcap/} ]; then \ 175 F=${_page:S/3$/3pcap/}; \ 176 elif [ -f ${PCAP_DISTDIR}/${_page:S/3$/3pcap.in/} ]; then \ 177 F=${_page:S/3$/3pcap.in/}; \ 178 elif [ -f ${PCAP_DISTDIR}/${_page:S/5$/manfile.in/} ]; then \ 179 F=${_page:S/5$/manfile.in/}; \ 180 elif [ -f ${PCAP_DISTDIR}/${_page:S/5$/manfile/} ]; then \ 181 F=${_page:S/5$/manfile/}; \ 182 else \ 183 F=${_page:S/7$/manmisc.in/}; \ 184 fi; \ 185 sed -e 's/3PCAP/3/g' ${PCAP_DISTDIR}/$$F > ${_page} 186.endfor 187 188.include <bsd.lib.mk> 189