xref: /freebsd/lib/libpcap/Makefile (revision ecb75be376a3e18d3e4836b6ee07015264784694)
1609c8587SJordan K. Hubbard# Makefile for libpcap
2609c8587SJordan K. Hubbard
318b2ee82SBaptiste DaroussinSHLIBDIR?= /lib
48f01da43SRuslan Ermilov
5c6063d0dSWarner Losh.include <src.opts.mk>
6e1fe3dbaSRuslan Ermilov
7609c8587SJordan K. HubbardLIB=	pcap
8b00ab754SHans Petter Selasky
9b00ab754SHans Petter SelaskySRCS=	bpf_dump.c \
10b00ab754SHans Petter Selasky	bpf_filter.c \
11b00ab754SHans Petter Selasky	bpf_image.c \
12b00ab754SHans Petter Selasky	etherent.c \
13b00ab754SHans Petter Selasky	fad-getad.c \
14b00ab754SHans Petter Selasky	fmtutils.c \
15b00ab754SHans Petter Selasky	gencode.c \
16b00ab754SHans Petter Selasky	grammar.y \
17b00ab754SHans Petter Selasky	nametoaddr.c \
18b00ab754SHans Petter Selasky	optimize.c \
19b00ab754SHans Petter Selasky	pcap-bpf.c \
20b00ab754SHans Petter Selasky	pcap-common.c \
21b00ab754SHans Petter Selasky	pcap-netmap.c \
22*6f9cba8fSJoseph Mingrone	pcap-util.c \
23b00ab754SHans Petter Selasky	pcap.c \
24b00ab754SHans Petter Selasky	savefile.c \
25b00ab754SHans Petter Selasky	scanner.l \
26b00ab754SHans Petter Selasky	sf-pcap.c \
27b00ab754SHans Petter Selasky	sf-pcapng.c \
28b00ab754SHans Petter Selasky	tokdefs.h
29919b495cSRui Paulo
30919b495cSRui Paulo# Old compatibility headers
31*6f9cba8fSJoseph MingroneINCS=	pcap-bpf.h \
32b00ab754SHans Petter Selasky	pcap-namedb.h \
33b00ab754SHans Petter Selasky	pcap-netmap.h \
34b00ab754SHans Petter Selasky	pcap.h
35919b495cSRui Paulo
36b00ab754SHans Petter SelaskyPCAPINCS= \
37b00ab754SHans Petter Selasky	pcap/bluetooth.h \
38b00ab754SHans Petter Selasky	pcap/bpf.h \
39b00ab754SHans Petter Selasky	pcap/can_socketcan.h \
40b00ab754SHans Petter Selasky	pcap/compiler-tests.h \
41b00ab754SHans Petter Selasky	pcap/dlt.h \
42b00ab754SHans Petter Selasky	pcap/funcattrs.h \
43b00ab754SHans Petter Selasky	pcap/ipnet.h \
44b00ab754SHans Petter Selasky	pcap/namedb.h \
45b00ab754SHans Petter Selasky	pcap/nflog.h \
46b00ab754SHans Petter Selasky	pcap/pcap-inttypes.h \
47b00ab754SHans Petter Selasky	pcap/pcap.h \
4857e22627SCy Schubert	pcap/socket.h \
49b00ab754SHans Petter Selasky	pcap/sll.h \
50b00ab754SHans Petter Selasky	pcap/usb.h \
51b00ab754SHans Petter Selasky	pcap/vlan.h
52b00ab754SHans Petter Selasky
53919b495cSRui PauloPCAPINCSDIR=	${INCLUDEDIR}/pcap
54919b495cSRui PauloINCSGROUPS=	INCS PCAPINCS
55919b495cSRui Paulo
5628510af5SRui PauloMAN=	pcap.3 \
5728510af5SRui Paulo	pcap_activate.3 \
5828510af5SRui Paulo	pcap_breakloop.3 \
5928510af5SRui Paulo	pcap_can_set_rfmon.3 \
6028510af5SRui Paulo	pcap_close.3 \
6128510af5SRui Paulo	pcap_compile.3 \
6228510af5SRui Paulo	pcap_create.3 \
6328510af5SRui Paulo	pcap_datalink.3 \
6428510af5SRui Paulo	pcap_datalink_name_to_val.3 \
6528510af5SRui Paulo	pcap_datalink_val_to_name.3 \
6628510af5SRui Paulo	pcap_dump.3 \
6728510af5SRui Paulo	pcap_dump_close.3 \
6828510af5SRui Paulo	pcap_dump_file.3 \
6928510af5SRui Paulo	pcap_dump_flush.3 \
7028510af5SRui Paulo	pcap_dump_ftell.3 \
7128510af5SRui Paulo	pcap_dump_open.3 \
7228510af5SRui Paulo	pcap_file.3 \
7328510af5SRui Paulo	pcap_fileno.3 \
7428510af5SRui Paulo	pcap_findalldevs.3 \
7528510af5SRui Paulo	pcap_freecode.3 \
76b00ab754SHans Petter Selasky	pcap_get_required_select_timeout.3 \
7728510af5SRui Paulo	pcap_get_selectable_fd.3 \
78681ed54cSXin LI	pcap_get_tstamp_precision.3 \
7928510af5SRui Paulo	pcap_geterr.3 \
80*6f9cba8fSJoseph Mingrone	pcap_init.3 \
8128510af5SRui Paulo	pcap_inject.3 \
8228510af5SRui Paulo	pcap_is_swapped.3 \
8328510af5SRui Paulo	pcap_lib_version.3 \
8428510af5SRui Paulo	pcap_list_datalinks.3 \
85d1e87331SXin LI	pcap_list_tstamp_types.3 \
8628510af5SRui Paulo	pcap_lookupdev.3 \
8728510af5SRui Paulo	pcap_lookupnet.3 \
8828510af5SRui Paulo	pcap_loop.3 \
8928510af5SRui Paulo	pcap_major_version.3 \
9028510af5SRui Paulo	pcap_next_ex.3 \
9128510af5SRui Paulo	pcap_offline_filter.3 \
9228510af5SRui Paulo	pcap_open_dead.3 \
9328510af5SRui Paulo	pcap_open_live.3 \
9428510af5SRui Paulo	pcap_open_offline.3 \
9528510af5SRui Paulo	pcap_set_buffer_size.3 \
9628510af5SRui Paulo	pcap_set_datalink.3 \
9728510af5SRui Paulo	pcap_set_promisc.3 \
9828510af5SRui Paulo	pcap_set_rfmon.3 \
9928510af5SRui Paulo	pcap_set_snaplen.3 \
10028510af5SRui Paulo	pcap_set_timeout.3 \
101681ed54cSXin LI	pcap_set_tstamp_precision.3 \
102d1e87331SXin LI	pcap_set_tstamp_type.3 \
10328510af5SRui Paulo	pcap_setdirection.3 \
10428510af5SRui Paulo	pcap_setfilter.3 \
10528510af5SRui Paulo	pcap_setnonblock.3 \
10628510af5SRui Paulo	pcap_snapshot.3 \
10728510af5SRui Paulo	pcap_stats.3 \
10828510af5SRui Paulo	pcap_statustostr.3 \
10928510af5SRui Paulo	pcap_strerror.3 \
110d1e87331SXin LI	pcap_tstamp_type_name_to_val.3 \
111174ae282SHans Petter Selasky	pcap_tstamp_type_val_to_name.3 \
112174ae282SHans Petter Selasky	pcap-savefile.5 \
113174ae282SHans Petter Selasky	pcap-filter.7 \
114174ae282SHans Petter Selasky	pcap-linktype.7 \
115174ae282SHans Petter Selasky	pcap-tstamp.7
116b00ab754SHans Petter Selasky
117b00ab754SHans Petter SelaskyMLINKS= \
118b00ab754SHans Petter Selasky	pcap_datalink_val_to_name.3 pcap_datalink_val_to_description.3 \
11928510af5SRui Paulo	pcap_dump_open.3 pcap_dump_fopen.3 \
120d1e87331SXin LI	pcap_findalldevs.3 pcap_freealldevs.3 \
12128510af5SRui Paulo	pcap_geterr.3 pcap_perror.3 \
12228510af5SRui Paulo	pcap_inject.3 pcap_sendpacket.3 \
123d1e87331SXin LI	pcap_list_datalinks.3 pcap_free_datalinks.3 \
124d1e87331SXin LI	pcap_list_tstamp_types.3 pcap_free_tstamp_types.3 \
12528510af5SRui Paulo	pcap_loop.3 pcap_dispatch.3 \
12628510af5SRui Paulo	pcap_major_version.3 pcap_minor_version.3 \
12728510af5SRui Paulo	pcap_next_ex.3 pcap_next.3 \
12828510af5SRui Paulo	pcap_open_offline.3 pcap_fopen_offline.3 \
12928510af5SRui Paulo	pcap_setnonblock.3 pcap_getnonblock.3
13057b00b99SPawel Jakub Dawidek
13179df4466SRui Paulo# Our man pages are a special copy from the distdir. See below.
13228510af5SRui PauloCLEANFILES+=${MAN}
133*6f9cba8fSJoseph MingroneCLEANFILES+=grammar.y scanner.h tokdefs.h
134bf18e76aSPaul Traina
135ada6f083SXin LIYFLAGS+=-p pcap_
136ada6f083SXin LILFLAGS+=-Ppcap_ --header-file=${.OBJDIR}/scanner.h --nounput
137ada6f083SXin LICFLAGS+=-DHAVE_CONFIG_H -I${.CURDIR} -I${.OBJDIR}
138eb9f0330SBruce M SimpsonCFLAGS+=-D_U_="__attribute__((unused))"
139eb9f0330SBruce M SimpsonCFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF
140ada6f083SXin LICFLAGS+=-DBUILDING_PCAP
141e1fe3dbaSRuslan Ermilov.if ${MK_INET6_SUPPORT} != "no"
142f3952ecbSBruce EvansCFLAGS+=-DINET6
1434f9bc6c6SSteve Price.endif
1443bc70204SMax Laier.if ${MK_PF} != "no"
1453bc70204SMax LaierCFLAGS+=-DHAVE_NET_PFVAR_H
1463bc70204SMax Laier.endif
147bf18e76aSPaul Traina
148b00ab754SHans Petter SelaskyCFLAGS+= -DPCAP_SUPPORT_NETMAP
149b00ab754SHans Petter Selasky
150b00ab754SHans Petter Selasky.if ${MK_OFED} != "no"
151b00ab754SHans Petter SelaskySRCS+= pcap-rdmasniff.c
152b00ab754SHans Petter SelaskyLIBADD+= ibverbs
153b00ab754SHans Petter SelaskyLIBADD+= mlx5
154b00ab754SHans Petter SelaskyCFLAGS+= -DPCAP_SUPPORT_RDMASNIFF
155b00ab754SHans Petter Selasky.endif
156b00ab754SHans Petter Selasky
157daaf5759SEd SchoutenWARNS?=	0
158daaf5759SEd Schouten
1597596eb48SKonstantin BelousovSHLIB_MAJOR=	8
1600db59933SPaul Traina
161bf18e76aSPaul Traina#
162bf18e76aSPaul Traina# Magic to grab sources out of src/contrib
163bf18e76aSPaul Traina#
1647423a047SEnji CooperPCAP_DISTDIR?=${SRCTOP}/contrib/libpcap
16546da4bc6SBill FennerCFLAGS+=-I${PCAP_DISTDIR}
1669f6ca50cSPaul Traina.PATH:	${PCAP_DISTDIR}
1679f6ca50cSPaul Traina.PATH:	${PCAP_DISTDIR}/bpf/net
168bf18e76aSPaul Traina
169*6f9cba8fSJoseph Mingronegrammar.y: grammar.y.in
170*6f9cba8fSJoseph Mingrone	sed  -e 's/@REENTRANT_PARSER@/%pure-parser/' < ${.ALLSRC} > ${.TARGET}
171*6f9cba8fSJoseph Mingrone
172b791fbe6SBryan Drewerytokdefs.h: grammar.h .NOMETA
173b791fbe6SBryan Drewery	ln -sf ${.ALLSRC} ${.TARGET}
17428510af5SRui Paulo
17528510af5SRui Paulo#
17628510af5SRui Paulo# Magic to convert the man pages to something non Solarish
17728510af5SRui Paulo#
17828510af5SRui Paulo.for _page in ${MAN}
17928510af5SRui Paulo${_page}:
18028510af5SRui Paulo	if [ -f ${PCAP_DISTDIR}/${_page:S/3$/3pcap/} ]; then		\
18128510af5SRui Paulo		F=${_page:S/3$/3pcap/}; 				\
182b00ab754SHans Petter Selasky	elif [ -f ${PCAP_DISTDIR}/${_page:S/3$/3pcap.in/} ]; then	\
183b00ab754SHans Petter Selasky		F=${_page:S/3$/3pcap.in/}; 				\
184b00ab754SHans Petter Selasky	elif [ -f ${PCAP_DISTDIR}/${_page:S/5$/manfile.in/} ]; then	\
185b00ab754SHans Petter Selasky		F=${_page:S/5$/manfile.in/};				\
18628510af5SRui Paulo	elif [ -f ${PCAP_DISTDIR}/${_page:S/5$/manfile/} ]; then	\
18728510af5SRui Paulo		F=${_page:S/5$/manfile/};				\
18828510af5SRui Paulo	else								\
189b00ab754SHans Petter Selasky		F=${_page:S/7$/manmisc.in/};				\
19028510af5SRui Paulo	fi;								\
191174ae282SHans Petter Selasky	sed \
192174ae282SHans Petter Selasky		-e 's/3PCAP/3/g' \
193174ae282SHans Petter Selasky		-e 's/@MAN_FILE_FORMATS@/5/g' \
194174ae282SHans Petter Selasky		-e 's/@MAN_MISC_INFO@/7/g' \
195174ae282SHans Petter Selasky		-e 's/@MAN_ADMIN_COMMANDS@/8/g' \
196174ae282SHans Petter Selasky		${PCAP_DISTDIR}/$$F > ${_page}
19728510af5SRui Paulo.endfor
19828510af5SRui Paulo
199609c8587SJordan K. Hubbard.include <bsd.lib.mk>
200