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