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